schrodinger.application.matsci.desmondutils module

Utilities for working with Desmond.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.desmondutils.ENEGRP_VALUE(time, value)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

time

Alias for field number 0

value

Alias for field number 1

schrodinger.application.matsci.desmondutils.make_chorus_orthorhombic(struct)[source]

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)[source]

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.might_be_system(structs)[source]

Check if we’re using a Desmond system or system is infinite.

Parameters

structs (iterable) – Each item should be a structure.Structure object

Return type

bool or str

Returns

False if none of the structures are infinite or Desmond systems. An error message is returned if at least one such structure is detected

schrodinger.application.matsci.desmondutils.determine_box_size(struct)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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)[source]

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.are_isomers_conn(struct1, struct2)[source]

Compare struct1 with struct2 to see if their ‘connectivity’ is the same. Returns True only if ct1 and ct2 have same: 1) #atoms; 2) types; 3) bonds; and 4) bond orders.

Parameters
Return type

bool

Returns

True if structures are equivalent, False otherwise

schrodinger.application.matsci.desmondutils.copy_atom_properties(struct1, struct2, atom_props)[source]
Parameters
schrodinger.application.matsci.desmondutils.get_npseudos_per_molecule(comp_ct)[source]

Get number of pseudo atoms per molecule.

Parameters

comp_ct (FFIOSTructure) – CMS component

Return type

int

Returns

Number of pseudo atoms in the first molecule of the component

schrodinger.application.matsci.desmondutils.get_molecules_pseudos(comp_ct, molecules)[source]

Given component and molecules indices return the corresponding pseudo indices.

Parameters
  • comp_ct (FFIOSTructure) – CMS component

  • molecules (list) – List of molecules indices

Return type

set[int]

Returns

Set of pseudo atoms indices

schrodinger.application.matsci.desmondutils.extend_comp(comp_ct, struct)[source]

Given a component (comp_ct) with possible some pseudo atoms, extend it with struct (must be the same isomers, NUM_COMPONENT == 1 is enforced).

Parameters
  • comp_ct (FFIOSTructure) – CMS component

  • npseudos (int) – Number of pseudo atoms in the first molecule of the component

  • struct (structure.Structure) – Structure to extend the component with

class schrodinger.application.matsci.desmondutils.SystemBuilder(struct, 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', 'i_matsci_orig_resnum'], check_infinite=True, split_components=False, water_fftype='SPC', use_viparr=False, set_incorporation=True, wam_type=None)[source]

Bases: object

__init__(struct, 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', 'i_matsci_orig_resnum'], check_infinite=True, split_components=False, water_fftype='SPC', use_viparr=False, set_incorporation=True, wam_type=None)[source]
Parameters
  • struct (schrodinger.structure.Structure) – The structure to run the system builder on.

  • 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 non-error 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) – request assign is_infinite during FF assignment

  • split_components (bool) – Whether to split system in components in the system build

  • water_fftype (str) – the force field type for water solute. Must be a key in the WATER_FFTYPES dictionary.

  • use_viparr (bool) – Whether to use viparr for water model assignment

  • set_incorporation (bool) – Set the cms as the incorporated structure when set_incorporation=True and copy_output=True

  • wam_type (int or None) – One of the enums defined in workflow_action_menu.h if the results should have a Workflow Action Menu in Maestro

run()[source]

Prepare and run the desmond system builder

Raises

FileNotFoundError – If the certain files cannot be found.

cleanAtomProperties()[source]

Clean atom properties that cause the system builder to fail

setChorusBoxProps()[source]

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.

cleanStructProperties()[source]

Romove or re-assign the structure-level properties that causes issues.

setAtomCharges()[source]

Set the charge1 and charge2 to not all zeros, if custom charges exist.

Unroll custom charge to charge1 and charge2 (should remove this when DESMOND-9274 is in)

setForceFieldDir()[source]

Set custom OPLS directory, if any

centerStruct()[source]

Translate the whole structure so that the centroid is at the origin.

splitComponents()[source]

Each list in Component cts contains isomers.

writeMae()[source]

Write out the mae file for Desmond forceField assignment input.

Raises

FileNotFoundError – if input files for desmond assign forcefield stage cannot be generated.

writeMsj()[source]

Write out the msj file for Desmond forceField assignment input.

runForceFieldAssignment()[source]

Run the desmond assign forcefield stage.

addFilesToBackend()[source]

Add intermediate and final files to backend.

postProcessCms()[source]

Post process of desmond cms output.

Raises

FileNotFoundError – If the cms cannot be found.

prepareWaterModel(struct)[source]

Modify atom properties for force field assignment.

Parameters

struct (schrodinger.structure.Structure) – The structure whose atom properties to be modified. Must be one component (all molecules of the same type)

schrodinger.application.matsci.desmondutils.run_system_builder(*args, **kwargs)[source]

Run the Desmond multisim system builder.

See SystemBuilder for argument documentation.

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)[source]

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)[source]

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)[source]

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_task_stage(extra_task_text='', check_cg=None, check_infinite=None, msj_string_header='', remove_com_motion=None)[source]

Get desmond task stage.

Parameters
  • 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.

  • msj_string_header (when extra_task_text is empty, use this string as the header of the output msj) – str

  • remove_com_motion (bool) – None - default behavior, add remove_com_motion only to infinite atomic systems, if True add plugin to msj regardless. If False don’t add remove_com_plugin

Return type

str

Returns

Task stage

schrodinger.application.matsci.desmondutils.validate_box_size(model, temp=300.0, simple=True)[source]

Validate model or structure box (lattice) size.

Parameters
  • model (cms.Cms or structure.Structure) – Desmond model or structure. For structure chorus properties must be set

  • temp (float) – Temperature in K

  • simple (bool) – If true, run an empirical test based on the lattice constants

Return bool

True if cell is valid for Desmond, False otherwise

class schrodinger.application.matsci.desmondutils.MSJStringer(stype, last=False, use_base=True, **kwargs)[source]

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'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
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', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
MINIMIZE = 'minimize'
SIMULATE = 'simulate'
ANALYSIS = 'matsci_analysis'
SYSBUILD = 'assign_forcefield'
AVE_CELL = 'average_cell'
EN_ANALYSIS = 'analysis'
CONCATENATE = 'concatenate'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
PADDING = ' '
INDENT = ' '
__init__(stype, last=False, use_base=True, **kwargs)[source]

Create a MSJStringer object

Parameters
  • stype (str) – The type of stage this is. Should be one of the class constants MINIMIZE, SIMULATE, SYSBUILD, ANALYSIS, or AVE_CELL

  • 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(concatenate=False)[source]

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

Return type

str

Returns

The msj string representing this stage

formLine(key, value)[source]

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()[source]

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 schrodinger.application.matsci.desmondutils.MinimizeMSJStringer(iterations=None, last=False, **kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for Minimizer stages

__init__(iterations=None, last=False, **kwargs)[source]

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()[source]

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'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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.AveCellMSJStringer(**kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for post average cell stage.

PERCENT_TO_AVG = 'percent_to_avg'
__init__(**kwargs)[source]

Create a MSJStringer object

Parameters
  • stype (str) – The type of stage this is. Should be one of the class constants MINIMIZE, SIMULATE, SYSBUILD, ANALYSIS, or AVE_CELL

  • 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’

getTitle()[source]

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

ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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.AnalysisMSJStringer(**kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for the analysis stage.

__init__(**kwargs)[source]

Create a MSJStringer object

Parameters
  • stype (str) – The type of stage this is. Should be one of the class constants MINIMIZE, SIMULATE, SYSBUILD, ANALYSIS, or AVE_CELL

  • 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’

ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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 schrodinger.application.matsci.desmondutils.MDMSJStringer(time=None, temp=None, pressure=None, random_seed=None, ensemble='NPT', method=None, timestep=None, last=False, **kwargs)[source]

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)[source]

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. If a string, will be treated as a float if it converts to float without error, otherwise it is used directly so must be in the proper [ x y z ] format used in .msj and .cfg files. If float or int, a string of the following format will be generated [ timestep timestep timestep * 3. ] If a list, the items will be converted to a string list of [ x y z ]

  • 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()[source]

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'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for MS MD Analysis stages

__init__(analysis_type=None, **kwargs)[source]

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()[source]

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'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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, ensemble='NVT', timestep='[ 0.001 0.001 0.003 ]', delta_max=0.1, btau=None, ttau=None, **kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MDMSJStringer

An MSJStringer class for Brownie stages

__init__(time=100.0, temp=10.0, ensemble='NVT', timestep='[ 0.001 0.001 0.003 ]', delta_max=0.1, btau=None, ttau=None, **kwargs)[source]

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
  • delta_max (float) – The value of delta_max

  • btau (float) – The value of the barostat tau

  • ttau (float) – The value of the thermostat tau

See parent class for additional information.

getTitle()[source]

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'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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.SysbuildMSJStringer(forcefield='OPLS_2005', compress='""', **kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for building systems

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

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'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

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 schrodinger.application.matsci.desmondutils.ConcatMSJStringer(**kwargs)[source]

Bases: schrodinger.application.matsci.desmondutils.MSJStringer

An MSJStringer class for the concatenate stage.

STAGES = 'stages'
__init__(**kwargs)[source]

Create a MSJStringer object

Parameters
  • stype (str) – The type of stage this is. Should be one of the class constants MINIMIZE, SIMULATE, SYSBUILD, ANALYSIS, or AVE_CELL

  • 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’

formLine(key, value)[source]

Create the line that should go in the .msj file for the ‘stages’ key. Parent function creates strings for all other keys.

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

ANALYSIS = 'matsci_analysis'
ANALYSIS_TYPE = 'analysis_type'
AVE_CELL = 'average_cell'
CHECKPOINT = 'checkpt.write_last_step'
COMPRESS = 'compress'
CONCATENATE = 'concatenate'
DIR = 'dir'
DOT = '_dot_'
ENSEMBLE = 'ensemble'
ENSEMBLE_CLASS = 'ensemble.class'
ENSEMBLE_METHOD = 'ensemble.method'
EN_ANALYSIS = 'analysis'
INDENT = ' '
INTERVAL = 'trajectory_dot_interval'
JOBNAME = 'jobname'
KNOWN_LINES = {'analysis_type', 'checkpt.write_last_step', 'compress', 'dir', 'ensemble', 'ensemble.class', 'ensemble.method', 'jobname', 'max_steps', 'othertag', 'pressure', 'randomize_velocity.seed', 'temperature', 'time', 'timestep', 'trajectory_dot_interval'}
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'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
SEED = 'randomize_velocity.seed'
SETTINGS = {'analysis': None, 'assign_forcefield': None, 'average_cell': None, 'concatenate': None, 'matsci_analysis': None, 'minimize': <schrodinger.utils.sea.sea.Map object>, 'simulate': <schrodinger.utils.sea.sea.Map object>}
SIMULATE = 'simulate'
SYSBUILD = 'assign_forcefield'
TEMP = 'temperature'
TIME = 'time'
TIMESTEP = 'timestep'
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
createString(concatenate=False)

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

Parameters

concatenate (bool) – If True enable concatenate mode. In this mode, stage type is not printed

Return type

str

Returns

The msj string representing this stage

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.get_materials_relaxation_stringers(temp=300.0, compress_last=True, pressure_isotropy='anisotropic')[source]

Get a list of Stringer objects that reproduce the Materials Relaxation protocol

Parameters
  • temp (float) – The temperature for the last of the three stages

  • compress_last (bool) – If true, compress the last stage - the trajectory will not be available except as part of the tgz file. If False, the last stage will not be compressed and the trajectory will be available.

  • pressure_isotropy (str) – Barostat coupling between x, y, and z.

Return type

list

Returns

Each item of the list is a stage in the Materials Relaxation protocol

schrodinger.application.matsci.desmondutils.create_msj(stringers, filename=None, task_stage=True, extra_task_text='', check_cg=None, check_infinite=None, msj_string_header='', remove_com_motion=None)[source]

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.

  • msj_string_header (when extra_task_text is empty, use this string as the header of the output msj) – str

  • remove_com_motion (bool) – None - default behavior, add remove_com_motion only to infinite atomic systems, if True add plugin to msj regardless. If False don’t add remove_com_plugin

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, for_shell=False, hosts=None, add_license=True, **kwargs)[source]

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) – Does nothing, left in for backwards compatibility. All calculations run on GPU

  • procs (int) – Does nothing, left in for backwards compatibility. All calculations run on GPU

  • 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.

  • hosts (str) – the hosts to run this job in the hostname:nprocs format

  • add_license (bool) – Whether Desmond GPU license should be added to the command. Should be False when running force field assignment.

Return type

list

Returns

The command line command to use

schrodinger.application.matsci.desmondutils.get_default_near_timestep()[source]

Return the default near timestep

Returns

Default near timestep in femtoseconds

Return type

float

schrodinger.application.matsci.desmondutils.get_default_far_timestep()[source]

Return the default far timestep

Returns

Default far timestep in femtoseconds

Return type

float

schrodinger.application.matsci.desmondutils.add_cms_property(cms_model, propname, value)[source]

Add or change a property of cms model

Parameters
  • cms_model (cms.Cms) – cms model

  • propname (str) – property name

  • value (str, int, or float) – value of the property

schrodinger.application.matsci.desmondutils.delete_cms_property(*args)[source]

Delete a property from a cms model

schrodinger.application.matsci.desmondutils.parse_ene_file(filename=None, fileobj=None, prop=None, gcmc=False)[source]

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)[source]

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 (from get_prop_from_ene method)

schrodinger.application.matsci.desmondutils.get_prop_from_ene(ene_file, prop, fraction=0.2, reciprocal=False)[source]

Parse the ene file and compute mean and std for a specific property. The property is averaged over the last fraction of frames.

Parameters
  • ene_file (str) – The name of the file to read in.

  • prop (str) – The name of the property to read in

  • fraction (float) – The fraction of frames to average the density over. For instance, use 0.20 to compute the prop 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.

  • reciprocal (bool) – If True, the mean and std will be done on the reciprocal of the property values.

Return type

(float, float)

Returns

The mean property and standard deviation of the property. (or the reciprocal ones if reciprocal=True)

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

  • ValueError – If data have zeros, and the reciprocal of them are requested.

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

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, traj_frames=None)[source]

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

  • traj_frames (An iterable of trajectory frames) – trajectory to yield

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_desmond_frames_in_range(traj_dir, trj_min, trj_max)[source]

Get desmond frames from trajectory within the selected range (top and bottom included).

Parameters
  • traj_dir (str) – Path to the trajectory directory.

  • trj_min (int or None) – Index of frame in trajectory to start with. If None it will start from the begining of the trajectory,

  • trj_max (int or None) – Index of frame in trajectory to end at. If None it will end at the ending of the trajectory

Return type

list

Returns

list of trajectory frames selected

Raises

ValueError – Will raise if no frames are selected.

schrodinger.application.matsci.desmondutils.get_trajectory_frames(options, frames=None)[source]

Return a generator for trajectory frames in the range that the user specified, as well as the number of frames

Requires that trajectory flags in parserutils are used in the parser.

Parameters
  • options (argparse.Namespace) – Parsed commandline options

  • frames (iterable or None) – Trajectory frames. If not provided, they will be read from the path in options

Return type

generator, int

Returns

The trajectory frame generator, and the number of frames

schrodinger.application.matsci.desmondutils.get_cutoff(length, percent)[source]

Get cutoff given length and percent.

Parameters
  • length (int) – Length

  • percent (float) – Percent for the cutoff

Return int

Cutoff (minimum 1)

schrodinger.application.matsci.desmondutils.parse_enegrp_file(enegrp_fn, props=('en', 'E_p', 'E_k', 'E_x', 'P', 'V', 'Dispersion_Correction', 'Self_Energy_Correction', 'Net_Charge_Correction', 'Global_Force_Sum', 'Kinetic', 'pair_elec', 'pair_vdw', 'stretch', 'angle', 'dihedral', 'far_exclusion', 'nonbonded_elec', 'nonbonded_vdw', 'far_terms', 'Total', 'Virial', 'K.E.tensor', 'Pressure_Tensor', 'Simulation_Box'))[source]

Parse data from a Desmond *enegrp.dat file. All the data from the file can be returned in a dictionary where key is the property name and values are dict, key is the time and values are the property value at that time.

Parameters

enegrp_fn (str) – name of enegrp file to read

Props list props

list of properties to parse. Check ALL_ENEGRP_PROPS for the list of supported properties.

Return type

dict

Returns

dictionary where key is the property name and values are namedtuple. The namedtuple has two fields, time and value. The value is the value for the property at that timestep. Value at the timestep can be a float or a list depending on the property.

schrodinger.application.matsci.desmondutils.get_ptensor_from_enegrp(enegrp_fn, percent_to_avg, log=None)[source]

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.get_ptensor_from_trj(trj, percent_to_avg, log=None)[source]

Extract and calculate average pressure from trajectory. Trajectory must be in the DTR format trajectory.write_velocity should be True.

Parameters
  • trj (str or iterable) – Trajectory directory or iterable trajectory

  • 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.deform_cms_model(model, box, remap=True)[source]

Deform the CMS box using values from new_box, and atom coordinates in the model are scaled proportionally to fit the new box if remap=True.

Parameters
  • model (cms.Cms) – model to modify

  • remap (bool) – whether to strain the atom coordinates in the cell

  • box (list) – deform to this box (9 values)

schrodinger.application.matsci.desmondutils.is_infinite(model)[source]

Return a boolean indicating whether the given desmond model has components that are infinitely bonded, meaning that it has bonds that cross the periodic boundary which can not be eliminated by means of molecule contraction.

Parameters

model (cms.Cms) – model to check

Return type

bool

Returns

True if infinite, False otherwise

schrodinger.application.matsci.desmondutils.set_physical_properties(model)[source]

Set cell formula, volume and density to model.

Type

cms.Cms

Param

Model to set

schrodinger.application.matsci.desmondutils.cms_writer(cms_fn_in, cms_fn_out=None)[source]

Context manager to modify desmond CMS model.

with desmondutils.cms_writer(cms_in) as model:

model.set_cts_property(‘r_matsci_real_property’, 11.2)

Parameters
  • cms_fn_in (str) – Input CMS filename

  • cms_fn_in – Output CMS filename. If None, cms_fn_in will be used

Yield

cms.Cms

schrodinger.application.matsci.desmondutils.assign_lipid_ff(model)[source]

Assign the lipid forcefield to the given model.

Parameters

model (cms.Cms) – the model containing the lipid

Raises

ValueError – if there is no known lipid present

schrodinger.application.matsci.desmondutils.combine_trajectories(trj_path, trj_dirs, trj_int, backend)[source]

Combine multiple trajectories into a single one

Parameters
  • trj_path (str) – The path to the final trj directory

  • trj_dirs (list) – List of trajectory directory paths

  • trj_int (float) – Trajectory recording interval in ps

  • backend (schrodinger.job._Backend or None) – Backend handle, or None if not running under job control

Return type

None or str

Returns

The path to the combined trj file, or None if the operation failed

schrodinger.application.matsci.desmondutils.use_monomer_charges(struct)[source]

Add charges to the structure based on the charges computed by monomer. To compute monomer charges we create a fragment for each residue that includes the residue and all attached residues or atoms. Whether attached residues or attached atoms are used depends on the size of the created fragment.

The partial_charge property of atoms in the structure will be modified with the computed charges and also the property ‘r_ffio_custom_charge’ will be added to each atom in the structure to indicate that these charges should be used by the force field

Parameters

struct (schrodinger.structure.Structure) – The structure to compute charges for.

schrodinger.application.matsci.desmondutils.balance_charge(struct)[source]

Ensure that the total of the partial charges on the molecule equals the total of the formal charges.

Parameters

struct (schrodinger.structure.Structure) – The structure to modify

schrodinger.application.matsci.desmondutils.partial_to_custom_charges(struct)[source]

Set the current partial charges as custom FF charges

Parameters

struct (schrodinger.structure.Structure) – The structure to modify

class schrodinger.application.matsci.desmondutils.AnalysisDriverMixin[source]

Bases: object

Class containing methods that are shared by most trajectory analysis drivers.

setDefaultAnalysisParams(opts)[source]

Set default class variables that all trajectory analysis drivers use.

Parameters

opts (argparse.Namespace) – options for running the driver

writeOutputCmsAndData(wam_type)[source]

Write the modified cms_model and set it as output structure. If a data file is generated (data_filename) if will be added to the backend.

Parameters

wam_type (int) – One of the enums defined in workflow_action_menu.h