arkane.common

Arkane common module

class arkane.common.ArkaneSpecies(species=None, conformer=None, author='', level_of_theory='', model_chemistry='', frequency_scale_factor=None, use_hindered_rotors=None, use_bond_corrections=None, atom_energies='', chemkin_thermo_string='', smiles=None, adjacency_list=None, inchi=None, inchi_key=None, xyz=None, molecular_weight=None, symmetry_number=None, transport_data=None, energy_transfer_model=None, thermo=None, thermo_data=None, label=None, datetime=None, RMG_version=None, reactants=None, products=None, reaction_label=None, is_ts=None, charge=None, formula=None, multiplicity=None)

A class for archiving an Arkane species including its statmech data into .yml files

as_dict(self) dict

A helper function for dumping objects as dictionaries for YAML files

Returns:

A dictionary representation of the object

Return type:

dict

load_yaml(path, label=None, pdep=False)

Load the all statMech data from the .yml file in path into species pdep is a boolean specifying whether or not job_list includes a pressureDependentJob.

make_object(self, dict data, dict class_dict)

A helper function for constructing objects from a dictionary (used when loading YAML files)

Parameters:
  • data (dict) – The dictionary representation of the object

  • class_dict (dict) – A mapping of class names to the classes themselves

Returns:

None

save_yaml(path)

Save the species with all statMech data to a .yml file

update_species_attributes(species=None)

Update the object with a new species/TS (while keeping non-species-dependent attributes unchanged)

update_xyz_string()

Generate an xyz string built from self.conformer, and standardize the result

Returns:

3D coordinates in an XYZ format.

Return type:

str

arkane.common.check_conformer_energy(energies, path)

Check to see that the starting energy of the species in the potential energy scan calculation is not 0.5 kcal/mol (or more) higher than any other energies in the scan. If so, print and log a warning message.

arkane.common.clean_dir(base_dir_path: str = '', files_to_delete: Optional[List[str]] = None, file_extensions_to_delete: Optional[List[str]] = None, files_to_keep: Optional[List[str]] = None, sub_dir_to_keep: Optional[List[str]] = None) None

Clean up a directory. Commonly used for removing unwanted files after unit tests.

Parameters:
  • base_dir_path (str) – absolute path of the directory to clean up.

  • files_to_delete (list[str]) – full name of the file (includes extension) to delete.

  • file_extensions_to_delete – extensions of files to delete.

  • files_to_keep – full name of the file (includes extension) to keep, files specified here will NOT be deleted even if its extension is also in file_extensions_to_delete.

  • sub_dir_to_keep – name of the subdirectories in the base directory to keep.

arkane.common.convert_imaginary_freq_to_negative_float(freq: Union[str, float, int])
Convert a string representation of an imaginary frequency into a negative float representation, e.g.:

‘635.0i’ -> -635.0 ‘500.0’ -> 500.0

Parameters:

freq (str) – The imaginary frequency representation.

Returns:

A float representation of the frequency value.

Return type:

float

arkane.common.get_center_of_mass(coords, numbers=None, symbols=None)

Calculate and return the 3D position of the center of mass of the current geometry. Either numbers or symbols must be given.

Parameters:
  • coords (np.array) – Entries are 3-length lists of xyz coordinates for an atom.

  • numbers (np.array, list) – Entries are atomic numbers corresponding to coords.

  • symbols (list) – Entries are atom symbols corresponding to coords.

Returns:

The center of mass coordinates.

Return type:

np.array

arkane.common.get_element_mass(input_element, isotope=None)

Returns the mass and z number of the requested isotope for a given element. ‘input_element’ can be wither the atomic number (integer) or an element symbol. ‘isotope’ is an integer of the atomic z number. If ‘isotope’ is None, returns the most common isotope. Data taken from NIST, https://physics.nist.gov/cgi-bin/Compositions/stand_alone.pl (accessed October 2018)

arkane.common.get_moment_of_inertia_tensor(coords, numbers=None, symbols=None)

Calculate and return the moment of inertia tensor for the current geometry in amu*angstrom^2. If the coordinates are not at the center of mass, they are temporarily shifted there for the purposes of this calculation. Adapted from J.W. Allen: https://github.com/jwallen/ChemPy/blob/master/chempy/geometry.py

Parameters:
  • coords (np.array) – Entries are 3-length lists of xyz coordinates for an atom.

  • numbers (np.array, list) – Entries are atomic numbers corresponding to coords.

  • symbols (list) – Entries are atom symbols corresponding to coords.

Returns:

The 3x3 moment of inertia tensor.

Return type:

np.array

Raises:

InputError – If neither symbols nor numbers are given, or if they have a different length than coords

arkane.common.get_principal_moments_of_inertia(coords, numbers=None, symbols=None)

Calculate and return the principal moments of inertia in amu*angstrom^2 in decending order and the corresponding principal axes for the current geometry. The moments of inertia are in translated to the center of mass. The principal axes have unit lengths. Adapted from J.W. Allen: https://github.com/jwallen/ChemPy/blob/master/chempy/geometry.py

Parameters:
  • coords (np.array) – Entries are 3-length lists of xyz coordinates for an atom.

  • numbers (np.array, list) – Entries are atomic numbers corresponding to coords.

  • symbols (list) – Entries are atom symbols corresponding to coords.

Returns:

The principal moments of inertia. tuple: The corresponding principal axes.

Return type:

tuple

arkane.common.is_pdep(job_list)

A helper function to determine whether a job is PressureDependenceJob or not

arkane.common.replace_yaml_syntax(content, label=None)

PEP8 compliant changes to RMG objects could be backward incompatible with Arkane’s YAML files. Search for knows phrases which were replace, and fix the format on the fly.

Parameters:

content (str) – The content of an Arkane YAML file.

Returns:

The modified content to be processed via yaml.safe_load().

Return type:

str

arkane.common.str_repr(dumper, data)

Repair YAML string representation