hylight.jmol package

Module contents

Write Jmol files.

hylight.jmol.export(dest, mode, *, displacement=True, scale=1.0, compression=8, offset=None, recenter=True, **opts)

Export a mode to JMol zip format.

Parameters:
  • dest – path to the JMol zip file.

  • mode – the mode to export.

  • displacement – (kw only, default True) choose between eigendisplacements and eigenvectors

  • scale – (kw only, default 1.0) a scale factor for the displacements/eigenvectors

  • compression – (kw only) zipfile compression algorithm.

  • offset – (kw only, np.array([0, 0, 0])) offset vector (in fractional coordinates) to shift the atoms in the unit cell to have different atoms at the center

  • recenter – (kw only, True) wether atoms should be moved according to periodic conditions to fit in the unit cell

  • **opts – see write_jmol_options()

hylight.jmol.export_disp(dest, struct, disp, *, compression=8, **opts)

Export a difference between two positions to JMol zip format.

Parameters:
  • dest – path to the JMol zip file.

  • struct – the reference position (a hylight.struct.Struct instance).

  • disp – an array of displacements.

  • compression – (optional) zipfile compression algorithm.

  • **opts – see write_jmol_options()

hylight.jmol.format_v(v)

Format a vector in Jmol syntax.

hylight.jmol.write_jmol_options(f, opts)

Write options in the form of a JMol script.

Parameters:
  • f – a file like object.

  • opts

    a dictionary of options

    • unitcell: lattice vectors as a 3x3 matrix where vectors are in rows.

    • bonds: a list of (sp_a, sp_b, min_dist, max_dist) where species

      names are strings of names of species and *_dist are interatomic distances in Angstrom.

    • atom_colors: a list of (sp, color) where sp is the name of a

      species and color is the name of a color or an HTML hex code (example "#FF0000" for pure red).

    • origin: the origin of the unitcell box (in fractional coordinates)

hylight.jmol.write_xyz(f, atoms, ref, delta)

Write the coordinates and displacements of in the JMol xyz format.

Parameters:
  • f – a file-like object to write to.

  • atoms – the list of atom names

  • ref – an array of atomic positions

  • delta – an array of displacements