schrodinger.application.desmond.packages.restraint.builder 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.builder.GeneratorType(value)¶
Bases:
enum.Enum
An enumeration.
- PRODUCT = 'product'¶
- CONNECTED = 'connected'¶
- schrodinger.application.desmond.packages.restraint.builder.decode_atom_ids(encoded_ids)¶
- schrodinger.application.desmond.packages.restraint.builder.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.builder.get_table_schema(table_name: str)¶
Returns schema for desmond term table with name
table_name
.- Parameters
table_name – name of the desmond term table
- Returns
(param_props, table_props) where both param_props and table_props are frozensets of property name strings
- Return type
tuple(frozenset(str), frozenset(str))
- class schrodinger.application.desmond.packages.restraint.builder.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¶
- static make(v)¶
- __init__(ct: int, atom: int) None ¶
- class schrodinger.application.desmond.packages.restraint.builder.Restraints(*, text=None)¶
Bases:
object
Holds restraint terms parameters. Assumes that “persistent” (aka “permanent”) tables support merging (only “posre_*” at the moment).
- __init__(*, text=None)¶
- Parameters
text (str or NoneType) – pre-existing serialized restraints (as json) to build upon
- getTable(table_name: str, persistent: bool = False) object ¶
Gets parameters table by name.
- Parameters
table_name – name of the desmond term table
persistent – persistent vs regular table
- Returns
requested table
- Return type
_GenericParams
or_PosreHarmParams
or_PosreFBHWParams
- addTerm(table_name: str, atoms: List[schrodinger.application.desmond.packages.restraint.builder.AtomID], props: dict, persistent: bool = False) 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.persistent – is this a persistent term
- Returns
index of the term added
- property has_persistent: bool¶
- toJson() str ¶
- Returns
json string to be loaded by msys
- property has_positional: bool¶
Set to True if the Restraint has any positional restraints.
- class schrodinger.application.desmond.packages.restraint.builder.RestraintBuilder(restraint_terms: schrodinger.utils.sea.sea.List, existing: schrodinger.application.desmond.constants.EXISTING_RESTRAINT, cms_sys: schrodinger.application.desmond.cms.Cms, persistent: bool = False)¶
Bases:
object
- __init__(restraint_terms: schrodinger.utils.sea.sea.List, existing: schrodinger.application.desmond.constants.EXISTING_RESTRAINT, cms_sys: schrodinger.application.desmond.cms.Cms, persistent: bool = False)¶
- 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
persistent – build “persistent” restraints
- 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()¶
Reports restraints built as b64 encoded JSON string.
- Return type
str
- getJson()¶
- Return type
str
- getString(skip_tables=None, **kwargs) str ¶
- Parameters
skip_tables – Skip the listed tables in the result string.
- schrodinger.application.desmond.packages.restraint.builder.generate_conf_pose_restraints(cts, ct_numbers, enable_pose_restraint=False, pose_restraint_cfg=None, pose_restraint_terms=None, enable_conf_restraint=False, conf_restraint_cfg=None, conf_restraint_terms=None)¶
Generate pose and conf restraints according to cfg.
- Parameters
cts (Tuple(structure.Structure, structure.Structure)) – tuple of reference and mutant structures
ct_numbers (Tuple(int, int)) – tuple of reference and mutant ct numbers in the original Maestro file
enable_pose_restraint (bool) – flag for ligand pose restraints
pose_restraint_cfg (Dict) – ligand pose specification
pose_restraint_terms (AlchemicalInteractions.pose_restraint) – dihedrals need to be restrained
enable_conf_restraint (bool) – flag for ligand pose restraints
conf_restraint_cfg (Dict) – conformation specification
conf_restraint_terms (AlchemicalInteractions.conf_restraint) – dihedrals need to be restrained
- Return type
restraint.Restraints
- schrodinger.application.desmond.packages.restraint.builder.has_positional_restraints(model: schrodinger.application.desmond.cms.Cms) bool ¶
Return True if the cms model has positional restraints.