schrodinger.application.desmond.packages.restraint module¶
Restraint generation for cross-CT terms and all terms supported by desmond backend, including alchemical terms.
Either a single term or a generator can be used. For single term, each selection corresponds to a single atom.
Two kinds of generators are implemented now:
- product: The product of all selections is used to generate all
the terms. Use case is to keep alchemical ions way from places they may get stuck.
- connected: One selection is evaluated to generate terms for bond, angle
and torsion. Use case is the alchemical restraints on protein conformations.
Reference distance, angle and torsion values are computed for generated terms. For alchemical terms, reference coordinates saved previously will be used for these calculations if available.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.desmond.packages.restraint.
GeneratorType
(value)¶ Bases:
enum.Enum
An enumeration.
-
PRODUCT
= 'product'¶
-
CONNECTED
= 'connected'¶
-
-
exception
schrodinger.application.desmond.packages.restraint.
CrossLinkGenerationError
¶ Bases:
Exception
-
__init__
(*args, **kwargs)¶ Initialize self. See help(type(self)) for accurate signature.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
schrodinger.application.desmond.packages.restraint.
is_position_restraint
(table_name: str)¶
-
schrodinger.application.desmond.packages.restraint.
is_alchemical
(table_name: str)¶
-
schrodinger.application.desmond.packages.restraint.
get_encoded_restraints
(cms_sys)¶ Get encoded restraints from cms
- Return type
str
-
schrodinger.application.desmond.packages.restraint.
set_encoded_restraints
(cms_sys, restr)¶ Store restraints in cms_sys object.
-
schrodinger.application.desmond.packages.restraint.
b64_encode
(input_string: str) → str¶ Encodes to a
str
rather thanbytes
so that the result can be set as a string property of a CT.- Parameters
input_string – string to be encoded
- Returns
base64 encoded input
-
schrodinger.application.desmond.packages.restraint.
b64_decode
(input_string: str) → str¶
-
schrodinger.application.desmond.packages.restraint.
get_natoms_in_term
(table_name: str) → int¶ Returns arity (number of atoms for each term) for the with name
table_name
. :param table_name: name of the desmond term table :return: number of atoms for each term
-
schrodinger.application.desmond.packages.restraint.
get_table_schema
(table_name: str)¶ Returns schema for desmond term table with name
table_name
. :param table_name: name of the desmond term table :return: (param_props, table_props) where both param_propsand table_props are frozensets of property name strings
- Return type
tuple(frozenset(str), frozenset(str))
-
class
schrodinger.application.desmond.packages.restraint.
AtomID
(ct: int, atom: int)¶ Bases:
object
Atom is specified by two numbers: ct index and atom index within this ct; ct indices starts from 0; ct == 0 indicates that the atom number is a gid used by desmond backend; ct == 1 is the “full system”; ct >= 2 correspond to the component cts
-
ct
: int¶
-
atom
: int¶
-
__init__
(ct: int, atom: int) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.application.desmond.packages.restraint.
Restraints
(*, text=None, unwanted_tables=None)¶ Bases:
object
Holds restraint terms parameters.
-
__init__
(*, text=None, unwanted_tables=None)¶ - Parameters
text (str or NoneType) – pre-existing restraints (as JSON) to build upon
unwanted_tables (set(str) or NoneType) – names of the tables potentially present within the pre-existing restraints that are to be ignored
-
getTable
(table_name: str) → object¶ Gets parameters table by name.
- Parameters
table_name – name of the desmond term table
- Returns
requested table
- Return type
_GenericParams
or_PosreHarmParams
or_PosreFBHWParams
-
addTerm
(table_name: str, atoms: List[schrodinger.application.desmond.packages.restraint.AtomID], props: dict) → int¶ Adds single restrain term.
table_name is the desmond interaction table, stretch_harm, alchemical_improper_harm etc.
An atom is specified by two numbers, ct number and atom number in ct. ct number starts from 0, that means the atom number is gid used by desmond backend. ct number 1 means full system. ct numbers greater than or equal to 2 mean component cts.
props contain the actual force-field parameters, force constants, equilibrium angles and other parameters that specific to the term, e.g. schedule for alchemical terms
- Parameters
table_name – name of the table, this is one of the term tables supported by desmond
atoms – atom ids
props – dictionary of parameter keyed by name of the parameter (
str
), including both table properties (e.g. schedule) and force field parameter properties.
- Returns
index of the term added
-
toJson
() → str¶ - Returns
json string to be loaded by msys
-
-
class
schrodinger.application.desmond.packages.restraint.
RestraintBuilder
(restraint_terms: schrodinger.utils.sea.sea.List, existing: schrodinger.application.desmond.constants.EXISTING_RESTRAINT, cms_sys: schrodinger.application.desmond.cms.Cms)¶ Bases:
object
-
__init__
(restraint_terms: schrodinger.utils.sea.sea.List, existing: schrodinger.application.desmond.constants.EXISTING_RESTRAINT, cms_sys: schrodinger.application.desmond.cms.Cms)¶ - Parameters
restraint_terms – all restraint terms to be added
existing – One of
constants.EXISTING_RESTRAINT
, determines whether toIGNORE
current restraints and replace them withrestraint_terms
orRETAIN
them and update them withrestraint_terms
.cms_sys – cms object for molecules
-
addRestraints
()¶ Add all restraint terms to the cms object passed in the constructor. This should be the only function called to process all the restraints specified
-
getEncoded
()¶ - Return type
str
-
getJson
()¶ - Return type
str
-
-
class
schrodinger.application.desmond.packages.restraint.
CrossLinkRestraint
(A=None, B=None, C=None, a=None, b=None, c=None)¶ Bases:
object
-
__init__
(A=None, B=None, C=None, a=None, b=None, c=None)¶ A
,B
, andC
are indices of the ligand’s atoms, anda
,b
, andc
are of the receptor’s.
-
asMsjSetting
(fc, sigma, schedule_name, lambda_state)¶ - Parameters
fc (list or tuple with 3 elements) – Force constants of the stretch, the angle, and the dihedral restraints.
sigma (list or tuple with 3 elements) – Sigmas of the stretch, the angle, and the dihedral restraints.
schedule_name (str) – Lambda schedule name of the restraints
lambda_state (int) – Must be either 0 or 1.
0
represent the reference state, whereas1
the mutant state.
- Return type
str
- Returns
Msj settings of the restraints.
-
property
atoms
¶ Returns indices of atoms currently included in this restraint.
-
property
variance
¶ Returns sum of all variances.
-
static
findBest
(model, tr, *, ligand_asl, receptor_asl, r_clone=4, min_angle=10.0, verbose=False, use_bonded_atoms=False) → Optional[schrodinger.application.desmond.packages.restraint.CrossLinkRestraint]¶ Examine the trajectory, and find and return the “best” cross-link restraint between the ligand molecule and the receptor molecule. Three atoms from the ligand molecule and three atoms from the receptor molecule will be selected. We denote the three ligand atoms as A, B, and C, the three receptor atoms as a, b, and c. Relative restraints will be applied to the following geometries:
1 stretch restraint: A-a distance
2 angle restraints: BAa and Aab angles
3 dihedral restraints: CBAa, BAab, Aabc dihedral angles
Only the given ligand atoms (
lig_atoms
) will be considered for the ligand atoms of the restraint, whereas all “protein” atoms will be considered for the receptor atoms of the restraint. We use the ASL expression “protein” to find protein atoms. It’s OK if thelig_atoms
is part of the result of that expression.Caveats: - This won’t work if the receptor is NOT a protein. - We assumed that there are at least 3 atoms in the ligand molecule
and 3 atoms in the receptor molecule(s).
The “best” criteria are the following: 1. To satisfy the requirement of Desmond’s midpoint algorithm, all
atoms are close to each other (i.e., within a sphere of radius of
r_clone
). This is mainly for the efficiency of the Desmond backend.No ill geometries such as colinear structures
The variance of the restraint is the least.
- Parameters
model (cms.Cms) – Simulation system
tr (list[traj.Frame]) – The trajectory to examine
r_clone (float) – Radius of particle / home box visibility (Desmond’s definition). Its value is half of the real space cutoff distance. We use 4 (Angstroms) as a safe default, assuming the cutoff distance is 8 which is a bit less than the typical value. The exact value doesn’t matter, but it’s better to be less as opposed (to greater) than the actual r_clone used in the simulation.
min_angle (
float
) – Mininum angle (in degrees) away from 0 or 180 degrees.use_bonded_atoms – Set to True to choose ‘ABC’ and ‘abc’ atoms that are bonded together and form an angle. The order of the atoms does not matter, just that they are bonded together. Default of False will not place restrictions on how these atoms are connected.
- Parma ligand_asl
ASL expression to specify candidate ligand atoms for the restraint
- Parma receptor_asl
ASL expression to specify candidate receptor atoms for the restraint
- Return type
-
-
schrodinger.application.desmond.packages.restraint.
gen_cross_link_restraint
(model, tr, *, ligand_asl, receptor_asl, r_clone=4, min_angle=10.0, use_bonded_atoms=False) → schrodinger.application.desmond.packages.restraint.CrossLinkRestraint¶ A cross-link restraint comprises one stretch restraint, two angle restraints, and three dihedral restraints between two molecules, which typically are the ligand and the receptor. A cross link restraint will completely restrain the relative distance and orientation of the two molecules.
N.B.: A cross link restraint requires to identify three atoms from the receptor (denoted as a, b, and c), and three from the ligand (denoted as A, B, and C). If any of the two molecules are too small to not even have three non-terminal atoms, this function will NOT work, and a
RuntimeError
exception will be raised. Also the ligand atoms and the receptor atoms should NOT have overlaps, otherwise aRuntimeError
exception will be raised.- Parameters
tr (
list
oftraj.Frame
) – A MD simulation trajectory that we will analyze to find out the optimal 6 atoms and the equilibrium values for the cross-link restraint.use_bonded_atoms – See
CrossLinkRestraint.findBest
for information on this parameter.
- Parma ligand_asl
ASL expression to specify candidate ligand atoms for the restraint
- Parma receptor_asl
ASL expression to specify candidate receptor atoms for the restraint
- Return type
-
class
schrodinger.application.desmond.packages.restraint.
CrossLinkRestraintCentroid
(A=None, B=None, C=None, a=None, b=None, c=None)¶ Bases:
schrodinger.application.desmond.packages.restraint.CrossLinkRestraint
Generate restraints using the centroid method. See
findBest
for more details.-
property
variance
¶ Returns sum of all variances.
-
static
findBest
(cms_model: schrodinger.application.desmond.cms.Cms, tr: List[traj.TrajFrame], *, ligand_asl: str, receptor_asl: str, r_clone=9999, min_angle=45.0) → Optional[CrossLinkRestraint]¶ Generate restraints using the centroid of the binding pocket and the ligand as the basis for the restraint candidates. These candidates are then filtered to pick the one that results in the minimal variance for the restraint terms over the input trajectory.
See
CrossLinkRestraint.findBest
for more details.
-
__init__
(A=None, B=None, C=None, a=None, b=None, c=None)¶ A
,B
, andC
are indices of the ligand’s atoms, anda
,b
, andc
are of the receptor’s.
-
asMsjSetting
(fc, sigma, schedule_name, lambda_state)¶ - Parameters
fc (list or tuple with 3 elements) – Force constants of the stretch, the angle, and the dihedral restraints.
sigma (list or tuple with 3 elements) – Sigmas of the stretch, the angle, and the dihedral restraints.
schedule_name (str) – Lambda schedule name of the restraints
lambda_state (int) – Must be either 0 or 1.
0
represent the reference state, whereas1
the mutant state.
- Return type
str
- Returns
Msj settings of the restraints.
-
property
atoms
¶ Returns indices of atoms currently included in this restraint.
-
property
-
class
schrodinger.application.desmond.packages.restraint.
CrossLinkRestraintInteraction
(A=None, B=None, C=None, a=None, b=None, c=None)¶ Bases:
schrodinger.application.desmond.packages.restraint.CrossLinkRestraint
Generate restraints using the interactions between the receptor and ligand. See
findBest
for more details.-
property
variance
¶ Returns sum of all variances.
-
static
findBest
(msys_model: msys.System, cms_model: schrodinger.application.desmond.cms.Cms, tr: List[traj.TrajFrame], *, ligand_asl: str, receptor_asl: str, min_angle=45.0, freq_cutoff=0.5, max_variance=300, max_dist_variance=0.16000000000000003) → Optional[CrossLinkRestraint]¶ Uses the protein-ligand interactions to determine the cross link restraints. These interactions include hydrogen bonds and salt bridge interactions. The candidates are considered by picking the ones with the most consistent interactions throughout the input trajectory. Then the candidates are filtered based on the sum of the variance for all terms, and the A-a distance variance. Then the candidates are filtered to pick the one that results in the minimal overall variance.
See
CrossLinkRestraint.findBest
for more details.- Parameters
freq_cutoff – Interactions must be present at least this fraction of the trajectory to be considered for the restraint. The default is 0.5.
max_variance – The maximum variance to allow the interaction to be used as the restraint. The default is 300 (mixed units).
max_dist_variance – The maximum variance to allow for the A-a distance. Default is 0.4**2 (in Angstrom**2).
-
__init__
(A=None, B=None, C=None, a=None, b=None, c=None)¶ A
,B
, andC
are indices of the ligand’s atoms, anda
,b
, andc
are of the receptor’s.
-
asMsjSetting
(fc, sigma, schedule_name, lambda_state)¶ - Parameters
fc (list or tuple with 3 elements) – Force constants of the stretch, the angle, and the dihedral restraints.
sigma (list or tuple with 3 elements) – Sigmas of the stretch, the angle, and the dihedral restraints.
schedule_name (str) – Lambda schedule name of the restraints
lambda_state (int) – Must be either 0 or 1.
0
represent the reference state, whereas1
the mutant state.
- Return type
str
- Returns
Msj settings of the restraints.
-
property
atoms
¶ Returns indices of atoms currently included in this restraint.
-
property
-
class
schrodinger.application.desmond.packages.restraint.
FragmentLinkingRestraint
(A: int, B: int, a: int, b: int, Aa: float, BAa: float, Aab: float)¶ Bases:
object
-
__init__
(A: int, B: int, a: int, b: int, Aa: float, BAa: float, Aab: float)¶ Container for the stretch restraint Aa and the angle restraints BAa and Aab. The parameters
A
B
a
andb
are the atom indicies for the restraints.- Parameters
Aa – Value for the stretch restraint in Angstrom.
BAa – Value for the first angle restraint in degrees.
Aab – Value for the second angle restraint in degrees.
-
asMsjSetting
(fc, sigma, schedule_name, lambda_state, atom_asl_dict)¶ - Parameters
fc (list or tuple with 2 elements) – Force constants of the stretch and the angle restraints.
sigma (list or tuple with 2 elements) – Sigmas of the stretch and the angle restraints.
schedule_name (str) – Lambda schedule name of the restraints
lambda_state (int) – Must be 0, 1 or None.
0
means to apply the restraints to the reference state, whereas1
means to apply the restraints to the mutant state.None
means to use regular nonalchemical restraints, which are fixed regardless of lambda.atom_asl_dict (dict) – If not None, specify the atom names ‘A’, ‘B’, ‘a’, ‘b’, as the keys and the corresponding restraint asl as the values. Default of None means to use the atom numbers as the asl.
- Return type
str
- Returns
Msj settings of the restraints.
-
classmethod
findRestraint
(ct, fragment0_asl, fragment1_asl) → schrodinger.application.desmond.packages.restraint.FragmentLinkingRestraint¶ Given a structure and the fragment0_asl/fragment1_asl asls, find the restraint that
minimizes the distance for the stretch term between fragments
maximizes the distance between the stretch term atom, and the atom used for the angle term within each fragment.
-
-
schrodinger.application.desmond.packages.restraint.
gen_cross_link_restraint_centroid
(model: schrodinger.application.desmond.cms.Cms, tr: List[traj.TrajFrame], *, ligand_asl: str, receptor_asl: str, min_angle=45.0) → schrodinger.application.desmond.packages.restraint.CrossLinkRestraintCentroid¶ Generate cross link restraints using the centroid method. See
gen_cross_link_restraint
for more detail.
-
schrodinger.application.desmond.packages.restraint.
gen_cross_link_restraint_interaction
(msys_model: msys.System, model: schrodinger.application.desmond.cms.Cms, tr: List[traj.TrajFrame], *, ligand_asl: str, receptor_asl: str, min_angle=45.0) → schrodinger.application.desmond.packages.restraint.CrossLinkRestraintInteraction¶ Generate cross link restraints looking at hydrogen bonds and salt bridges to determine the atoms to use for the restraint. See
gen_cross_link_restraint
for more detail.- Parameters
msys_model – Msys model used to analyze the trajectory.
-
class
schrodinger.application.desmond.packages.restraint.
PLInteractionAids
(ligand_aid: int, receptor_n_aid: int, receptor_ca_aid: int, receptor_c_aid: int)¶ Bases:
object
-
ligand_aid
: int¶
-
receptor_n_aid
: int¶
-
receptor_ca_aid
: int¶
-
receptor_c_aid
: int¶
-
property
receptor_aids
¶
-
__init__
(ligand_aid: int, receptor_n_aid: int, receptor_ca_aid: int, receptor_c_aid: int) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
-
class
schrodinger.application.desmond.packages.restraint.
CentroidData
(aids: List[int], diff: numpy.ndarray, centroid: numpy.ndarray)¶ Bases:
object
-
aids
: List[int]¶
-
diff
: numpy.ndarray¶
-
centroid
: numpy.ndarray¶
-
__init__
(aids: List[int], diff: numpy.ndarray, centroid: numpy.ndarray) → None¶ Initialize self. See help(type(self)) for accurate signature.
-