schrodinger.application.matsci.atom_group module

Module to do geometry based structure calculation which works both on structure and trajectory.

There are three levels. Base level is MSAtom level is single atom or group atoms treated as as a single atom. This is similar to Coarse grain bead which can represent multiple atoms.

Second level is MSAtomGroup which is a holds multiple atom group. This is the class which is responsible for geometric calculation using MSAtom coordinates.

Third level is MSAtomGroups which holds multiple atom groups and runs the same geometric calculation on all of them.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.atom_group.MSAtom(indices, struct, pos_type='atom')

Bases: object

A atom like object which holds an atom or group of atoms that can be construed as a single atom.

__init__(indices, struct, pos_type='atom')

Initialize MSAtom

Parameters
  • index (int) – index of the atom

  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • pos_type (str) – Select GROUP_MASS or GROUP_CENTROID group all the atoms into single atom group represented by the center of mass and geometric center respectively. GROUP_NONE will not group any of the atom, however, indices should contain a single atom. Defaults to GROUP_NONE.

Raises

ValueError – If there are more than one atom with pos_type as GROUP_NONE

getXYZ(all_pos=None)

Get current coordinate of the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

current coordinate for the atom group

Raises

AttributeError – Raise attribute error if grouping is None and single xyz is requested

property index

Index of the atom in the structure if MSAtom has only one atom. Raises error if there are multiple atoms, ie when using pos type

Return type

int

Returns

index of atom in the structure

Raises

ValueError – If there are more than one atom making this MSAtom

property atomic_weight

Get atomic weight of the atom

Return type

float

Returns

atomic weight of the atom

class schrodinger.application.matsci.atom_group.HelixArc(indices, struct, pos_type='atom')

Bases: schrodinger.application.matsci.atom_group.MSAtom

A MSAtom that constitutes of 4 consecutive atoms representing an helix arc

getArcCenter(pos)

Fit the arc points to a sphere and return the center of the sphere

Parameters

pos (numpy.ndarray) – coordinates of the arc points

Return type

numpy.ndarray

Returns

coordinate of the center

calculateHelixProp(all_pos=None)

Calculate the local helix properties using 4 points in the arc of the helix

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

__init__(indices, struct, pos_type='atom')

Initialize MSAtom

Parameters
  • index (int) – index of the atom

  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • pos_type (str) – Select GROUP_MASS or GROUP_CENTROID group all the atoms into single atom group represented by the center of mass and geometric center respectively. GROUP_NONE will not group any of the atom, however, indices should contain a single atom. Defaults to GROUP_NONE.

Raises

ValueError – If there are more than one atom with pos_type as GROUP_NONE

property atomic_weight

Get atomic weight of the atom

Return type

float

Returns

atomic weight of the atom

getXYZ(all_pos=None)

Get current coordinate of the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

current coordinate for the atom group

Raises

AttributeError – Raise attribute error if grouping is None and single xyz is requested

property index

Index of the atom in the structure if MSAtom has only one atom. Raises error if there are multiple atoms, ie when using pos type

Return type

int

Returns

index of atom in the structure

Raises

ValueError – If there are more than one atom making this MSAtom

class schrodinger.application.matsci.atom_group.MSAtomGroup(struct, group_atom_ids, pos_type='atom')

Bases: object

Class to calculate properties of a group of MSAtoms

BASE_ATOM_TYPE

alias of schrodinger.application.matsci.atom_group.MSAtom

__init__(struct, group_atom_ids, pos_type='atom')

Initialize MSAtomGroup

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • group_atom_ids (list) – list of atom ids to add to the group

  • pos_type (str) – Select GROUP_MASS or GROUP_CENTROID group all the atoms into single-atom group represented by the center of mass and geometric center, respectively. GROUP_NONE will not group any of the atoms. However, indices should contain a single atom when using GROUP_NONE. Defaults to GROUP_NONE.

groupAtoms()

Create atom groups from group atom ids

getGroupXYZ(all_pos=None)

Get xyz values for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

array

Returns

xyz values for the atom group

getCentroid(all_pos=None)

Get centroid for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

centroid for the atom group, it is same as the single atom xyz when there is no grouping.

getCenterOfMass(all_pos=None)

Get center of mass for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

center of mass for the atom group, it is same as the single atom xyz when there is no grouping.

class schrodinger.application.matsci.atom_group.MSRingAtomGroup(struct, group_atom_ids, pos_type='atom')

Bases: schrodinger.application.matsci.atom_group.MSAtomGroup

Class containing group of MSAtoms where each atoms that are part of the same ring are grouped into a single MSAtom

groupAtoms()

Overwrite parent group to create group where MSAtom that are part of the same ring are grouped into a single MSAtom

BASE_ATOM_TYPE

alias of schrodinger.application.matsci.atom_group.MSAtom

__init__(struct, group_atom_ids, pos_type='atom')

Initialize MSAtomGroup

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • group_atom_ids (list) – list of atom ids to add to the group

  • pos_type (str) – Select GROUP_MASS or GROUP_CENTROID group all the atoms into single-atom group represented by the center of mass and geometric center, respectively. GROUP_NONE will not group any of the atoms. However, indices should contain a single atom when using GROUP_NONE. Defaults to GROUP_NONE.

getCenterOfMass(all_pos=None)

Get center of mass for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

center of mass for the atom group, it is same as the single atom xyz when there is no grouping.

getCentroid(all_pos=None)

Get centroid for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

centroid for the atom group, it is same as the single atom xyz when there is no grouping.

getGroupXYZ(all_pos=None)

Get xyz values for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

array

Returns

xyz values for the atom group

class schrodinger.application.matsci.atom_group.HelixData(time: Optional[Any] = None, diameter: Optional[float] = None, twist: Optional[float] = None, rise: Optional[float] = None, base_per_turn: Optional[float] = None, pitch: Optional[float] = None, narcs: Optional[int] = None, aids: Optional[str] = None)

Bases: object

Data class to store helix data values

Parameters
  • time (float) – time associated with helix

  • diameter (float) – diameter of the helix

  • twist (float) – twist angle of the helix

  • rise (float) – rise distance of each helix

  • base_per_turn (float) – average number of bases in each turn

  • pitch (float) – pitch of the helix

  • narcs (int) – number of arc used to define the helix

  • aids (str) – string of atom indices used to generate helix separated by semi-colon

time: Any = None
diameter: float = None
twist: float = None
rise: float = None
base_per_turn: float = None
pitch: float = None
narcs: int = None
aids: str = None
getFieldNames()

Gets the field names for the data class

Return type

list

Returns

list of attribute names for the data class

getValues()

Gets the values for attributes that are not none

Return type

dict

Returns

dictionary where key is the attribute name value is the value of the attribute

getHeader()

Gets the header string for current class values. The values that are None will be left out of the header

Return type

str

Returns

header string where each key is separated by a comma

__init__(time: Optional[Any] = None, diameter: Optional[float] = None, twist: Optional[float] = None, rise: Optional[float] = None, base_per_turn: Optional[float] = None, pitch: Optional[float] = None, narcs: Optional[int] = None, aids: Optional[str] = None) None
class schrodinger.application.matsci.atom_group.HelixArcAtomGroup(struct, group_atom_ids)

Bases: schrodinger.application.matsci.atom_group.MSAtomGroup

Class containing group of HelixArc and combine then into helix groups

RADIUS_TOLERANCE = 20
BEND_TOLERANCE = 40
BASE_ATOM_TYPE

alias of schrodinger.application.matsci.atom_group.HelixArc

__init__(struct, group_atom_ids)

Initialize HelixArcAtomGroup

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • group_atom_ids (list) – list of atom ids to add to the group

estimateRadius(arcs, all_pos)

Estimate helix radius from arc points by finding their distance from the helix axis.

Parameters
  • arcs (list of HelixArc) – The arcs making the helix

  • all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Returns

mean radius for the helix

Return type

float

fixDiameter(helix_grp, all_pos)

Estimate the diameter of helix group and then set the helix group diameter as the diameter of each arc. Since the local diameter of arc may not truly represent the helix diameter when the helix is not perfectly straight or points are far apart.

Parameters
  • helix_grp (list) – The list of arcs making the helix group

  • all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

groupAtoms()

Overwrite parent group to create group where each group element is a HelixArc comprising for four atoms

appendToSplitGroup(split_grp, current_grp)

Append the current group to split group if current group contains at least three atom group(s).

Parameters
  • split_grp (list) – list of list of atom group(s)

  • current_grp (list) – list of atom group(s) to append

cleanBoolCheck(bool_check)

Clean the check to remove a single noise False point

Parameters

bool_check (list) – list of bool values

splitGroupByChecks(groups, grp_check)

Split an ordered list of elements into list of list containing the (not all) elements of arc_group. Splitting occurs when False values are encountered in grp_check, and the corresponding groups elements are excluded.

Parameters
  • groups (list) – list of elements to split

  • grp_check (list) – list of bool values

Return type

list(list)

Returns

list containing list of elements whose corresponding index in grp_check is True

Raises

AttributeError – If the length of groups and grp_check is not the same

splitGroupByArc(groups)

Split the groups into multiple list of groups that contain atom group that are arcs

Parameters

groups (list) – list of atom group

Return type

list(list)

Returns

list of list of atom groups that are arc

splitGroupByLine(arc_grps)

Split arc groups into helix groups where arc groups should lie in a straight line. The amount of straight-ness is controlled by bend tolerance.

Parameters

arc_grps (list) – list of atom groups that are arc

Return type

list

Returns

list of atom groups that are helical arcs

splitGroupByRadius(helix_grps, all_pos)

Split helix arc groups into helix arc groups where local arc radius are similar. The amount of similarity is controlled by radius tolerance.

Parameters
  • helix_grps (list) – list of atom groups that are arc

  • all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

list

Returns

list of atom groups that are helical arcs

helixGroupToData(helix_grp)

Get the average helix property from list of local helix arcs

Parameters

helix_grp (list) – list of local helix arc

Return type

HelixData

Returns

Helix data containing helix properties

calculateHelices(all_pos=None)
getCenterOfMass(all_pos=None)

Get center of mass for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

center of mass for the atom group, it is same as the single atom xyz when there is no grouping.

getCentroid(all_pos=None)

Get centroid for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

numpy.ndarray

Returns

centroid for the atom group, it is same as the single atom xyz when there is no grouping.

getGroupXYZ(all_pos=None)

Get xyz values for the atom group

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

array

Returns

xyz values for the atom group

class schrodinger.application.matsci.atom_group.MSAtomGroupsBase(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Bases: object

Class containing atom groups and calculate properties for each of them

BASE_ATOM_GROUP

alias of schrodinger.application.matsci.atom_group.MSAtomGroup

__init__(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Initialize MSAtomGroups

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • atom_ids (list or None) – atom indices to create atom groups from

  • msys_model (msys.System or None) – Desmond model system

  • frames (list or None) – list of trajectory frames if analyzing trajectory. None if analyzing static structure.

  • wrap_traj (bool) – If true, it will wrap trajectory

  • logger (function or None) – logger function to log updates to.

updateFrameLog(frame_id, prop_name)

Add to log with updates to calculations

Parameters
  • frame_id (int) – Index of the current frame id

  • prop_name (str) – Name of the property being calculated

addIndicesToGroup(atom_indices)

Create a group from passed atom indices and add it to groups

Parameters

atom_indices (list) – list of atom indices

setAtomGroups()

Function to create atom groups. Runs when the object is initiated.

Raises

NotImplementedError – Raises error if not implemented for the class

getCordsIterator(prop_name=None)

Iterator for xyz for all the groups. This will iterate over all trajectory frames or once for a static structure

Parameters

prop_name (str or None) – Name of the property which is being calculated. If logger is available and property is not None, it will log the progress.

Return type

list

Returns

list of xyz values for all groups

class schrodinger.application.matsci.atom_group.MSMoleculeAtomGroups(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Bases: schrodinger.application.matsci.atom_group.MSAtomGroupsBase

Class containing atom groups created for each molecule in the structure

setAtomGroups()

Set atom groups for each segment in the structure

BASE_ATOM_GROUP

alias of schrodinger.application.matsci.atom_group.MSAtomGroup

__init__(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Initialize MSAtomGroups

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • atom_ids (list or None) – atom indices to create atom groups from

  • msys_model (msys.System or None) – Desmond model system

  • frames (list or None) – list of trajectory frames if analyzing trajectory. None if analyzing static structure.

  • wrap_traj (bool) – If true, it will wrap trajectory

  • logger (function or None) – logger function to log updates to.

addIndicesToGroup(atom_indices)

Create a group from passed atom indices and add it to groups

Parameters

atom_indices (list) – list of atom indices

getCordsIterator(prop_name=None)

Iterator for xyz for all the groups. This will iterate over all trajectory frames or once for a static structure

Parameters

prop_name (str or None) – Name of the property which is being calculated. If logger is available and property is not None, it will log the progress.

Return type

list

Returns

list of xyz values for all groups

updateFrameLog(frame_id, prop_name)

Add to log with updates to calculations

Parameters
  • frame_id (int) – Index of the current frame id

  • prop_name (str) – Name of the property being calculated

class schrodinger.application.matsci.atom_group.HelixGroups(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Bases: schrodinger.application.matsci.atom_group.MSAtomGroupsBase

A class containing group of HelixArcAtomGroup and calculate global helix properties from it

BASE_ATOM_GROUP

alias of schrodinger.application.matsci.atom_group.HelixArcAtomGroup

setAtomGroups()

Set atom groups for each segment in the structure

getHelixData(all_pos=None)

Calculate all helices for current frame / structure

Parameters

all_pos (numpy.ndarray or None) – all coordinates in the trajectory for the current/analyzed frame. None if it is a static structure

Return type

list

Returns

list of HelixData that contain properties of each helix

__init__(struct, atom_ids=None, msys_model=None, frames=None, wrap_traj=False, logger=None)

Initialize MSAtomGroups

Parameters
  • struct (schrodinger.structure.Structure or cms.Cms) – Structure to which the atom group belongs. It will be cms model if trajectory is used, and structure if trajectory is not used.

  • atom_ids (list or None) – atom indices to create atom groups from

  • msys_model (msys.System or None) – Desmond model system

  • frames (list or None) – list of trajectory frames if analyzing trajectory. None if analyzing static structure.

  • wrap_traj (bool) – If true, it will wrap trajectory

  • logger (function or None) – logger function to log updates to.

addIndicesToGroup(atom_indices)

Create a group from passed atom indices and add it to groups

Parameters

atom_indices (list) – list of atom indices

getCordsIterator(prop_name=None)

Iterator for xyz for all the groups. This will iterate over all trajectory frames or once for a static structure

Parameters

prop_name (str or None) – Name of the property which is being calculated. If logger is available and property is not None, it will log the progress.

Return type

list

Returns

list of xyz values for all groups

getHelixDataIterator()

Iterator to get helices in each frame. Will yield a single list of helices for a static structure.

Return type

list

Returns

list of all the helix data containing helix properties

updateFrameLog(frame_id, prop_name)

Add to log with updates to calculations

Parameters
  • frame_id (int) – Index of the current frame id

  • prop_name (str) – Name of the property being calculated