QM_Wrapper Submodule

janus.qm_wrapper.QMWrapper(class_type)
janus.qm_wrapper.Psi4Wrapper([method, …]) A wrapper class that calls Psi4 to obtain quantum mechanical information.

QMWrapper

class janus.qm_wrapper.QMWrapper(class_type)

Bases: abc.ABC

build_qm_param() Function implemented in individual child classes
compute_info() Function implemented in individual child classes
convert_input() Function not implemented for QM wrappers
convert_trajectory() Function not implemented for QM wrappers
get_energy_and_gradient([traj, geometry, …]) Gets the energy and gradient from a QM computation of the primary subsystem
get_geom_from_trajectory([qm_traj]) Obtains geometry information from an MDtrah trajectory object.
get_main_charges() Function not implemented for QM wrappers
get_main_info() Function not implemented for QM wrappers
initialize() Function not implemented for QM wrappers
optimize_geometry() Function implemented in individual child classes
set_external_charges() Function not implemented for QM wrappers
set_qm_geometry(geom) Sets self.qm_geometry as geom
set_up_reporters() Function not implemented for QM wrappers
take_step(force) Function not implemented for QM wrappers

Attributes

build_qm_param()

Function implemented in individual child classes

compute_info()

Function implemented in individual child classes

convert_input()

Function not implemented for QM wrappers

convert_trajectory()

Function not implemented for QM wrappers

get_energy_and_gradient(traj=None, geometry=None, include_coulomb='all', link_atoms=None, minimize=False, charges=None)

Gets the energy and gradient from a QM computation of the primary subsystem

Parameters:
  • traj (MDtraj trajectory object) – A trajectory object from which to extract geometry information if geometry is None
  • geometry (str) – A string containing geometry information as XYZ coordinates. Default is None.
  • include_coulomb (str) – whether to include coulombic interactions. Not applicable for QM programs
  • link_atoms (list) – indices of link_atoms
  • minimize (bool) – whether to return the geometry optimized energy
  • charges (list) – charges and corresponding positions in angstroms as xyz coordinates
Returns:

A dictionary with energy(‘energy’) and gradient(‘gradients’) information

Return type:

dict

Examples

>>> get_energy_and_gradient(traj=mdtraj, geometry=None)
get_geom_from_trajectory(qm_traj=None)

Obtains geometry information from an MDtrah trajectory object.

Parameters:qm_traj (MDtraj object) – describes just the primary subsystem, default is None
get_main_charges()

Function not implemented for QM wrappers

get_main_info()

Function not implemented for QM wrappers

initialize()

Function not implemented for QM wrappers

optimize_geometry()

Function implemented in individual child classes

set_external_charges()

Function not implemented for QM wrappers

set_qm_geometry(geom)

Sets self.qm_geometry as geom

Parameters:geom (str) – A str containing an XYZ coordinate
set_up_reporters()

Function not implemented for QM wrappers

take_step(force)

Function not implemented for QM wrappers

Psi4Wrapper

class janus.qm_wrapper.Psi4Wrapper(method='scf', charge=0, multiplicity=1, reference='rhf', basis='STO-3G', e_convergence=1e-08, d_convergence=1e-08, sys_info=None, sys_info_format=None, **kwargs)

Bases: janus.qm_wrapper.qm_wrapper.QMWrapper

A wrapper class that calls Psi4 to obtain quantum mechanical information. Class inherits from QMWrapper.

build_qm_param() Builds a dictionary of QM parameters from input options and saves as self.param
compute_energy() Calls Psi4 to obtain the energy and Psi4 wavefunction object of the QM region and saves as self.energy and self.wavefunction
compute_energy_and_charges([charge_method]) Calls Psi4 to obtain the self.energy, self.wavefunction, and self.charges on each atom.
compute_gradient() Calls Psi4 to obtain the gradient of the QM region and saves it as a numpy array self.gradient
compute_info() Calls Psi4 to obtain the energy, Psi4 wavefunction object, and gradient of the QM region and saves as self.energy, self.wavefuction, and self.gradient
compute_scf_charges([charge_method]) Calls Psi4 to obtain the self.charges on each atom given and saves it as a numpy array.
convert_input() Function not implemented for QM wrappers
convert_trajectory() Function not implemented for QM wrappers
get_energy_and_gradient([traj, geometry, …]) Gets the energy and gradient from a QM computation of the primary subsystem
get_geom_from_trajectory([qm_traj]) Obtains geometry information from an MDtrah trajectory object.
get_main_charges() Function not implemented for QM wrappers
get_main_info() Function not implemented for QM wrappers
initialize() Function not implemented for QM wrappers
optimize_geometry() Calls Psi4 to obtain a geometry optimized geometry
set_external_charges() Function not implemented for QM wrappers
set_qm_geometry(geom) Sets self.qm_geometry as geom
set_up_psi4() Sets up a psi4 computation
set_up_reporters() Function not implemented for QM wrappers
take_step(force) Function not implemented for QM wrappers

Attributes

build_qm_param()

Builds a dictionary of QM parameters from input options and saves as self.param

compute_energy()

Calls Psi4 to obtain the energy and Psi4 wavefunction object of the QM region and saves as self.energy and self.wavefunction

compute_energy_and_charges(charge_method='MULLIKEN_CHARGES')

Calls Psi4 to obtain the self.energy, self.wavefunction, and self.charges on each atom. This method for correlated methods.

Note

Think about passing in wavefunction instead of calling for energy and wavefunction

compute_gradient()

Calls Psi4 to obtain the gradient of the QM region and saves it as a numpy array self.gradient

compute_info()

Calls Psi4 to obtain the energy, Psi4 wavefunction object, and gradient of the QM region and saves as self.energy, self.wavefuction, and self.gradient

compute_scf_charges(charge_method='MULLIKEN_CHARGES')

Calls Psi4 to obtain the self.charges on each atom given and saves it as a numpy array. This method works well for SCF wavefunctions. For correlated levels of theory (e.g., MP2), it is advised that compute_energy_and_charges() be used instead.

optimize_geometry()

Calls Psi4 to obtain a geometry optimized geometry

Returns:XYZ coordinates of the optimized geometry
Return type:numpy array
set_up_psi4()

Sets up a psi4 computation