Geometry class¶
- class AaronTools.geometry.Geometry(structure='', name='', comment='', components=None, refresh_connected=True, refresh_ranks=True)¶
Attributes:
name
comment
atoms
other
_iter_idx
- __init__(structure='', name='', comment='', components=None, refresh_connected=True, refresh_ranks=True)¶
- Parameters:
structure – can be a Geometry(), a FileReader(), a file name, or a list of atoms
name (str) – name
comment (str) – comment
components (list(AaronTools.component.Component())|None) – components list or None
refresh_connected (bool) –
usually True - determine connectivity
can save time for methods that only need coordinates by using refresh_connected=False
refresh_ranks (bool) – usually True - rank atoms, False when loading from database can save time for methods that only don’t rely on ranks by using refresh_ranks=False
- static iupac2smiles(name)¶
convert IUPAC name to SMILES using the OPSIN web API
- Parameters:
name (str) – IUPAC name of a molecule
- Returns:
SMILES name of a molecule
- classmethod from_string(name, form='smiles', strict_use_rdkit=False)¶
Converts a string input into a Geometry object
- Parameters:
name (str) – either an IUPAC name or a SMILES for a molecule
form (str) –
“smiles” - structure from cactvs API/RDKit
”iupac” - iupac to smiles from opsin API, then the same as form=smiles
strict_use_rdkit (bool) – force use of RDKit and never use cactvs
- Returns:
Geometry object that matches the input name
- Return type:
- classmethod get_coordination_complexes(center, ligands, shape, c2_symmetric=None, minimize=False, session=None)¶
get all unique coordination complexes uses templates from Inorg. Chem. 2018, 57, 17, 10557–10567
- Parameters:
center (str) –
element of center atom
ligands (list(str)) –
list of ligand names in the ligand library
shape (str) – coordination geometry (e.g. octahedral) - see Atom.get_shape
c2_symmetric (list(bool)) – specify which of the bidentate ligands are C2-symmetric if this list is as long as the ligands list, the nth item corresponds to the nth ligand otherwise, the nth item indicate the symmetry of the nth bidentate ligand
minimize (bool) – passed to cls.map_ligand when adding ligands
- Returns:
a list of cls containing all unique coordination complexes and the general formula of the complexes
- Return type:
list(Geometry)
- classmethod get_diastereomers(geometry, minimize=True)¶
Generate diastereomers of Geometry
- static weighted_percent_buried_volume(geometries, energies, temperature, *args, **kwargs)¶
Boltzmann-averaged percent buried volume
- Parameters:
geometries (list(Geometry)) – structures to calculate buried volume for
energies (np.ndarray) – energy in kcal/mol; ith energy corresponds to ith substituent
temperature – temperature in K
args (float) – passed to Geometry.percent_buried_volume()
kwargs – passed to Geometry.percent_buried_volume()
- Returns:
Boltzmann-weighted percent buried volume
- classmethod get_solvent(solvent)¶
Converts the name of a solvent into a Geometry representation based on solvents within AaronTools libraries Note: list_solvents provides a str array of solvents within the libraries
- Parameters:
solvent (str) – name of the solvent to be converted
- Returns:
converted solvent
- Return type:
- Raises:
LookupError – when input solvent is not present in libraries
- classmethod ring_conformers(geometry, targets=None, include_uncommon=False)¶
returns a list of Geometry objects with varying ring conformations :param Geometry geometry: structure to look for conformers of :param Atom targets: atoms in rings to search for conformers of (default is all rings)
- static list_solvents(include_ext=False)¶
Retrieves a list of solvents stored in AaronTools
- Parameters:
include_ext (bool) – Includes file extensions (.xyz) on each solvent when true.
- Returns:
string array with the names of all solvents in the libraries
- property elements¶
returns list of elements composing the atoms in the geometry
- property num_atoms¶
number of atoms
- property coords¶
array of coordinates (read only)
- coordinates(atoms=None)¶
- Parameters:
atoms (list(Atom)) – atoms to be searched
- Returns:
N x 3 coordinate matrix for requested atoms (defaults to all atoms)
- Return type:
np.ndarray
- tag(tag, targets=None)¶
Adds a tag to atoms within a Geometry object
- Parameters:
tag (str) – tag to be added to the targets
targets (list(Atom)) – atoms to be given the tag, defaults to all atoms
- write(name=None, *args, **kwargs)¶
Write geometry to a file
- Parameters:
name (str) – name for geometry defaults to self.name
args – passed to FileWriter.write
kwargs – passed to FileWriter.write
- display(style='stick', colorscheme='Jmol')¶
Display py3Dmol viewer from Geometry
- Parameters:
style (str) – stick, sphere, or line (or other style supported by 3Dmol.js)
colorscheme (str) – 3Dmol.js color scheme (see https://3dmol.org/doc/global.html#builtinColorSchemes)
- convert_to_Psi4(charge=0, mult=1, fix_com=True, fix_orientation=True)¶
converts Geometry into Psi4 Molecule object (requires Psi4)
- Parameters:
charge (int) – total molecular charge
mult (int) – multiplicity
fix_com (bool) – whether to fix center of mass in Psi4 Molecule
fix_coordinates (bool) – whether to fix coordinates in Psi4 Molecule
- Returns:
activated Psi4 Molecule (or None if Psi4 not available)
- plot(ax, fig, fp=40, ascale=0.5, bwidth=0.15)¶
displays HoukMol style molecule in Matplotlib
- Parameters:
ax (matplotlib.pyplot.Axis) – Matplotlib Axis object
fig (matplotlib.pyplot.Figure) – Matplotlib Figure object:w
fp (float) – z-value (Angstroms) for focal point for adding perspective (Default: 40)
ascale (float) – scaling factor for covalent radii (default: 0.5)
bwidth (float) – scaling factor for bond radii (default: 0.15)
- copy(atoms=None, name=None, comment=None, copy_atoms=True)¶
creates a new copy of the geometry
- Parameters:
atoms (list(Atom)) – atoms to copy defaults to all atoms
name (str) – defaults to NAME_copy
comment (str) – comment to add to the copy, defaults to self’s comment
copy_atoms (bool) – passed to _fix_connectivity, defaults to True
- parse_comment()¶
Saves auxillary data found in comment line
- fix_comment()¶
sets self.comment to define key atoms for ligands, etc.
- freeze(targets=None)¶
freezes atoms in the geometry
- Parameters:
targets (list(Atom|str|Finder)) – atoms to freeze
- relax(targets=None)¶
relaxes atoms in the geometry
- Parameters:
targets (list(Atom|str|Finder)) – atoms to unfreeze
- get_constraints(as_index=True)¶
get frozen atoms
- Parameters:
as_index (bool) – return indices instead of atoms
- Returns:
frozen atoms
- Return type:
list(int|Atom)
- get_connectivity()¶
Iterates through each atom and finds its connected atoms
- Returns:
list of all atoms’ connectivities
- Return type:
list(list(Atom))
- get_frag_list(targets=None, max_order=None)¶
find fragments connected by only one bond (both fragments contain no overlapping atoms)
- Parameters:
targets – atoms to look for fragments on, defaults to all atoms
max_order (int) – max bond order to cut when defining fragments
- Returns:
list of all fragments found
- Return type:
list(list(Atom))
- get_graph()¶
returns a graph based on connectivity graph consists of a list for each atom consisting of a list of connected atoms For example, for H2O with O as atom 1, graph = [[1,2], [0], [0]]
- Returns:
graph created by the method
- detect_substituents()¶
sets self.substituents to a list of substituents
- find(*args, debug=False)¶
finds atom in geometry
- Parameters:
args (list|tuple|str|Finder) – tags, names, elements, or a Finder subclass args=([‘this’, ‘that’], ‘other’) will find atoms for which (‘this’ || ‘that’) && ‘other’ == True
- Returns:
list of matching atoms
- Return type:
list(Atom)|list()
- Raises:
LookupError – when the tags/names provided do not exist. However, it will return empty list if valid tag/names were provided but were screened out using the && argument form
- find_exact(*args)¶
finds exactly the same number of atoms as arguments used.
- Parameters:
args (list|tuple|str|Finder) – tags, names, elements, or Finder subclass consisting of those you want to check self for
- Returns:
list of atoms found
- Return type:
tuple(Atom)
- Raises:
LookupError – if wrong number of atoms found
- refresh_connected(targets=None, threshold=0.3)¶
reset connected atoms
atoms are connected if their distance from each other is less than the sum of their covalent radii plus a threshold
- Parameters:
targets – atoms to update connectivity
threshold (float) – upper limit on difference to ideal covalent bond length
- refresh_ranks(invariant=True)¶
updates ranks of all atoms
- Parameters:
invariant (bool) – passed to Geometry.canonical_rank
- make_oniom()¶
convert existing geometry composed of Atom objects to geometry of OniomAtom objects including changing all atoms in attribute lists to OniomAtom objects
- get_invariants(heavy_only=False)¶
returns a list of invariants for the specified targets see Atom.get_invariant for some more details
- Parameters:
heavy_only (bool) – atoms to get invariants for
heavy_only – ignores hydrogens if true
- canonical_rank(heavy_only=False, break_ties=True, update=False, invariant=True, initial_ranks=None)¶
determine canonical ranking for atoms
- Parameters:
heavy_only (bool) – ignores hydrogens if true
break_ties (bool) – breaks ties based on angle around COM
invariant (bool) – if True, use invariant described in J. Chem. Inf. Comput. Sci. 1989, 29, 2, 97–101 (DOI: 10.1021/ci00062a008) if False, use neighbor IDs
initial_ranks (list) – list of initial ranks, one for each atom
- Returns:
list of rankings
algorithm described in J. Chem. Inf. Model. 2015, 55, 10, 2111–2120 (DOI: 10.1021/acs.jcim.5b00543)
- element_counts()¶
number of each element in this Geometry
- Return type:
dict(str:int)
- reorder(start=None, targets=None, heavy_only=False)¶
Depth-first reorder of atoms based on canonical ranking
- detect_fragments(targets, avoid=None)¶
Returns a list of Geometries in which the connection to other atoms in the larger geometry must go through the center atoms
for example,
L1--C--L2 ( / L1/
will give two fragments, L1 and L2
- shortest_path(atom1, atom2, avoid=None)¶
Uses Dijkstra’s algorithm to find shortest path between atom1 and atom2
- Parameters:
atom1 – starting atom
atom2 – ending atom
avoid – atoms to avoid on the path
- Returns:
atoms on the path from atom1 to atom2, including atom1 and atom2
- Return type:
list(Atom)
- get_monomers()¶
Searches a geometry for monomers
- Returns:
A list of atoms for each monomer of self in order
- Return type:
list(Atom)
- bond(a1, a2)¶
takes two atoms and returns the bond vector (need to fix formatting)
- angle(a1, a2, a3=None)¶
returns a1-a2-a3 angle
- dihedral(a1, a2, a3, a4)¶
measures dihedral angle of a1 and a4 with respect to a2-a3 bond
- COM(targets=None, heavy_only=False, mass_weight=True, charge_weight=False)¶
calculates center of mass of the target atoms mass_weight and charge_weight cannot both be true
- Parameters:
targets – the atoms to use in calculation, defaults to all
heavy_only (bool) – exclude hydrogens, defaults to False
mass_weight (bool) – bases calculations on mass, defaults to True
charge_weight (bool) – based calculations on charge, defaults to False
- Returns:
a vector from the origin to the center of mass
- RMSD(ref, align=False, heavy_only=False, sort=True, refresh_ranks=True, targets=None, ref_targets=None, debug=False, weights=None, ref_weights=None)¶
calculates the RMSD between two geometries
- Parameters:
ref (Geometry) – the geometry to compare to
align (bool) – if True (default), align self to other; if False, just calculate the RMSD
heavy_only (bool) – only use heavy atoms (default False)
targets – the atoms in self to use in calculation
ref_targets – the atoms in the reference geometry to use
sort (bool) – canonical sorting of atoms before comparing
sort – refresh atom ranks before doing canonical sorting
debug (bool) – returns RMSD and Geometry([ref_targets]), Geometry([targets])
weights (list(float)) – weights to apply to targets
ref_weights (list(float)) – weights to apply to ref_targets
- Returns:
RMSD in Angstroms
- Return type:
float
- RMSD_permute(ref, align=False, heavy_only=False, targets=None, ref_targets=None, debug=False, weights=None, ref_weights=None, max_order='smallest', stop_threshold=0.001)¶
calculate the RMSD between two structures by considering permutations of equivalent atoms
- Parameters:
ref (Geometry) – structure to compare to
align (bool) – align self to ref
heavy_only (bool) – only use non-H atoms
targets (list) – atoms on self to use in RMSD calculation
ref_targets (list) – atoms on ref to use in RMSD calculation
weights (list) – list of weights for each atom for weighted RMSD calculation
ref_weights (list) – list of weights for each ref atom for weighted RMSD calculation
max_order (int) – max size of groups of atoms to permute (default is the size of the smallest group)
stop_threshold (float) – stop checking permutations if we find an RMSD < stop_threshold
- Returns:
RMSD in Angstroms
- Return type:
float
- get_near(ref, dist, by_bond=False, include_ref=False)¶
- Returns:
list of atoms within a distance or number of bonds of a reference point, line, plane, atom, or list of atoms
- Return type:
list(Atom)
- Parameters:
ref (list) – the point (eg: [0, 0, 0]), line (eg: [‘*’, 0, 0]), plane (eg: [‘*’, ‘*’, 0]), atom, or list of atoms
dist (float) – the distance threshold or number of bonds away threshold, is an inclusive upper bound (uses this <= dist)
by_bond (bool) – if true, dist is interpreted as the number of bonds away instead of distance in angstroms NOTE: by_bond=True means that ref must be an atom or list of atoms
include_ref (bool) – if Atom or list(Atom) given as ref, include these in the returned list, (default=False, do not include ref in returned list)
- get_principle_axes(targets=None, mass_weight=True, center=None)¶
- Parameters:
mass_weight (bool) – mass-weight axes (i.e. moments of inertia)
targets – atoms to include in the calculation (default: all atoms)
center (np.ndarray) – center of rotation, defaults to Geometry.COM
- Returns:
[principal moments], [principle axes]
- LJ_energy(other=None, use_prev_params=False)¶
computes LJ energy using autodock parameters
- Parameters:
other (Geometry) – calculate LJ energy between self and other instead of just self
use_prev_params (bool) – use same sigma/epsilon as the last time LJ_energy was called; useful for methods that make repetitive LJ_energy calls, like minimize_torsion
- examine_constraints(thresh=None)¶
Determines if constrained atoms are too close/ too far apart
- Parameters:
thresh (float) – threshold to define ‘too close’ or ‘too far’
- Returns:
(atom1, atom2, flag) where flag is 1 if atoms too close, -1 if atoms to far apart (so one can multiply a distance to change by the flag and it will adjust in the correct direction)
- compare_connectivity(ref, thresh=None, return_idx=False)¶
Compares connectivity of self relative to ref
- Parameters:
ref – the structure to compare to (str(path), FileReader, or Geometry) ref.atoms should be in the same order as self.atoms
thresh (float) – allow for connectivity changes as long as the difference between bond distances is below a threshold, default None
return_idx (bool) – output will be indices of atoms instead of names
- Returns:
broken, formed
broken - set of atom name pairs for which a bond broke
formed - set of atom name pairs for which a bond formed
- Return type:
set(), set()
- percent_buried_volume(center=None, targets=None, radius=3.5, radii='umn', scale=1.17, exclude=None, method='lebedev', rpoints=20, apoints=1454, min_iter=25, basis=None, n_threads=1)¶
calculates % buried volume (%V_bur) using Monte-Carlo or Gauss-Legendre/Lebedev integration
see Organometallics 2008, 27, 12, 2679–2681 (DOI: 10.1021/om8001119) for details
- Parameters:
center – center atom(s) or np.array of coordinates if more than one atom is specified, the sphere will be centered on the centroid between the atoms
targets – atoms to use in calculation, defaults to all non-center if there is only one center, otherwise all atoms
radius (float) – sphere radius around center atom
radii (str|dict) – “umn” or “bondi”, VDW radii to use can also be a dict() with atom symbols as the keys and their respective radii as the values
scale (float) – scale VDW radii by this
exclude (list(Atom)) – atoms to exclude from calculation
method (str) – integration method (MC or lebedev)
rpoints (int) – number of radial shells for Lebedev integration
apoints (int) – number of angular points for Lebedev integration
min_iter (int) – minimum number of iterations for MC integration each iteration is a batch of 3000 points iterations will continue beyond min_iter if the volume has not converged
basis (np.ndarray) – change of basis matrix will cause %Vbur to be returned as a tuple for different quadrants (I, II, III, IV)
n_threads (int) – number of threads to use for MC integration using multiple threads doesn’t benefit performance very much
- Returns:
the percent buried volume
- Return type:
float
- steric_map(center=None, key_atoms=None, targets=None, radii='umn', radius=3.5, oop_vector=None, ip_vector=None, return_basis=False, num_pts=100, shape='circle')¶
Creates a steric map based on a Geometry
- Parameters:
center – atom, list of atoms, or array specifiying the origin
key_atoms – list of ligand key atoms. Atoms on these ligands will be in the steric map.
targets (list(Atom)) – atoms to be included in the map, defaults to all
radii (str|dict) – “umn”, “bondi”, or dict() specifying the VDW radii to use
radius (float) – atomic radius to be considered in Angstroms, default 3.5
oop_vector (np.ndarray) – None or array specifying the direction out of the plane of the steric map if None, oop_vector is determined using the average vector from the key atoms to the center atom
ip_vector (np.ndarray) – None or array specifying a vector in the plane of the steric map if None, ip_vector is determined as the plane of best fit through the key_atoms and the center
return_basis (bool) – whether or not to return a change of basis matrix
num_pts (int) – number of points along x and y axis to use
shape (str) – “circle” or “square”
- Returns:
x, y, z, min_alt, max_alt
or x, y, z, min_alt, max_alt, basis, atoms if return_basis is True
a contour plot can be created with this data - see stericMap.py command line script
x - x coordinates for grid
y - y coordinates for grid
z - altitude levels; points where no atoms are will be -1000
min_alt - minimum altitude (above -1000)
max_alt - maximum altitute
basis - basis to e.g. reorient structure with np.dot(self.coords, basis)
atoms - list of atoms that are in the steric map
- sterimol(L_axis, start_atom, targets, L_func=None, return_vector=False, radii='bondi', at_L=None, buried=False, max_error=None)¶
Determines sterimol parameters of a Geometry.
B1 is determined numerically; B2-B4 depend on B1
B5 and L are analytical (unless L_func is not analytical)
see Verloop, A. and Tipker, J. (1976), Use of linear free energy related and other parameters in the study of fungicidal selectivity. Pestic. Sci., 7: 379-390. (DOI: 10.1002/ps.2780070410)
- Parameters:
radii (str|dict|list) –
“bondi” - Bondi vdW radii
”umn” - vdW radii from Mantina, Chamberlin, Valero, Cramer, and Truhlar
dict() - radii are values and elements are keys
list() - list of radii corresponding to targets
L_axis (np.ndarray) – vector defining L-axis
targets – atoms to include in the parameter calculation
L_func (function) –
function to evaluate for getting the L value and vector for each atom takes positional arguments:
- atom:
Atom - atom being checked
- start:
Atom - start_atom
- radius:
vdw radius of atom
- L_axis:
unit vector for L-axis
if L_func is not given, the default is the distance from start_atom to the furthest vdw radius projected onto the L-axis
return_vector (bool) – returned dictionary will have tuples of start, end for vectors to represent the parameters in 3D space
at_L (float) –
L value to calculate sterimol parameters at
Useful for Sterimol2Vec
buried (float|bool) –
calculate buried sterimol using the given buried radius (or 5.5 if buried is simply True)
buried and at_L are incompatible
max_error (float) –
max. error in angstroms for B1 higher error can sometimes make the calculation go slightly faster
max_error=None will have an error for B1 of at most (sum of radii tangent to B1 face) * (1 - cos(0.5 degrees))
- Returns:
sterimol parameter values in a dictionary
keys are B1, B2, B3, B4, B5, and L
- update_geometry(structure)¶
Replace current coords with those from :structure:
- Parameters:
structure – a file name, atom list, Geometry or np.array() of shape Nx3
- get_all_connected(target)¶
Finds all elements of a monomer
- get_fragment(start, stop=None, as_object=False, copy=False, biggest=False)¶
Finds and returns a fragment of a Geometry object
- Parameters:
start – the atoms to start on
stop – the atom(s) to avoid stop=None will try all possibilities and return smallest fragment
as_object (bool) – return as list (default) or Geometry object
copy (bool) – whether or not to copy the atoms before returning the list; copy will automatically fix connectivity information
biggest (bool) – if stop=None, will return biggest possible fragment instead of smallest
- Returns:
[Atoms()] if as_object == False
Geometry() if as_object == True
- remove_fragment(start, avoid=None, add_H=True)¶
Removes a fragment of the geometry
- Parameters:
start – the atom of the fragment to be removed that attaches to the rest of the geometry
avoid – the atoms :start: is attached to that should be avoided
add_H (bool) – default is to change :start: to H and update bond lengths, but add_H=False overrides this behaviour
- Returns:
- start:
the removed fragment
- Return type:
list(Atom)
- coord_shift(vector, targets=None)¶
shifts the coordinates of the target atoms by a vector
- Parameters:
vector (np.ndarray) – the shift vector
targets (list(Atom)) – the target atoms to shift (default to all)
- change_distance(a1, a2, dist=None, adjust=False, fix=0, as_group=True)¶
For setting/adjusting bond length between atoms
- Parameters:
a1 – the first atom
a2 – the second atom
dist (float) – the distance to change by/to. Default is to set the bond length to that determined by RADII
adjust (bool) – default is to set the bond length to dist, adjust=True indicates the current bond length should be adjusted by dist
fix (int) – default is to move both a1 and a2 by half of dist, fix=1 will move only a2 and fix=2 will move only a1
as_group (bool) – default is to move the fragments connected to a1 and a2 as well, as_group=False will only move the requested atom(s)
- rotate_fragment(start, avoid, angle)¶
rotates the all atoms on the ‘start’ side of the start-avoid bond about the bond vector by angle
- rotate(w, angle=None, targets=None, center=None)¶
rotates target atoms by an angle about an axis
- Parameters:
w (np.ndarray) – the axis of rotation (doesnt need to be unit vector) or a quaternion (angle not required then)
angle (float) – the angle by which to rotate (in radians)
targets – atoms to rotate (defaults to all)
center – if provided, the atom (or COM of a list) will be centered at the origin before rotation, then shifted back after rotation
- mirror(plane='xy')¶
mirror self across a plane
- Parameters:
plane (str) – plane to mirror the Geometry object across can be xy, xz, yz, or an array for a vector orthogonal to a plane
- invert()¶
invert self’s coordinates
- change_angle(a1, a2, a3, angle, radians=True, adjust=False, fix=0, as_group=True)¶
For setting/adjusting angle between atoms
- Parameters:
a1 – first atom
a2 – second atom (vertex)
a3 – third atom
angle (float) – the angle to change by/to
radians (bool) – default units are radians, radians=False uses degrees
adjust (bool) – default is to set the angle to angle, adjust=True indicates the current angle should be adjusted by angle
fix (int) – default is to move both a1 and a3 by half of angle, fix=1 will move only a3 and fix=3 will move only a1
as_group (bool) – default is to move the fragments connected to a1 and a3 as well, as_group=False will only move the requested atom(s)
- change_dihedral(*args, **kwargs)¶
For setting/adjusting dihedrals
- Parameters:
args –
- a1:
the first atom
- a2:
the second atom
- a3:
the third atom (optional for adjust=True if as_group=True)
- a4:
the fourth atom (optional for adjust=True if as_group=True)
- dihedral:
the dihedral to change by/to
kwargs –
- fix:
default is to move both a1 and a4 by half of dihedral, fix=1 will move only a4 and fix=4 will move only a1
- adjust:
default is to set the dihedral to dihedral, adjust=True indicates the current dihedral should be adjusted by dihedral
- as_group:
default is to move the fragments connected to a1 and a3 as well, as_group=False will only move the requested atom(s)
- radians:
default units are degrees, radians=True to use radians
- minimize_sub_torsion(geom=None, all_frags=False, increment=30, allow_planar=False)¶
rotate substituents to try to minimize LJ potential
- Parameters:
geom – calculate LJ potential between self and another geometry-like object, instead of just within self
all_frags (bool) – minimize rotatable bonds on substituents
increment (float) – angle stride in degrees
allow_planar (bool) – allow substituents that start and end with atoms with planar VSEPR geometries that are nearly planar to be rotated
- minimize_torsion(targets, axis, center, geom=None, increment=5)¶
Rotate targets to minimize the LJ potential
- Parameters:
targets (list(Atom)) – the target atoms to rotate
axis (np.ndarray) – the axis by which to rotate
center (np.ndarray|Atom) – where to center before rotation
geom (Geometry) – calculate LJ potential between self and another geometry-like object, instead of just within self
increment (float) – angle stride in degrees
- substitute(sub, target, attached_to=None, minimize=False)¶
substitutes fragment containing target with substituent sub
- Parameters:
sub (str|Substituent) – substituent (or name from the library) to use
target – atom to place the substituent on
attached_to –
if attached_to is provided, this is the atom where the substituent is attached;
if attached_to=None, replace the smallest fragment containing target
minimize (bool) – rotate sub to lower LJ potential
- find_substituent(start, for_confs=False)¶
Finds a substituent based on a given atom (matches start==sub.atoms[0])
- Parameters:
start – the first atom of the subsituent, where it connects to sub.end
for_confs – if true, only consider substituents that need to be rotated to generate conformers
- Returns:
substituent that matches the given criteria
- Return type:
- get_substituents(for_confs=True)¶
Returns list of all substituents found on all components
- Parameters:
for_confs – if true (default), returns only substituents that need to be rotated to generate conformers
- Returns:
subsituents that match criteria
- Return type:
list(Substituent)
- ring_substitute(targets, ring_fragment, minimize=False, flip_walk=False)¶
take ring, reorient it, put it on self and replace targets with atoms on the ring fragment
- Parameters:
targets – pair of atoms to be in the ring
ring_fragment (str|Ring) – Ring or name of ring in the library
minimize (bool) – try other rings with the same name (appended with a number) in the library to see if they fit better
flip_walk (bool) – also flip the rings when minimizing to see if that fits better
- change_element(target, new_element, adjust_bonds=False, adjust_hydrogens=False, hold_steady=None)¶
change the element of an atom on self
- Parameters:
target – target atom
new_element (str) – element of new atom
adjust_bonds (bool) – bool adjust distance to bonded atoms
adjust_hydrogens (bool|tuple(int, str)) –
- bool:
try to add or remove hydrogens and guess how many hydrogens to add or remove
- tuple(int, str):
remove specified number of hydrogens and set the geometry to the specified shape (see Atom.get_shape for a list of shapes)
hold_steady – atom bonded to target that will be held steady when adjusting bonds; Default - longest fragment
- map_ligand(ligands, old_keys, minimize=True, center=None)¶
Maps new ligand according to key_map
- remove_clash(sub_list=None)¶
rotates substituents slightly to reduce steric clashing
- minimize(targets=None, increment=5)¶
Rotates substituents in each component to minimize LJ_energy. Different from Component.minimize_sub_torsion() in that it minimizes with respect to the entire catalyst instead of just the component
- next_conformer(conf_spec, skip_spec={})¶
Generates the next possible conformer
- Parameters:
conf_spec (dict) – {sub_start_number: conf_number}
skip_spec (dict) – {sub_start_number: [skip_numbers]}
- Returns:
conf_spec if there are still more conformers {} if there are no more conformers to generate
- oniom_layer(layer='', low_layer='', as_object=False)¶
returns atoms for the specified layer and adds link atoms to satisfy valence
- Parameters:
layer (str) – ONIOM layer (H, M, L)
low_layer (str) – label for low layer, defaults to L
as_object (bool) –
True - return Geometry
False - return list(Atom)
- Return type:
list(Atom)
- add_links(high_layer='', low_layer='')¶
adds link atom hydrogens to molecular structure (useful when separating out a layer as a fragment)
- Parameters:
high_layer (str) – higher ONIOM layer
low_layer (str) – lower ONIOM layer
- Returns:
edited Geometry with link atoms as part of molecular structure
- Return type:
- sub_link_hosts()¶
remove link atom hosts from a molecular structure
- Returns:
the Geometry with link atom hosts removed from the list of atoms in the structure
- Return type:
- sub_links()¶
remove link atoms from a molecular structure
- Returns:
the Geometry with link atoms removed from the list of atoms in the structure
- Return type:
_type_
- make_conformer(conf_spec)¶
rotates substituents according to the specified conformer specification
- Parameters:
conf_spec (dict) – {sub_start_number: (conf_number, [skip_numbers])}
- Returns:
conf_spec, True if conformer generated (allowed by conf_spec), conf_spec, False if not allowed or invalid
- get_aromatic_atoms(return_rings=False, return_h=False)¶
Finds atoms within aromatic rings in a molecule
- Parameters:
return_rings (bool) – returns full aromatic rings if true, default False
return_h (bool) – includes hydrogens in return if true, default False
- Returns:
List(Atom) of atoms in aromatic rings, including hydrogens if return_h is True
- Charge (int) (also could be number of atoms in aromatic rings not participating in aromaticity) of rings
number of rings (int) that are fused (napthalene would be 2)
List of aromatic rings if return_rings is True
- get_gaff_geom()¶
- Returns:
geometry comprised of OniomAtoms with GAFF atomtypes from OfType finder
- define_layer(layer, reference, distance, bond_based=False, expand=True, force=False, res_based=False)¶
define an ONIOM layer based on reference information reference can be list(Atom), list(list(float)), list(float), or str representing a layer (H, M, L, !H, etc) if defining a 3 layer job, start at High layer (reaction center)
- Parameters:
layer (str) – new ONIOM layer to be defined
reference (Atom|list(Atom)|list(list(float(coords)))|list(float(coords))|str(layer)) – atom, atoms, or layer to be used as reference point(s) for beginning of layer definition
distance (float) – distance from reference point to boundary of new layer
bond_based (bool) – will treat distance as number of bonds from reference if True, default False
expand (bool) – determines whether to expand layer or contract if new layer boundary cuts across pi or polar bond(s), default True
force (bool) – determines whether to force new layer boundary to cut across pi or polar bond(s), default False
res_based (bool) – new layer will include entire amino acid residue if new layer boundary cuts across intra-residue bonds if True, default False
- change_chirality(target)¶
change chirality of the target atom
- detect_solvent(solvent)¶
detects solvent based on either an input solvent xyz, solvent in solvent library, or input SMILES
- Parameters:
solvent (str) – solvent to be detected
- Returns:
solvent if able to be found
- Return type:
list(Geometry)
- classmethod from_pdb(structure, name='')¶
Returns a list of Geometry objects from pdb files with multiple structural poses
- Parameters:
structure (FileReader|str) – molecular structure information from a pdb file
name (str, optional) – name to be assigned to molecular structure, defaults to “”
- Returns:
Geometry objects for all poses of structure in pdb file
- Return type:
list(Geometry)
- update_charges(charges='')¶
update the atomic partial charges. accepts Tuple or List(charges), Dict{atom name: charge}
- Parameters:
charges (tuple(charges)|list(charges)|dict(charges)) – new charges to update to