schrodinger.application.matsci.geometry module¶
Utilities for geometry manipulation or property calculation
Copyright Schrodinger, LLC. All rights reserved.
- schrodinger.application.matsci.geometry.backbone_path_search(sub_graph, start, end, backbone_indices)¶
Perform a BFS to find a deterministic backbone-respecting path.
- Parameters:
sub_graph ('networkx.classes.graph.Graph') – The graph to find path in structure
start (int) – First atom index
end (int) – Index of last atom
backbone_indices (set) – Index of all marked backbone atoms
- Return type:
list or None
- Returns:
List of atom indices in the valid path or None
- schrodinger.application.matsci.geometry.find_marked_backbone_path(struct, sub_graph)¶
Find the shortest path based on atoms marked as backbone.
- Parameters:
struct (
schrodinger.structure.Structure
) – The structure to find backbone path in.sub_graph ('networkx.classes.graph.Graph') – The graph to find path in structure
- Return type:
list or None
- Returns:
list of nodes in the path in the graph. The selected path must contain the marked backbone atoms.
- schrodinger.application.matsci.geometry.get_backbone_atoms(struct, exclude_hydrogen=True, max_fix=True)¶
Return dictionary of backbone atoms for each molecule in the structure.
- Parameters:
struct (Structure) – The structure to find backbone atoms in.
exclude_hydrogen (bool) – If true hydrogen will be excluded in creation of graph and searching for backbone atoms. This results in much faster calculation.
max_fix (bool) – Whether to fix internal degeneracy when maximum number of path checks are reached
- Return dict:
A dictionary mapping molecule number to a list of backbone atom indices. If there are less than two atoms in the molecule the associated value will be an empty list.
- schrodinger.application.matsci.geometry.get_ordered_polymer_backbone(struct, backbone_path, remove_side_chain)¶
Backbone of a polymer chain should follow H–TH–TH–T format, where backbone starts with head and ends with tail.
- Parameters:
struct (Structure) – The structure to find backbone atoms in.
backbone_path (list) – list of atom indexes in the backbone
remove_side_chain (bool) – If true it will remove the side chain atoms from the backbone in the start and end.
- Return list:
list of atom indexes in the backbone such that first atom is always a head.
- schrodinger.application.matsci.geometry.get_ordered_backbone_atoms(struct)¶
Return dictionary of backbone atoms for each molecule in the structure.
- Parameters:
struct (Structure) – The structure to find backbone atoms in.
- Return dict(list):
the key of the dictionary is molecule number and the value is the list of backbone atoms
- schrodinger.application.matsci.geometry.radius_of_gyration(struct, molecule_coms=False)¶
Calculate radius of gyration for a structure
- Parameters:
struct (Structure) – The structure to calculate RG for
molecule_coms (bool) – Whether to use center of mass of each molecule in the structure for calculating Rg
- Return type:
float
- Returns:
The radius of gyration
- schrodinger.application.matsci.geometry.fit_structure_to_ellipsoid(struct)¶
Fit the structure to an ellipsoid and return the ellipsoid semi-axes and principal moments of inertia
The method is taken from https://pubs.acs.org/doi/abs/10.1021/jp047138e and uses the following equations to calculate the semi-axes values: I1 = M/5 * (a**2 + b**2) I2 = M/5 * (a**2 + c**2) I3 = M/5 * (b**2 + c**2) Also see https://en.wikipedia.org/wiki/Ellipsoid#Dynamical_properties
- Parameters:
struct (Structure) – The structure to fit to an ellipsoid
- Return type:
tuple of (float, float, float, [float, float, float])
- Returns:
Tuple of semi-axes values in Angstroms and principal moments of inertia in u * A**2
- schrodinger.application.matsci.geometry.fit_points_to_circle(x_vals, y_vals, center_x=None)¶
Fit 2D points to a circle
- Parameters:
x_vals (numpy.array) – Array containing point x values
y_vals (numpy.array) – Array containing point y values
center_x (float) – If provided, this will be the x value of the circle center
- Return type:
tuple(float, float, float)
- Returns:
Center x value, center y value, and radius
- schrodinger.application.matsci.geometry.get_center(st, atom_ids=None)¶
Get the structure’s center of mass, limited to the given
atom_ids
. Return None ifatom_ids
is empty or None- Parameters:
st (Structure) – Structure
atom_ids (list(int)) – Atom ids for which center of mass has to be calculated
- Returns:
centroid given as 3-element array [x, y, z]
- Return type:
numpy.array(float) or None