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')[source]

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')[source]

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)[source]

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')[source]

Bases: schrodinger.application.matsci.atom_group.MSAtom

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

getArcCenter(pos)[source]

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)[source]

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')[source]

Bases: object

Class to calculate properties of a group of MSAtoms

BASE_ATOM_TYPE

alias of MSAtom

__init__(struct, group_atom_ids, pos_type='atom')[source]

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()[source]

Create atom groups from group atom ids

getGroupXYZ(all_pos=None)[source]

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)[source]

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)[source]

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')[source]

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()[source]

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 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(diameter: float, twist: float, rise: float, base_per_turn: float, pitch: float)[source]

Bases: object

Data class to store helix data values

Parameters
  • 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

diameter: float
twist: float
rise: float
base_per_turn: float
pitch: float
__init__(diameter: float, twist: float, rise: float, base_per_turn: float, pitch: float) → None

Initialize self. See help(type(self)) for accurate signature.

class schrodinger.application.matsci.atom_group.HelixArcAtomGroup(struct, group_atom_ids)[source]

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 HelixArc

__init__(struct, group_atom_ids)[source]

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

groupAtoms()[source]

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

appendToSplitGroup(split_grp, current_grp)[source]

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)[source]

Clean the check to remove a single noise False point

Parameters

bool_check (list) – list of bool values

splitGroupByChecks(groups, grp_check)[source]

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)[source]

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)[source]

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)[source]

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

Return type

list

Returns

list of atom groups that are helical arcs

helixGroupToData(helix_grp)[source]

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)[source]
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)[source]

Bases: object

Class containing atom groups and calculate properties for each of them

BASE_ATOM_GROUP

alias of MSAtomGroup

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

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)[source]

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)[source]

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

Parameters

atom_indices (list) – list of atom indices

setAtomGroups()[source]

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)[source]

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)[source]

Bases: schrodinger.application.matsci.atom_group.MSAtomGroupsBase

Class containing atom groups created for each molecule in the structure

setAtomGroups()[source]

Set atom groups for each segment in the structure

BASE_ATOM_GROUP

alias of 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)[source]

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 HelixArcAtomGroup

setAtomGroups()[source]

Set atom groups for each segment in the structure

getHelixData(all_pos=None)[source]

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()[source]

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