schrodinger.application.matsci.desmondutils module

Utilities for working with Desmond.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.desmondutils.make_chorus_orthorhombic(struct)

Zero out all the non-diagonal Chorus box properties. The main use of this function is to remove numerical imprecision in the off-diagonal elements that causes Desmond to consider the box triclinic. The function returns the largest off-diagonal element pre-zeroing so the calling routine can decide what to do (warn user, etc) if the off-diagonals looked large enough to be intentionally non-zero.

Parameters:struct (schrodinger.structure.Structure) – The structure whose Chorus box properties should be modified
Return type:float
Returns:The absolute value of the largest off-diagonal element before zeroing
schrodinger.application.matsci.desmondutils.has_orthorhombic_pbc(struct, tolerance=0.0)

Detect if the given structure has a PBC that is orthorhombic (all angles are 90 degrees).

Parameters:
Return type:

bool

Returns:

True if a PBC exists and it is orthorhombic

schrodinger.application.matsci.desmondutils.determine_box_size(struct)

Determine the size of a cubic box that encloses the entire structure

Parameters:struct (schrodinger.structure.Structure) – The structure to use in determining the box size.
Return type:float
Returns:The largest span in the X, Y or Z direction
schrodinger.application.matsci.desmondutils.add_cubic_chorus_box_props(struct)

Add the Chorus box properties to the structure for a cubic box

Parameters:struct (schrodinger.structure.Structure) – The structure to add the properties to
schrodinger.application.matsci.desmondutils.store_chorus_box_props(struct, ax, ay=0.0, az=0.0, bx=0.0, by=None, bz=0.0, cx=0.0, cy=0.0, cz=None)

Add properties to the structure that define the periodic boundary condition in the way Desmond wants it defined.

Parameters:struct (schrodinger.structure.Structure) – The structure to add the properties to

@ax: float :param ax: The value of the ax box property

@ay: float :param ay: The value of the ay box property. Defaults to 0.

@az: float :param az: The value of the az box property. Defaults to 0.

@bx: float :param bx: The value of the bx box property. Defaults to 0.

@by: float :param by: The value of the by box property. If not given, this value is set

the same as ax.

@bz: float :param bz: The value of the bz box property. Defaults to 0.

@cx: float :param cx: The value of the cx box property. Defaults to 0.

@cy: float :param cy: The value of the cy box property. Defaults to 0.

@cz: float :param cz: The value of the cz box property. If not given, this value is set

the same as ax.
schrodinger.application.matsci.desmondutils.has_chorus_box_props(struct)

Check if the structure has all the Chorus box properties

Parameters:struct (schrodinger.structure.Structure) – The structure to check for properties
Return type:bool
Returns:Whether the structure has all the chorus box properties
schrodinger.application.matsci.desmondutils.has_space_group_pbc_props(struct)

Check if the structure has all the space group PBC properties

Parameters:struct (schrodinger.structure.Structure) – The structure to check for properties
Return type:bool
Returns:Whether the structure has all the space group pbc properties
schrodinger.application.matsci.desmondutils.is_opls3_model(model)

Check if the given Cms model was made with OPLS3

Parameters:model (schrodinger.application.desmond.cms.Cms) – The cms model to check
Return type:bool
Returns:True if OPLS3 was detected, False if not
schrodinger.application.matsci.desmondutils.is_opls2005_model(model)

Check if the given Cms model was made with OPLS_2005

Parameters:model (schrodinger.application.desmond.cms.Cms) – The cms model to check
Return type:bool
Returns:True if OPLS_2005 was detected, False if not
schrodinger.application.matsci.desmondutils.get_model_ff_name(model)

If possible detect what force field the model was created with

Parameters:model (schrodinger.application.desmond.cms.Cms) – The cms model to check
Return type:str
Returns:The name of the detected forcefield or and empty string if no known force field was detected. FF names are the module constants OPLS3 or OPLS2005
schrodinger.application.matsci.desmondutils.write_builder_input(struct, out_name, forcefield='OPLS_2005', rezero_system=True, split_components=False)

Write input for the Desmond System Builder

Parameters:
  • struct (schrodinger.structure.Structure) – The structure to run the system builder on
  • out_name (str) – The base name for the output files
  • forcefield (str) – The forcefield to use
  • rezero_system (bool) – Whether to move the center of mass to the origin
  • split_components (bool) – Whether to split system in components in the system build
Return type:

(str, str)

Returns:

The names of the .msj and .mae files that were created

schrodinger.application.matsci.desmondutils.remove_fatal_atom_properties(struct, fatal_atom_properties)

Remove atom properties from struct that cause the system builder to fail

Parameters:struct (schrodinger.structure.Structure) – The structure to remove atom properties from
schrodinger.application.matsci.desmondutils.copy_atom_properties(struct1, struct2, atom_props)
Parameters:
schrodinger.application.matsci.desmondutils.run_system_builder(struct_in, output_basename, forcefield='OPLS_2005', rezero_system=True, logger=None, copy_output=True, fatal_atom_properties=['i_ffio_grp_ligand', 'i_ffio_grp_energy', 'i_psp_parent', 'f_psp_parent', 's_psp_parent'], check_infinite=True, split_components=False)

Run the Desmond multisim system builder

Parameters:
  • struct_in (schrodinger.structure.Structure) – The structure to run the system builder on. If the chorus box properties are not set to define the periodic boundary condition, a cubic PBC will be imposed based on the largest span of the X, Y or Z coordinates.
  • output_basename (str) – The base name of the output file
  • forcefield (str) – The name of the force field to use. The default is ‘OPLS_2005’. Note that any custom directory needed for OPLS3 is taken care of via the runtime environment as long as the script was launched via launcher with the oplsdir argument.
  • rezero_system (bool) – Whether to move the center of mass to the origin
  • logger (logging.Logger) – The logger to use to record any messages. If None, the messages are printed.
  • copy_output (bool) – specifies to copy output files back to the launch directory by adding them to the job control backend
  • fatal_atom_properties (tuple of strings) – Properties to remove from structure
  • check_infinite (bool) – check whether the input structure is infinitely bonded and if so then set the periodic fix flag on the structure
  • split_in_components – Whether to split system in components in the system build
Return type:

str or None

Returns:

The name of the resulting .cms file, or None if the file was not produced successfully

schrodinger.application.matsci.desmondutils.find_forcefield_invalid_structures(structs, ffield_num)

Check structures to see if the specified forcefield is valid for them

Parameters:
Return type:

list

Returns:

A list containing all the structures that fail the force field test. The list is empty if all structures are valid for the force field

schrodinger.application.matsci.desmondutils.validate_ff_name_and_get_number(name)

Check that the given name is a valid force field name and if so, return the mmffld number associated with that name

Parameters:name (str) – The force field name to check
Return type:(str or None, int)
Returns:The first item is an error message if an error occurred. The second item is the mmffld integer for the given forcefield, or 0 if an error occurred.
schrodinger.application.matsci.desmondutils.read_density_from_eaf(density_eaf, fraction=0.2, logger=None)

Reads in a .eaf file generated by an ms_analysis stage of a Desmond MD run and returns density data.

Parameters:
  • density_eaf (str) – EAF file containing density information
  • fraction (float) – The last fraction of the frames to use in the density averaging
  • logger (logging.Logger) – The logger to use while logging errors. If not supplied, messages will be printed.
Return type:

(None, None), or (float, float)

Returns:

(None, None) if the density cannot be read from the file, or tuple of the calculated density and standard deviation.

schrodinger.application.matsci.desmondutils.get_bigger_rclone_setting(for_gpu, check_cg=None)

We use bigger_rclone = true for all non-gpu jobs

Parameters:
  • for_gpu (bool) – True if this is for a cpu run, False if not
  • check_cg (schrodinger.structure.Structure) – Check the given structure to see if it is coarse grain and return the value appropriate for coarse grain structures.
Return type:

str

Returns:

The value to set bigger_rclone to in the .msj file

schrodinger.application.matsci.desmondutils.get_periodic_fix_msj_header(struct)

Get periodic fix settings string if structure is infinite, this should be added to task block.

Parameters:struct (schrodinger.structure.Structure) – Check the given structure to see if it is infinite and return the value appropriate for infinite structures.
Returns:Family header with periodic fix settings
Return type:str
class schrodinger.application.matsci.desmondutils.MSJStringer(stype, last=False, use_base=True, **kwargs)

Bases: object

A base class for setting up the information and generating a string describing that information for a stage in a Desmond MSJ file.

DOT = '_dot_'
MAX_STEPS = 'max_steps'
TIME = 'time'
TEMP = 'temperature'
SEED = 'randomize_velocity.seed'
PRESSURE = 'pressure'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
TIMESTEP = 'timestep'
JOBNAME = 'jobname'
CHECKPOINT = 'checkpt.write_last_step'
DIR = 'dir'
COMPRESS = 'compress'
INTERVAL = 'trajectory_dot_interval'
ANALYSIS_TYPE = 'analysis_type'
OTHERS = 'othertag'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
MINIMIZE = 'minimize'
SIMULATE = 'simulate'
ANALYSIS = 'matsci_analysis'
SYSBUILD = 'assign_forcefield'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
PADDING = ' '
INDENT = ' '
__init__(stype, last=False, use_base=True, **kwargs)

Create a MSJStringer object

Parameters:
  • stype (str) – The type of stage this is. Should be one of the class constants MINIMIZE, SIMULATE, SYSBUILD or ANALYSIS
  • last (bool) – Whether the msj lines typically associated with the last stage (dir, compress) should be included
  • use_base (bool) – Whether the base msj lines (jobname, checkpoint) that are common to almost all stages should be included.

All other keyword arguments are turned into lines in the .msj file. Keys that have a ‘.’ in them should have that . replaced with the class constant string DOT (_dot_). For instance to include a line setting trajectory.write_velocity to true, use the keyword argument trajectory_dot_write_velocity=’true’

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

getTitle()

This function returns a title for the stage describing the main parameters. The default implementation has no title.

Return type:str
Returns:The title for this stage
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n A base class for setting up the information and generating a string\n describing that information for a stage in a Desmond MSJ file.\n ', 'DOT': '_dot_', 'MAX_STEPS': 'max_steps', 'TIME': 'time', 'TEMP': 'temperature', 'SEED': 'randomize_velocity.seed', 'PRESSURE': 'pressure', 'ENSEMBLE': 'ensemble', 'ENSEMBLE_CLASS': 'ensemble.class', 'ENSEMBLE_METHOD': 'ensemble.method', 'TIMESTEP': 'timestep', 'JOBNAME': 'jobname', 'CHECKPOINT': 'checkpt.write_last_step', 'DIR': 'dir', 'COMPRESS': 'compress', 'INTERVAL': 'trajectory_dot_interval', 'ANALYSIS_TYPE': 'analysis_type', 'OTHERS': 'othertag', 'MSJ_BASE': OrderedDict([('jobname', '"$MASTERJOBNAME"'), ('checkpt.write_last_step', 'yes')]), 'MSJ_LAST': {'dir': '"."', 'compress': '""'}, 'LINE_ORDER': ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step'], 'KNOWN_LINES': {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}, 'MINIMIZE': 'minimize', 'SIMULATE': 'simulate', 'ANALYSIS': 'matsci_analysis', 'SYSBUILD': 'assign_forcefield', 'SETTINGS': {'minimize': <schrodinger.utils.sea.Map object>, 'simulate': <schrodinger.utils.sea.Map object>, 'matsci_analysis': None, 'assign_forcefield': None}, 'PADDING': ' ', 'INDENT': ' ', '__init__': <function MSJStringer.__init__>, 'createString': <function MSJStringer.createString>, 'formLine': <function MSJStringer.formLine>, 'getTitle': <function MSJStringer.getTitle>, '__dict__': <attribute '__dict__' of 'MSJStringer' objects>, '__weakref__': <attribute '__weakref__' of 'MSJStringer' objects>})
__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.matsci.desmondutils'
__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)

class schrodinger.application.matsci.desmondutils.MinimizeMSJStringer(iterations=None, last=False, **kwargs)

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for Minimizer stages

__init__(iterations=None, last=False, **kwargs)

Create a MinimizeMSJStringer object

Parameters:
  • last (bool) – Whether the msj lines typically associated with the last stage (dir, compress) should be included
  • iterations (int) – The number of iterations. If not provided the Desmond default will be used.

All other keyword arguments are turned into lines in the .msj file. See parent class for additional information.

getTitle()

Return a title for the stage describing the main parameters.

Return type:str
Returns:The title for this stage
ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
MAX_STEPS = 'max_steps'
MINIMIZE = 'minimize'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
OTHERS = 'othertag'
PADDING = ' '
PRESSURE = 'pressure'
SEED = 'randomize_velocity.seed'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n An MSJStringer class for Minimizer stages\n ', '__init__': <function MinimizeMSJStringer.__init__>, 'getTitle': <function MinimizeMSJStringer.getTitle>})
__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.matsci.desmondutils'
__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)

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

class schrodinger.application.matsci.desmondutils.MDMSJStringer(time=None, temp=None, pressure=None, random_seed=None, ensemble='NPT', method=None, timestep=None, last=False, **kwargs)

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for Molecular Dynamics stages

__init__(time=None, temp=None, pressure=None, random_seed=None, ensemble='NPT', method=None, timestep=None, last=False, **kwargs)

Create a MDMSJStringer object

Any keyword that does not have a value supplied will use the default Desmond value for MD simulations.

Parameters:
  • time (float) – Time in picoseconds
  • temp (float) – Temperature in Kelvin
  • pressure (float) – The pressure in bar
  • random_seed (int) – The seed for the random number generator
  • ensemble (str) – Valid Desmond ensemble such as NPT, NVT
  • method (str) – Valid Desmond ensemble method such as NH, Berendson, Langevin
  • timestep (int or float or str or list) – The timestep in picoseconds, either as a list of three floats or a string. If a string, it is used directly so must be in the proper [ x y z ] format used in .msj and .cfg files. If float or int, string of the format will be generated [timestep timestep timestep * 3.]
  • last (bool) – Whether the msj lines typically associated with the last stage (dir, compress) should be included

All other keyword arguments are turned into lines in the .msj file. See parent class for additional information.

getTitle()

Return a title for the stage describing the main parameters.

Return type:str
Returns:The title for this stage
ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
MAX_STEPS = 'max_steps'
MINIMIZE = 'minimize'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
OTHERS = 'othertag'
PADDING = ' '
PRESSURE = 'pressure'
SEED = 'randomize_velocity.seed'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n An MSJStringer class for Molecular Dynamics stages\n ', '__init__': <function MDMSJStringer.__init__>, 'getTitle': <function MDMSJStringer.getTitle>})
__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.matsci.desmondutils'
__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)

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

class schrodinger.application.matsci.desmondutils.MSAnalysisMSJStringer(analysis_type=None, **kwargs)

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for MS MD Analysis stages

__init__(analysis_type=None, **kwargs)

Create a MSAnalysisMSJStringer object

Any keyword that does not have a value supplied will use the default Desmond value for MD simulations.

Parameters:analysis_type (str) – A string in the form of [ property property ] that lists the properties to be computed in the analysis.

All other keyword arguments are turned into lines in the .msj file. See parent class for additional information.

getTitle()

Return a title for the stage describing the main parameters.

Return type:str
Returns:The title for this stage
ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
MAX_STEPS = 'max_steps'
MINIMIZE = 'minimize'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
OTHERS = 'othertag'
PADDING = ' '
PRESSURE = 'pressure'
SEED = 'randomize_velocity.seed'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n An MSJStringer class for MS MD Analysis stages\n ', '__init__': <function MSAnalysisMSJStringer.__init__>, 'getTitle': <function MSAnalysisMSJStringer.getTitle>})
__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.matsci.desmondutils'
__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)

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

class schrodinger.application.matsci.desmondutils.BrownieMSJStringer(time=100.0, temp=10.0, random_seed=None, timestep='[0.001 0.001 0.003]', last=False, **kwargs)

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for Brownie stages

__init__(time=100.0, temp=10.0, random_seed=None, timestep='[0.001 0.001 0.003]', last=False, **kwargs)

Create a BrownieMSJStringer object

Desmond config does not have a specific set of defaults for Brownie stages, so the defaults are supplied here for all keywords.

Parameters:
  • time (float) – Time in picoseconds
  • temp (float) – Temperature in Kelvin
  • random_seed (int) – The seed for the random number generator
  • timestep (str or list) – The timestep in picoseconds, either as a list of three floats or a string. If a string, it is used directly so must be in the proper [ x y z ] format used in .msj and .cfg files.
  • last (bool) – Whether the msj lines typically associated with the last stage (dir, compress) should be included

All other keyword arguments are turned into lines in the .msj file. See parent class for additional information.

formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

getTitle()

Return a title for the stage describing the main parameters.

Return type:str
Returns:The title for this stage
ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
MAX_STEPS = 'max_steps'
MINIMIZE = 'minimize'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
OTHERS = 'othertag'
PADDING = ' '
PRESSURE = 'pressure'
SEED = 'randomize_velocity.seed'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n An MSJStringer class for Brownie stages\n ', '__init__': <function BrownieMSJStringer.__init__>, 'formLine': <function BrownieMSJStringer.formLine>, 'getTitle': <function BrownieMSJStringer.getTitle>})
__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.matsci.desmondutils'
__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)

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
class schrodinger.application.matsci.desmondutils.SysbuildMSJStringer(forcefield='OPLS_2005', compress='""', **kwargs)

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for building systems

__init__(forcefield='OPLS_2005', compress='""', **kwargs)

Create a SysbuildMSJStringer object

Parameters:forcefield (str) – The forcefield to use

All other keyword arguments are turned into lines in the .msj file. See parent class for additional information.

ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'time', 'ensemble.class', 'max_steps', 'timestep', 'checkpt.write_last_step', 'ensemble.method', 'compress', 'ensemble', 'temperature', 'pressure', 'randomize_velocity.seed', 'othertag', 'dir', 'trajectory_dot_interval', 'jobname'}
LINE_ORDER = ['max_steps', 'analysis_type', 'time', 'timestep', 'ensemble', 'ensemble.class', 'ensemble.method', 'temperature', 'pressure', 'trajectory_dot_interval', 'randomize_velocity.seed', 'othertag', 'jobname', 'dir', 'compress', 'checkpt.write_last_step']
MAX_STEPS = 'max_steps'
MINIMIZE = 'minimize'
MSJ_BASE = {'checkpt.write_last_step': 'yes', 'jobname': '"$MASTERJOBNAME"'}
MSJ_LAST = {'compress': '""', 'dir': '"."'}
OTHERS = 'othertag'
PADDING = ' '
PRESSURE = 'pressure'
SEED = 'randomize_velocity.seed'
SETTINGS = {'assign_forcefield': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.Map object at 0x7f9c3ce5cf28>, 'simulate': <schrodinger.utils.sea.Map object at 0x7f9c3cee1a58>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.desmondutils', '__doc__': '\n An MSJStringer class for building systems\n ', '__init__': <function SysbuildMSJStringer.__init__>})
__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.matsci.desmondutils'
__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)

createString()

Create and return the string that represents this stage in the .msj file

Return type:str
Returns:The msj string representing this stage
formLine(key, value)

Create the line that should go in the .msj file for this key.

Subclasses should use this function to create custom strings for specific key values

Parameters:
  • key (str) – Typically, the string before the key = value pair on an msj line.
  • value (str) – Typically, the string after the key = value pair on an msj line.
Return type:

str

Returns:

The line (or lines) to put in the .msj file for this key/value pair

getTitle()

This function returns a title for the stage describing the main parameters. The default implementation has no title.

Return type:str
Returns:The title for this stage
schrodinger.application.matsci.desmondutils.create_msj(stringers, filename=None, task_stage=True, extra_task_text='', check_cg=None, check_infinite=None)

Write a Desmond .msj file based on the supplied stringers

Parameters:
  • filename (str) – If given, write the msj string to this path
  • stringers (list of MSJStringer objects) – Each item of the list is the MSJStringer for a single stage. The stages will be written in list order
  • task_stage (bool) – Whether the traditional desmond auto task stage should be written before the stages in stringers
  • extra_task_text (str) – Additional text to place in the task stage. Ignored if task_stage=False.
  • check_cg (schrodinger.structure.Structure) – Check the given structure to see if it is coarse grain. If it is, add the typical headers for the appropriate coarse grain structure type. Note that the interplay between extra_task_test and the headers used for coarse grain structures is uncertain and left to the caller to determine if the results are acceptable if both are used. Ignored if task_stage=False.
  • check_infinite (schrodinger.structure.Structure) – Check the given structure to see if it is infinite. If it is, add the typical headers for the infinite systems. Ignored if task_stage=False.
Return type:

str

Returns:

The string that was written to the file

schrodinger.application.matsci.desmondutils.get_multisim_command(input_name, output_name, msj_name=None, job_name=None, gpu=False, procs=1, for_shell=False)

Return a command to run the Desmond multisim utility

Parameters:
  • input_name (str) – The name of the input file
  • output_name (str) – The name to use for the output CMS file
  • msj_name (str) – The name of the .msj command file
  • job_name (str) – The name to use for the job
  • gpu (bool) – Whether the job will run on gpu. Will override the procs keyword
  • procs (int) – The number of CPU processors to use. Will not be used if gpu=True
  • for_shell (bool) – True if this will be used directly in a shell, such as when a panel writes a .sh file or used via subprocess. False if the command will be issued via normal Schrodinger job launching. If True, $SCHRORDINGER will be prepended to the command.
Return type:

list

Returns:

The command line command to use

schrodinger.application.matsci.desmondutils.get_default_near_timestep()

Return the default near timestep

Returns:Default near timestep in femtoseconds
Return type:float
schrodinger.application.matsci.desmondutils.get_default_far_timestep()

Return the default far timestep

Returns:Default far timestep in femtoseconds
Return type:float
schrodinger.application.matsci.desmondutils.add_cms_property(cms, propname, value)

Add or change a property of cms model

Parameters:
  • cms (cms.Cms) – cms model
  • propname (str) – property name
  • value (str, int, or float) – value of the property
schrodinger.application.matsci.desmondutils.delete_cms_property(cms, propname)

Delete a property from a cms model

Parameters:
  • cms (cms.Cms) – cms model
  • propname (str) – property name
schrodinger.application.matsci.desmondutils.parse_ene_file(filename=None, fileobj=None, prop=None, gcmc=False)

Parse data from a Desmond .ene file. All the data from the file can be returned in a dictionary, or just the data from a single property can be returned in a list.

Parameters:
  • filename (str) – The name of the .ene file to read
  • fileobj (file or io.BufferedReader) – The open file object for the .ene file. Only one of filename or fileobj should be supplied. If both are given, filename will take precedence. io.BufferedReader objects come from tarfile.extractfile, for instance. Note - in Python 3, open file objects are io.TextIOWrapper
  • prop (str) – If given, should match one of the properties in the ene file header (such as ‘V’). The return value will be a list of values for this property only
  • gcmc (bool) – Whether to parse GMCM or a standard MD file
Return type:

dict, dict, or list, list or dict or list

Returns:

If prop is not specified, the return value is a dict if gcmc is False, otherwise two dicts. Keys are property names from the ene header (without units, such as ‘V’) and values are lists of floating point values for that property in the order obtained from the .ene file. If prop is specified, the return value is a list if gcmc is False, otherwise two lists of those property values in the order found in the .ene file.

Raises:
  • ValueError – If a line of unknown format is found while reading the file, or if neither filename or fileobj is specified.
  • TypeError – If prop is supplied but does not match a property in the header line
schrodinger.application.matsci.desmondutils.get_density_from_ene(ene_file, struct, fraction=0.2)

Parse the volume from the ene file and compute the density from it. The density is averaged over the last fraction of frames.

Parameters:
  • ene_file (str) – The name of the file to read in.
  • struct (schrodinger.structure.Structure) – The structure to compute the density for
  • fraction (float) – The fraction of frames to average the density over. For instance, use 0.20 to compute the density over the final 20% of frames. Use the special value 0 to just use the final density. With fraction=0, the returned standard deviation is 0.
Return type:

(float, float)

Returns:

The mean density and standard deviation of the density.

Raises:

IOError – If unable to read the volumes from the ene file

schrodinger.application.matsci.desmondutils.update_pdb_pbc(icms_obj=None, icms_file=None, ocms_file=None)

Update the PDB PBC properties given a cms-type input.

Parameters:
  • icms_obj (cms.Cms or None) – input cms.Cms object or None if icms_file is given instead
  • icms_file (str or None) – input .cms file name or None if icms_obj is given instead
  • ocms_file (str or None) – if provided the updated cms.Cms will be written to this file, if None then no file will be written
Raises:

RuntimeError – if there is a problem with the input

Return type:

cms.Cms

Returns:

the updated cms.Cms

schrodinger.application.matsci.desmondutils.get_desmond_trj_frames(cms_path=None, traj_dir=None)

Yield a desmond trajectory frame by frame. The memory taken by the previous frame is released before yielding the next one.

Parameters:
  • cms_path (str or None) – path to the CMS file
  • traj_dir (str or None) – path to trajectory dir
Raises:

RuntimeError – if there is a problem with the input

Return type:

iterator(schrodinger.application.desmond.packages.traj.frame)

Returns:

an iterator for a trajectory frame

schrodinger.application.matsci.desmondutils.get_ptensor_from_enegrp(enegrp_fn, percent_to_avg, log=<built-in function print>)

Extract and calculate average pressure from an energy group file.

Parameters:
  • enegrp_fn (str) – Energy group filename
  • percent_to_avg (float) – Percent to use when averaging pressure tensor
  • log (method) – Log method
Return type:

numpy.array()

Returns:

Averaged pressure tensor

schrodinger.application.matsci.desmondutils.modify_cms_box(model, new_box)

Modify CMS box using values from new_box. Atom coordinates in the model are scaled proportionally to fit the new box.

Parameters:
  • model (cms.Cms) – model to modify
  • new_box (list) – New box values (9 total)