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.Restraints(existing=None)

Bases: object

This is a class to generate json for restraint terms. Typical usage:

call getNatomsInterm(table) to get number of atoms in the term call getTableSchema(table) to get property names needed. populate atoms tuple and prop dictionary call addTerm on Restraints instance to add terms call toJson on the Restraints instance to convert all restraints to json

__init__(existing=None)

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

static getNatomsInTerm(table_name)

get arity (number of atoms for each term) for table_name :type table_name: str :param table_name: name of the desmond term table :return: number of atoms for each term :rtype: int

static getTableSchema(table_name)

get schema for table_name :type table_name: str :param table_name: name of the desmond term table :return: (param_props, table_props) where both param_props

and table_props are frozensets of property name strings
Return type:tuple(frozenset, frozenset)
addTable(table_name)

add named table if not there :type table_name: str :param table_name: name of the desmond term table :return: named table if it exists;

otherwise an empty table is created.
Return type:dict
addTerm(table_name, atoms, props)

add one 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 (str) – name of the table, this is one of the term tables supported by desmond
  • atoms (tuple) – tuple of atoms specified ct numbers and atom number tuple (ct, atom number)
  • props (dict) – 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

Return type:

int

toJson()
Returns:json string to be loaded by msys
Return type:str
static encode(input_string)

Encodes to a str rather than bytes so that the result can be set as a string property of a CT.

Parameters:input_string (str) – string to be encoded
Returns:base64 encoded input
Return type:str
static decode(input_string)
Parameters:input_string (str) – string to be decoded
Returns:json string
Return type:str
class schrodinger.application.desmond.packages.restraint.GeneratorTypes(PRODUCT, CONNECTED)

Bases: tuple

CONNECTED

Alias for field number 1

PRODUCT

Alias for field number 0

__contains__

Return key in self.

__init__

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

__len__

Return len(self).

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

schrodinger.application.desmond.packages.restraint.is_position_restraint(table_name)
schrodinger.application.desmond.packages.restraint.is_alchemical(table_name)
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.

class schrodinger.application.desmond.packages.restraint.RestraintBuilder(restraint_terms: schrodinger.utils.sea.List, existing: schrodinger.application.desmond.constants.EXISTING_RESTRAINT, cms_sys: schrodinger.application.desmond.cms.Cms)

Bases: object

__init__(restraint_terms: schrodinger.utils.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 to IGNORE current restraints and replace them with restraint_terms or RETAIN them and update them with restraint_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, and C are indices of the ligand’s atoms, and a, b, and c 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, whereas 1 the mutant state.
Return type:

str

Returns:

Msj settings of the restraints.

atoms

Returns indices of atoms currently included in this restraint.

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)

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 the lig_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.
  1. No ill geometries such as colinear structures
  2. 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:

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 a RuntimeError exception will be raised.

Parameters:
  • tr (list of traj.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:

CrossLinkRestraint

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 and b 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, whereas 1 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

  1. minimizes the distance for the stretch term between fragments
  2. maximizes the distance between the stretch term atom, and the atom used for the angle term within each fragment.