schrodinger.application.matsci.packmol module¶
Utilities for working with packmol.
Copyright Schrodinger, LLC. All rights reserved.
-
class
schrodinger.application.matsci.packmol.
PDBdata
(pdbname, pdbres, resnum, chain_name, order)¶ Bases:
tuple
-
__contains__
(key, /)¶ Return key in self.
-
__len__
()¶ Return len(self).
-
chain_name
¶ Alias for field number 3
-
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.
-
order
¶ Alias for field number 4
-
pdbname
¶ Alias for field number 0
-
pdbres
¶ Alias for field number 1
-
resnum
¶ Alias for field number 2
-
-
schrodinger.application.matsci.packmol.
get_pdb_data
(pdbname, pdbres, resnum=None, chain_name=None, order=None)[source]¶ Return a PDBdata.
- Parameters
- Return type
- Returns
the PDB data
-
class
schrodinger.application.matsci.packmol.
Job
(*args, **kwargs)[source]¶ Bases:
schrodinger.job.queue.SubprocessJob
-
addFinalizer
(function: Callable[[BaseJob], None], run_dir: str = None)¶ Add a function to be invoked when the job completes successfully.
See also the add_multi_job_finalizer function.
-
addGroupPrereq
(job: schrodinger.job.queue.BaseJob)¶ Make all jobs connected to
job
prerequisites of all jobs connected to this Job.
-
addPrereq
(job: schrodinger.job.queue.BaseJob)¶ Add a job that is an immediate prerequisite for this one.
-
cancel
()¶ Send termination request to subprocess managed job. This method will eventually deprecate SubprocessJob.kill
-
finalize
()¶ Clean up after a job successfully runs.
-
genAllJobs
(seen: Set[BaseJob] = None) → Generator[schrodinger.job.queue.BaseJob, None, None]¶ A generator that yields all jobs connected to this one.
-
genAllPrereqs
(seen=None) → Generator[schrodinger.job.queue.BaseJob, None, None]¶ A generator that yields all jobs that are prerequisites on this one.
-
getCommand
() → List[str]¶ Return the command used to run this job.
-
getCommandDir
() → str¶ Return the launch/command directory name. If None is returned, the job will be launched in the current directory.
-
getDuration
() → Optional[int]¶ Return the CPU time of the job in seconds.
If the job is still running, returns None.
-
getJobDJ
() → schrodinger.job.queue.JobDJ¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
getStatusStrings
() → Tuple[str, str, str]¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, host).
-
hasExited
() → bool¶ Returns True if this job finished, successfully or not.
-
hasStarted
() → bool¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
() → bool¶ Returns True if this job finished successfully
-
kill
()¶ Send termination request to subprocess managed job.
-
maxFailuresReached
(msg: str)¶ This is a method that will be called after the job has failed and the maximum number of failures per
JobDJ
run has been reached. After invoking this method,JobDJ
will raise aRuntimeError
and the process will exit.
-
preCommand
()¶ A method to make pre-command changes, like cd’ing to the correct directory to run the command in.
-
run
(*args, **kwargs)¶ Run the job.
- The steps taken are as follows:
Execute the preCommand method for things like changing the working directory.
Call the doCommand to do the actual work of computation or job launching.
Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
() → bool¶ Return True if the job runs on the
JobDJ
control host, False if not. Jobs that run locally don’t need hosts.There is no limit on the number of locally run jobs.
-
setup
()¶ A method to do initial setup; executed after
preCommand
, just beforedoCommand
.
-
property
state
¶ Return the current state of the job.
Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling
BaseJob
instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.
-
-
schrodinger.application.matsci.packmol.
run
(input_files, allow_failures=True)[source]¶ Run.
- Parameters
input_files (list) – packmol input files
allow_failures (bool) – if True then all but a single subjob are allowed to fail without causing the main job to fail
- Raises
RuntimeError – if all subjobs fail, if allow_failures is False then if a single subjob fails then the main job fails
- Return type
dict
- Returns
keys are input files, values are structure output files
-
class
schrodinger.application.matsci.packmol.
PDBWriter
(filename, reorder_by_sequence=False, first_occ=False, translate_pdb_resnames=True)[source]¶ Bases:
schrodinger.structure._io.PDBWriter
-
__init__
(filename, reorder_by_sequence=False, first_occ=False, translate_pdb_resnames=True)[source]¶ Initialize needed mmlibs and open the file ‘filename’.
Note that the file will not be completely written until it is explicitly closed or the object is garbage collected.
- Parameters
filename (str) – The filename to write to.
reorder_by_sequence (bool) – Whether to re-order the residues by sequence before writing the PDB file.
first_occ (bool) – If True and there are alternate occupancy sites, only the first occupancy site will be included in the output PDB file. Otherwise, all occupancy sites will be included.
translate_pdb_resnames (bool) – If True, the pdb residue names get converted to a standard set. If False, the translation is turned off.
NOTE: Any existing file will be overwritten when the class instance is created.
-
setOption
(option, value)¶ Set a single option for this writer. This method is meant for options that may not be supported for all writer formats. See the
StructureWriter
class documentation for details on the available options.Raises an OptionError subclass (either UnsupportedOption or UnsupportedOptionValue) if unsuccessful.
- Parameters
option (str) – The name of the option to set.
value – The value for the option. The data type of this parameter depends on the option being set.
-
-
schrodinger.application.matsci.packmol.
set_unique_pdb_atom_names
(st)[source]¶ Set unique PDB atom names on the given structure.
- Parameters
st (schrodinger.structure.Structure) – the structure
-
schrodinger.application.matsci.packmol.
get_cells
(input_files, sts, allow_failures=True)[source]¶ Return cells.
- Parameters
input_files (dict) – keys are packmol input files, values are tuples of the 3 box lengths (Angstrom) defining the PBC
sts (dict) – keys are file names (referenced in the given packmol input files), values are schrodinger.structure.Structure
allow_failures (bool) – if True then all but a single subjob are allowed to fail without causing the main job to fail
- Raises
RuntimeError – if there is a problem with the input
- Return type
dict
- Returns
keys are input files, values are schrodinger.structure.Structure
-
schrodinger.application.matsci.packmol.
write_desmond_cells
(input_files, sts, allow_failures=True, force_field=None, water_force_field='SPC', cg_ff_loc_type='local')[source]¶ Write Desmond cells.
- Parameters
input_files (dict) – keys are packmol input files, values are tuples of the 3 box lengths (Angstrom) defining the PBC
sts (dict) – keys are file names (referenced in the given packmol input files), values are schrodinger.structure.Structure
allow_failures (bool) – if True then all but a single subjob are allowed to fail without causing the main job to fail
force_field (str) – name of FF to apply
water_force_field (str) – name of the water force field to apply, options are available in desmondutils
cg_ff_loc_type (str) – specifies the location to which to look for coarse-grained force field files, one of cgff.INSTALLED_FF_LOCATION_TYPE or cgff.LOCAL_FF_LOCATION_TYPE
- Raises
RuntimeError – if there is a problem with the input
- Return type
dict
- Returns
keys are input files, values are names of written Desmond *cms files
-
schrodinger.application.matsci.packmol.
set_unique_pdb_res_names
(st)[source]¶ Set unique PDB residue names on the given structure.
- Raises
RuntimeError – if there is a problem with the input
- Parameters
st (schrodinger.structure.Structure) – the structure
-
schrodinger.application.matsci.packmol.
unset_unique_pdb_res_names
(st)[source]¶ Unset unique PDB residue names on the given structure.
- Parameters
st (schrodinger.structure.Structure) – the structure