\(\newcommand{\AA}{\text{Å}}\)
CRYSTALpytools.convert module
Functions that do conversion between data / file formats
- cry_ase2gui(structure, gui_file=None, vacuum=None, symmetry=True)
Transform an ASE Structure object into a Pymatgen structure object and then a CRYSTAL structure (gui) object. Vacuum layer is set to 500 Angstrom as the default of CRYSTAL for low symmstry systems
- Parameters:
structure (ASE Structure) – ASE Structure object.
gui_file (str) – CRYSTAL gui / fort.34 file.
vacuum (float) – Vacuum distance. Unit: Angstrom. If none, set the length of non-periodic direction to 500 Angstrom. Low dimensional systems only.
symmetry (bool) – Perform symmetry analysis.
- cry_bands2pmg(band, output, labels=None)
Transform a CRYSTAL bands object/file into a Pymatgen
BandStructureSymmLine
object (inherited fromBandStructure
). No projection is available for now. Output is mandatory here.- Parameters:
band (str|ElectronBand) – CRYSTAL fort.25 or BAND.DAT file or CRYSTALpytools ElectronBand object
output (str) – CRYSTAL properties output file
labels (list[str]) – K point labels to display in the band structure.
- Returns:
BandStructureSymmLine – Pymatgen band structure object.
- cry_gui2ase(gui, vacuum=None, **kwargs)
Transform a CRYSTAL structure (gui) file into an ASE atoms object.
- Parameters:
gui (str|geometry.Crystal_gui) – CRYSTAL gui / fort.34 file or CRYSTALpytools gui object
vacuum (float) – Vacuum distance. Unit: Angstrom. If none, set the
pbc
attribute of ASE atoms object. Low dimensional systems only.**kwargs – Passed to ASE Atoms constructor
- Returns:
Atoms – ASE atoms object.
- cry_gui2cif(gui, cif_file_name, vacuum=None, **kwargs)
Read a CRYSTAL structure (gui) file and save a cif file. The CifWriter object of Pymatgen is called. By default,
symprec = 0.01
is used.- Parameters:
gui (str|geometry.Crystal_gui) – CRYSTAL gui / fort.34 file or CRYSTALpytools gui object
cif_file_name (str) – Name (including path) of the cif file to be saved
vacuum (float) – Vacuum distance. Unit: Angstrom. If none, set the
pbc
attribute of Pymatgen atoms object. Low dimensional systems only.**kwargs – Passed to Pymatgen CifWriter.
- cry_gui2pmg(gui, vacuum=None, molecule=True)
Transform a CRYSTAL structure (gui) object into a Pymatgen Structure object.
- Parameters:
gui (str|geometry.Crystal_gui) – CRYSTAL gui / fort.34 file or CRYSTALpytools gui object
vacuum (float) – Vacuum distance. Unit: \(\AA\). If none, set the
pbc
attribute of Pymatgen object. Low dimensional systems only.molecule (bool) – Generate a Molecule Pymatgen object for 0D structures.
- Returns:
Structure or Molecule – Pymatgen Structure or Molecule object.
- cry_gui2xyz(gui, xyz_file_name, **kwargs)
Transform a CRYSTAL structure (gui) file into an XYZ file.
- Parameters:
xyz_file_name (str) – Name of the XYZ file to be saved.
gui (str) – CRYSTAL gui / fort.34 file.
**kwargs – Passed to Pymatgen XYZ object.
- cry_out2ase(output, vacuum=None, initial=False, **kwargs)
Transform a CRYSTAL output object into an ASE atoms object.
- Parameters:
output (str|Crystal_output) – Crystal output file or Crystal_output object
vacuum (float) – Vacuum distance. Unit: Angstrom. If none, set the
pbc
attribute of ASE atoms object. Low dimensional systems only.initial (bool) – Read the last geometry of the output file.
**kwargs – Passed to ASE Atoms constructor
- Returns:
Atoms – ASE atoms object.
- cry_out2cif(output, cif_file_name, vacuum=None, initial=False, **kwargs)
Read geometry from a CRYSTAL output file and save it as a CIF file. The CifWriter object of Pymatgen is called. By default,
symprec = 0.01
is used.- Parameters:
output (str|Crystal_output) – Crystal output file or Crystal_output object
cif_file_name (str) – Name (including path) of the CIF file to be saved.
vacuum (float) – Vacuum distance. Unit: \(\AA\). If none, set the
pbc
attribute of Pymatgen atoms object. Low dimensional systems only.initial (bool) – Read the last geometry of the output file.
**kwargs – Passed to Pymatgen CifWriter.
- cry_out2pmg(output, vacuum=None, initial=False, molecule=True)
Read geometry from a CRYSTAL output file and save it as a pymatgen structure object.
- Parameters:
output (str|Crystal_output) – Crystal output file or Crystal_output object
vacuum (float) – Vacuum distance. Unit: Angstrom. If none, set the
pbc
attribute of Pymatgen object. Low dimensional systems only.initial (bool) – Read the last geometry of the output file.
molecule (bool) – Generate a Molecule Pymatgen object for 0D structures.
- Returns:
Structure – Pymatgen Structure object.
- cry_out2xyz(output, xyz_file_name, initial=False, **kwargs)
Read geometry from a CRYSTAL output file and save it as an XYZ file.
- Parameters:
output (str|Crystal_output) – Crystal output file or Crystal_output object
xyz_file_name (str) – Name (including path) of the XYZ file to be saved.
initial (bool) – Read the last geometry of the output file.
**kwargs – Passed to Pymatgen XYZ object.
- cry_pmg2gui(structure, gui_file=None, pbc=None, vacuum=None, symmetry=True, zconv=None, **kwargs)
Save a pymatgen Structure object into a CRYSTAL gui file. Vacuum layer is set to 500 Angstrom as the default of CRYSTAL for low symmstry systems.
- Parameters:
structure (Structure | Molecule) – Pymatgen Structure / Molecule object.
gui_file (str) – CRYSTAL gui / fort.34 file.
pbc (list) – 1*3 boolian list. Implements periodicity along x, y and z directions. If none, the code will read it from input structure.
vacuum (float) – Vacuum distance. Unit: \(\AA\). If none, set the length of non-periodic direction to 500 Angstrom. Low dimensional systems only.
symmetry (bool) – Do symmetry analysis.
zconv (list[list[int, int]]) – 1st element: The index of atom; 2nd element: The new conventional atomic number.
**kwargs – Passed to Pymatgen SpacegroupAnalyzer object. Valid only if
symmetry=True
.