spycci.tools sub-module
split_multixyz function
- spycci.tools.split_multixyz(mol, file, suffix='', charge=None, spin=None, engine=None, remove_xyz_files=False)
Splits a .xyz file containing multiple structures into individual structures.
- Parameters:
mol (System object) – Input molecule, giving the charge/spin (if not defined) and name of the output molecules
file (str) – .xyz file containing the multiple structures
suffix (str, optional) – suffix to add to the new molecule names. By default, empty.
charge (int, optional) – Charge of the output molecules, by default the same as the input molecule
spin (int, optional) – Spin of the output molecules, by default the same as the input molecule
engine (Engine, optional) – The engine used to produce the multiple xyz file (If given and if available, the energies included in the comment line will be added to each system parsed)
remove_xyz_files (bool) – If set to True will remove the temporary .xyz files used in generating the System list
- Returns:
molecules_list – List containing the individual System object, whose structure is taken from the .xyz file
- Return type:
list
compress_dftb_trajectory function
- spycci.tools.compress_dftb_trajectory(filename, md_out='md.out', geo_xyz='geo_end.xyz')
Parses a geo_end.xyz trajectory and an md.out file to export a single compressed trajectory file also containing the energies for all frames
- Parameters:
filename (str) – name of the output trajectory files
md_out (str, optional) – path to the md.out file containing energy info (by default, ./md.out)
geo_xyz (str, optional) – path to the geo_end.xyz file containing energy info (by default, ./geo_end.xyz)
maxdist function
cyclization_check function
- spycci.tools.cyclization_check(start_file, end_file)
Checks if a cyclization has occurred (e.g., during a geometry optimization), or if a ring opening has occurred.
- Parameters:
start_file (str) – .xyz file containing the starting geometry
end_file (str) – .xyz file containing the final geometry
- Return type:
If a change in the number of rings is detected, returns True.
dissociation_check function
- spycci.tools.dissociation_check()
Checks if a dissociation has occurred (e.g., during a geometry optimization). Requires the presence of a .mol file in the current directory.
- Returns:
True, if a dissociation is detected
False, if a dissociation is not detected
process_output function
- spycci.tools.process_output(mol, method, calc, charge=None, spin=None, save_cubes=False)
Processes the output of a calculation, copying the output files to a safe directory (output_files) in the parent directory tree, and cleans the temporary directory if requested.
- Parameters:
mol (System object) – Systems processed in the calculation
method (str) – String indicating the level of theory for the calculation
calc (str) – Type of calculation
charge (int, optional) – Charge of the molecule in the calculation
spin (int, optional) – Spin of the molecule in the calculation
save_cubes (bool) – If set to true will copy the .cube files in a safe directory (output_densities) in the parent directory tree
save_dftb_trajectory function
- spycci.tools.save_dftb_trajectory(output_prefix)
Saves the geo_end.xyz and md.out files to a temporary directory where an MDTrajectory object can go read the data it needs.
- Parameters:
output_prefix (str) – name of the output trajectory files prefix
reorder_energies function
- spycci.tools.reorder_energies(system_list, ncores=None, maxcore=350, method_opt=None, method_el=None, method_vib=None)
Reorders a System list (generated by a CREST routine such as deprotonation) at a different level of theory.
- Parameters:
system_list (list(System)) – list containing the System objects to be reordered (e.g., generated by a CREST routine)
ncores (int, optional) – number of cores, by default all available cores
maxcore (int, optional) – memory per core, in MB, by default 350
method_opt (XtbInput/OrcaInput, optional) – level of theory for the geometry optimization. By default converted to gfn2
method_el (XtbInput/OrcaInput, optional) – level of theory for the electronic part of the energy. By default converted to M06-2X
method_vib (XtbInput/OrcaInput, optional) – level of theory for the vibrational contribution to the energy. By default converted to gfn2
- Returns:
molecule_list – System list, reordered at the new level of theory.
- Return type:
list(System)
spycci.tools.vmdtools sub-module
- class spycci.tools.vmdtools.VMDRenderer(resolution=800, scale=1.0, xyz_translation=[0.0, 0.0, 0.0], xyx_rotation=[0.0, 0.0, 0.0], shadows=True, ambientocclusion=True, dof=True, show_axes=False, VMD_PATH=None)
The VMDRenderer class is a simple wrapper developed around the Visual Molecular Dynamics (VMD) software. The class allows the user to easily generate images and renders of molecules and cube files. Once an instance of the VMDRenderer is created, the user can use its render functionality through the provided built-in methods.
- Parameters:
resolution (Union[int, List[int]]) – The resolution of the output image. This argument accepts either a single integer, which sets the same resolution for both the X and Y axes (producing a square image), or a list of two integers, which independently specify the resolution along the X (width) and Y (height) axes (producing a rectangular image). (default: 800).
scale (float) – Scales the frame zoom according to the user specified factor (default: 1. no zoom is applied)
xyz_translation (List[float]) – A list of three float values defining the translation vector (X, Y, Z) to apply to the object. (default: [0., 0., 0.] no translation is applied).
xyx_rotation (List[float]) – The list of 3 rotation angles (from 0 to 360°) defyning subsequent rotations around the X, Y and X axis. (default: [0., 0., 0.] no rotation is applied).
shadows (bool) – If set to True will enable the vmd shadows option. (default: True)
ambientocclusion (bool) – If set to True will enable the vmd ambientocclusion option. (default: True)
dof (bool) – If set to True will enable the vmd dof option. (default: True)
show_axes (bool) – If set to True will show the axes representation in the render window. (default: False)
VMD_PATH (str) – The path to the vmd executable. Is set to None (default), will automatically search vmd in the system PATH.
- Raises:
FileNotFoundError – Exception raised if the user provided VMD_PATH is invalid.
RuntimeError – Exception raised if either the vmd program or the Tachyon ray tracer are not found.
ValueError – Exception raised if scale or xyx rotation angles are not properly formatted.
- render_condensed_fukui(cubefile, filename=None)
Given the path to a Fukui function cube file saves a .bmp render of the condensed Fukui functions.
- Parameters:
cubefile (str) – The path to the .fukui.cube file that must be rendered.
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root_condensed.bmp from root.xyz).
- Return type:
None
- render_cube(cube, filename, isovalue=None, positive_color=1, negative_color=0, show_negative=False)
Given a Cube object the function saves a .bmp render of the contained volumetric data.
- Parameters:
cube (Cube) – The Cube object encoding the volumetric data.
filename (str) – The name, or the path, of the output .bmp file (Required because Cube objects have no pre-assigned names).
isovalue (Optional[float]) – The isovalue at which the contour must be plotted. If set to None (default) a proper isovalue will be set automatically as the 20% of the maximum voxel value.
positive_color (int) – The color of the positive phase of the plot.
negative_color (int) – The color of the positive phase of the plot.
show_negative (bool) – If set to True, will render also the negative part of the Fukui function. (default: False)
- Return type:
None
- render_cube_file(cubefile, isovalue=None, positive_color=1, negative_color=0, show_negative=False, filename=None)
Given the path to a generic .cube file, saves a .bmp render of the contained volumetric data.
- Parameters:
cubefile (str) – The path to the .fukui.cube file that must be rendered.
isovalue (Optional[float]) – The isovalue at which the contour must be plotted. If set to None (default) a proper isovalue will be set automatically as the 20% of the maximum voxel value.
positive_color (int) – The color of the positive phase of the plot.
negative_color (int) – The color of the positive phase of the plot.
show_negative (bool) – If set to True, will render also the negative part of the Fukui function. (default: False)
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root.bmp from root.xyz).
- Return type:
None
- render_fukui_cube(cubefile, isovalue=None, show_negative=False, filename=None)
Given the path to a Fukui function cube file saves a .bmp render the volumetric Fukui function.
- Parameters:
cubefile (str) – The path to the .fukui.cube file that must be rendered.
isovalue (Optional[float]) – The isovalue at which the contour must be plotted. If set to None (default) a proper isovalue will be set automatically as the 20% of the maximum voxel value.
show_negative (bool) – If set to True, will render also the negative part of the Fukui function. (default: False)
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root.bmp from root.xyz).
- Return type:
None
- render_spin_density_cube(cubefile, isovalue=None, filename=None)
Given the path to an ORCA spin density cube file saves a .bmp render the function.
- Parameters:
cubefile (str) – The path to the .fukui.cube file that must be rendered.
isovalue (Optional[float]) – The isovalue at which the contour must be plotted. If set to None (default) a proper isovalue will be set automatically as the 20% of the maximum voxel value.
xyx_rotation (Optional[tuple]) – The tuple of 3 rotation angles (from 0 to 360°) defyning subsequent rotations around the X, Y and X axis. If None (default), no rotation is applied.
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root_condensed.bmp from root.xyz).
- Return type:
None
- render_system(mol, filename=None)
Given a System object the function saves a .bmp render of its molecular structure.
- Parameters:
mol (System) – The System object to render.
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root.bmp from root.xyz).
- Return type:
None
- render_system_file(molecule_file, filename=None)
Given the path to a molecule file (e.g. .xyz, .pdb) the function saves a .bmp render of the molecular structure.
- Parameters:
molecule_file (str) – The path to the file encoding the structure of the molecule.
filename (Optional[str]) – The name, or the path, of the output .bmp file. If None (default) the output file will be generated from the root of the input filename (e.g. root.bmp from root.xyz).
- Return type:
None
- property resolution: List[int]
The list of two integer values setting the XY resolution of the output image.
- Returns:
The list encoding the image resolution across the X and Y axes.
- Return type:
List[int]
- property scale: float
The float value setting the frame zoom. The value 1. is set by VMD on startup to render the whole molecule in the unrotated frame.
- Returns:
The scale of the frame.
- Return type:
float
- property xyx_rotation: List[float]
The list of 3 rotation angles (from 0 to 360°) defyning subsequent rotations around the X, Y and X axis.
- Returns:
The list of XYX rotation angles.
- Return type:
List[float]
- property xyz_translation: List[float]
The list of three float values defining the translation vector (X, Y, Z) to apply to the object.
- Returns:
The translation vector.
- Return type:
List[float]