schrodinger.application.desmond.packages.restrain module¶
This is a module 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
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.desmond.packages.restrain.
Restraints
(existing=None)¶ Bases:
object
-
__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_propsand table_props are frozensets of property name stringsReturn 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
- table_name (
-
toJson
()¶ Returns: json string to be loaded by msys Return type: str
-
static
encode
(input_string)¶ Encodes to a
str
rather thanbytes
so that the result can be set as a string property of a CT.Parameters: input_string ( str
) – string to be encodedReturns: base64 encoded input Return type: str
-
__class__
¶ alias of
builtins.type
-
__delattr__
¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'schrodinger.application.desmond.packages.restrain', '_dummy_msys': <System ''>, '__init__': <function Restraints.__init__>, 'getNatomsInTerm': <staticmethod object>, 'getTableSchema': <staticmethod object>, 'addTable': <function Restraints.addTable>, 'addTerm': <function Restraints.addTerm>, 'toJson': <function Restraints.toJson>, 'encode': <staticmethod object>, 'decode': <staticmethod object>, '__dict__': <attribute '__dict__' of 'Restraints' objects>, '__weakref__': <attribute '__weakref__' of 'Restraints' objects>, '__doc__': None})¶
-
__dir__
() → list¶ default dir() implementation
-
__eq__
¶ Return self==value.
-
__format__
()¶ default object formatter
-
__ge__
¶ Return self>=value.
-
__getattribute__
¶ Return getattr(self, name).
-
__gt__
¶ Return self>value.
-
__hash__
¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
¶ Return self<=value.
-
__lt__
¶ Return self<value.
-
__module__
= 'schrodinger.application.desmond.packages.restrain'¶
-
__ne__
¶ Return self!=value.
-
__new__
()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
()¶ helper for pickle
-
__reduce_ex__
()¶ helper for pickle
-
__repr__
¶ Return repr(self).
-
__setattr__
¶ Implement setattr(self, name, value).
-
__sizeof__
() → int¶ size of object in memory, in bytes
-
__str__
¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
static
decode
(input_string)¶ Parameters: input_string ( str
) – string to be decodedReturns: json string Return type: str
-