Molsys
- class optking.molsys.Molsys(fragments, dimer_intcos=None)[source]
Bases:
object
Attributes Summary
Determine vector with 1 for any frozen internal coordinate
cartesian geometry [a0]
Methods Summary
Bmat
([massWeight])Gmat
([massWeight])Calculates BuB^T (calculates B matrix)
apply_external_forces
(fq, H, stepNumber)atom2frag_index
(atom_index)atom_list2unique_frag_list
(atomList)clear
()constraint_matrix
([fq])Returns constraint matrix with 1 on diagonal for frozen coordinates
dimerfrag_1st_intco
(iDI)See description in Fragment class.
frag_1st_atom
(iF)frag_1st_intco
(iF)frag_atom_range
(iF)frag_atom_slice
(iF)frag_geom
(iF)cartesian geometry for fragment i
frag_intco_range
(iF)frag_intco_slice
(iF)from_dict
(d)from_psi4
(mol)Creates a optking molecular system from psi4 mol.
from_schema
(qc_molecule)Creates optking molecular system from JSON input.
converts the gradient from internal into Cartesian coordinates
gradient_to_internals
(g_x[, coeff, B, useMasses])Transform cartesian gradient to internals :param g_x: (3nat, 1) cartesian gradient :type g_x: np.ndarray :param coeff: prefactor coefficient; -1 for forces :type coeff: float :param B: B matrix to use :type B: np.ndarray, optional :param useMasses: instead of identity, use u = 1/masses in transformation :type useMasses: boolean
hessian_to_cartesians
(Hint[, g_q])hessian_to_internals
(H[, g_x, useMasses])converts the hessian from cartesian coordinates into internal coordinates Hq = A^t (Hxy - Kxy) A, where K_xy = sum_q ( grad_q[I] d^2(q_I)/(dx dy) and A = (BuB^t)^-1 Bu
Returns a string of the geometry for logging in [a0]
Project redundancies and constraints out of forces and Hessian
q
()Returns internal coordinate values in au as list.
q_array
()Returns internal coordinate values in au as array.
q_show
()returns internal coordinates values in Angstroms/degrees as list.
returns internal coordinates values in Angstroms/degrees as array.
q_show_forces
(forces)Returns scaled forces as array.
Determine vector with 1 for any ranged intco that is at its limit
Return a string of the geometry in [A]
Split any fragment not connected by bond connectivity.
Test the analytic B matrix (dq/dx) via finite differences.
Test the analytic derivative B matrix (d2q/dx2) via finite differences.
to_dict
()See description in Fragment class.
See description in Fragment class.
Attributes Documentation
- Z
- all_fragments
- atom_symbols
- dimer_intcos
- dimer_psuedo_frags
- frag_natoms
- fragments
- fragments_atom_list
- frozen_intco_list
Determine vector with 1 for any frozen internal coordinate
- geom
cartesian geometry [a0]
- intco_lbls
- intcos_present
- masses
- natom
- nfragments
- num_intcos
- num_intrafrag_intcos
Methods Documentation
- Gmat(massWeight=False)[source]
Calculates BuB^T (calculates B matrix)
- Parameters
masses (List, optional) –
- constraint_matrix(fq=None)[source]
Returns constraint matrix with 1 on diagonal for frozen coordinates
- static from_psi4(mol)[source]
Creates a optking molecular system from psi4 mol. Note that not all information is preserved. :param mol: psi4 mol :type mol: object
- Returns
optking molecular system: list of fragments
- Return type
cls
- classmethod from_schema(qc_molecule)[source]
Creates optking molecular system from JSON input.
- Parameters
qc_molecule (dict) – molecule key in MOLSSI QCSchema see http://molssi-qc-schema.readthedocs.io/en/latest/auto_topology.html
- Returns
molsys cls consists of list of Frags
- Return type
cls
- gradient_to_cartesians(g_q)[source]
converts the gradient from internal into Cartesian coordinates
- Parameters
g_q (ndarray) – internal coordinate gradient
- Returns
g_x – Cartesian coordinate gradient
- Return type
ndarray
- gradient_to_internals(g_x, coeff=1.0, B=None, useMasses=False)[source]
Transform cartesian gradient to internals :param g_x: (3nat, 1) cartesian gradient :type g_x: np.ndarray :param coeff: prefactor coefficient; -1 for forces :type coeff: float :param B: B matrix to use :type B: np.ndarray, optional :param useMasses: instead of identity, use u = 1/masses in transformation :type useMasses: boolean
- Returns
gradient in internal coordinates (coeff==1)
- Return type
ndarray
Notes
g_q = (BuB^T)^(-1)*B*g_x
- hessian_to_internals(H, g_x=None, useMasses=False)[source]
converts the hessian from cartesian coordinates into internal coordinates Hq = A^t (Hxy - Kxy) A, where K_xy = sum_q ( grad_q[I] d^2(q_I)/(dx dy) and A = (BuB^t)^-1 Bu
- Parameters
H (np.ndarray) – Hessian in cartesians
g_x (np.ndarray) – (nat, 3) gradient in cartesians (optional)
massWeight (boolean) – whether to keep arbitrary transformation matrix u=I or use 1/mass_i as in spectroscopy or cases where rotations/translations matter.
- Returns
Hq – hessian in internal coordinates
- Return type
np.ndarray
- project_redundancies_and_constraints(fq, H)[source]
Project redundancies and constraints out of forces and Hessian
- ranged_frozen_intco_list(fq)[source]
Determine vector with 1 for any ranged intco that is at its limit
- test_Bmat()[source]
Test the analytic B matrix (dq/dx) via finite differences. The 5-point formula should be good to DISP_SIZE^4 - a few unfortunates will be slightly worse.
- Returns
passes – Returns True or False, doesn’t raise exceptions
- Return type
boolean