schrodinger.application.desmond.packages.analysis module

Classes and functions for trajectory-based analysis

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.desmond.packages.analysis.GroupType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: enum.Enum

Enum representing different methods to grouping method to group atoms.

Currently supported types are: - MOLECULE: Atoms are grouped by the molecule they belong to. - RESIDUE: Atoms are grouped by the residue they belong to.

MOLECULE = 'molecule'
RESIDUE = 'residue'
schrodinger.application.desmond.packages.analysis.is_small_struc(atoms)

A simple API to determine whether a molecular structure is small.

Parameters

atoms (list) – A list of atoms in the structure. The atoms can be atom IDs or atom-class instances.

class schrodinger.application.desmond.packages.analysis.Pbc(box)

Bases: object

__init__(box)

This implementation supports triclinic cell.

Parameters

box (numpy.ndarray) – 3x3 matrix whose ROWS are primitive cell vectors. For a msys.System instance, call msys_model.cell to get this matrix. For a traj.Frame instance, call fr.box to get it. For a Cms instance, call numpy.reshape(cms_model.box, [3, 3]) to get it.

property box
property volume
property inv_box
calcMinimumImage(ref_pos, pos)

Calculates the minimum image of a position vector pos relative to another position vector ref_pos. pos and ref_pos can also be arrays of 3D vectors. In this case, they must be of the same size, and minimum images will be calculated for each element in pos and ref_pos.

Parameters
  • ref_pos (numpy.ndarray. Either 1x3 or Nx3.) – Reference position vector(s)

  • pos (numpy.ndarray. Either 1x3 or Nx3.) – Position vector(s) of which we will calculate the minimum image.

Return type

numpy.ndarray with numpy.float64 elements

Returns

The position vector(s) of the mininum image. This function does NOT mutate any of the input vectors.

calcMinimumDiff(from_pos, to_pos)

Calculates the difference vector from from_pos to the minimum image of to_pos. pos and ref_pos can also be arrays of 3D vectors. In this case, they must be of the same size, and minimum image difference will be calculated for each element in pos and ref_pos.

Parameters
  • from_pos (numpy.ndarray. Either 1x3 or Nx3) – Reference position vector(s)

  • to_pos (numpy.ndarray. Either 1x3 or Nx3) – Position vector(s) of which we will calculate the minimum image.

Return type

numpy.ndarray with numpy.float64 elements

Returns

The difference vector(s). This function does NOT mutate any of the input vectors.

wrap(pos)

Puts a coordinate back into the box. If the coordinate is already in the box, this function will return a new position vector that equals the original vector.

Return type

numpy.ndarray with numpy.float64 elements

Returns

A new position vector which is within the box. This function does NOT mutate and return the input vector pos.

isWithinCutoff(pos0, pos1, cutoff_sq)

Return True if any of pos0 and pos1 are within the cutoff distance.

Parameters

cutoff_sq (float) – = cutoff x cutoff

class schrodinger.application.desmond.packages.analysis.CenterOf(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Base class for computing averaged center of a group of atoms, with optional weights. Periodic boundary condition is taken into account.

N.B.: The calculated center is an unwrapped coordinate.

__init__(gids: List[int], weights: Optional[List[float]] = None, return_unwrapped_atompos=False)
Parameters

return_unwrapped_atompos – if False, return the unwrapped center. Otherwise return both unwrapped center and the unwrapped positions of the selected atoms.

class schrodinger.application.desmond.packages.analysis.Com(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.CenterOf

Class for computing averaged position weighted by atomic mass under periodic boundary condition.

Basic usage:

ana = Com(msys_model, cms_model, gids=[1, 23, 34, 5, 6]) results = analyze(tr, ana)

where tr is a trajectory, and results contain a list of unwrapped centers of mass as floats, one float for each frame. If return_unwrapped_atompos is True, results contain a list of 2-tuples: (unwrapped-center-of-mass, [unwrapped-positions-of-involved-atoms]), and each 2-tuple in the list corresponds to a trajectory frame.

__init__(msys_model, cms_model, asl=None, gids=None, return_unwrapped_atompos=False)
Parameters
  • asl (str) – ASL expression to specify the atom selection

  • gids (list of int) – GIDs of atoms

  • return_unwrapped_atompos – if False, return the unwrapped center. Otherwise return both unwrapped center and the unwrapped positions of the selected atoms.

Both msys_model and cms_model must be previously obtained through the read_cms function. They both should have the same atom coordinates and the same simulation box matrix. cms_model is used to obtain atom GIDs from ASL selection. msys_model is used to retrieve atom attribute from GIDs.

Either asl or gids must be specified, but not both.

class schrodinger.application.desmond.packages.analysis.Coc(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.Com

Class for computing center of charge under periodic boundary condition. Pseudo atoms are included.

For each frame, the results will be the unwrapped-center-of-charge. If return_unwrapped_atompos is True, the results will be a 2-tuple: (unwrapped-center-of-charge, [unwrapped-positions-of-involved-atoms]).

__init__(msys_model, cms_model, asl=None, gids=None, return_unwrapped_atompos=False)

Refer to the docstring of Com.__init__.

class schrodinger.application.desmond.packages.analysis.Centroid(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.CenterOf

Class for computing centroid under periodic boundary condition.

For each frame, the results will be the unwrapped centroid. If return_unwrapped_atompos is True, the results will be a 2-tuple: (unwrapped-centroid, [unwrapped-positions-of-involved-atoms]).

__init__(msys_model, cms_model, asl=None, gids=None, return_unwrapped_atompos=False)

Refer to the docstring of Com.__init__.

class schrodinger.application.desmond.packages.analysis.Vector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate the vector between two xids. Result is a vector for each trajectory frame.

__init__(msys_model, cms_model, from_xid, to_xid)
class schrodinger.application.desmond.packages.analysis.Distance(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate the distance between two xids. Result is a scalar (distance in Angstroms) for each trajectory frame.

__init__(msys_model, cms_model, xid0, xid1)
class schrodinger.application.desmond.packages.analysis.Angle(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate the angle formed between three xids. Result is a scalar (angle in degrees) for each trajectory frame.

__init__(msys_model, cms_model, xid0, xid1, xid2)

The angle is formed by the vectors xid1`==>`xid0 and xid1`==>`xid2.

class schrodinger.application.desmond.packages.analysis.Torsion(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate the torsion formed between four xids. Result is a scalar (dihedral angle in degrees) for each trajectory frame.

__init__(msys_model, cms_model, xid0, xid1, xid2, xid3)

The torsion is defined by the four atoms:

0 o           o 3
   \         /
    \       /
   1 o-----o 2
class schrodinger.application.desmond.packages.analysis.PlanarAngle(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate planar angle formed among six xids. The first three xids define the first plane and the latter three xids define the second plane. Result is a list of planar angles in degrees for the trajectory frames.

__init__(msys_model: schrodinger.application.desmond.packages.msys.System, cms_model: schrodinger.application.desmond.cms.Cms, xid0: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], xid1: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], xid2: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], xid3: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], xid4: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], xid5: Union[int, schrodinger.application.desmond.packages.analysis.CenterOf], minangle: bool = True)
Parameters
  • msys_model – defines the system structure and atomic mapping

  • cms_model – defines the system structure and atomic mapping

  • xid* – integer representing an aid or CenterOf type (Com, Coc, Centroid)

  • minangleTrue to restrict the returned angle to the range [0, 90] degrees, treating the order of atoms defining the plane as unimportant and ignoring the directionality of the plane normals. False to return the angle in the range [0, 180] degrees.

class schrodinger.application.desmond.packages.analysis.FittedPlanarAngle(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate planar angle formed among two groups of atoms, each of containing 3 or more atoms. The first list contains xids of the first group and the second list contains xids of the second group. A best-fitting plane is calculated for each group of xids. Result is a list of planar angles in degrees for the trajectory frames.

This analyzer is useful for such cases as calculating angles between two rings.

__init__(msys_model: schrodinger.application.desmond.packages.msys.System, cms_model: schrodinger.application.desmond.cms.Cms, xids0: List[Union[int, schrodinger.application.desmond.packages.analysis.CenterOf]], xids1: List[Union[int, schrodinger.application.desmond.packages.analysis.CenterOf]], minangle: bool = True)
Parameters
  • msys_model – defines the system structure and atomic mapping

  • cms_model – defines the system structure and atomic mapping

  • xids* – list of integers representing aid or CenterOf types (Com, Coc, Centroid)

  • minangleTrue to restrict the returned angle to the range [0, 90] degrees, treating the order of atoms defining the plane as unimportant and ignoring the directionality of the plane normals. False to return the angle in the range [0, 180] degrees.

class schrodinger.application.desmond.packages.analysis.Gyradius(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Class for computing radius of gyration under periodic boundary condition.

For each frame, the result is the radius of gyration as float

__init__(msys_model, cms_model, asl=None, gids=None, mass_weighted: bool = False)
class schrodinger.application.desmond.packages.analysis.MassAvgVel(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.Com

Class for computing mass-averaged velocity. The trajectory should contain velocities data.

For each frame, the result is numpy.ndarray of float

class schrodinger.application.desmond.packages.analysis.PosTrack(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Class for tracking positions of selected atoms in a trajectory. Pseudo atoms are included.

Since periodic boundary condition is assumed in the MD simulation, the atom positions are wrapped back into the simulation box when they move out of the box. The PosTrack class unwraps the atom positions with respect to their positions in the previous frame. It can be used when atom positions need to be tracked over time, such as diffusion.

__init__(msys_model, cms_model, asl=None, gids=None)

Refer to the docstring of Com.__init__.

schrodinger.application.desmond.packages.analysis.RadiusOfGyration

alias of schrodinger.application.desmond.packages.analysis.Gyradius

schrodinger.application.desmond.packages.analysis.CenterOfMotion

alias of schrodinger.application.desmond.packages.analysis.MassAvgVel

schrodinger.application.desmond.packages.analysis.Position

alias of schrodinger.application.desmond.packages.analysis.PosTrack

class schrodinger.application.desmond.packages.analysis.Ramachandran(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis._Ramachandran

Calculate the Phi and Psi torsions for selected atoms.

Usage example:

ana = Ramachandran(msys_model, cms_model, ‘protein and res.num 20-30’) results = analyze(tr, ana)

where tr is a trajectory, and results is a list, and each element in the list is a list: [(phi_0, psi_0), (phi_1, psi_1),] for the corresponding trajectory frame.

__init__(msys_model, cms_model, asl)
Parameters

asl (str) – ASL expression to specify the residues

reduce(results, *_, **__)
schrodinger.application.desmond.packages.analysis.align_pos(pos, fit_pos, fit_ref_pos, weights=None, return_trans_rot=False, allow_improper_rotation=False, is_precentered=False)

Align pos using transformations (rotation and translation) derived from converting fit_pos to fit_ref_pos. Weighted Kabsch algorithm is used to obtain the transformations.

Parameters
  • allow_improper_rotation – If not set, only proper rotation is allowed.

  • is_precentered (bool) – True if all position arrays, i.e., pos, fit_pos, and fit_ref_pos, have been properly centered. Note that pos and fit_pos should be centered to the origin with respect to weights.

Returns

aligned pos and optionally the transformation matrices if return_trans_rot is set to be True

Return type

Nx3 numpy.ndarray if return_trans is False. Otherwise (numpy.ndarray, (1x3 numpy.ndarray, 3x3 numpy.ndarray)) where the 1x3 array is the translation vector, and the 3x3 array is the rotation matrix. The aligned position is calculated as numpy.dot(pos - trans_vec, rot_mat).

class schrodinger.application.desmond.packages.analysis.PosAlign(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CenteredSoluteAnalysis

This analyzer first centers the solute atoms. If fit_aids and fit_ref_pos are provided, it further aligns the given trajectory frames: first calculate the rotation / translation transformation to fit the sub-structure defined by fit_aids to the given geometry (fit_ref_pos), and then apply the transformation to the coordinates of the selected atoms (aids). The returned value is the transformed coordinates for aids.

__init__(msys_model, cms_model, aids, fit_aids, fit_ref_pos)
Parameters

fit_ref_pos (Mx3 numpy.ndarray or None) – positions of reference conformer structure for translation/rotation calculation

Both msys_model and cms_model must be previously obtained through the read_cms function.

class schrodinger.application.desmond.packages.analysis.RMSD(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.PosAlign

Root Mean Square Deviation with respect to reference positions, with optional alignment fitting.

See RMSF docstring for a detailed example (replace “RMSF” with “RMSD”).

If spikes are seen, call topo.make_glued_topology first.

__init__(msys_model, cms_model, aids, ref_pos, fit_aids=None, fit_ref_pos=None, in_place=False)

See PosAlign for parameters.

Parameters
  • ref_pos (Nx3 numpy.ndarray) – positions of reference conformer structure

  • in_place – if True, calculate RMSD without applying transformations on ref_pos

Typically, aids and fit_aids come from a common source whereas ref_pos and fit_ref_pos come from another common source.

class schrodinger.application.desmond.packages.analysis.RMSF(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.PosAlign

Per-atom Root Mean Square Fluctuation with respect to averaged position over the trajectory, with optional alignment fitting.

Example: calculate ligand RMSF with protein backbone aligned

>>> backbone_asl = 'backbone and not (atom.ele H) and not (m.n 4)'
>>> backbone_aids = cms_model.select_atom(backbone_asl)
>>> ligand_aids = cms_model.select_atom('ligand')
>>> # suppose the backbone reference position comes from a trajectory frame
>>> backbone_gids = topo.aids2gids(cms_model, backbone_aids, include_pseudoatoms=False)
>>> backbone_ref_pos = a_frame.pos(backbone_gids)
>>> ana = RMSF(msys_model, cms_model, ligand_aids, backbone_aids, backbone_ref_pos)
>>> result = analysis.analyze(a_trajectory, ana)

Here result is a length N numpy array where N is the number of ligand atoms. If spikes are seen, call topo.make_glued_topology before any analysis:

>>> topo.make_glued_topology(msys_model, cms_model)

This call will change the topology of msys_model, i.e., add ‘bonds’ for atoms that are close and belong to different molecules, using the positions in cms_model as gold standard. This change only affects position unwrapping for certain trajectory APIs such as topo.make_whole(), topo.center().

__init__(msys_model, cms_model, aids, fit_aids, fit_ref_pos, in_place=False)
Parameters
  • fit_ref_pos (Mx3 numpy.ndarray) – positions of reference conformer structure for translation/rotation calculation

  • in_place – if True, calculate RMSF without applying alignment transformations

Both msys_model and cms_model must be previously obtained through the read_cms function.

reduce(pos_t, *_, **__)

Temporal average of the RMSF over the trajectory

Return type

length N numpy.ndarray

class schrodinger.application.desmond.packages.analysis.LigandRMSD(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.PosAlign

Ligand Root Mean Square Deviation from reference positions, with optional alignment fitting. Taking conformational symmetry into account.

__init__(msys_model, cms_model, aids, ref_pos, fit_aids=None, fit_ref_pos=None)

see RMSD.__init__ for parameters

schrodinger.application.desmond.packages.analysis.get_pdb_protein_bfactor(fsys_ct, aids)

Calculate per-residue b-factor from pdb data for the selected atoms.

Parameters

aids (list of int) – Atom selections

Return type

numpy.ndarray of float

class schrodinger.application.desmond.packages.analysis.ProteinSF(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.RMSF

Per-frame per-residue Square Fluctuation (SF) with respect to averaged positions over the trajectory, with optional alignment fitting.

It returns a tuple of (residue labels, N_frame x N_residue matrix). Each matrix entry is the mass-weighted SF averaged over the residue’s atoms.

__init__(msys_model, cms_model, aids, fit_aids, fit_ref_pos, in_place=False)

see RMSF.__init__ for parameters

reduce(pos_t, *_, **__)

:rtype : list[string], list[numpy.ndarray] :return: residue tags and per-frame per-residue SF matrix

class schrodinger.application.desmond.packages.analysis.ProteinRMSF(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.ProteinSF

Per-residue Root Mean Square Fluctuation with respect to averaged positions over the trajectory, with optional alignment fitting.

reduce(pos_t, *_, **__)

:rtype : list[string], list[float] :return: residue tags and RMSF for each residue

class schrodinger.application.desmond.packages.analysis.Dipole(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Electric dipole moment of the selected atoms, in unit of debye.

The result may not be reliable when the structure of the selected atoms are large compared to the simulation box. The unwrapping with respect to periodic boundary condition provided by CenterOf is based on circular mean and may not be adequate.

EA2DEBYE = 4.802813198
__init__(msys_model, cms_model, aids)
class schrodinger.application.desmond.packages.analysis.AxisDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Basis vector of 3D axis

__init__(axis)
Parameters

axis (str) – axis name, ‘X’, ‘Y’ or ‘Z’

class schrodinger.application.desmond.packages.analysis.MomentOfInertia(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Moment of inertia tensor

Result is 3x3 numpy.ndarray

__init__(msys_model, cms_model, aids)
class schrodinger.application.desmond.packages.analysis.MomentOfInertiaDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeDynamicAslAnalyzer

This class calculates the principal moment-of-inertia for each of the selected molecules.

Result: A list of vectors

class schrodinger.application.desmond.packages.analysis.SmartsDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeDynamicAslAnalyzer

Direction of atom pairs from SMARTS pattern. The SMARTS pattern should pick bonds, i.e., atom pairs, e.g., smarts='CC'.

Convention: The vector is pointing from the first atom to the second.

__init__(msys_model, cms_model, asl, smarts)
reduce_vec(n, m)

Calculate Legendre polynomial P2 using the inner product of n and m as the input.

Parameters

m (N’x3 numpy.array where N’ is the number of chemical bonds.) – Output of SmartsDirector for one frame

class schrodinger.application.desmond.packages.analysis.SystemDipoleDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeDynamicAslAnalyzer

Direction of electric dipole moment of all the selected atoms

class schrodinger.application.desmond.packages.analysis.DipoleDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis.SystemDipoleDirector

Dipole direction for each molecule in the selection

class schrodinger.application.desmond.packages.analysis.LipidDirector(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Direction of CH bond for carbon atoms on lipid tail

__init__(msys_model, cms_model, asl, tail_type)
Parameters

tail_type – ‘sn1’, ‘sn2’, ‘all’

schrodinger.application.desmond.packages.analysis.reduce_vec(n, m)

Calculate Legendre polynomial P2 using the inner product of n and m as the input.

schrodinger.application.desmond.packages.analysis.reduce_vec_list(n, m)

Calculate Legendre polynomial P2 using the inner product of n and m as the input.

schrodinger.application.desmond.packages.analysis.reduce_lipid_vec_list(n, m)

Calculate Legendre polynomial P2 using the inner product of n and m as the input. Return its absolute value.

class schrodinger.application.desmond.packages.analysis.OrderParameter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Given the director (local or global), and the descriptor (local or global), calculate the order parameter <P2> for each frame:

S = 1/N sum_i ((3 * (n dot m_i)^2 -1) / 2)

where n is the director vector and m is the descriptor vector. For example, n is the z axis and m is the electric dipole moment.

Typical usage includes:

Director            Descriptor          result
Axis                Lipid               avg over carbon type
Axis                Smarts              avg over bond type
Axis                Dipole              avg over molecule
SystemDipole        Dipole              avg over molecule
Dipole              Smarts              avg over bond type

To extend its functionality, implement to the GeomAnalyzerBase interface and provide the reduction rule as callable.

__init__(vec1, vec2, reducer)
Parameters
  • vec1 – a GeomAnalyzerBase that computes director

  • vec2 – a GeomAnalyzerBase that computes descriptor

Typically both director and descriptor return Nx3 vectors for each frame, where N depends on the context. In this case, one should make sure that the orders of these vectors match. For example, if both director and descriptor give one vector per molecule, then the implementation should guarantee the molecule orders are the same in vec1() and vec2().

For axis director which returns 1x3 vector, reduction with descriptor is taken care of by numpy broadcasting. For more complicated cases where director and descriptor have incompatible dimensions, the user needs to provide special-purpose reduce function, see SmartsDirector.reduce_vec for example.

class schrodinger.application.desmond.packages.analysis.MoleculeWiseCom(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeDynamicAslAnalyzer

Calculate the center-of-mass for each of the selected molecules.

Result: A list of Nx3 numpy arrays, where N is the number of molecules. Note that the array size N may vary from frame to frame if the ASL is dynamic.

class schrodinger.application.desmond.packages.analysis.AtomicPosition(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.DynamicAslAnalyzer

Extract the positions of the selected atoms.

Result: A list of Nx3 numpy arrays, where N is the number of atoms. Note that the array size N may vary from frame to frame if the ASL is dynamic.

__init__(msys_model, cms_model, asl=None)
class schrodinger.application.desmond.packages.analysis.SecondaryStructure(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Calculate the secondary-structure property for selected atoms. The result is a list of int numbers, each of which corresponds to a selected atoms and is one of the following values:

SecondaryStructure.NONE SecondaryStructure.LOOP SecondaryStructure.HELIX SecondaryStructure.STRAND SecondaryStructure.TURN

The selected atoms can be obtained by calling the aids method.

NONE = -1
LOOP = 0
HELIX = 1
STRAND = 2
TURN = 3
__init__(msys_model, cms_model, aids: List[int])
Parameters

aids – IDs of atoms to calculate the secondary-structure property for

reduce(results, *_, **__)
class schrodinger.application.desmond.packages.analysis.SolventAccessibleSurfaceAreaByResidue(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Calculate the relative SASA broken down by residues. The values are relative to the average SASAs as given by SolventAccessibleSurfaceAreaByResidue.DIPEPTIDE_SASA.

The result is a 2-tuple: ([residue-names], [relative-SASAs]), where relative-SASAs has the structure of [[relative-SASA for each residue] for each frame]

DIPEPTIDE_SASA = {'ACE': (115.4897, 3.5972), 'ALA': (128.7874, 4.715), 'ARG': (271.5978, 9.5583), 'ASH': (175.7041, 5.1167), 'ASN': (179.5393, 4.632), 'ASP': (173.4664, 6.9882), 'CYS': (158.1909, 5.3923), 'CYX': (99.3829, 10.7089), 'GLH': (203.2443, 6.2765), 'GLN': (208.6171, 6.5794), 'GLU': (201.466, 6.9328), 'GLY': (94.1021, 5.1977), 'HID': (208.8269, 5.9202), 'HIE': (218.799, 5.6097), 'HIP': (221.1223, 8.3364), 'HIS': (208.8269, 5.9202), 'ILE': (207.2248, 5.0012), 'LEU': (211.8823, 5.149), 'LYN': (235.5351, 6.8589), 'LYS': (242.8734, 9.351), 'MET': (218.5396, 6.9879), 'NMA': (97.3748, 4.0446), 'PHE': (243.4793, 5.9699), 'PRO': (168.783, 5.5848), 'SER': (140.6706, 4.9089), 'THR': (169.0046, 4.9049), 'TRP': (287.0895, 6.892), 'TYR': (256.8637, 6.2782), 'UNK': (189.961, 6.3732), 'VAL': (181.2543, 4.864)}
__init__(msys_model, cms_model, asl, resolution=None)
Parameters
  • asl_center – ASL for the atoms to be centered

  • asl_exclude – ASL for the atoms to be excluded from centering. For example, ASL ‘protein’ could select ion and water molecules which may be too mobile for the centering.

reduce(results, *_, **__)
class schrodinger.application.desmond.packages.analysis.MolecularSurfaceArea(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CenteredSoluteAnalysis

Calculate the molecular surface area. The result is a single scalar number per frame.

__init__(msys_model, cms_model, asl, grid_spacing=None)
Parameters

asl (str) – ASL expression to select atoms whose secondary-structure property is of interest.

class schrodinger.application.desmond.packages.analysis.SolventAccessibleSurfaceArea(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Calculate solvent accessible surface area for selected atoms.

__init__(msys_model, cms_model, asl, exclude_asl=None, resolution=None)
Parameters
  • asl_center – ASL for the atoms to be centered

  • asl_exclude – ASL for the atoms to be excluded from centering. For example, ASL ‘protein’ could select ion and water molecules which may be too mobile for the centering.

class schrodinger.application.desmond.packages.analysis.PolarSurfaceArea(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CenteredSoluteAnalysis

Calculate polar surface area for selected atoms.

N.B.: Only O and N atoms are considered as polar atoms in this implementation.

__init__(msys_model, cms_model, asl, resolution=None)
Parameters
  • asl_center – ASL for the atoms to be centered

  • asl_exclude – ASL for the atoms to be excluded from centering. For example, ASL ‘protein’ could select ion and water molecules which may be too mobile for the centering.

class schrodinger.application.desmond.packages.analysis.HydrogenBondFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Find hydrogen bonds between two sets of atoms. The result has the structure of [[(acceptor atom ID, donor atom ID) for each H bond] for each frame].

Basic usage:

ana = HydrogenBondFinder(msys_model, cms_model, aids1, aids2) results = analyze(tr, ana)

__init__(msys_model, cms_model, aids1, aids2, max_dist=2.8, min_donor_angle=120.0, min_acceptor_angle=90.0, max_acceptor_angle=180.0)
Parameters
  • aids1 (list or None) – A list of atom indices for the first atom set. All atoms will be used if it is None.

  • aids2 (list or None) – A list of atom indices for the second atom set. All atoms will be used if it is None.

class schrodinger.application.desmond.packages.analysis.HalogenBondFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Find halogen bonds between two sets of atoms. The result has the structure of [[(acceptor atom ID, donor atom ID) for each bond] for each frame].

Basic usage:

ana = HalogenBondFinder(msys_model, cms_model, protein_aids, ligand_aids) results = analyze(tr, ana)

__init__(msys_model, cms_model, aids1, aids2, max_dist=3.5, min_donor_angle=140.0, min_acceptor_angle=90.0, max_acceptor_angle=170.0)
schrodinger.application.desmond.packages.analysis.get_ligand_fragments(lig_ct)

Decompose the ligand into several fragments using the murcko rules.

Returns

ligand fragments

Return type

list. Each element is a list of int.

class schrodinger.application.desmond.packages.analysis.HydrophobicInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Calculate hydrophobic interactions between protein and ligand, with hbonds and pi-pi interactions excluded.

The result has the structure of:

[{
'HydrophobicResult': [`_HydrophobicInter.Result` for each interaction],
'PiPiResult': [`ProtLigPiInter.Pipi` for each interaction],
'PiCatResult': [`ProtLigPiInter.PiLCatP` or `ProtLigPiInter.PiPCatL` for each interaction],
'HBondResult': [`ProtLigHbondInter.Result` for each interaction],
  } for each frame]
__init__(msys_model, cms_model, prot_asl, lig_asl, contact_cutoff=6.0, hydrophobic_search_cutoff=3.2, hbond_cutoff=2.8)
class schrodinger.application.desmond.packages.analysis.HydrophobicInterFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

This method is adopted from the following script: mmshare/python/common/display_hydrophobic_interactions.py While a similar analyzer HydrophobicInter is used specifically for finding Protein-Ligand hydrophobic interactions, this method seems more general. We may want to transition using this method for detecting Protein-Ligand hydrophobic interactions.

The frames are first centered on aids1 selection.

HYDROPHOB_ASL = 'SMARTS.[#6!$([C,c][O,o])&!$([C,c][N,n]),S&^3,P,Cl,Br,I]'
__init__(msys_model, cms_model, aids1, aids2, good_cutoff_ratio=1.3, bad_cutoff_ratio=0.89)
Parameters
  • asl_center – ASL for the atoms to be centered

  • asl_exclude – ASL for the atoms to be excluded from centering. For example, ASL ‘protein’ could select ion and water molecules which may be too mobile for the centering.

class schrodinger.application.desmond.packages.analysis.SaltBridgeFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Find salt bridges present between two sets of atoms. This class wraps around the get_salt_bridges function.

The result has the structure of:

[[(anion atom, cation atom) for each bridge] for each frame]

where the atoms are structure._StructureAtom.

__init__(msys_model, cms_model, aids1, aids2, cutoff=5.0)
Parameters
  • asl_center – ASL for the atoms to be centered

  • asl_exclude – ASL for the atoms to be excluded from centering. For example, ASL ‘protein’ could select ion and water molecules which may be too mobile for the centering.

class schrodinger.application.desmond.packages.analysis.ProtLigPolarInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Calculate polar interactions between protein and ligand, with hbonds and water bridges excluded.

The result has the structure of [{ ‘PolarResult’: [_ProtLigSaltBridges.Result for each bridge], ‘HBondResult’: [ProtLigHbondInter.Result for each H bond], ‘WaterBridgeResult’: [WaterBridges.Result for each bridge], } for each frame]

__init__(msys_model, cms_model, prot_asl, lig_asl, contact_cutoff=6.0, salt_bridge_cutoff=5.0, hbond_cutoff=2.8)
class schrodinger.application.desmond.packages.analysis.MetalInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Interactions between metal elements and protein/ligand atoms.

The result has the structure of [{ ‘MetalResult’: [_MetalInter.MetalP or _MetalInter.MetalL for each interaction] } for each frame]

MetalP

alias of schrodinger.application.desmond.packages.analysis._MetalP

MetalL

alias of schrodinger.application.desmond.packages.analysis._MetalL

__init__(msys_model, cms_model, prot_asl, lig_asl, metal_asl=None, contact_cutoff=6.0, metal_cutoff=3.4)
schrodinger.application.desmond.packages.analysis.PiPiInteraction

alias of schrodinger.application.desmond.packages.analysis._PiPiInteraction

schrodinger.application.desmond.packages.analysis.CatPiInteraction

alias of schrodinger.application.desmond.packages.analysis._PiCatInteraction

class schrodinger.application.desmond.packages.analysis.PiPiFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis._PiInteractionFinder

Find Pi-Pi interactions present between two sets of atoms, or within one set of atoms.

The result has the structure of [[PiPiInteraction for each interaction] for each frame]

class schrodinger.application.desmond.packages.analysis.CatPiFinder(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.analysis._PiInteractionFinder

Find Cation-Pi interactions present between two sets of atoms, or within one set of atoms. With two sets of atom selections, it computes both cations in selection 1 with respect to rings in selection 2, cations in selection 2 with respect to rings in selection 1, but not within the same selection.

The result has the structure of [[CatPiInteraction for each interaction] for each frame]

class schrodinger.application.desmond.packages.analysis.WatLigFragDistance(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Distance between water oxygen atom and its closest ligand fragment, with water bridges excluded.

The result has the structure of [{ ‘LigWatResult’: [_WatLigFragDistance.Result for each water-ligand-fragment-pair], ‘WaterBridgeResult’: [WaterBridges.Result for each bridge] } for each frame]

__init__(msys_model, cms_model, prot_asl, lig_asl, contact_cutoff=6.0, hbond_cutoff=2.8)
class schrodinger.application.desmond.packages.analysis.ProtLigInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Composition of various protein ligand interactions.

The result has the structure of [{ ‘WaterBridgeResult’: [WaterBridges.Result for each bridge], ‘LigWatResult’: [_WatLigFragDistance.Result for each water-ligand-fragment-pair], ‘HBondResult’: [ProtLigHbondInter.Result for each interaction], ‘PiPiResult’: [ProtLigPiInter.Pipi for each interaction], ‘PiCatResult’: [ProtLigPiInter.PiLCatP or ProtLigPiInter.PiPCatL for each interaction], ‘MetalResult’: [_MetalInter.MetalP or _MetalInter.MetalL for each interaction], ‘PolarResult’: [_ProtLigSaltBridges.Result for each bridge], }]

__init__(msys_model, cms_model, prot_asl, lig_asl, metal_asl=None)
Parameters
  • prot_asl (str) – ASL expression to specify protein atoms

  • lig_asl (str) – ASL expression to specify ligand atoms

  • metal_asl (str or None) – ASL expression to specify metal atoms. If None, use default values.

class schrodinger.application.desmond.packages.analysis.AmorphousCrystalInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Composition of various interactions between a specified molecule and its crystal-mates.

The result has the structure of:

{'HBondResult': [number of `HydrogenBondFinder.Result` per frame],
 'HalBondResult': [number of `HalogenBondFinder.Result` per frame],
 'PiPiResult': [number of `PiPiFinder.Result` per frame],
 'CatPiResult': [number of `CatPiFinder.Result` per frame],
 'PolarResult': [number of `SaltBridgeFinder.Result` per frame]
 'HydrophobResult': [number of `HydrophobicInterFinder.Result` per frame]}
RESULT_NAMES = ['HBondResult', 'HalBondResult', 'PiPiResult', 'CatPiResult', 'PolarResult', 'HydrophobResult']
__init__(msys_model, cms_model, asl)

Selection of molecule of interest is passed through asl variable. Environment selection is generated by excluding the asl and waters.

Parameters

asl (str) – ASL expression to specify selection atoms

reduce(results)
class schrodinger.application.desmond.packages.analysis.VolumeMapper(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

This class calculates the 3D histogram of selected atoms over a trajectory.

Note: The trajectory input for this method should already be centered and

aligned on the atoms of interest. By default, the returned histogram has origin in its central bin.

Basic usage:

ana = VolumeMapper(cms_model, ‘mol.num 1’) results = analyze(tr, ana)

__init__(cms_model, asl=None, aids=None, spacing=(1.0, 1.0, 1.0), length=(10.0, 10.0, 10.0), center=(0.0, 0.0, 0.0), normalize=True)
Parameters

asl (str) – The ASL selection for which volumetric density map will be constructed

reduce(pos_t, *_, **__)
schrodinger.application.desmond.packages.analysis.progress_report_frame_number(i, *_)
schrodinger.application.desmond.packages.analysis.analyze(tr, analyzer, *arg, **kwarg)

Do analyses on the given trajectory tr, and return the results. The analyses are specified as one or more positional arguements. Each analyzer should satisfy the interface requirements (see the docstring of GeomCalc.addAnalyzer).

Parameters
  • tr (list of traj.Frame) – The simulation trajectory to analyze

  • arg – A list of analyzer objects

  • kwarg["progress_feedback"] (callable, e.g., func(i, fr, tr), where i is the current frame index, fr the current frame, tr the whole trajectory.) – This function will be called at start of analysis on the current frame. This function is intended to report the progress of the analysis.

Return type

list

Returns

For a single analyzer, this function will return a list of analysis results, and each element in the list corresponds to the result of the corresponding frame. For multiple analyzers, this function will return a list of lists, and each element is a list of results of the corresponding analyzer. If an analyzer has a reduce method, the reduce method will be called, and its result will be returned.

schrodinger.application.desmond.packages.analysis.rmsd_matrix(obj, tr, rmsd_gids, fit_gids=None)

Return an NxN matrix where N is the number of frames in the trajectory tr and the (i, j)’th entry is the RMSD between frame i and frame j. The frame-wise RMSD values are calculated for atoms specified by rmsd_gids. If fit_gids is provided, the corresponding atoms are used to superimpose the two frames first.

Parameters
  • obj (msys.System or cms.Cms.glued_topology) – connection for trjactory centering

  • tr (list of traj.Frame objects) – Trajectory

  • rmsd_gids (list of int) – GIDs of atoms for which to calculate the RMSD

  • fit_gids (None or a list of int) – GIDs of atoms on which to we align the structures. If None, no alignment is performed.

Return type

numpy.ndarray of float

Returns

A symmetric square matrix of RMSDs

schrodinger.application.desmond.packages.analysis.cluster(affinity_matrix) Tuple[List[int], List[int]]

Use the affinity propagation method to cluster the input matrix, gradually increasing the damping factor until the algorithm converges.

The maximum number of iterations is currently hard-coded to 400. If the damping factor reaches 1.0 (which is not a valid value), the function will return empty lists for the centers and labels.

Parameters

affinity_matrix (numpy.ndarray of float) – A square matrix of affinity/similarity values

Returns

The first list is the sample indices of the clusters’ centers, the second list is a cluster label of all samples.

class schrodinger.application.desmond.packages.analysis.Rdf(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Calculate radial distribution function (RDF, also known as g(r)) for atom or atom group selections.

In general, we need two groups of positions. The first group are the reference positions, whereas the second the distance group. The reference and distance groups can be the same.

The ‘pos_type’ parameter determines the types of positions used as reference and distance groups. When ‘pos_type’ is set to “atom”, each atom is considered individually and the ‘group_type’ parameters are ignored, meaning no grouping is performed.

However, when ‘pos_type’ is set to values other than “atom”, such as “com”, “coc”, or “centroid”, the atoms can be grouped into larger units like molecules or residues based on the ‘group_type’ parameters. In these cases, the RDF is calculated using these larger group units instead of individual atoms.

For example, if we want to calculate the RDF of the distances of water hydrogen atoms with respect to water oxygen atoms, and ‘pos_type’ is set to “atom”, each atom is considered individually. Alternatively, if ‘pos_type’ is “com” and ‘group_type’ is “MOLECULE”, atoms are grouped by their molecular identity and the center of mass of each molecule is used, thus resulting in RDF of water molecules with respect to water molecules.

__init__(msys_model, cms_model, asl0, asl1=None, pos_type0='atom', pos_type1='atom', dr=0.1, rmax=12.0, group_type0=GroupType.MOLECULE, group_type1=GroupType.MOLECULE)
Parameters
  • asl0 (str) – Atom selection for the reference group

  • asl1 (str or None) – Atom selection for the distance group. If it’s None, it will default to asl0.

  • pos_type0 (str) – Type of positions of the reference group: “atom” : Use atom’s position directly “com” : Use molecular center of mass “coc” : Use molecular center of charge “centroid”: Use molecular centroid

  • pos_type1 (str) – Type of positions of the distance group. Values are the same as those of pos_type0

  • dr (float) – Bin width in the unit of Angstroms

  • rmax (float) – Maximum distance in the unit in Angstroms. The RDF will be calculated until rmax.

  • group_type0 (GroupType) – Method to use to group atoms in asl0 selection. Only used when pos_type0 is not “atom”.

  • group_type1 (GroupType) – Method to use to group atoms in asl1 selection. Only used when pos_type1 is not “atom”.

reduce(*_, **__)

Aggregates the frame-based results (histograms) and returns the final RDF results.

Return type

(list, list)

Returns

Returns the RDF (the first list), and the integral (the second list).

bins()
class schrodinger.application.desmond.packages.analysis.ProtProtPiInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.MaestroAnalysis

Protein-protein Pi interaction finder. The result has the structure of [{ ‘pi-pi’: [(an atom from ring1, an atom from ring2) for each interaction], ‘pi-cat’: [(an atom from ring, an atom from cation) for each interaction] } for each frame]

__init__(msys_model, cms_model, asl)
Parameters

asl (str) – ASL expression to select protein atoms

class schrodinger.application.desmond.packages.analysis.ProtProtHbondInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Protein-protein hydrogen bond finder.

The result has the structure of [{ ‘hbond_bb’: [(donor AID, acceptor AID) for each interaction], ‘hbond_ss’: [(donor AID, acceptor AID) for each interaction], ‘hbond_sb’: [(donor AID, acceptor AID) for each interaction], ‘hbond_bs’: [(donor AID, acceptor AID) for each interaction] } for each frame]

Here ‘b’ denotes backbone and ‘s’ sidechain.

__init__(msys_model, cms_model, asl)
class schrodinger.application.desmond.packages.analysis.ProtProtInter(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.CompositeAnalyzer

Protein-protein interactions.

The result has the structure of:

[{
'pi-pi': [(an atom from ring1, an atom from ring2) for each interaction],
'pi-cat': [(an atom from ring, an atom from cation) for each interaction],
'salt-bridge': [(anion atom AID, cation atom AID) for each bridge],
'hbond_bb': [(donor AID, acceptor AID) for each interaction],
'hbond_ss': [(donor AID, acceptor AID) for each interaction],
'hbond_sb': [(donor AID, acceptor AID) for each interaction],
'hbond_bs': [(donor AID, acceptor AID) for each interaction]
  } for each frame]

Here ‘b’ denotes backbone and ‘s’ sidechain. For the same frame, results are unique up to residue level, e.g., even if there are multiple salt-bridges between residue A and B, only 1 is recorded.

__init__(msys_model, cms_model, asl)
Parameters

asl (str) – ASL expression to select protein atoms

reduce(results, *_, **__)
Parameters

results (list of dict. Its length is the number of frames.) – interactions of all frames

:rtype : dict :return: counts of the various interactions over the whole trajectory

class schrodinger.application.desmond.packages.analysis.AreaPerLipid(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate Area-Per-Lipid in from pure lipid bilayer simulation (no protein). This analyzer assumes the bilayer is symmetric – number of lipids in upper and lower leaflets are the same. To calculate area-per-lipid, get X-Y area and divides by number of lipids/2

__init__(msys_model, cms_model, membrane_asl: str = 'membrane')
Parameters

membrane_asl (asl) – selection to center the system along the Z-axis

class schrodinger.application.desmond.packages.analysis.MembraneDensityProfile(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate Density Profile along the Z axis. The results are returned in g/cm^3.

AMU_TO_GRAM = 1.66
__init__(msys_model, cms_model, membrane_asl='membrane', density_sel_asl='lipids', slice_height=1.0, z_min=- 40, z_max=40)
Parameters
  • membrane_asl (asl) – selection to center the system along the Z-axis

  • density_sel_asl (asl) – selection for density calculation

  • slice_height (float) – the height of the slices to use

  • z_min (int) – the lower limit for which density will be calculated

  • z_max (int) – the upper limit for which density will be calculated

reduce(results, *_, **__)

Return (mean, std) density along the Z-axis

class schrodinger.application.desmond.packages.analysis.MembraneThickness(*args, **kwargs)

Bases: schrodinger.application.desmond.packages.staf.GeomAnalyzerBase

Calculate thickness of the membrane bilayer. For phospholipids a phosphate atom is often used as a proxy for each leaflet. The system is first centered along the Z-axis, and the distance betweent the <phosphates> in each leaflet is calculated.

__init__(msys_model, cms_model, membrane_asl='membrane', proxy_asl='atom.ele P')
Parameters
  • membrane_asl (asl) – selection to center the system along the Z-axis

  • proxy_asl (asl) – selection of atom(s) to be used for thickness