arc.parser

A module for parsing information from various files.

arc.parser.identify_ess(path: str) Optional[str][source]

Identify the software that generated a specific output file. This function supports ESS not identified by Arkane.

Parameters:

path (str) – The ESS log file to parse from.

Returns:

The ESS.

Return type:

Optional[str]

arc.parser.parse_1d_scan_coords(path: str) List[Dict[str, tuple]][source]

Parse the 1D torsion scan coordinates from an ESS log file.

Parameters:

path (str) – The ESS log file to parse from.

Returns:

The Cartesian coordinates.

Return type:

List[Dict[str, tuple]]

arc.parser.parse_1d_scan_energies(path: str, initial_angle: float = 0.0) Tuple[Optional[List[float]], Optional[List[float]]][source]

Parse the 1D torsion scan energies from an ESS log file.

Parameters:
  • path (str) – The ESS log file to parse from.

  • initial_angle (float, optional) – The initial dihedral angle.

Raises:

InputError – If path is invalid.

Returns: Tuple[Optional[List[float]], Optional[List[float]]]

The electronic energy in kJ/mol and the dihedral scan angle in degrees.

arc.parser.parse_dipole_moment(path: str) Optional[float][source]

Parse the dipole moment in Debye from an opt job output file.

Parameters:

path – The ESS log file.

Returns: Optional[float]

The dipole moment in Debye.

arc.parser.parse_e_elect(path: str, zpe_scale_factor: float = 1.0, software: Optional[str] = None) Optional[float][source]

Parse the electronic energy from an sp job output file.

Parameters:
  • path (str) – The ESS log file to parse from.

  • zpe_scale_factor (float) – The ZPE scaling factor, used only for composite methods in Gaussian via Arkane.

  • software (str, optional) – The ESS.

Returns: Optional[float]

The electronic energy in kJ/mol.

arc.parser.parse_frequencies(path: str, software: Optional[str] = None) ndarray[source]

Parse the frequencies from a freq job output file.

Parameters:
  • path (str) – The log file path.

  • software (str, optional) – The ESS.

Returns: np.ndarray

The parsed frequencies (in cm^-1).

arc.parser.parse_geometry(path: str) Optional[Dict[str, tuple]][source]

Parse the xyz geometry from an ESS log file.

Parameters:

path (str) – The ESS log file to parse from.

Returns: Optional[Dict[str, tuple]]

The cartesian geometry.

arc.parser.parse_ic_info(file_path: str) DataFrame[source]

Get the information of internal coordinates (ic) of an intermediate scan conformer.

Parameters:

file_path (str) – The path to a readable output file.

Raises:

NotImplementedError – If files other than Gaussian log is input

Returns: pd.DataFrame

A DataFrame containing the information of the internal coordinates

arc.parser.parse_ic_values(ic_block: List[str], software: Optional[str] = None) DataFrame[source]

Get the internal coordinates (ic) for an intermediate scan conformer

Parameters:
  • ic_block (list) – A list of strings containing the optimized internal coordinates of

  • conformer (an intermediate scan) –

  • software (str, optional) – The software to used to generate the log file.

Raises:

NotImplementedError – If the software is not supported

Returns:

A DataFrame containing the values of the internal coordinates

Return type:

pd.DataFrame

arc.parser.parse_nd_scan_energies(path: str, software: Optional[str] = None, return_original_dihedrals: bool = False) Tuple[dict, Optional[List[float]]][source]

Parse the ND torsion scan energies from an ESS log file.

Parameters:
  • path (str) – The ESS log file to parse from.

  • software (str, optional) – The software used to run this scan, default is ‘gaussian’.

  • return_original_dihedrals (bool, optional) – Whether to return the dihedral angles of the original conformer. True to return, default is False.

Raises:

InputError – If path is invalid.

Returns: Tuple[dict, Optional[List[float]]]

The “results” dictionary, which has the following structure:

results = {'directed_scan_type': <str, used for the fig name>,
           'scans': <list, entries are lists of torsion indices>,
           'directed_scan': <dict, keys are tuples of '{0:.2f}' formatted dihedrals,
                             values are dictionaries with the following keys and values:
                             {'energy': <float, energy in kJ/mol>,  * only this is used here
                              'xyz': <dict>,
                              'is_isomorphic': <bool>,
                              'trsh': <list, job.ess_trsh_methods>}>
           },

The dihedral angles of the original conformer

arc.parser.parse_normal_mode_displacement(path: str, software: Optional[str] = None, raise_error: bool = True) Tuple[ndarray, ndarray][source]

Parse frequencies and normal mode displacement.

Parameters:
  • path (str) – The path to the log file.

  • software (str, optional) – The software to used to generate the log file.

  • raise_error (bool, optional) – Whether to raise an error if the ESS isn’t implemented.

Raises:

NotImplementedError – If the parser is not implemented for the ESS this log file belongs to.

Returns: Tuple[np.ndarray, np.ndarray]

The frequencies (in cm^-1) and the normal mode displacements.

arc.parser.parse_polarizability(path: str) Optional[float][source]

Parse the polarizability from a freq job output file, returns the value in Angstrom^3.

Parameters:

path – The ESS log file.

Returns: Optional[float]

The polarizability in Angstrom^3.

arc.parser.parse_scan_args(file_path: str) dict[source]

Get the scan arguments, including which internal coordinates (IC) are being scanned, which are frozen, what is the step size and the number of atoms, etc.

Parameters:

file_path (str) – The path to a readable output file.

Raises:

NotImplementedError – If files other than Gaussian log is input

Returns: dict

A dictionary that contains the scan arguments as well as step number, step size, number of atom:

{'scan': <list, atom indexes of the torsion to be scanned>,
 'freeze': <list, list of internal coordinates identified by atom indexes>,
 'step': <int, number of steps to scan>,
 'step_size': <float, the size of each step>,
 'n_atom': <int, the number of atoms of the molecule>,
 }
arc.parser.parse_scan_conformers(file_path: str) DataFrame[source]

Parse all the internal coordinates of all the scan intermediate conformers and tabulate all the info into a single DataFrame object. Any redundant internal coordinates will be removed during the process.

Parameters:

file_path (str) – The path to a readable output file.

Raises:

NotImplementedError – If files other than Gaussian log is input

Returns:

a list of conformers containing the all the internal

coordinates information in pd.DataFrame

Return type:

pd.DataFrame

arc.parser.parse_str_blocks(file_path: str, head_pat: Union[Match, str], tail_pat: Union[Match, str], regex: bool = True, tail_count: int = 1, block_count: int = 1) List[str][source]

Return a list of blocks defined by the head pattern and the tail pattern.

Parameters:
  • file_path (str) – The path to the readable file.

  • head_pat (str/regex) – Str pattern or regular expression of the head of the block.

  • tail_pat (str/regex) – Str pattern or regular expresion of the tail of the block.

  • regex (bool, optional) – Use regex (True) or str pattern (False) to search.

  • tail_count (int, optional) – The number of times that the tail repeats.

  • block_count (int, optional) – The max number of blocks to search. -1 for any number.

Raises:

InputError – If the file could not be found.

Returns: List[str]

List of str blocks.

arc.parser.parse_t1(path: str) Optional[float][source]

Parse the T1 parameter from a Molpro or Orca coupled cluster calculation.

Parameters:

path (str) – The ess log file path.

Returns: Optional[float]

The T1 parameter.

arc.parser.parse_trajectory(path: str) Optional[List[Dict[str, tuple]]][source]

Parse all geometries from an xyz trajectory file or an ESS output file.

Parameters:

path (str) – The file path.

Raises:

ParserError – If the trajectory could not be read.

Returns: Optional[List[Dict[str, tuple]]]

Entries are xyz’s on the trajectory.

arc.parser.parse_xyz_from_file(path: str) Optional[Dict[str, tuple]][source]

Parse xyz coordinated from: - .xyz: XYZ file - .gjf: Gaussian input file - .out or .log: ESS output file (Gaussian, Molpro, Orca, QChem, TeraChem) - calls parse_geometry() - .yml or .yaml files - other: Molpro or QChem input file

Parameters:

path (str) – The file path.

Raises:

ParserError – If the coordinates could not be parsed.

Returns: Optional[Dict[str, tuple]]

The parsed cartesian coordinates.

arc.parser.parse_zpe(path: str) Optional[float][source]

Determine the calculated ZPE from a frequency output file

Parameters:

path (str) – The path to a frequency calculation output file.

Returns: Optional[float]

The calculated zero point energy in kJ/mol.

arc.parser.process_conformers_file(conformers_path: str) Tuple[List[Dict[str, tuple]], List[float]][source]

Parse coordinates and energies from an ARC conformers file of either species or TSs.

Parameters:

conformers_path (str) – The path to an ARC conformers file (either a “conformers_before_optimization” or a “conformers_after_optimization” file).

Raises:

InputError – If the file could not be found.

Returns: Tuple[List[Dict[str, tuple]], List[float]]

Conformer coordinates in a dict format, the respective energies in kJ/mol.