Tools
Structure Generation Tools
- molSimplify.Scripts.structgen.align_dent1_lig(args, cpoint, core3D, coreref, ligand, lig3D, catoms, rempi=False, ligpiatoms=[], MLb=[], ANN_flag=False, ANN_bondl: float = nan, this_diag=0, MLbonds={}, MLoptbds: List[float] | None = None, i: int = 0, EnableAutoLinearBend=True) Tuple[mol3D, List[float]] [source]
Aligns a monodentate ligand to core connecting atom coordinates.
- Parameters:
args (Namespace) – Namespace of arguments.
cpoint (atom3D) – atom3D class instance containing backbone connecting point.
core3D (mol3D) – mol3D class instance of partially built complex.
coreref (atom3D) – atom3D of core reference atom.
ligand (str) – Name of ligand for dictionary lookup.
lig3D (mol3D) – mol3D class instance of the ligand.
catoms (list) – List of ligand connecting atom indices.
rempi (bool, optional) – Flag for pi-coordinating ligand. Default is False.
ligpiatoms (list, optional) – List of pi-coordinating atom indices in ligand. Default is empty.
MLb (list, optional) – Custom M-L bond length (if any). Default is empty.
ANN_flag (bool, optional) – Flag for ANN activation. Default is False.
this_diag (run_diag, optional) – ANN run_diag class instance. Default is 0.
MLbonds (dict, optional) – M-L bond dictionary. Default is empty.
MLoptbds (list, optional) – List of final M-L bond lengths. Default is None.
i (int, optional) – Ligand serial number. Default is 0.
EnableAutoLinearBend (bool, optional) – Flag for enabling automatic bending of linear ligands (e.g. superoxo).
- Returns:
lig3D_aligned (mol3D) – mol3D class instance of aligned ligand.
MLoptbds (list) – Updated list of metal ligand bonds.
- molSimplify.Scripts.structgen.align_dent2_catom2_coarse(args, lig3D, core3D, catoms, r1, r0, m3D, batoms, corerefcoords)[source]
Crude rotations to improve alignment of the 2nd connecting atom of a bidentate substrate.
- Parameters:
args (Namespace) – Namespace of arguments.
lig3D (mol3D) – mol3D class instance of the ligand.
core3D (mol3D) – mol3D class instance of partially built complex.
catoms (list) – List of ligand connecting atom indices.
r1 (list) – Coordinates of ligand first connecting atom.
r0 (list) – Coordinates of core reference point.
m3D (mol3D) – mol3D class instance of backbone template.
batoms (list) – List of backbone atom indices.
corerefcoords (list) – Coordinates of core reference atom.
- Returns:
lig3D_aligned (mol3D) – mol3D class instance of aligned ligand.
r1b (list) – Coordinates of second backbone point.
- molSimplify.Scripts.structgen.align_dent2_catom2_refined(args, lig3D, catoms, bondl, r1, r0, core3D, rtarget, coreref, MLoptbds)[source]
Aligns second connecting atom of a bidentate ligand to balance ligand strain and the desired coordination environment.
- Parameters:
args (Namespace) – Namespace of arguments.
lig3D (mol3D) – mol3D class instance of the ligand.
catoms (list) – List of ligand connecting atom indices.
bondl (float) – Target M-L bond length.
r1 (list) – Coordinates of ligand first connecting atom.
r0 (list) – Coordinates of core reference point.
core3D (mol3D) – mol3D class instance of partially built complex.
rtarget (list) – Coordinates of target point for second connecting atom.
coreref (atom3D) – atom3D of core reference atom.
MLoptbds (list) – List of final M-L bond lengths.
- Returns:
lig3D_aligned – mol3D class instance of aligned ligand.
- Return type:
- molSimplify.Scripts.structgen.align_dent2_lig(args, cpoint, batoms, m3D, core3D, coreref, ligand, lig3D, catoms, MLb, ANN_flag, ANN_bondl: float, this_diag, MLbonds, MLoptbds: List[float], frozenats: List[int], i: int) Tuple[mol3D, List[int], List[float]] [source]
Aligns a bidentate ligand to core connecting atom coordinates.
- Parameters:
args (Namespace) – Namespace of arguments.
cpoint (atom3D) – atom3D class instance containing backbone connecting point.
batoms (list) – List of backbone atom indices.
m3D (mol3D) – mol3D of backbone template.
core3D (mol3D) – mol3D class instance of partially built complex.
coreref (atom3D) – atom3D of core reference atom.
ligand (str) – Name of ligand for dictionary lookup.
lig3D (mol3D) – mol3D class instance of the ligand.
catoms (list) – List of ligand connecting atom indices.
MLb (list) – Custom M-L bond length (if any).
ANN_flag (bool) – Flag for ANN activation.
ANN_bondl (list) – List of ANN predicted bond lengths.
this_diag (run_diag) – ANN run_diag class instance.
MLbonds (dict) – M-L bond dictionary.
MLoptbds (list) – List of final M-L bond lengths.
frozenats (list) – List of atoms frozen in FF optimization.
i (int, optional) – Ligand serial number. Default is 0.
- Returns:
lig3D_aligned (mol3D) – mol3D class instance of aligned ligand.
frozenats (list) – List of frozen atoms.
MLoptbds (list) – Updated list of metal ligand bonds.
- molSimplify.Scripts.structgen.align_dent3_lig(args, cpoint, batoms, m3D, core3D, coreref, ligand, lig3D, catoms, MLb, ANN_flag, ANN_bondl, this_diag, MLbonds, MLoptbds: List[float], frozenats: List[int], i: int) Tuple[mol3D, List[int], List[float]] [source]
Aligns a tridentate ligand to core connecting atom coordinates
- Parameters:
args (Namespace) – Namespace of arguments.
cpoint (atom3D) – atom3D class instance containing backbone connecting point.
batoms (list) – List of backbone atom indices.
m3D (mol3D) – mol3D of backbone template.
core3D (mol3D) – mol3D class instance of partially built complex.
coreref (atom3D) – atom3D of core reference atom.
ligand (str) – Name of ligand for dictionary lookup.
lig3D (mol3D) – mol3D class instance of the ligand.
catoms (list) – List of ligand connecting atom indices.
MLb (list) – Custom M-L bond length (if any).
ANN_flag (bool) – Flag for ANN activation.
ANN_bondl (list) – List of ANN predicted bond lengths.
this_diag (run_diag) – ANN run_diag class instance.
MLbonds (dict) – M-L bond dictionary.
MLoptbds (list) – List of final M-L bond lengths.
frozenats (list) – List of atoms frozen in FF optimization.
i (int, optional) – Ligand serial number. Default is 0.
- Returns:
lig3D_aligned (mol3D) – mol3D class instance of aligned ligand.
frozenats (list) – List of frozen atoms.
MLoptbds (list) – Updated list of metal ligand bonds.
- molSimplify.Scripts.structgen.align_lig_centersym(corerefcoords, lig3D, atom0, core3D, EnableAutoLinearBend)[source]
Aligns a ligand’s center of symmetry along the metal-connecting atom axis
- Parameters:
corerefcoords (list) – Core reference coordinates.
lig3D (mol3D) – mol3D class instance of the ligand.
atom0 (int) – Ligand connecting atom index.
core3D (mol3D) – mol3D instance of partially built complex.
EnableAutoLinearBend (bool) – Flag for enabling automatic bending of linear ligands (e.g. superoxo).
- Returns:
lig3D_aligned – mol3D class instance of aligned ligand.
- Return type:
- molSimplify.Scripts.structgen.align_linear_pi_lig(corerefcoords, lig3D, atom0, ligpiatoms)[source]
Aligns a linear pi ligand’s connecting point to the metal-ligand axis.
- Parameters:
- Returns:
lig3D_aligned – mol3D class instance of aligned ligand.
- Return type:
- molSimplify.Scripts.structgen.align_pi_ring_lig(corerefcoords, lig3D, atom0, ligpiatoms, u)[source]
Rotates the ligand such that the aromatic ring that bonds to the central metal is perpendicular to the vector from the metal to the fictitous atom in the center of the ring.
- Parameters:
corerefcoords (list) – Core reference coordinates. These are the coordinates of the central metal.
lig3D (mol3D) – mol3D class instance of the ligand.
atom0 (int) – Ligand connecting atom index. Here, refers to the fictitious atom in the center of the aromatic ring, since we have a ligand that coordinates through an aromatic ring.
ligpiatoms (list) – List of ligand pi-connecting atom indices.
u (list) – Vector from the metal to the fictitious atom in the center of the aromatic ring. Length is 3.
- Returns:
lig3D – mol3D class instance of aligned ligand.
- Return type:
- molSimplify.Scripts.structgen.check_rotate_linear_lig(corerefcoords, lig3D, atom0)[source]
Checks if ligand has a linear coordination environment (e.g., OCO) and ensures perpendicularity to M-L axis
- molSimplify.Scripts.structgen.check_rotate_symm_lig(corerefcoords, lig3D, atom0, core3D)[source]
Aligns a ligand’s center of symmetry along the metal-connecting atom axis
- Parameters:
- Returns:
lig3D_aligned – mol3D class instance of rotated ligand.
- Return type:
- molSimplify.Scripts.structgen.ffopt(ff: str, mol: mol3D, connected: List[int], constopt: int, frozenats: List[int], frozenangles: bool, mlbonds: List[float], nsteps: int | str, spin: int = 1, debug: bool = False) Tuple[mol3D, float] [source]
Main constrained FF opt routine.
- Parameters:
ff (str) – Name force field to use. Available options are MMFF94, UFF, Ghemical, GAFF, XTB. (XTB only works if the xtb command-line program is installed.)
mol (mol3D) – mol3D instance of molecule to be optimized.
connected (list) – List of indices of connection atoms to metal.
constopt (int) – Flag for constrained optimization - 0: unconstrained, 1: fixed connecting atom positions, 2: fixed connecting atom distances.
frozenats (list) – List of frozen atom indices.
frozenangles (bool) – Flag for frozen angles, equivalent to constopt==1.
mlbonds (list) – List of M-L bonds for distance constraints.
nsteps (int) – Number of steps to take.
spin (int) – Spin multiplicity
debug (bool) – Flag to print extra info to debug.
- Returns:
mol (mol3D) – Optimized molecule mol3D instance.
en (float) – Forcefield energy of optimized molecule.
- molSimplify.Scripts.structgen.findsmarts(lig3D: mol3D, smarts: List[str], catom: int) bool [source]
Checks if connecting atom of lig3D is part of SMARTS pattern.
- Parameters:
- Returns:
SMARTS_flag – SMARTS match flag. True if found, False if not.
- Return type:
- molSimplify.Scripts.structgen.generate_report(args: Namespace, ligands: List[str], ligoc: List[int]) Tuple[mol3D, List[mol3D], str, run_diag, List[int], List[int]] [source]
- molSimplify.Scripts.structgen.get_MLdist(metal: atom3D, oxstate: str, spin: str, lig3D: mol3D, atom0: int, ligand: str, MLb: List[str], i: int, ANN_flag: bool, ANN_bondl: float, this_diag: run_diag, MLbonds: dict, debug: bool = False) float [source]
Gets target M-L distance from desired source (custom, sum cov rad or ANN). Aligns a monodentate ligand to core connecting atom coordinates.
- Parameters:
args (Namespace) – Namespace of arguments.
lig3D (mol3D) – mol3D class instance of the ligand.
atom0 (int) – Ligand connecting atom index.
ligand (str) – Name of ligand for dictionary lookup.
metal (atom3D) – atom3D class instance of the first atom (usually a metal).
MLb (float) – Custom M-L bond length (if any).
i (int) – Ligand index number.
ANN_flag (bool) – Flag for ANN activation.
ANN_bondl (float) – ANN predicted M-L bond length.
this_diag (run_diag) – run_diag instance for ANN diagnostic object.
MLbonds (dict) – M-L bond dictionary.
- Returns:
bondl – M-L bond length in angstroms.
- Return type:
- molSimplify.Scripts.structgen.get_MLdist_database(metal: atom3D, oxstate: str, spin: str, lig3D: mol3D, atom0: int, ligand: str, MLbonds: dict, debug=False) Tuple[float, bool] [source]
Gets target M-L distance from desired source (custom, sum cov rad or ANN). Aligns a monodentate ligand to core connecting atom coordinates.
- Parameters:
metal (atom3D) – atom3D class instance of the first atom (usually a metal).
oxstate (str:) – oxidation state
spin (str) – spin state
lig3D (mol3D) – mol3D class instance of the ligand.
atom0 (int) – Ligand connecting atom index.
ligand (str) – Name of ligand for dictionary lookup.
MLbonds (dict) – M-L bond dictionary.
- Returns:
bondl (float) – M-L bond length in angstroms.
exact_match (bool) – Flag for database match.
- molSimplify.Scripts.structgen.get_batoms(args, batslist, ligsused)[source]
Get backbone atoms from template.
- molSimplify.Scripts.structgen.getbackbcombsall(nums)[source]
Gets all possible combinations for connection atoms in geometry in the case of forced order or unknown geometry.
- molSimplify.Scripts.structgen.getconnection(core: mol3D, cidx: int, BL: float) List[float] [source]
Finds the optimum attachment point for an atom/group to a central atom given the desired bond length. Objective function maximizes the minimum distance between attachment point and other groups bonded to the central atom.
- molSimplify.Scripts.structgen.getnupdateb(backbatoms: List[List[int]], denticity: int) Tuple[List[int], List[List[int]]] [source]
Gets a combination of backbone points that satisfies denticity and updates possible combinations.
- molSimplify.Scripts.structgen.init_ANN(args, ligands: List[str], occs: List[int], dents: List[int], batslist: List[List[int]], tcats: List[List[str | int]], licores: dict) Tuple[bool, List[Any], str, Dict[str, Any], bool] [source]
Initializes ANN.
- Parameters:
args (Namespace) – Namespace of arguments.
ligands (list) – List of ligands, given as names.
occs (list) – List of ligand occupations (frequencies of each ligand).
dents (list) – List of ligand denticities.
batslist (list) – List of backbond points.
tcats (list) – List of SMILES ligand connecting atoms.
licores (dict) – Ligand dictionary within molSimplify.
- Returns:
ANN_flag (bool) – Whether an ANN call was successful.
ANN_bondl (float) – ANN predicted bond length.
ANN_reason (str) – Reason for ANN failure, if failed.
ANN_attributes (dict) – Dictionary of predicted attributes of complex.
catalysis_flag (bool) – Whether or not complex is compatible for catalytic ANNs.
- molSimplify.Scripts.structgen.init_ligand(args: Namespace, lig: mol3D, tcats, keepHs: List[List[bool | str]], i: int)[source]
Initializes ligand 3D geometry and properties.
- Parameters:
- Returns:
lig3D (mol3D) – Ligand mol3D instance.
rempi (bool) – Flag for pi coordination.
ligpiatoms (list) – List of pi coordinating atoms.
- molSimplify.Scripts.structgen.init_template(args: Namespace, cpoints_required: int) Tuple[mol3D, mol3D, str, list, int, mol3D] [source]
Initializes core and template mol3Ds and properties.
- Parameters:
args (Namespace) – Namespace of arguments.
cpoints_required (int) – Number of connecting points required.
- Returns:
m3D (mol3D) – Template complex mol3D instance.
core3D (mol3D) – Core mol3D instance.
geom (str) – Geometry used.
backbatoms (list) – List of backbone atoms.
coord (int) – Coordination number.
corerefatoms (mol3D) – Core reference atom index, mol3D instance.
- molSimplify.Scripts.structgen.mcomplex(args: Namespace, ligs: List[str], ligoc: List[int]) Tuple[mol3D, List[mol3D], str, run_diag, List[int], List[int]] [source]
Main ligand placement routine
- Parameters:
- Returns:
core3D (mol3D) – mol3D class instance for core.
complex3D (mol3D) – mol3D class instance for built complex.
emsg (str) – Flag for error. String if error, with error message.
this_diag (run_diag) – run_diag class instance of the complex.
subcatoms_ext (list) – Substrate connection atoms from TSGen. Deprecated.
mligcatoms_ext (list) – Ligand connection atoms from TSGen. Deprecated.
- molSimplify.Scripts.structgen.modifybackbonep(backb, pangles)[source]
Distorts backbone according to user specified angles.
- Parameters:
backb (List) – List with points comprising the backbone.
pangles (List) – Pairs of theta/phi angles in DEGREES. Should be list of tuples.
- Returns:
backb – List of distorted backbone points.
- Return type:
- molSimplify.Scripts.structgen.openbabel_ffopt(ff: str, mol: mol3D, connected: List[int], constopt: int, frozenats: List[int], frozenangles: bool, mlbonds: List[float], nsteps: int | str, debug: bool = False) Tuple[mol3D, float] [source]
OpenBabel constraint optimization. To optimize metal-containing complexes with MMFF94, an intricate procedure of masking the metal atoms and manually editing their valences is applied. OpenBabel’s implementation of MMFF94 may run extremely slowly on some systems. If so, consider switching to UFF.
- Parameters:
ff (str) – Name force field to use. Available options are MMFF94, UFF, Ghemical, GAFF.
mol (mol3D) – mol3D instance of molecule to be optimized.
connected (list) – List of indices of connection atoms to metal.
constopt (int) –
- Flag for constrained optimization
0: unconstrained, 1: fixed connecting atom positions, 2: fixed connecting atom distances.
frozenats (list) – List of frozen atom indices.
frozenangles (bool) – Flag for frozen angles, equivalent to constopt==1.
mlbonds (list) – List of M-L bonds for distance constraints.
nsteps (int) – Number of steps to take.
debug (bool) – Flag to print extra info to debug.
- Returns:
mol (mol3D) – Optimized molecule mol3D instance.
en (float) – Forcefield energy of optimized molecule.
- molSimplify.Scripts.structgen.rotate_MLaxis_minimize_steric(corerefcoords, lig3D, atom0, core3D)[source]
Rotates aligned ligand about M-L axis to minimize steric clashes with rest of complex
- Parameters:
- Returns:
lig3D_aligned – mol3D class instance of rotated ligand.
- Return type:
- molSimplify.Scripts.structgen.rotate_catom_fix_Hs(lig3D, catoms, n, mcoords, core3D)[source]
Rotates a connecting atom of a multidentate ligand to improve H atom placement. There are separate routines for terminal connecting atoms and intermediate connecting atoms.
- Parameters:
- Returns:
lig3D_aligned – mol3D class instance of rotated ligand.
- Return type:
- molSimplify.Scripts.structgen.rotate_catoms_fix_Hs(lig3D: mol3D, catoms: List[int], mcoords, core3D: mol3D) mol3D [source]
Rotates connecting atoms of multidentate ligands to improve H atom placement. Loops over rotate_catom_fix_Hs().
- Parameters:
- Returns:
lig3D_aligned – mol3D class instance of rotated ligand.
- Return type:
- molSimplify.Scripts.structgen.rotation_objective_func(rotations, lig3D, atom0, ligpiatoms, metal_lig_vec, directional_vectors)[source]
Objective function for finding rotations that make an aromatic ring perpendicular to the metal-ligand vector.
- Parameters:
rotations (list) – Floats that indicate angles by which to rotate the ligand. Length is 3.
lig3D (mol3D) – mol3D class instance of the ligand.
atom0 (int) – Ligand connecting atom index. Here, refers to the fictitious atom in the center of the aromatic ring.
ligpiatoms (list) – List of ligand pi-connecting atom indices.
metal_lig_vec (np.array) – Vector from the metal to the fictitious atom in the center of the aromatic ring. Shape is (3,)
directional_vectors (list) – Numpy arrays of the x-axis vector, y-axis vector, and z-axis vector. Length is 3.
- Returns:
lig3D_aligned – mol3D class instance of aligned ligand.
- Return type:
- molSimplify.Scripts.structgen.smartreorderligs(ligs: List[str], dentl: List[int], ligalign: bool = True) List[int] [source]
Smart reorder ligands by denticity (-ligalign True)
- molSimplify.Scripts.structgen.structgen(args: Namespace, rootdir: str, ligands: List[str], ligoc: List[int], sernum: int, write_files: bool = True) Tuple[List[str], str, run_diag] [source]
Main structure generation routine - multiple structures
- Parameters:
args (Namespace) – Namespace of arguments.
rootdir (str) – Directory of current run to generate complex.
ligands (list) – List of ligand names.
ligoc (list) – List of ligand occupations.
sernum (int) – Serial number of complex for naming.
write_files (bool, optional) – Flag to write files. Default is True. False for pythonic generation.
- Returns:
strfiles (str) – List of XYZ files.
emsg (str) – Error message for structure generation. If True, has string.
this_diag (run_diag) – run_diag class instance containing properties of structure.
- molSimplify.Scripts.structgen.xtb_opt(ff: str, mol: mol3D, connected: List[int], constopt: int, frozenats: List[int], frozenangles: bool, mlbonds: List[float], nsteps: int | str, spin: int = 1, inertial: bool = False, debug: bool = False) Tuple[mol3D, float] [source]
XTB optimization. Writes an input file (xtb.in) containing all the constraints and parameters to a temporary folder, executes the XTB program using the subprocess module and parses the output.
- Parameters:
ff (str) – Name force field to use. Only option for now is XTB.
mol (mol3D) – mol3D instance of molecule to be optimized.
connected (list) – List of indices of connection atoms to metal.
constopt (int) – Flag for constrained optimization - 0: unconstrained, 1: fixed connecting atom positions, 2: fixed connecting atom distances.
frozenats (list) – List of frozen atom indices.
frozenangles (bool) – Flag for frozen angles, equivalent to constopt==1.
mlbonds (list) – List of M-L bonds for distance constraints.
nsteps (int) – Number of steps to take.
spin (int) – Spin multiplicity
inertial (bool) – Flag for the fast inertial relaxation engine (FIRE)
debug (bool) – Flag to print extra info to debug.
- Returns:
mol (mol3D) – Optimized molecule mol3D instance.
en (float) – Forcefield energy of optimized molecule.
- molSimplify.Scripts.generator.startgen(argv, flag, gui, inputfile_str=None, write_files=True)[source]
Coordinates subroutines.
- Parameters:
argv (list) – Argument list.
flag (bool) – Flag for printing information.
gui (bool) – Flag for GUI.
inputfile_str (str, optional) – Optional input passed in as a string. Default is None.
write_files (bool, optional) – Flag for whether or not files should be written. Should set to false for pythonic generation.
- Returns:
emsg – Flag for error. If error, returns a string with error.
- Return type:
- molSimplify.Scripts.generator.startgen_pythonic(input_dict={'-core': 'fe', '-lig': 'cl,cl,cl,cl,cl,cl'}, argv=['main.py', '-i', 'asdfasdfasdfasdf'], flag=True, gui=False, write=False)[source]
This is the main way to generate structures completely within Python.
- Parameters:
input_dict (dict) – Argument list in the form of a dictionary.
argv (list) – Default argument list used to “fool” startgen into accepting input_dict.
flag (bool, optional) – Flag for printing information. Default is True.
gui (bool, optional) – Flag for GUI. Default is False.
write (bool, optional) – Flag to generate outputfile from python
- Returns:
strfiles (str) – Folder containing the runs.
emsg (bool) – Flag for error. If error, returns a string with error.
this_diag (rundiag) – Rundiag class instance that contains ANN attributes (this_diag.ANN_attributes) and a mol3D class instance (this_diag.mol).
Geometry Manipulation Tools
- molSimplify.Scripts.geometry.PointRotateAxis(u, rp, r, theta)[source]
Rotates point about axis defined by direction vector and point on axis. Theta units in radians.
- molSimplify.Scripts.geometry.PointRotateMat(r, R)[source]
Rotates point using arbitrary 3x3 rotation matrix
- molSimplify.Scripts.geometry.PointRotateSph(Rp, p0, D)[source]
Rotates point about Cartesian axes defined relative to given origin.
- molSimplify.Scripts.geometry.PointTranslateSph(Rp, p0, D) List[float] [source]
Translates point in spherical coordinates.
- molSimplify.Scripts.geometry.PointTranslateSphgivenphi(Rp, p0, D)[source]
Translates point in spherical coordinates. Redundant with PointTranslateSph. Will be deprecated.
- molSimplify.Scripts.geometry.PointTranslateSphgivenr(Rp, p0, D, pref, r)[source]
Translates point in spherical coordinates given R.
- molSimplify.Scripts.geometry.PointTranslatetoPSph(Rp, p0, D)[source]
Converts spherical translation vector into Cartesian translation vector
- molSimplify.Scripts.geometry.ReflectPlane(u, r, Rp)[source]
Reflects point about plane defined by its normal vector and a point on the plane
- molSimplify.Scripts.geometry.alignPtoaxis(Rr, Rp, u, d)[source]
Translates point and aligns to axis
- molSimplify.Scripts.geometry.aligntoaxis(mol, Rr, Rp, u)[source]
Translates molecule to align point to axis at constant distance.
- molSimplify.Scripts.geometry.aligntoaxis2(mol, Rr, Rp, u, d)[source]
Translates molecule to align point to axis at arbitrary distance
- Parameters:
- Returns:
mol – mol3D class instance of translated molecule.
- Return type:
- molSimplify.Scripts.geometry.best_fit_plane(coordinates)[source]
Finds the best fitting plane to a set of atoms at the specified coordinates.
- Parameters:
corerefcoords (np.array) – Coordinates of atoms for which the best fitting plane is to be found. Shape is 3 x N.
- Returns:
normal_vector_plane – The vector perpendicular to the best fitting plane.
- Return type:
np.array
- molSimplify.Scripts.geometry.checkcolinear(r1, r2, r3)[source]
Checks if three points are collinear.
- molSimplify.Scripts.geometry.checkplanar(r1, r2, r3, r4)[source]
Checks if four points are coplanar.
- molSimplify.Scripts.geometry.cmrotate(mol, D)[source]
Rotates molecule about its center of mass Loops over PointRotateSph().
- molSimplify.Scripts.geometry.connectivity_match(inds1, inds2, mol1, mol2)[source]
Check whether the connectivity of two fragments of mols match. Note: This will mark atom transfers between different ligands as False, which may not be correct mathmetically as the graph after atoms transfer can still be the same. We disallow these cases from chemical concerns and avoid the NP-hard porblem of comparing two adjecent matrix.
- molSimplify.Scripts.geometry.dihedral(mol, idx1, idx2, idx3, idx4)[source]
Computes dihedral angle for a set of four atom indices.
- molSimplify.Scripts.geometry.getPointu(Rr, dist, u)[source]
Gets point given reference point, direction vector and distance.
- molSimplify.Scripts.geometry.kabsch(mol0, mol1)[source]
Aligns (translates and rotates) two molecules to minimize RMSD using the Kabsch algorithm.
- Parameters:
- Returns:
mol0 (mol3D) – mol3D class instance of aligned molecule.
U (list) – Rotation matrix as list of lists.
d0 (list) – Translation vector for mol0.
d1 (list) – Translation vector for mol1.
- molSimplify.Scripts.geometry.pmrotate(mol, Rp, D)[source]
Rotates molecule about Cartesian axes defined relative to given origin. Loops over PointRotateSph().
- molSimplify.Scripts.geometry.protate(mol, Rr, D)[source]
Translates molecule in spherical coordinates based on center of mass reference. Loops over PointTranslateSph().
- molSimplify.Scripts.geometry.protateref(mol, Rr, Rref, D)[source]
Translates molecule in spherical coordinates based on arbitrary reference. Loops over PointTranslateSph().
- Parameters:
- Returns:
mol – mol3D class instance of translated molecule.
- Return type:
- molSimplify.Scripts.geometry.reflect_through_plane(mol, u, Rp)[source]
Reflects molecule about plane defined by its normal vector and a point on the plane. Loops over ReflectPlane().
- molSimplify.Scripts.geometry.rotateRef(mol, Ref, D)[source]
Rotates molecule about an arbitrary point Loops over PointRotateSph().
- molSimplify.Scripts.geometry.rotate_around_axis(mol, Rp, u, theta)[source]
Rotates molecule about axis defined by direction vector and point on axis. Loops over PointRotateAxis().
- molSimplify.Scripts.geometry.rotate_mat(mol, R)[source]
Rotates molecule using arbitrary rotation matrix. Loops over PointRotateMat().
- molSimplify.Scripts.geometry.rotation_params(r0, r1, r2)[source]
Gets angle between three points (r10 and r21) and the normal vector to the plane containing three points.
- molSimplify.Scripts.geometry.setPdistance(mol, Rr, Rp, bond)[source]
Translates molecule such that a given point in the molecule is at a given distance from a reference point. The molecule is moved along the axis given by the two points.
- Parameters:
- Returns:
mol (mol3D) – mol3D class instance of translated molecule.
dxyz (np.array) – The translation vector.
- molSimplify.Scripts.geometry.setPdistanceu(mol, Rr, Rp, bond, u)[source]
Translates molecule such that a given point in the molecule is at a given distance from a reference point. The molecule is moved along an arbitrary axis.
- Parameters:
- Returns:
mol – mol3D class instance of translated molecule.
- Return type:
- molSimplify.Scripts.geometry.setcmdistance(mol, Rp, bond)[source]
Translates molecule such that its center of mass is at a given distance from a reference point. The molecule is moved along the axis given by the two points.
- molSimplify.Scripts.distgeom.CosRule(AB: float, BC: float, theta: float) float [source]
Applies the cosine rule to get the length of AC given lengths of AB, BC and angle ABC
- molSimplify.Scripts.distgeom.DistErr(x, *args)[source]
Computes distance error function for scipy optimization. Copied from E3 in pp. 311 of ref. [1]
- Parameters:
x (np.array) – 1D array of coordinates to be optimized.
*args (dict) – Other parameters (refer to scipy.optimize docs)
- Returns:
E – Objective function
- Return type:
np.array
- molSimplify.Scripts.distgeom.DistErrGrad(x, *args)[source]
Computes gradient of distance error function for scipy optimization. Copied from E3 in pp. 311 of ref. [1]
- Parameters:
x (np.array) – 1D array of coordinates to be optimized.
*args (dict) – Other parameters (refer to scipy.optimize docs)
- Returns:
g – Objective function gradient
- Return type:
np.array
- molSimplify.Scripts.distgeom.Get3Eigs(G, natoms)[source]
Gets 3 largest eigenvalues and corresponding eigenvectors of metric matrix
- Parameters:
G (np.array) – Metric matrix.
natoms (int) – Number of atoms in the molecule.
- Returns:
L (np.array) – Three largest eigenvalues
V (np.array) – Eigenvectors corresponding to largest eigenvalues.
- molSimplify.Scripts.distgeom.GetBoundsMatrices(mol, natoms, catoms=[], shape=[], A=[])[source]
Generate distance bounds matrices. The basic idea is outlined in ref [1]. We first apply 1-2 (bond length) and 1-3 (bond angle) constraints, read from the FF-optimized initial conformer. Next, to bias the search towards coordinating conformers, approximate connection atom distance constraints based on topological distances are also included.
- Parameters:
- Returns:
LB (np.array) – Lower bound matrix.
UB (np.array) – Upper bound matrix.
- molSimplify.Scripts.distgeom.GetCMDists(D, natoms)[source]
Get distances of each atom to center of mass given the distance matrix. Copied from ref [2], pp. 309.
- Parameters:
D (np.array) – Distance matrix.
natoms (int) – Number of atoms in the molecule.
- Returns:
D0 (np.array) – Vector of distances from center of mass.
status (bool) – Flag for successful search.
- molSimplify.Scripts.distgeom.GetConf(mol, args, catoms=[])[source]
Uses distance geometry to get a random conformer.
- Parameters:
- Returns:
Conf3D – mol3D class instance of new conformer.
- Return type:
- molSimplify.Scripts.distgeom.GetMetricMatrix(D, D0, natoms)[source]
Get metric matrix from distance matrix and CM distances Copied from ref [2], pp. 306.
- Parameters:
D (np.array) – Distance matrix.
D0 (np.array) – Vector of distances from center of mass.
natoms (int) – Number of atoms in the molecule.
- Returns:
G – Metric matrix.
- Return type:
np.array
- molSimplify.Scripts.distgeom.Metrize(LB, UB, natoms, Full=False, seed=False)[source]
Metrization to select random in-range distances. Copied from ref [2], pp. 253-254. Scales O(N^3).
- Parameters:
- Returns:
D – Distance matrix.
- Return type:
np.array
- molSimplify.Scripts.distgeom.SaveConf(X, mol, ffclean=True, catoms=[])[source]
Further cleans up with OB FF and saves to a new mol3D object. Note that distance geometry tends to produce puckered aromatic rings because of the lack of explicit impropers, see Riniker et al. JCIM (2015) 55, 2562-74 for details. Hence, a FF optimization (with connection atoms constrained) is recommended to clean up the structure.
- Parameters:
- Returns:
conf3D – mol3D class instance of conformer.
- Return type:
- molSimplify.Scripts.distgeom.Triangle(LB, UB, natoms)[source]
Triangle inequality bounds smoothing. Copied from ref [2], pp. 252-253. Scales O(N^3).
- Parameters:
LB (np.array) – Lower bounds matrix.
UB (np.array) – Upper bounds matrix.
natoms (int) – Number of atoms in the molecule.
- Returns:
LL (np.array) – Lower triangularized bound matrix
UL (np.array) – Upper triangularized bound matrix
- molSimplify.Scripts.distgeom.findshape(args, master_ligand) Dict [source]
Determines the relative positioning of different ligating atoms
- molSimplify.Scripts.distgeom.inverseCosRule(A, B, C) float [source]
Apply the cosine rule to find the angle ABC given points A,B, and C.
- molSimplify.Scripts.rmsd.centroid(X)[source]
Centroid is the mean position of all the points in all of the coordinate directions, from a vectorset X. https://en.wikipedia.org/wiki/Centroid C = sum(X)/len(X)
- Parameters:
X (np.array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
C – centroid
- Return type:
- molSimplify.Scripts.rmsd.hungarian(A, B)[source]
Hungarian reordering. Assume A and B are coordinates for atoms of SAME type only.
- Parameters:
A (np.array) – (N,D) matrix, where N is points and D is dimension. coordinates.
B (np.array) – (N,D) matrix, where N is points and D is dimension. coordinates.
- Returns:
indices_b – Indices as a result of Hungarian analysis on distance matrix between atoms of 1st structure and trial structure
- Return type:
np.array
- molSimplify.Scripts.rmsd.kabsch(P, Q)[source]
Using the Kabsch algorithm with two sets of paired point P and Q, centered around the centroid. Each vector set is represented as an NxD matrix, where D is the dimension of the space. The algorithm works in three steps: 1. a centroid translation of P and Q (assumed done before this functioncall) 2. the computation of a covariance matrix C 3. computation of the optimal rotation matrix U For more info see http://en.wikipedia.org/wiki/Kabsch_algorithm
- Parameters:
P (np.array) – (N,D) matrix, where N is points and D is dimension.
Q (np.array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
U – Rotation matrix (D,D)
- Return type:
np.array
- molSimplify.Scripts.rmsd.kabsch_rmsd(P, Q, translate=False)[source]
Rotate matrix P unto Q using Kabsch algorithm and calculate the RMSD.
- Parameters:
P (np.array) – (N,D) matrix, where N is points and D is dimension.
Q (np.array) – (N,D) matrix, where N is points and D is dimension.
translate (bool, optional) – Use centroids to translate vector P and Q unto each other. Default is False.
- Returns:
rmsd – root-mean squared deviation
- Return type:
- molSimplify.Scripts.rmsd.kabsch_rotate(P, Q)[source]
Rotate matrix P unto matrix Q using Kabsch algorithm.
- Parameters:
P (np.array) – (N,D) matrix, where N is points and D is dimension.
Q (np.array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
P – (N,D) matrix, where N is points and D is dimension, rotated.
- Return type:
np.array
- molSimplify.Scripts.rmsd.makeQ(r1, r2, r3, r4=0)[source]
Make Q matrix involved in quaternion rotation
- Parameters:
r1 (np.array) – Vector 1.
r2 (np.array) – Vector 2.
r3 (np.array) – Vector 3.
r4 (np.array, optional) – Vector 4. Default is 0.
- Returns:
Q – Q matrix involved in quaternion rotation.
- Return type:
np.array
- molSimplify.Scripts.rmsd.makeW(r1, r2, r3, r4=0)[source]
Make W matrix involved in quaternion rotation
- Parameters:
r1 (np.array) – Vector 1.
r2 (np.array) – Vector 2.
r3 (np.array) – Vector 3.
r4 (np.array, optional) – Vector 4. Default is 0.
- Returns:
W – W matrix involved in quaternion rotation.
- Return type:
np.array
- molSimplify.Scripts.rmsd.quaternion_rmsd(P, Q) float [source]
Rotate matrix P unto Q and calculate the RMSD based on doi:10.1016/1049-9660(91)90036-O
- Parameters:
P (np.array) – (N,D) matrix, where N is points and D is dimension.
Q (np.array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
rmsd – RMSD between P and Q.
- Return type:
- molSimplify.Scripts.rmsd.quaternion_rotate(X, Y)[source]
Calculate the rotation
- Parameters:
X (array) – (N,D) matrix, where N is points and D is dimension.
Y (array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
rot – Rotation matrix (D,D)
- Return type:
matrix
- molSimplify.Scripts.rmsd.quaternion_transform(r)[source]
Get optimal rotation. Note: translation will be zero when the centroids of each molecule are the same.
- Parameters:
r (np.array) – Array of vectors to transform.
- molSimplify.Scripts.rmsd.reorder_distance(p_atoms, q_atoms, p_coord, q_coord)[source]
Re-orders the input atom list and xyz coordinates by atom type and then by distance of each atom from the centroid.
- Parameters:
atoms (np.array) – (N,1) matrix, where N is points holding the atoms’ names
coord (np.array) – (N,D) matrix, where N is points and D is dimension
- Returns:
atoms_reordered (np.array) – (N,1) matrix, where N is points holding the ordered atoms’ names
coords_reordered (np.array) – (N,D) matrix, where N is points and D is dimension (rows re-ordered)
- molSimplify.Scripts.rmsd.reorder_hungarian(p_atoms, q_atoms, p_coord, q_coord)[source]
Re-orders the input atom list and xyz coordinates using the Hungarian method (using optimized column results)
- Parameters:
p_atoms (np.array) – (N,1) matrix, where N is points holding the atoms’ names
p_atoms – (N,1) matrix, where N is points holding the atoms’ names
p_coord (np.array) – (N,D) matrix, where N is points and D is dimension
q_coord (np.array) – (N,D) matrix, where N is points and D is dimension
- Returns:
view_reorder – (N,1) matrix, reordered indexes of atom alignment based on the coordinates of the atoms
- Return type:
np.array
- molSimplify.Scripts.rmsd.rigorous_rmsd(mol1, mol2, rotation: str = 'kabsch', reorder: str = 'hungarian') float [source]
Rigorous RMSD measurement
- Parameters:
- Returns:
result_rmsd – Resulting RMSD from aligning and rotating.
- Return type:
- molSimplify.Scripts.rmsd.rmsd(V, W)[source]
Calculate Root-mean-square deviation from two sets of vectors V and W.
- Parameters:
V (np.array) – (N,D) matrix, where N is points and D is dimension.
W (np.array) – (N,D) matrix, where N is points and D is dimension.
- Returns:
rmsd – Root-mean-square deviation between the two vectors.
- Return type:
- molSimplify.Scripts.rmsd.rmsd_reorder_rotate(p_atoms, q_atoms, p_coord, q_coord, rotation='kabsch', reorder='hungarian')[source]
Reorder and rotate for RMSD.
- Parameters:
p_atoms (np.array) – Atom symbol list.
q_atoms (np.array) – Atom symbol list.
p_coord (np.array) – List of coordinates for p_atoms.
q_atoms – List of coordinates for q_atoms.
rotation (str, optional) – Rotation method. Default is kabsch.
reorder (str, optional) – Reorder method. Default is hungarian.
- Returns:
result_rmsd – Resulting RMSD from aligning and rotating.
- Return type:
Cellbuilder Tools
- molSimplify.Scripts.cellbuilder.align_payload_to_multi_site(payload, surface_coord_list, cand_list, bind_dist, debug=False)[source]
- molSimplify.Scripts.cellbuilder.axes_angle_align(payload, cand_ind, align_ind, align_target, angle)[source]
This function rotates a given payload molecule such that the X-Y projection of the cord joining the two atoms in cand_ind and align_ind is aligned with the vector given in align_target.
- Parameters:
payload (mol3D) – mol3D class that contains that target molecule
cand_ind (int) – index of atom in payload that is used as reference
align_ind (int) – index of atom in payload that define the cord to align
align_target (list of 3 float) – vector on the cell surface to align. Normally z=0
angle (float) – rotation angle
- Returns:
new_payload – mol3D class, rotation of payload.
- Return type:
- molSimplify.Scripts.cellbuilder.choose_best_site(avail_sites_dict, occupied_sites_dict, centroid, super_cell, super_cell_vector, weight=0.5, method='linear', debug=False)[source]
- molSimplify.Scripts.cellbuilder.choose_nearest_neighbour(target_site, avail_sites_dict, occupied_sites_dict, super_cell, super_cell_vector, debug=False)[source]
- molSimplify.Scripts.cellbuilder.combine_multi_aligned_payload_with_cell(super_cell, super_cell_vector, payload, cand_list, surface_coord_list, bind_dist, duplicate=False, control_angle=False, align_axis=False, align_ind=False, debug=False)[source]
- molSimplify.Scripts.cellbuilder.force_field_relax_with_slab(super_cell, payload, cand_list, its)[source]
- molSimplify.Scripts.cellbuilder.molecule_placement_supervisor(super_cell, super_cell_vector, target_molecule, method, target_atom_type, align_dist, surface_atom_type=False, control_angle=False, align_ind=False, align_axis=False, duplicate=False, number_of_placements=1, coverage=False, weighting_method='linear', weight=0.5, masklength=1, surface_atom_ind=False, debug=False)[source]
- molSimplify.Scripts.cellbuilder.multialign_objective_function(payload, surface_coord_list, cand_list, bind_dist)[source]
- molSimplify.Scripts.cellbuilder_tools.find_all_surface_atoms(super_cell, tol=0.01, type_of_atom=False)[source]
Input File Generation
- molSimplify.Scripts.qcgen.gamgen(args, strfiles, method)[source]
Generate a single GAMESS input file.
- molSimplify.Scripts.qcgen.molcbasis(strfiles, basistyp)[source]
Generate MOLCAS basis keyword for a given mol3D.
- molSimplify.Scripts.qcgen.molcfrozens(strfiles)[source]
Determine MOLCAS CASSCF frozen orbitals for a given mol3D
- molSimplify.Scripts.qcgen.molcgen(args, strfiles, method)[source]
Generate a single MOLCAS input file.
- molSimplify.Scripts.qcgen.molcnactels(strfiles, oxnum)[source]
Determine MOLCAS CASSCF active electrons for a given mol3D.
- molSimplify.Scripts.qcgen.molcras2s(strfiles)[source]
Determine MOLCAS CASSCF active space for a given mol3D.
- molSimplify.Scripts.qcgen.molcwrt(output, jobparams, xyzf, xyzind)[source]
Generate a single MOLCAS input file with custom parameters.
- molSimplify.Scripts.qcgen.multigamgen(args, strfiles)[source]
Generate multiple GAMESS files, loops over methods.
- molSimplify.Scripts.qcgen.multiqgen(args, strfiles)[source]
Generate multiple QChem input files at once.
- molSimplify.Scripts.qcgen.multitcgen(args, strfiles)[source]
Generate multiple terachem input files at once.
- molSimplify.Scripts.qcgen.ogenwrt(output, jobparams, xyzf)[source]
Generate a single ORCA input file with custom parameters.
- molSimplify.Scripts.qcgen.tcgen(args, strfiles, method)[source]
Generate a single terachem input file.