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__

Return key in self.

__init__

Initialize self. See help(type(self)) for accurate signature.

__len__

Return len(self).

chain_name

Alias for field number 3

count(value) → integer -- return number of occurrences of value
index(value[, start[, stop]]) → integer -- 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)

Return a PDBdata.

Parameters:
  • pdbname (str) – the PDB atom name
  • pdbres (str) – the PDB residue name
  • resnum (int or None) – the PDB residue number if needed
  • chain_name (str or None) – the PDB chain name if needed
  • order (int or None) – a bond order to be used when bonding to the atom corresponding to this object
Return type:

PDBdata

Returns:

the PDB data

class schrodinger.application.matsci.packmol.Job(*args, **kwargs)

Bases: schrodinger.job.queue.SubprocessJob

__init__(*args, **kwargs)

See parent class for documentation.

doCommand(*args, **kwargs)

See parent class for documentation.

postCommand()

See parent class for documentation.

update()

See parent class for documentation.

addFinalizer(function, run_dir=None)

Add a function to be invoked when the job completes successfully.

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

Make all jobs connected to job prerequisites of all jobs connected to this Job.

addPrereq(job)

Add a job that is an immediate prerequisite for this one.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

A generator that yields all jobs that are prerequisites on this one.

getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

Return the launch/command directory name. If None is returned, the job will be launched in the current directory.

Return type:str
getJobDJ()

Return the JobDJ instance that this job has been added to.

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, name, host).

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send termination request to subprocess managed job.

maxFailuresReached(msg)

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 a RuntimeError 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:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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 before doCommand.

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 DONE could be returned immediately and the job would not run.

schrodinger.application.matsci.packmol.run(input_files, allow_failures=True)

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)

Bases: schrodinger.structure._io.PDBWriter

write(ct)

See parent class for documentation.

__init__(filename, reorder_by_sequence=False, first_occ=False, translate_pdb_resnames=True)

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.

append(ct)

Alias to the write() method (for consistency with the other Writer classes).

close()

Does nothing. Added for consistency with other Writer classes.

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)

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)

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='OPLS3e', cg_ff_loc_type='local')

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