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

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