schrodinger.application.matsci.desmondutils module¶
Utilities for working with Desmond.
Copyright Schrodinger, LLC. All rights reserved.
- class schrodinger.application.matsci.desmondutils.DesmondModel(msys, cms)¶
Bases:
tuple
- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- cms¶
Alias for field number 1
- 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.
- msys¶
Alias for field number 0
- schrodinger.application.matsci.desmondutils.exit_if_incompatible_with_desmond(logger=None)¶
Desmond only runs on certain platforms. Exit if the platform being used is not compatible. If a logger is supplied, it will print an error to the logger.
- Parameters
logger (logging.Logger) – The logging object to print an error to if the platform is incompatible. If not supplied, nothing will print.
- Raises
SystemExit – If the current platform is not compatible with Desmond
- 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
struct (
schrodinger.structure.Structure
) – The structure to checktolerance (float) – The tolerance for the 90 degree check, in degrees
- Return type
bool
- Returns
True if a PBC exists and it is orthorhombic
- schrodinger.application.matsci.desmondutils.might_be_system(structs)¶
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)¶
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 toax (float) – The value of the ax box property
ay (float) – The value of the ay box property. Defaults to 0.
az (float) – The value of the az box property. Defaults to 0.
bx (float) – The value of the bx box property. Defaults to 0.
by (float) – The value of the by box property. If not given, this value is set the same as ax.
bz (float) – The value of the bz box property. Defaults to 0.
cx (float) – The value of the cx box property. Defaults to 0.
cy (float) – The value of the cy box property. Defaults to 0.
cz (float) – 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.copy_atom_properties(struct1, struct2, atom_props)¶
- Parameters
struct1 (
schrodinger.structure.Structure
) – The structure from which atom properties are copiedstruct2 (
schrodinger.structure.Structure
) – The structure to which atom properties are copiedatom_props (list of strings) – Atom properties that are copied
- schrodinger.application.matsci.desmondutils.get_npseudos_per_molecule(comp_ct)¶
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)¶
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)¶
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
- schrodinger.application.matsci.desmondutils.is_traj_gcmc(trj_path, check_all_frames=False)¶
Whether trajectory is generated during Grand-canonical Monte Carlo simulation :param str trj_path: The path to input trajectory
- Parameters
check_all_frames (bool) – Whether to check all the frames of a trajectory. In case of false it will only check the first frame
- Return type
bool
- Returns
Whether passed trajectory is generated during Grand-canonical Monte Carlo simulation
- 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'], check_infinite=True, split_components=False, water_fftype='SPC', set_incorporation=True, wam_type=None, per_structure_wam=False, build_geometry_msj=None, redistribute_hydrogen_mass=False)¶
Bases:
object
- SOLVATION_RADIUS_KEY = 'solvation_exclusion_radius'¶
- __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'], check_infinite=True, split_components=False, water_fftype='SPC', set_incorporation=True, wam_type=None, per_structure_wam=False, build_geometry_msj=None, redistribute_hydrogen_mass=False)¶
- 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.
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
per_structure_wam (bool) – Whether wam is to be added per structure
build_geoemtry_msj (str or None) – build_geometry stage msj file
redistribute_hydrogen_mass (bool) – whether to perform hydrogen mass repartition
- run()¶
Prepare and run the desmond system builder
- Raises
FileNotFoundError – If the certain files cannot be found.
- cleanAtomProperties()¶
Clean atom properties that cause the system builder to fail
- setChorusBoxProps()¶
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()¶
Romove or re-assign the structure-level properties that causes issues.
- setForceFieldDir()¶
Set custom OPLS directory, if any
- centerStruct()¶
Translate the whole structure so that the centroid is at the origin.
- splitComponents()¶
Each list in Component cts contains isomers.
- writeMae()¶
Write out the mae file for Desmond forceField assignment input.
- Raises
FileNotFoundError – if input files for desmond assign forcefield stage cannot be generated.
- writeMsj()¶
Write out the msj file for Desmond forceField assignment input.
- static validateBuildGeometryMsj(msj_fn=None, msj_sea=None)¶
Validate MSJ file or Map to have two stages, task and build_geometry.
- Return type
(bool, sea.Map) or (bool, str)
- Returns
Whether MSJ is valid. If it is, return Map of the MSJ, otherwise error message
- prepareBuildGeometryInput(in_mae)¶
Prepare mae input for the structure builder
- Parameters
in_mae (str) – Input mae (not modified)
- Return str
Mae file with prepared input for build_geometry
- setupBuildGeometryMSJ(msj_fn)¶
Write msj with build_geometry stage.
- Parameters
msj_fn (str) – MSJ filename to use
- Return type
bool or float
- Returns
False on error. 0 if no solvation was requested, otherwise solvation radius
- runBuildGeometry()¶
Run build_geometry with multisim if requested. self.in_mae may be updated here.
- runForceFieldAssignment()¶
Run the desmond assign forcefield stage.
- addFilesToBackend()¶
Add intermediate and final files to backend.
- postProcessCms()¶
Post process of desmond cms output.
- Raises
FileNotFoundError – If the cms cannot be found.
- prepareWaterModel(struct)¶
Prepare water component.
- 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(struct, base, *args, **kwargs)¶
Run the Desmond multisim system builder.
See SystemBuilder for argument documentation.
- Parameters
location_type (str) – the location type, either parserutils.INSTALLED_CG_FF_LOCATION_TYPE or parserutils.LOCAL_CG_FF_LOCATION_TYPE
encrypt (bool or None) – whether to encrypt the FF parameters in the written cms, if None and an encrypted CG FF file is used then the cms is automatically encrypted
adapt_ff (bool) – applies structure specific modifications to the FF after its raw application to the given structure
scale (bool) – Scale the lattice vector to get density representative of the force field parameters
- 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=None, handle=None)¶
Check structures to see if the specified forcefield is valid for them
- Parameters
structs (list) – A list of
schrodinger.structure.Structure
objectsffield_num (int or None) – An integer specifying which forcefield to use, if None then handle must be given
handle (int or None) – A forcefield handle, if None then ffield_num must be given
- 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.validate_box_size(model, temp=300.0, simple=True)¶
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
- schrodinger.application.matsci.desmondutils.get_multisim_command(input_name, output_name, msj_name=None, job_name=None, num_retries=None, for_shell=False, hosts=None, add_license=True, license_host=None, **kwargs)¶
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
num_retries (None or int) – Number of retries by multisim. If None, default value is used. Multisim retries are different from job retries. JobDj retries correspond to resubmission of job if it fizzled or died which is not error. Desmond multisim contains its own retries in case desmond job dies. The defined parameter is used for desmond multisim 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.
license_host (None or str) – Host to be used to generate license. It will NOT appear in the returned cmd. To keep the host pass it in
hosts
. This option cannot be used together withhosts
- 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.prepare_cms_properties_for_writing(model)¶
Deletes several properties that should be removed before writing a CMS. Notably, this function removes the trajectory property.
- Parameters
model (cms.Cms) – System to update
- schrodinger.application.matsci.desmondutils.delete_molecules_from_comps(model, comp_data)¶
Delete molecules from specific components of a model system
- Parameters
model (cms.Cms) – Desmond model/system to update
comp_data (dict) – keys - components ids, values list of molecules ids
- Return set
Set of empty (removed) component names
- schrodinger.application.matsci.desmondutils.delete_molecules_from_model(model, mol_indices, cg_ff_path=None)¶
Delete molecules from a Desmond system
- Parameters
model (cms.Cms) – Model to update
mol_indices (list(int)) – A list of integers containing the indices of the molecules that should be removed. These indices should correspond with the
model.molecule
indices.cg_ff_path (str) – The path to the force field file for the coarse-grain system. Used to reassign the forcefield for coarse-grained systems after delete molecules.
- Return type
- Returns
A copy of the input model with the molecules removed
- Raises
TypeError – When a coarse-grain model is given, but no
cg_ff_path
argument is given.
- schrodinger.application.matsci.desmondutils.delete_molecules_from_cg_model(model, mol_indices, ff_path)¶
Delete molecules from a coarse-grained Desmond system
- Parameters
model (cms.Cms) – Model to update
mol_indices (list(int)) – A list of integers containing the indices of the molecules that should be removed. These indices should correspond with the
model.molecule
indices.ff_path (str) – The path to the force field file
- Return type
- Returns
A copy of the input model with the molecules removed
- schrodinger.application.matsci.desmondutils.delete_molecules_from_aa_model(model, mol_indices)¶
Delete molecules from an all-atom system
- Parameters
model (cms.Cms) – Model to update
mol_indices (list(int)) – A list of integers containing the indices of the molecules that should be removed. These indices should correspond with the
model.molecule
indices.
- Return type
set
- Returns
Set of empty (removed) components names
- 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 insteadicms_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
- Returns
the updated cms.Cms
- schrodinger.application.matsci.desmondutils.get_desmond_trj_frames(cms_path=None, traj_dir=None, traj_frames=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 filetraj_dir (
str
or None) – path to trajectory dirtraj_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, trj_step=None)¶
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
trj_step (int or None) – The step for 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_desmond_frames_from_options(options)¶
Convenience function to get desmond frames in the range specified by the user from commandline options
- Parameters
options (parserutils.SubscriptableNameSpace) – Parsed commandline options
- Return list
List of trajectory frames
- schrodinger.application.matsci.desmondutils.get_avg(data, percent, axis=0)¶
Get average of the last percent of data along the axis.
- Parameters
data (list) – Input data to average
percent (float) – Percent from the end to average
param int axis: Axis to use to average
- Return type
numpy.array
- Returns
Averaged data
- schrodinger.application.matsci.desmondutils.get_cutoff(length, percent)¶
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.get_ptensor_from_trj(trj, percent_to_avg, log=None)¶
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.get_ptensor_from_plugin(ptensor_fn, percent_to_avg, print_volume=False, log=None)¶
Extract and calculate average pressure from pressure tensor plugin.
- Parameters
ptensor_fn (str) – Output file of ptensor plugin
percent_to_avg (float) – Percent to use when averaging pressure tensor
log (method or None) – Log method. If None, print will be used
- Return type
numpy.array
- Returns
Averaged pressure tensor
- schrodinger.application.matsci.desmondutils.deform_cms_model(model, box, remap=True)¶
Deform the CMS box using values from 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
box (list[float]) – Values (9) of the new box
remap (bool) – Whether to strain atom coordinates besides lattice
- schrodinger.application.matsci.desmondutils.is_infinite(model)¶
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)¶
Set cell formula, volume and density to model.
- Type
- Param
Model to set
- schrodinger.application.matsci.desmondutils.cms_writer(cms_fn_in, cms_fn_out=None)¶
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)¶
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)¶
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, ff_name)¶
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.ff_name (str) – The name of the OPLS forcefield
- schrodinger.application.matsci.desmondutils.balance_charge(struct)¶
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)¶
Set the current partial charges as custom FF charges
- Parameters
struct (
schrodinger.structure.Structure
) – The structure to modify
- class schrodinger.application.matsci.desmondutils.AnalysisDriverMixin¶
Bases:
object
Class containing methods that are shared by most trajectory analysis drivers.
- setDefaultAnalysisParams(opts, static_allowed=False, set_jobname=True)¶
Set default class variables that all trajectory analysis drivers use.
- Parameters
opts (parserutils.SubscriptableNameSpace) – options for running the driver
static_allowed (bool) – whether static frames are allowed
set_jobname (bool) – If True, set the jobname based on the cms file name
- trjFrames()¶
Yield the trajectory frame by frame. The memory taken by the previous frame is released before yielding the next one.
- Return type
iterator(
schrodinger.application.desmond.packages.traj.frame
)- Returns
an iterator for trajectory frames
- getOutfileName(extension, add_to_backend=True)¶
Get an outfile name by appending the extension to the job name
- Parameters
add_to_backend (bool) – Whether the outfile should be added to backend
- Return str
The outfile name
- writeOutputCmsAndData(wam_type, per_structure_wam=False)¶
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
per_structure_wam (bool) – Whether the WAM should be set on the cms model instead of file-level
- getFirstCellPositions(frame)¶
Get all the positions from the frame and then translate to first unit cell
- Parameters
frame ('schrodinger.application.desmond.packages.traj.Frame') – current frame
- Return ‘numpy.ndarray’
numpy array containing translated positional coordinates
- exportStructuresForDebugging()¶
Export the full system structure at each frame for debugging
- schrodinger.application.matsci.desmondutils.validate_ff_and_water_model(ffld, model)¶
Verify that the chosen water model is compatible with the chosen forcefield
- Parameters
ffld (str) – The name of the forcefield
model (str) – The name of the water model. From water combobox use currentData method.
- Return type
True or (False, str)
- Returns
The return type is compatible with AF2 validators. Either True if everything is OK, or False with an error message if not.
- schrodinger.application.matsci.desmondutils.struct_has_ffio_ct_type(st)¶
Return True if the given structure has the ‘s_ffio_ct_type’ property defined.
- Parameters
st (
schrodinger.structure.Structure
) – structure to check- Return type
bool
- Returns
True if defined
- schrodinger.application.matsci.desmondutils.get_cms_and_trj_path_from_st(struct)¶
- Get trajectory and cms path for the passed structure in maestro
using structure property
- Parameters
schrodinger.structure.Structure (struct) – Structure to get associated cms and trajectory of
str (source_path) – Path to source cms and trj folder
- Return str,str
Path to the cms file trajectory frames if both are found.
- schrodinger.application.matsci.desmondutils.make_pos_restraints(model, asl, force_const=500.0)¶
Create kwargs that can be used in MD MSJ stringers to restrain atoms
- Parameters
model (cms.Cms) – the Desmond system that you want to restrain
asl (str) – the atom-specification-language string used to identify the atoms in the system that should be restrained
force_const (float) – the force constant of the restraints that you want imposed on the specified atoms, in units of kcal/mol/Ang^2
- Return type
dict(str=str)
- Returns
key-word arguments that can be passed to
MDMSJStringer
to restrain the atoms
- schrodinger.application.matsci.desmondutils.has_atom_vel(struct)¶
Check whether structure (or CMS model) has atoms with FFIO velocity set.
- Parameters
struct (structure.Structure or cms.Cms) – Structure or CMS model
- Return type
bool
- Returns
Whether at least one atom has velocity set
- schrodinger.application.matsci.desmondutils.add_energy_atom_groups(cms, asl, overwrite=False)¶
Add an energy atom group to the CMS.
- Parameters
cms (cms.Cms) – cms object where atom group will be added
asl (string) – ASL string to select atom
overwrite (bool) – overwrite energy group if True. If not true and energy group already exists in model, raise error
- schrodinger.application.matsci.desmondutils.register_md_outfiles(save_files, cms_fname, trj_dirname=None)¶
Add cms and trj to backend based on the value of parserutils.SAVE_FLAG. If the flag value is trj but trj dir is not passed, the trj property is removed from the cms.
- Parameters
save_files (str) – One of parserutils.SAVE_NONE, parserutils.SAVE_CMS or parserutils.SAVE_TRJ
cms_fname (str) – Cms file name
trj_dirname – Trj directory name
- Type
str or None
- schrodinger.application.matsci.desmondutils.get_atom_ffio_velocity(atom)¶
Get FFIO atom velocities.
- Parameters
atom (structure._StructureAtom) – Input atom
- Return numpy.array
Array of velocities
- schrodinger.application.matsci.desmondutils.set_atom_ffio_velocity(atom, velocity)¶
Set FFIO atom velocities.
- Parameters
atom (structure._StructureAtom) – Atom to modify
velocity (list) – List of velocities (x, y, z components)