compechem.engines.orca sub-module#

OrcaInput class#

class compechem.engines.orca.OrcaInput(method='PBE', basis_set='def2-TZVP', aux_basis='def2/J', solvent=None, optionals='', blocks={}, ORCADIR=None)#

Interface for running Orca calculations.

Parameters:
  • method (str) – level of theory, by default “PBE”

  • basis_set (str, optional) – basis set, by default “def2-TZVP”

  • aux_basis (str, optional) – auxiliary basis set for RIJCOSX, by default “def2/J”

  • solvent (str, optional) – SMD solvent, by default None

  • optionals (str, optional) – optional keywords, by default “”

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user

  • ORCADIR (str, optional) – the path or environment variable containing the path to the ORCA folder. If set to None (default) the orca executable will be loaded automatically.

Examples

An instance of an OrcaInput engine can be created by simply invoking the class constructor. As an example the following command can be invoked to define an engine capable of running electronic structure calculations at the M06-2X/def2-TZVP level of theory.

>>> orca = OrcaInput(method="M062X", basis_set="def2-TZVP", aux_basis=None)
freq(mol, ncores=None, maxcore=750, inplace=False, remove_tdir=True, raman=False, overtones=False, blocks={})#

Frequency analysis (analytical frequencies).

Note: if the SMD solvation model is detected, defaults to numerical frequencies (analytical frequencies are not currently supported)

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • inplace (bool, optional) – updates info for the input molecule instead of outputting a new molecule object, by default False

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • raman (bool) – If set to True will compute the Raman spectrum. (default: False)

  • overtones (bool) – If set to True will enable the computation of infrared overtones and combination bands. (default: False)

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

newmol – Output molecule containing the new energies.

Return type:

System object

Examples

Starting from an initialized instance orca of the OrcaInput class, an analytical frequency analysis of the molecule mol can be run using the command:

>>> newmol = orca.freq(mol)

Warning: Analytical frequencies are not supported during in-solvent calculations.

The newmol object will contain the same geometry of the molecule mol together with all the vibrational data computed during the frequency analysis process. If a new instance of the molecule mol is not wanted. The properties of the molecule can be set using the flag inplace.

>>> orca.freq(mol, inplace=True)

In doing so, the molecule mol will be updated with the computed properties without returning anything.

neb_ci(reactant, product, nimages=None, preoptimize=False, ncores=None, maxcore=750, remove_tdir=True, blocks={})#

Run a climbing image nudged elastic band calculation (NEB-CI) and output the ensemble encoding the optimized minimum energy path trajectory.

Parameters:
  • reactant (System) – The starting structure to be used in the calculation

  • product (System) – The final structure to be used in the calculation

  • nimages (int) – The number of images (without the fixed endpoints) to be used in the calcluation (default: 8)

  • preoptimize (bool) – If set to True, will run a preoptimization in internal coordinates of the reactant and product structures.

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Raises:

RuntimeError – Exception raised if the given System objects are not compatible with a NEB-CI calculation (e.g. same name or different charge or spin multiplicity)

Returns:

The ensemble object containing the structures along the minimum energy path.

Return type:

Ensemble

Examples

Starting from an initialized instance orca of the OrcaInput class, a climbing image nudged elastic band calculation, returning the minimum energy path (MEP) connecting a reactant and a product structures, can be run invoking the neb_ci command according to the syntax:

>>> ensemble = orca.neb_ci(reactant, product)

The ensemble object is of type Ensemble and will contain all the evaluated structures alomng the computed minimum energy path.

neb_ts(reactant, product, guess=None, nimages=None, preoptimize=False, ncores=None, maxcore=750, remove_tdir=True, blocks={})#

Run a climbing image nudged elastic band calculation (NEB-CI) followed by a transition state optimization and output the optimized transition state structure together with the ensemble encoding the optimized minimum energy path trajectory.

Parameters:
  • reactant (System) – The starting structure to be used in the calculation.

  • product (System) – The final structure to be used in the calculation.

  • guess (Optional[System]) – The guess for the transition state structure.

  • nimages (int) – The number of images (without the fixed endpoints) to be used in the calcluation (default: 8).

  • preoptimize (bool) – If set to True, will run a preoptimization in internal coordinates of the reactant and product structures.

  • ncores (int, optional) – number of cores, by default all available cores.

  • maxcore (int, optional) – memory per core, in MB, by default 750.

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True.

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction.

Raises:

RuntimeError – Exception raised if the given System objects are not compatible with a NEB-CI calculation (e.g. same name or different charge or spin multiplicity)

Returns:

  • System – The optimized transition state structure obtained from the NEB-TS.

  • Ensemble – The ensemble object containing the structures along the minimum energy path.

Return type:

Tuple[System, Ensemble]

Examples

Starting from an initialized instance orca of the OrcaInput class, a transition state search based on a climbing image nudged elastic band calculation can be run invoking the neb_ts command. Starting from a reactant and a product structures, a NEB-CI calculation is performed. Starting from the transition state located during the NEB-CI procedure a transition state optimization is carried out. The syntax to run the calculation is the following:

>>> transition_state, mep_ensemble = orca.neb_ts(reactant, product)

The transition_state object is of type System and encodes the optimized transition state structure. The mep_ensemble object is of type Ensemble and will contain all the evaluated structures along the computed minimum energy path.

For complex calculation a transition state guess can be provided to the routine by using the guess option:

>>> transition_state, mep_ensemble = orca.neb_ts(reactant, product, guess=guess)

Note: All the structures (reactant, product, guess) should have the same charge, spin multiplicity but different names.

nfreq(mol, ncores=None, maxcore=750, inplace=False, remove_tdir=True, raman=False, overtones=False, blocks={})#

Frequency analysis (numerical frequencies).

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • inplace (bool, optional) – updates info for the input molecule instead of outputting a new molecule object, by default False

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • raman (bool) – If set to True will compute the Raman spectrum.

  • overtones (bool) – Is set to True will enable the computation of infrared overtones and combination bands.

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

newmol – Output molecule containing the new energies.

Return type:

System object

Examples

Starting from an initialized instance orca of the OrcaInput class, a numerical frequency analysis of the molecule mol can be run using the command:

>>> newmol = orca.nfreq(mol)

The newmol object will contain the same geometry of the molecule mol together with all the vibrational data computed during the frequency analysis process. If a new instance of the molecule mol is not wanted. The properties of the molecule can be set using the flag inplace.

>>> orca.nfreq(mol, inplace=True)

In doing so, the molecule mol will be updated with the computed properties without returning anything.

opt(mol, ncores=None, maxcore=750, save_cubes=False, cube_dim=250, hirshfeld=False, inplace=False, remove_tdir=True, optimization_level=None, frequency_analysis=True, blocks={})#

Geometry optimization + frequency analysis.

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • save_cubes (bool, optional) – if set to True, will save a cube file containing electronic and spin densities, by default False.

  • cube_dim (int, optional) – resolution for the cube files (default 250)

  • hirshfeld (bool) – if set to true, will run the Hirshfeld population analysis. (default: False)

  • inplace (bool, optional) – updates info for the input molecule instead of outputting a new molecule object, by default False

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • optimization_level (str) – The convergence level to be adopted during the geometry optimization (Default: NORMALOPT)

  • frequency_analysis (bool) – If set to True (default) will also compute the vibration modes of the molecule and the frequencies. If the optimization is run in solvent, it will automatically switch to numerical frequencies.

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

newmol – Output molecule containing the new geometry and energies.

Return type:

System object

Examples

Starting from an initialized instance orca of the OrcaInput class, a geometry optimization of the molecule mol can be performed using the command:

>>> newmol = orca.opt(mol)

The newmol object will contain the optimized geometry of the molecule mol and the electronic_energy property will be set according to the energy provided by the level of theory encoded into the orca engine. By default a frequency analysis will also be performed at the end of the optimization process. As such, vibrational frequencies and normal modes will also be set among the properties of newmol. If the frequency analysis is not required,it can be avoided setting the proper frequency_analysis flag according to:

>>> newmol = orca.opt(mol, frequency_analysis=False)

If a new instance of the molecule mol is not wanted. The properties and geometry of the molecule can be updated inplace using the command:

>>> orca.opt(mol, inplace=True)
opt_ts(mol, ncores=None, maxcore=750, save_cubes=False, cube_dim=250, hirshfeld=False, inplace=False, remove_tdir=True, scf_convergence_level='TIGHTSCF', convergence_strategy='SLOWCONV', calculate_hessian=True, frequency_analysis=True, blocks={})#

Transition state optimization + frequency analysis.

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • save_cubes (bool, optional) – if set to True, will save a cube file containing electronic and spin densities, by default False.

  • cube_dim (int, optional) – resolution for the cube files (default 250)

  • hirshfeld (bool) – if set to true, will run the Hirshfeld population analysis. (default: False)

  • inplace (bool, optional) – updates info for the input molecule instead of outputting a new molecule object, by default False

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • scf_convergence_level (Optional[str]) – The SCF level of convergence to be adopted during the transition state optimization (Default: TIGHTSCF)

  • convergence_strategy (Optional[str]) – The SCF convergence strategy to be adopted during the transition state optimization (Default: SLOWCONV)

  • calculate_hessian (bool) – If set to True (default) will compute the exact Hessian before the first optimization step.

  • frequency_analysis (bool) – If set to True (default) will also compute the vibration modes of the molecule and the frequencies. If the optimization is run in solvent, it will automatically switch to numerical frequencies.

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

newmol – Output molecule containing the new geometry and energies.

Return type:

System object

Examples

Starting from an initialized instance orca of the OrcaInput class, a transition state optimization can be performed, starting from a good transition state guess guess, using the command:

>>> transition_state = orca.opt_ts(guess)

The transition_state object will contain the optimized geometry of the transition state and the corresponding electronic_energy property will be set according to the energy provided by the level of theory encoded into the orca engine. By default a frequency analysis will also be performed at the end of the optimization process. As such, vibrational frequencies and normal modes will also be set among the properties of transition_state. Keep in mind that the function computes a structure located on a first-order saddle point and, as such, an imaginary mode should be expected. If the frequency analysis is not required, it can be avoided setting the proper frequency_analysis flag according to:

>>> transition_state = orca.opt(guess, frequency_analysis=False)

If a new instance of the molecule guess is not wanted. The properties and geometry of the transition state can be updated inplace using the command:

>>> orca.opt(guess, inplace=True)

The original guess will be updated with the newly defined transition state structure.

property output_suffix: str#

Suffix used to compose the name of calculation output files

Returns:

The output suffix string

Return type:

str

parse_output(mol)#

The function will parse an ORCA output file automatically looking for all the relevant numerical properties derived form a calculation. All the properties of the given molecule will be set or updated.

Parameters:

mol (System) – The System to which the properties must be written to.

Raises:

RuntimeError – Exception raised if the given path to the output file is not valid.

Return type:

None

scan(mol, scan=None, constraints=None, invertconstraints=False, ncores=None, maxcore=750, remove_tdir=True, blocks={})#

Relaxed surface scan.

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • scan (str) – string for the scan section in the %geom block

  • constraints (str) – string for the constraints section in the %geom block

  • invertconstraints (bool, optional) – if True, treats the constraints block as the only coordinate NOT to constrain

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

scan_list – Output Ensemble containing the scan frames.

Return type:

Ensemble

Examples

Starting from an initialized instance orca of the OrcaInput class, a relaxed surface scan of one or more coordinates of the molecule mol can be run passing a properly formatted scan instruction to the scan method. As an example, the scan string "B 0 1 = 1.0, 3.0, 10" will scan the bond between the first two atoms in the molecule mol dividing the range from 1Å to 3Å in 10 equal steps (extremes are included). The syntax of the command is:

>>> output = orca.scan(mol, scan="B 0 1 = 1.0, 3.0, 10")

The output object is of type Ensemble and will contain all the evaluated structures together with their electronic energies.

scan_ts(mol, scan=None, fullscan=False, constraints=None, invertconstraints=False, frequency_analysis=True, scf_convergence_level='TIGHTSCF', convergence_strategy='SLOWCONV', ncores=None, maxcore=750, inplace=False, remove_tdir=True, blocks={})#

Relaxed surface scan based transition state search.

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • scan (str) – string for the scan section in the %geom block

  • fullscan (bool) – If set to True will not stop the scan when the transition state has been located (default: False)

  • constraints (str) – string for the constraints section in the %geom block

  • invertconstraints (bool, optional) – if True, treats the constraints block as the only coordinate NOT to constrain

  • frequency_analysis (bool) – If set to True (default) will also compute the vibration modes of the molecule and the frequencies. If the optimization is run in solvent, it will automatically switch to numerical frequencies.

  • scf_convergence_level (Optional[str]) – The SCF level of convergence to be adopted during the transition state optimization (Default: TIGHTSCF)

  • convergence_strategy (Optional[str]) – The SCF convergence strategy to be adopted during the transition state optimization (Default: SLOWCONV)

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • inplace (bool) – If set to True will update the given mol System with the optimized transition state structure. If set to False (default) will return a new system object with the optimized transition state structure together with an Ensemble object encoding the explored scan steps.

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

  • System – The optimized transition state structure. (only if inplace is False)

  • Ensemble – Output Ensemble containing the scan frames. (only if inplace is False)

Examples

Starting from an initialized instance orca of the OrcaInput class, a transition state search based on a relaxed surface scan of one coordinate of the molecule mol can be run passing a properly formatted scan instruction to the scan_ts method. The scan will be performed until a maximum in the energy profile is found. The structure located at the local maximum will then be used as a guess in a transition state optimization procedure. As an example, the scan string "B 0 1 = 1.0, 3.0, 10" will scan the bond between the first two atoms in the molecule mol dividing the range from 1Å to 3Å in 10 equal steps (extremes are included). The syntax of the command is:

>>> transition_state, scan_ensemble = orca.scan_ts(mol, scan="B 0 1 = 1.0, 3.0, 10")

The transition_state object is of type System and encodes the optimized transition state structure while the scan_ensemble object is of type Ensemble and will contain all the evaluated structures during the scan step.

spe(mol, ncores=None, maxcore=750, save_cubes=False, cube_dim=250, hirshfeld=False, inplace=False, remove_tdir=True, blocks={})#

Single point energy calculation.

Parameters:
  • mol (System object) – input molecule to use in the calculation

  • ncores (int, optional) – number of cores, by default all available cores

  • maxcore (int, optional) – memory per core, in MB, by default 750

  • save_cubes (bool, optional) – if set to True, will save a cube file containing electronic and spin densities, by default False.

  • cube_dim (int, optional) – resolution for the cube files (default 250)

  • hirshfeld (bool) – if set to true, will run the Hirshfeld population analysis. (default: False)

  • inplace (bool, optional) – updates info for the input molecule instead of outputting a new molecule object, by default False

  • remove_tdir (bool, optional) – temporary work directory will be removed, by default True

  • blocks (Dict[str, Dict[str, Any]]) – The dictionary of dictionaries encoding a series of custom blocks defined by the user. If set to a non-empty value, will overvrite the block option eventually set on the OrcaInput class construction

Returns:

newmol – Output molecule containing the new energies.

Return type:

System object

Examples

Starting from an initialized instance orca of the OrcaInput class, a single point calculation on a molecule mol can be run using the command:

>>> newmol = orca.spe(mol)

The newmol object will contain the same geometry of the molecule mol and the electronic_energy property will be set according to the energy provided by the level of theory encoded into the orca engine. If a new instance of the molecule mol is not wanted. The properties of the molecule can be set using the flag inplace.

>>> orca.spe(mol, inplace=True)

In doing so, the molecule mol will be updated with the computed energy without returning anything.

write_input(mol, job_info)#

Function responsible of writing the orca input file.

Parameters:
  • mol (System) – The molecule subject to the calculation.

  • job_info (OrcaJobInfo) – The helper class encoding the calculation type.

Return type:

None

OrcaJobInfo class#

class compechem.engines.orca.OrcaJobInfo#

The OrcaJobInfo class is an helper class designed to provide a compact tool to define orca-based quantum chemical calculations. The attributes of the class univocally identify a calculation type and can be used to compile orca input files.

is_singlet#

If True, the molecule on which the calculation is performed is in a singlet state (If cube is saved also the spindensity will be saved).

Type:

bool

solvent#

The SMD solvent to be used during the calculation.

Type:

Optional[str]

opt#

If set to True, will trigger a geometry optimization calculation.

Type:

bool

opt_ts#

If set to True, will trigger a transition-state optimization calculation.

Type:

bool

freq#

If set to True, will trigger a frequency analysis (with analytical frequencies if not in solvent).

Type:

bool

nfreq#

If set to True, will trigger a numerical frequency analysis.

Type:

bool

scan#

If not None, will encode the scan parameters in string format.

Type:

Optional[str]

scan_ts#

If not None, will encode the transition state scan parameters in string format.

Type:

Optional[str]

neb_ci#

If set to True will trigger a NEB-CI calculation.

Type:

bool

constraints#

If not None, will encode the constraints to be used during the scan or optimization operations.

Type:

Optional[str]

invert_constraints#

If set to True, will invert the constraints to be used in the calculation.

Type:

bool

fullscan#

If set to True during scan TS will continue the scan even if the transition state is located.

Type:

bool

cube_dim#

If set to integer value will trigger the saving of cube files with a equally spaced grid of cube_dim points.

Type:

Optional[int]

calc_hess#

If set to True will compute the analytical hessian before the starting of a calculation.

Type:

bool

hirshfeld#

If set to True will trigger the Hirshfeld population analysis

Type:

bool

nearir#

If set to True will trigger the calcuation of overtones and combination bands in the infrared spectrum

Type:

bool

raman#

If set to True, will trigger the polarizability calcualtion outputting also the raman spectra.

Type:

bool

neb_product#

If not None, will encode the final endopoint to be used in the neb calculation.

Type:

Optional[str]

neb_ts_guess#

In not None, will encode the xyz file to be used as a transition state guess.

Type:

Optional[str]

neb_images#

If set to an integer value, will define the number of images to be used in the neb calculation (endpoints excluded)

Type:

Optional[int]

neb_preopt#

If set to True when a NEB calculation is performed, will preoptimize the reactant and product structures.

Type:

bool

property cpcm_block: Dict[str, Any]#

Returns the %cpcm block generated by merging the user provided solvent options with the ones specified by the library flags.

Returns:

The content of the cpcm block encoded in dictionary format.

Return type:

Dict[str, Any]

property elprop_block: Dict[str, Any]#

Returns the %elprop block generated by merging the user provided electronic properties options with the ones specified by the library flags.

Returns:

The content of the elprop block encoded in dictionary format.

Return type:

Dict[str, Any]

property geom_block: Dict[str, Any]#

Returns the %geom block generated by merging the user provided geometry options with the ones specified by the library flags.

Returns:

The content of the geom block encoded in dictionary format.

Return type:

Dict[str, Any]

property maxcore: int#

The amount of RAM per core to be used in the calculation

Returns:

The maxcore value to be used by orca

Return type:

int

property ncores: int#

The number of cores to be used in the calculation

Returns:

The total number of cores

Return type:

int

property neb_block: Dict[str, Any]#

Returns the %neb block generated by merging the user provided neb options with the ones specified by the library flags.

Returns:

The content of the neb block encoded in dictionary format.

Return type:

Dict[str, Any]

property optimization_level: Optional[str]#

The optimization level to be used during the calculation. The possible values are “VERYTIGHTOPT”, “TIGHTOPT”, “NORMALOPT”, “LOOSEOPT”.

Returns:

The string encoding the optimization level to be used in the output.

Return type:

str

property output_block: Dict[str, Any]#

Returns the %output block generated by merging the user provided output options with the ones specified by the library flags.

Returns:

The content of the output block encoded in dictionary format.

Return type:

Dict[str, Any]

property parsed_blocks: Dict[str, Dict[str, Any]]#

Returns the dictionary encoding all the blocks to be used in the definition of an orca input file. The function merges the user provided options with the ones specified by the library flags.

Returns:

The dictionary of dictionaries encoding all the blocks to be used in the orca input file.

Return type:

Dict[str, Dict[str, Any]]

property plots_block: Dict[str, Any]#

Returns the %plots block generated by merging the user provided plot options with the ones specified by the library flags.

Returns:

The content of the geom block encoded in dictionary format.

Return type:

Dict[str, Any]

property print_level: Optional[str]#

The print level to be used during the calculation. The possible values are “MINIPRINT”, “SMALLPRINT”, “NORMALPRINT”, “LARGEPRINT”.

Returns:

The string encoding the print level to be used in the output.

Return type:

str

property scf_convergence_level: Optional[str]#

The scf convergence level to be used during the calculation. The possible values are “NORMALSCF”, “LOOSESCF”, “SLOPPYSCF”, “STRONGSCF”, “TIGHTSCF”, “VERYTIGHTSCF”, “EXTREMESCF”.

Returns:

The string encoding the scf convergence level to be used during the calculation.

Return type:

str

property scf_convergence_strategy: Optional[str]#

The scf convergence strategy to be used during the calculation. The possible values are “EASYCONV”, “NORMALCONV”, “SLOWCONV”, “VERYSLOWCONV”, “FORCECONV”, “IGNORECONV”.

Returns:

The string encoding the scf convergence strategy to be used during the calculation.

Return type:

str