schrodinger.application.matsci.permittivity module

Permittivity module for permittivity workflow.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.permittivity.get_permittivity_config_file(filename='default_permittivity_protocols.yaml', product_dir='permittivity')

Get the permittivity config yaml from the mmshare data dir.

Parameters:
  • filename (str) – the yaml filename
  • product_dir (str) – subdir name inside the mmshare_data_dir
Returns:

the full path and filename for the input yaml

Return type:

str

schrodinger.application.matsci.permittivity.get_polymer_templates(moiety_dir=None, moiety_filename=None)

Return the polymer template file or dir

Parameters:
  • moiety_dir (str) – moiety dirname inside the polymer template dir
  • moiety_filename (str) – filename inside the moiety dir
Returns:

a polymer template file or dir

Return type:

str

schrodinger.application.matsci.permittivity.log_debug(msg)

Add a message to the log file and exit with an error code

Parameters:msg (str) – The message to debug logging
schrodinger.application.matsci.permittivity.create_debug_logger(name=None, logfile=None, set_with_cur_name=False, formatter=None, add_to_backend=False, stream=True)

Create a logger for module level debug usage.

Parameters:
  • name (str) – the logger name
  • logfile (str) – create this filename if the logger doesn’t have a file handler
  • set_with_script_name (bool) – logger name and file name are set by the current file name
  • formatter ('logging.Formatter') – the logging format
  • add_to_backend (bool) – if True and logfile is created, add it to the backend
  • stream (bool) – if True and the newly created logfile is added to the backend, stream the file to the submission host
Returns:

The logger created for this function

Return type:

logging.Logger

schrodinger.application.matsci.permittivity.elapsed_timer()

Handy way to print time consumption for the execution of a few python line codes.

example to print line number and time elapsed: from inspect import currentframe with elapsed_timer() as elapsed:

xxx print(currentframe().f_lineno, elapsed()) xxx print(currentframe().f_lineno, elapsed())
Returns:float
Return type:time elapsed in second
schrodinger.application.matsci.permittivity.path_join(paths, linux=True)

Wrapper around os.path.join to allow forced ‘/’ as the path separator.

Parameters:linux (bool) – force using ‘/’ as the separator if True
Returns:the str paths
Return type:str
schrodinger.application.matsci.permittivity.permittivity_transform(tau0, beta, tau_max=20, tau_num=None, omega_range=(100000.0, 1000000000000000.0), omega_num=None, simpson_quadrature=True)

Based on the parameters in the KWW equation, non-uniform grid in tau and omega are used to transform the time domain (tau) signal to frequency domain (omega).

Note: the KWW is the equation 1 and implemented transform is equation 7 in the following paper.

Further Considerations of Non Symmetrical Dielectric Relaxation Behaviour arising from a Simple Empirical Decay Function. BY G. WILLIAM AND D. C. WATT

Parameters:
  • tau0 (float) – the tau0 in unit ps is the decay constant in KWW equation
  • beta (float) – the beta in KWW equation
  • tau_max (float) – tau upper limit in tau (time) domain
  • tau_num (int or None) – total number of data points in the tau (time) domain
  • omega_range (tuple of two floats) – output frequency domain range
  • omega_num (int or None) – total number of data points in the frequency domain
  • simpson_quadrature (bool) – If True, simpson rule with quadratic interpolation is used to reduce the oscillation
Returns:

three columns are angular frequency, storage permittivity, and loss permittivity

Return type:

3xn numpy.array

schrodinger.application.matsci.permittivity.get_properties_from_inputfiles(opts, input_required_properties, input_readers=None)

Get properties from the input files. If the requested doesn’t exist, a KeyError error is raised.

Parameters:
  • opts (Named tuple) – The parsed command line options
  • input_required_properties (dict) – keys are struct type and values are property keys.
  • input_readers (dict) – keys are struct type and values are readers for different struct types.
Raises:

KeyError – when the struct misses one required property

Returns:

requested property keys and obtained values

Return type:

dict

schrodinger.application.matsci.permittivity.is_file_property(property_name)

Whether the property is related to a file.

Parameters:property_name (str) – a property
Returns:whether the property should point to a file
Return type:bool
schrodinger.application.matsci.permittivity.get_permittivity_config_file_from_options(options)

Return the permittivity config file based on command line inputs.

Parameters:options (argparse.ArgumentParser) – the command parsered options
Returns:the path to a config yaml
Return type:str
class schrodinger.application.matsci.permittivity.chdir(dirname, rm_created_dir=False, always_create=False)

Bases: schrodinger.utils.fileutils.chdir

Make dir, change, and exit. If this indeed creates a dir, it will remove the dir on exit with rm_created_dir=True.

__init__(dirname, rm_created_dir=False, always_create=False)
Parameters:
  • dirname (str) – the directory name to make and cd to
  • rm_created_dir (bool) – If True and this class creates a directory, the directory will be removed on exit.
  • always_create (bool) – If True and the input dirname exists, creates a directory, with a different name. For example ‘my_dir’ exists, the newly created dir will be ‘my_dir.1’. If ‘my_dir.1’ exists, the newly create dir will be ‘my_dir.2’.
getNextDirname(midfix='.', zfill_width=0)

Get the next dirname based on the input path and current existing directories.

Parameters:
  • path (str) – path to a directory
  • midfix (str) – this string split the basename and number <root><midfix><number>
  • zfill_width (int) – pad a numeric string S with zeros on the left, to fill a field of the specified width
Returns:

the next dirname based on the input path and all dirs in the relevant folder.

Return type:

str

schrodinger.application.matsci.permittivity.get_model(filename)

Get the model from a cms or mae file.

Parameters:filename (str) – file path pointing to a cms or mae file.
Returns:the model in the file.
Return type:‘CmsModel’ or ‘MaeModel’
class schrodinger.application.matsci.permittivity.Model(filename)

Bases: object

Wrapper around a structure.

__init__(filename)
Parameters:filename (str) – file path pointing to a cms or mae file.
load()

Load a model.

setProperty(key, value)

Set the property to the model.

Parameters:
  • key (str) – property name
  • value (str, float, int) – the value of the property
property

Return the model property.

Returns:a dictionary
Return type:dict
write(fname)

Write the model into a file.

Parameters:fname (str) – filename to write out the model.
class schrodinger.application.matsci.permittivity.MaeModel(filename)

Bases: schrodinger.application.matsci.permittivity.Model

Wrapper around Structure.

load()

Load a model from the mae file.

setProperty(key, value)

Set the property to the mae model.

Parameters:
  • key (str) – property name
  • value (str, float, int) – the value of the property
__init__(filename)
Parameters:filename (str) – file path pointing to a cms or mae file.
property

Return the model property.

Returns:a dictionary
Return type:dict
write(fname)

Write the model into a file.

Parameters:fname (str) – filename to write out the model.
class schrodinger.application.matsci.permittivity.CmsModel(filename)

Bases: schrodinger.application.matsci.permittivity.Model

Wrapper around Cms.

load()

load a model from a cms file.

setProperty(key, value)

Set the property to the cms model.

Parameters:
  • key (str) – property name
  • value (str, float, int) – the value of the property
__init__(filename)
Parameters:filename (str) – file path pointing to a cms or mae file.
property

Return the model property.

Returns:a dictionary
Return type:dict
write(fname)

Write the model into a file.

Parameters:fname (str) – filename to write out the model.
class schrodinger.application.matsci.permittivity.Protocol(protocol)

Bases: object

__init__(protocol)

The protocol for the workflow or one task.

Parameters:protocol (dict or list) – dict for workflow and regular task protocol; list for multistage desmond protocol.
class schrodinger.application.matsci.permittivity.TaskProtocol(protocol)

Bases: schrodinger.application.matsci.permittivity.Protocol

Wrapper for task protocol: regular driver or desmond multi-stages.

__init__(protocol)

The protocol for the workflow or one task.

Parameters:protocol (dict or list) – the settings for a task: dict for task protocol; list for multistage desmond protocol.
getDriverPath(driver_path=None)

Return the driver path of the task

Parameters:driver_path (None or str) – the driver path of the task
Returns:the driver path of the task
Return type:str or None
getPreScript(pre_script=['$SCHRODINGER', 'run'])

Return the shell script before regular driver. For example, $SCHRODINGER/run

Parameters:pre_script (None or list) – the shell script before regular driver
Returns:the shell script before regular driver
Return type:None or str
getFlagBlock(label='cmd_flags')

Get the flag block with desired label.

Parameters:label (str) – the block header label to search
Returns:the flag block for a certain task in the config yaml
Return type:None or list
getReplicaKeywords()

Return the replica keyword list or None.

Returns:the replica keywords
Return type:None or list
Raises:ValueError – if more than one replica setting blocks are found.
getSeed(seed_flag)

Return the random seed for this task.

Returns:the random seed in the config or the default value
Return type:int
getCruNums()

Return a list of requested ‘num_cru’s (cru means repeat unit).

Returns:list of int
Return type:str or None
getCmdFromFlagBlock()

Return the command list from the cmd flag block.

Returns:the command list built from the task protocol cmd flag block
Return type:None or list
interpretFlagBlock(flag_block)

Interpret the flag block from yaml parsed values to a dict data type.

Parameters:flag_block (list of dict and str. In .yaml, {flag: 'None'} means 'store_true' or 'store_false' optional arguments; [flag] means positional arguments; {flag: 'none'; flag: 'value'} means regular optional arguments.) – a list of dict and str contains flags and values
Returns:Keys are flags without ‘-‘, and values are None for positional flag, ‘None’ for optional ‘store_true’ or ‘store_false’ flag, ‘none’ or ‘any_value’ for regular optional ‘store’ flag
Return type:dict
Raises:ValueError – if the item in cmd block is not string or dict.
update(user_input, block_label='cmd_flags')

This function updates the task_protocol according to a user input dict. The update happens for optional arg: store, store_true and store_false. The flag to locate the optional block must be either CMD_FLAGS or XTRA_FLAGS. The logic is to put all subdriver recognizable optional flags in CMD_FLAGS, and put other flags in XTRA_FLAGS.

In short, flags in CMD_FLAGS are passed to subjob driver directly. Flags in XTRA_FLAGS can be used to control worflow (not used in subdriver) or be reformatted and passed to subdriver in a file format depending on specific implementation.

If user_input = {‘animal’: ‘cat’}, the ‘cat’ will be used for drivers. If user_input = {‘animal’: None}, auto set: drivers with animal key use their

own defaults set by the driver or config yaml.
If user_input = {‘is_rainy’: True}, drivers with is_rainy key adds -is_rainy
to the cmd.
If user_input = {‘is_rainy’: False}, drivers with is_rainy key remove -is_rainy
in the cmd.
If user_input = {‘is_rainy’: None}, auto set: drivers with is_rainy key check
config yaml for whether to add -is_rainy in cmd.

Current implementation doesn’t support the positional argument substitution, as this is a replacements of certain list values and positional argument are input/output filenames that are changed by updateInfileAndCommand().

Parameters:
  • task_protocol (dict) – dict for regular single stage
  • block_label (str) – the flag block in task_protocol defined by this flag is updated (either CMD_FLAGS or XTRA_FLAGS)
  • user_input (dict) – {flag: value}
parserUserInput(user_input)

Parse the user input dict data and return a dict for values to be added and a list for values to be removed.

Parameters:user_input (dict) – the dict to be parsed
Returns:values to be added, values to be removed
Return type:dict, list
class schrodinger.application.matsci.permittivity.WorkflowProtocol(protocol)

Bases: schrodinger.application.matsci.permittivity.Protocol

__init__(protocol)

The protocol for the workflow.

Parameters:protocol (dict or list) – dict for workflow and regular task protocol; list for multistage desmond protocol.
indexUnbalancedWorkflow()

Generate an unique tuple of integers for each task (item) in the workflow. Return the map from tuple to task name.

Returns:the map from un unique tuple to task name
Return type:dict
getItemByIndex(index)

Get the item in the workflow protocol of this index.

Parameters:index (tuple or list of int) – the indexes of the item
Returns:the item saved in the workflow yaml with this index
Return type:str, list, or dict
static isIterable(item)

Whether the input is iterable. Currently, list, set, and tuple are treated as iterable.

Parameters:item – str, list, tuple, or other data type
Returns:Whether the input is iterable
Return type:bool
getParentTasknames(index)

Get the parent task names for the current task pointed by this index.

Parents can be defined via three methods: parent / child by nested list or tuple: outer is parent; inner is child parent / child by list: former is the parent; later is the child parent / child by dict: key is the child; values are parents.

These methods are equivalent in setting the job dependency.

Parameters:index (tuple, list, or generator for integers) – the index of the current item
Returns:the task names of parent jobs
Return type:list of str
getParentTasknameByIndexFromDict(index)

Get the parent task names of the current task indicated by the dict format. (the key and value of the item in the workflow pointed by the index are child and parents). If str instead of dict, return empty.

Parameters:index (tuple or list of int) – the indexes of the item
Raises:TypeError – when it is not a str or dict, meaning this not a leaf item in the workflow tree data struct.
Returns:the task name for this item
Return type:str
classmethod flatten(an_iterable_item)

Robust function to flatten list recursively.

Parameters:an_iterable_item (list, tuple or set) – the iterable item to be flatten. (an iterable that describes the whole or part of the workflow)
Returns:the flatten items in a list ([uniterable value 1, uniterable value 2, uniterable value 3 …])
Return type:list of uniterable values (str or dict)
flattenWithoutDict(an_iterable_item)

Robust function to flatten list recursively. If a dict presents as the value, use the key of the dict. The difference between the above flatten is that this function don’t return a dict as one value in the list. Instead, it uses the dict key to represent the dict.

Parameters:an_iterable_item (list, tuple or set) – the iterable item to be flatten. (an iterable that describes the whole or part of the workflow)
Returns:the flatten items in a list ([uniterable value 1, uniterable value 2, uniterable value 3 …])
Return type:list of str values
getFirstLevelTasknames(task_stages)

Get the first level tasknames without dict. For example, [a, [b, [c]], {d:f}, [e]] returns [a, d]

Parameters:task_stages (list, tuple, or set) – an iterable that describes the whole or part of the workflow.
Returns:the first level tasknames
Return type:list of string
getTaskNames()

A set of all task name in the workflow section.

Returns:set of task names
Return type:set
getWorkflowTasknameByindex(index)

Get the task name of this item in the workflow.

Parameters:index (list or tuple of int) – index of an item containing a task name.
Raises:TypeError – when it is not a str or dict, meaning this not a leaf item in the workflow tree data struct.
Returns:the task name for this item
Return type:str
class schrodinger.application.matsci.permittivity.StepBase(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: object

OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (the replica index) – int
log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
updateTaskReplicaSettings()

Update the task settings due to replica.

setup(copy_infile=True, copy_additional_files=True, more_files=None)

Setup things before the job starts. For example, logging format, and file transfer.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

class schrodinger.application.matsci.permittivity.Step(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.StepBase, schrodinger.application.matsci.jaguarworkflows.RobustSubmissionJob

Over write the parent class, and set subjobname, subdir, and etc.

__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup(copy_infile=True, copy_additional_files=True, more_files=None)

Setup things before the job starts. For example, logging format, and file transfer.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.PolymerBuilder(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class for customized polymer builder.

DRIVER_PATH = 'polymer_builder_gui_dir/polymer_builder_driver.py'
POLYMER_BUILDER = 'polymer_builder'
DEFAULT_JOBNAME = 'permittivity_polymer_builder_task'
FLAG_NUM_CRU = '-num_cru'
classmethod getSeedFlag()

Return the flag for random seed.

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Process the stages, for example, update relaxation stages, update the productions stage, and remove productions markers.

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

list of desmond stages

Return type:

list

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup(copy_infile=True, copy_additional_files=True, more_files=None)

Setup things before the job starts. For example, logging format, and file transfer.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.MultiStageMd(*arg, **kwarg)

Bases: schrodinger.application.matsci.permittivity.Step

Multi-stage simulations with relaxation.

BROWNIAN_DYNAMICS = 'Brownian Dynamics'
MOLECULAR_DYNAMICS = 'Molecular Dynamics'
AVERAGE_CELL = 'Average Cell'
MATSCI_ANALYSIS = 'Matsci Analysis'
TIME = 'time'
TEMP = 'temp'
PRESS = 'pressure'
TIMESTEP = 'timestep'
ENSEMBLE = 'ensemble'
SIM_TYPE = 'sim_type'
TRJ_INTVL = 'trajectory.interval'
FLAG_TO_KEY = {'-md_ensemble': 'ensemble', '-md_press': 'pressure', '-md_temp': 'temp', '-md_time': 'time', '-md_timestep': 'timestep', '-md_trj_int': 'trajectory.interval'}
DESMOND_UNIT_CONVERTERS = {'-md_time': <function MultiStageMd.<lambda>>, '-md_timestep': <function MultiStageMd.<lambda>>}
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
LAST_STAGE_DICT = {'compress': '""', 'dir': '"."'}
FLOAT_FIELDS = ['time', 'temp', 'pressure']
DUMMY_FIELDS = ['index', 'is_production', 'is_relaxation', 'use_customized_relaxation']
MSJSTRINGERS = {'Average Cell': <class 'schrodinger.application.matsci.desmondutils.AveCellMSJStringer'>, 'Brownian Dynamics': <class 'schrodinger.application.matsci.desmondutils.BrownieMSJStringer'>, 'Matsci Analysis': <class 'schrodinger.application.matsci.desmondutils.MSAnalysisMSJStringer'>, 'Molecular Dynamics': <class 'schrodinger.application.matsci.desmondutils.MDMSJStringer'>}
HOFMANN = 'Hofmann'
HOFMANN_PROTOCOL = 'Hofmann_relaxation_protocol.yaml'
RELAXATION_MAP = {'Hofmann': 'Hofmann_relaxation_protocol.yaml'}
DEFAULT_MSJ_HEADER = 'task { task = "desmond:auto"}\n'
OUTFILE_EXT = '-out.cms'
__init__(*arg, **kwarg)

See parent class.

setup()

Over write parent class method.

updateTaskReplicaSettings()

Replica settings are handled in the msj during the updateReplicaSeed() in job setup()

createMSJ()

Creat msj for desmond.

parseMsjStr(msj_str)

Parse MSJ string, set task stage and customize settings.

Parameters:msj_str (str) – a string in MSJ format
Returns:modified msj string with task stage
Return type:schrodinger.application.desmond.multisim.Msj
getStages()

Get desmond stages from config yaml.

Returns:the MSJSTRINGERS contains desmond stage information, the orig_msj_str is for msj string provided by users.
Return type:list of desmondutils.MSJStringer, str
updateReplicaSeed(stages, msj_stages)

Update the random seed in the msj so that each replica has a different value.

Parameters:
  • stages (list of desmondutils.MSJStringer) – the desmond MSJSTRINGERS contains desmond information
  • msj_header (schrodinger.application.desmond.multisim.Msj) – the msj header with task stage (may have other simulation stages)
modifyReplicaStages(stages)

Search the desmond stages for seed, and tune them based on the replica index.

Parameters:stages (list of the MSJSTRINGERS) – the desmond MSJSTRINGERS contains desmond information
Returns:whether some seeds in the stages are modified
Return type:bool
modifyReplicaMsjHeader(msj_stages)

Modify the replica Msj header.

Parameters:msj_stages (schrodinger.application.desmond.multisim.Msj) – the msj header with task stage (may have other simulation stages)
Returns:whether the msj_stages are modified
Return type:bool
modifyReplicaFirstStage(stages)

Modify the first desmond stages to add seed based on the replica index

Parameters:stages (list of the MSJSTRINGERS) – the desmond MSJSTRINGERS contains desmond information
classmethod optionsToStage(options)

Convert command line options to a stage like dict.

Parameters:options (argparse.ArgumentParser) – the command parsered options
Returns:key and values for a desmond stage
Return type:dict
static getRelaxationStages(relaxation_file)

Get the relaxation stages from relaxation protocol file and return it as desmond stages.

Parameters:relaxation_file (str) – a file containing relaxation protocol
Returns:list of desmond stages
Return type:list
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Process the stages, for example, update relaxation stages, update the productions stage, and remove productions markers.

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

list of desmond stages

Return type:

list

classmethod getRelaxationProtocolFile(relaxation_option)

Return the relaxation protocol file based on the relaxation option.

Parameters:relaxation_option (str) – file with path or a protocol name
Returns:relaxation file with path
Return type:str
classmethod getAllStages(options, task_name)

Construct the stages in general by looking at the config yaml, commandline relaxation, and productions. Note: only when stages are marked by USE_CUSTOMIZED_RELAXATION and options.relaxation_protocol is provided, the stages in the relaxation_protocol is used to overwrite the stages in options.config_yaml.

Parameters:
  • options (argparse.Namespace) – The object holding all the cmd options
  • task_name (str) – the task name of the stage
Returns:

task_protocol.protocol is a list of stages

Return type:

‘TaskProtocol’

classmethod modifyStageSettings(all_stages, options, seed=None)

Modify the stages based on command line options, including update the temperature and pressure of the first flexible stages before each production stage, pass velocity to NVE production stage.

Parameters:
  • all_stages (list) – stages
  • options (Named tuple) – The parsed command line options
  • seed (int or None) – random seed to randomize the initial velocities
DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.MdStageModifier(stages, options, seed=None)

Bases: object

RANDOMIZE_VELOCITY_DOT_FIRST = 'randomize_velocity.first'
RANDOMIZE_VELOCITY_DOT_SEED = 'randomize_velocity.seed'
LAST_RELAX_STAGE_TRJ_INTVL = 100.0
__init__(stages, options, seed=None)
Parameters:
  • stages (each stage is a dict containing desmond run settings) – list of stages
  • options (Named tuple) – The parsed command line options
  • seed (int or None) – random seed to randomize the initial velocities
run()

Main method to drive the functionality.

setRelaxAndProductionIndexes()

Set relaxation and production stage indexes according to markers. Note: if only relaxation stages are found, the stage right after the last relaxation is assumed to be the production stages.

static getStageIndicesByMarker(stages, marker='is_production', expected_value='yes', remove_marker=False)

Indexes of the stages marked with certain markers. For example, IS_PRODUCTION markers stages as production stages; IS_RELAXATION markers stages as relaxation stages; If USE_CUSTOMIZED_RELAXATION markers some stages, the first with this marker and those before this one will be replaced by customized relaxation stages defined by users.

Parameters:
  • stages (list) – multistages for desmond serial simulations
  • marker (bool) – remove the marker flag, if True
  • expected_value (str) – this is expected value pointed to by the marker
  • remove_marker (bool) – remove the yes production flag, if True
Returns:

the indexes of all the stages marked with ‘xxx:yes’

Return type:

list of int

setRelaxRandomVel()

Set the randomize velocity seed for the first relaxation stage.

updateProductStageTempAndPress()

Update the temp and press of the production stage.

updateRelaxStageTempAndPress()

Update the temperature and pressure settings of stages. If no NPT or NVT ahead of the NVE, randomize the NVE production velocity.

connectNVEInitialVelocity()

Seamlessly connect the NVE production stage to the previous stages by writing out velocities and skip the randomizing initial velocities.

updateLastRelaxStage()

Update the last relaxation stage settings.

updateTrjIntvel()

Update the trajectory output interval for the stages before the last relaxation stage.

updateLastStage()

Update the settings of the last stage.

removeCom()

Add remove center of mass string to relaxation and production stages.

removeDummyFields()

Remove the intermediate arguments that desmond doesn’t recognize.

class schrodinger.application.matsci.permittivity.DisorderSystemBuilder(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class for customized disorder system builder.

DSB_DRIVER = <module 'disordered_system_builder_driver' from '/scr/buildbot/savedbuilds/2020-3/NB/build-133/mmshare-v5.1/python/scripts/disordered_system_builder_gui_dir/disordered_system_builder_driver.py'>
DRIVER_PATH = 'disordered_system_builder_gui_dir/disordered_system_builder_driver.py'
DISORDER_SYSTEM = 'disorder_system'
DEFAULT_JOBNAME = 'permittivity_disorder_system_task'
FLAG_MOLECULES = '-molecules'
FLAG_COMPOSITION = '-composition'
DEFAULT_NUMBER_OF_MOLECULES = 500
classmethod getSeedFlag()

Return the flag for random seed.

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str
classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Process the stages, for example, update relaxation stages, update the productions stage, and remove productions markers.

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

list of desmond stages

Return type:

list

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup(copy_infile=True, copy_additional_files=True, more_files=None)

Setup things before the job starts. For example, logging format, and file transfer.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.MdPostAnalysis(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Base class to hold molecular dynamics post analysis functionality.

TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
setup(copy_ene=False, write_cms=False)

Over write parent class method.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.DensityAnalysis(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.MdPostAnalysis

Class to do post desmond density analysis.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_density_driver.py'
DENSITY = 'density'
DEFAULT_JOBNAME = 'permittivity_density_task'
DENSITY_PROP = 'r_matsci_Density(g/cm3)'
DENSITY_STD_PROP = 'r_matsci_stdev_Density(g/cm3)'
DENSITY_REPLICA_PROP = 'r_matsci_Density_Replica_%i(g/cm3)'
DENSITY_STD_REPLICA_PROP = 'r_matsci_stdev_Density_Replica_%i(g/cm3)'
TEMP_REPLICA_PROP = 'r_matsci_Temperature_Replica_%i(K)'
TEMP_STD_REPLICA_PROP = 'r_matsci_stdev_Temperature_Replica_%i(K)'
DENSITY_REPLICA_PROP_REX = 'r_matsci_Density_Replica_(\\d)\\(g/cm3\\)'
TEMP_REPLICA_PROP_REX = 'r_matsci_Temperature_Replica_(\\d)\\(K\\)'
OUTFILE_EXT = '-out.cms'
setup(copy_ene=True)

Over write parent class method.

static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.MdPostAnalysis

Base class to hold molecular dynamics post trajectory analysis functionality.

setup(copy_ene=False, write_cms=True)

Over write parent class method.

static getTrajectoryFromCms(input_cms, orig_cms=None)

Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.

Return type:

str, str or None

Returns:

existing trajectory if found, whether the input trajectory sits with the original cms

classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.AveCellAnalysis(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to do post cell average analysis on desmond trajectory.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_ave_cell_driver.py'
AVE_CELL = 'ave_cell'
DEFAULT_JOBNAME = 'permittivity_ave_cell_task'
OUTFILE_EXT = '-out.cms'
setup(copy_ene=True, write_cms=True)

Over write parent class method.

static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

static getTrajectoryFromCms(input_cms, orig_cms=None)

Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.

Return type:

str, str or None

Returns:

existing trajectory if found, whether the input trajectory sits with the original cms

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.AnalyzeSimulation(*arg, **kwarg)

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to analyze trajectory from desmond simulation using analyze_simulation.py

DRIVER_PATH = 'analyze_simulation.py'
ANALYZE_SIMULATION = 'analyze_simulation'
DEFAULT_JOBNAME = 'permittivity_analyze_simulation_task'
OUTFILE_EXT = '-out.cms'
ST2_EXT = '.st2'
OUT_ST2_EXT = '-out.st2'
INPUT_ST2 = 'input_st2'
OUT_ST2_PROP = 's_matsci_St2_File'
__init__(*arg, **kwarg)

See paraent class for documentation

setup()

Over write parent class method.

appendTrjInOutst2ToCmd()

Append the trajectory, input st2, and output st2 information to the cmd.

createInputSt2()

Create input st2 file based on the configure yaml.

setOutfile()

Set the outfile of a job.

static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

static getTrajectoryFromCms(input_cms, orig_cms=None)

Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.

Return type:

str, str or None

Returns:

existing trajectory if found, whether the input trajectory sits with the original cms

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.DipoleAnalysis(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to do post dipole analysis on desmond trajectory.

FLAG_SLICE_INTVL = '-slice_intvl'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
DIPOLE = 'dipole'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
OUTFILE_EXT = '-out.cms'
TIME_SERIAL = 'time_serial'
AUTOCORRELATION = 'autocorrelation'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
SUSCEPTIBILITY = 'susceptibility'
TIME_SERIAL_CAPITALIZE = 'Time_Serial'
TIME_SERIAL_FILE_PROP = 's_matsci_Dipole_Time_Serial_File'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
KWW = 'kww'
TAU = 'tau'
BETA = 'beta'
KWW_TAU_PROP = 'r_matsci_Kww_Tau'
KWW_BETA_PROP = 'r_matsci_Kww_Beta_(ps)'
static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

static getTrajectoryFromCms(input_cms, orig_cms=None)

Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.

Return type:

str, str or None

Returns:

existing trajectory if found, whether the input trajectory sits with the original cms

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup(copy_ene=False, write_cms=True)

Over write parent class method.

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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.ComplexPermittivity(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.DipoleAnalysis

Class to do post complex permittivity analysis based on dipole autocorrelation output files (npz, csv).

MAX_DIEL_LOSS_ANLR_FREQ_PROP = 'r_matsci_Angular_Frequency_of_Maximum_Dielectric_Loss_(Hz)'
setup()

See parent class.

udpateCmd()

Update the command of the subjob: trim the input cms to one single; all the cms files are parsed for original cms and the original cms filenames are provided as the base filename without cms, csv, or npz.

static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
AUTOCORRELATION = 'autocorrelation'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
BETA = 'beta'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
DIPOLE = 'dipole'
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
FLAG_SLICE_INTVL = '-slice_intvl'
KWW = 'kww'
KWW_BETA_PROP = 'r_matsci_Kww_Beta_(ps)'
KWW_TAU_PROP = 'r_matsci_Kww_Tau'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.cms'
REPLICA_TAG = 'Replica %i: '
classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
SUSCEPTIBILITY = 'susceptibility'
TAU = 'tau'
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
TIME_SERIAL = 'time_serial'
TIME_SERIAL_CAPITALIZE = 'Time_Serial'
TIME_SERIAL_FILE_PROP = 's_matsci_Dipole_Time_Serial_File'
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

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.

static autocorrelation(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

Calculate the auto correlation of the input numpy.array data.

Parameters:
  • time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
  • normalize (bool) – if True, the auto correlation data will be normalized
Returns:

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
static getEneFromCms(input_cms, orig_cms=None)

Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when ene file cannot be found.

Return type:

str, str or None

Returns:

existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)

static getEneFromFilename(cms_file)

Get the ene file based on cms file name (may with path).

Parameters:cms_file (str) – the cms whose ene file is searched.
Returns:the ene file
Return type:str or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

static getTrajectoryFromCms(input_cms, orig_cms=None)

Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.

Parameters:
  • input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
  • orig_cms (str) – the original cms defined by users.
Raises:

KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.

Return type:

str, str or None

Returns:

existing trajectory if found, whether the input trajectory sits with the original cms

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

writeCms()

Write out cms files to current dir and each of them has a ‘cms.Cms.PROP_CMS’ property pointing to the original cms file path.

class schrodinger.application.matsci.permittivity.JaguarCalculation(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class to do a Jaguar calculation with keywords.

IN_EXT = '.in'
DRIVER_PATH = 'run'
POSITIONAL_CMD = 'permittivity_gui_dir/permittivity_positional_driver.py'
DEFAULT_JOBNAME = 'permittivity_jaguar_task'
FLAG_PARALLEL = '-PARALLEL'
BASIS = 'basis'
IGEOPT = 'igeopt'
MOLCHG = 'molchg'
MULTIP = 'multip'
IUHF = 'iuhf'
DFTNAME = 'dftname'
IPOLAR = 'ipolar'
B3LYP = 'B3LYP'
INT_KEYWORDS = ['igeopt', 'molchg', 'multip', 'iuhf', 'ipolar']
KEYWORD_DEFAULTS = {'dftname': 'B3LYP', 'igeopt': 0, 'ipolar': None, 'iuhf': None, 'molchg': 0, 'multip': 1}
FLAG_JAGUAR_OPTIONS = '-jaguar_options'
DEFAULT_JAGUAR_OPTIONS = {'basis': '6-31G**', 'dftname': 'B3LYP', 'igeopt': 1}
setup()

See parent class.

getCommand()

Structure from polymer builder with the target length can be very large and shouldn’t directly go into jaguar. Overwrite the jaguar job command so that this step skipped for now with all the input information saved in the workflow tree.

Returns:the command to run the subjob
Return type:list of str
customizeInputAndCommand()

Jaguar stage requires its own input file instead of mae. The method writes out the jaguar input file and update the command with the jaguar input file.

static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the task protocol according to the user input.

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

list of desmond stages

Return type:

list

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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.

getCommandDir()

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

Return type:str
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.ElectricPolarizability(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class to do jaguar calculation of electric polarizability.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_electric_polarizability_driver.py'
ELECTRIC_POLARIZABILITY = 'electric_polarizability'
DEFAULT_JOBNAME = 'permittivity_electric_polarizability_task'
FLAG_JAGUAR_OPTIONS = '-jaguar_options'
FLAG_ELEC_POLARIZABILITY = '-elec_polarizability'
DEFAULT_JAGUAR_OPTIONS = {'basis': 'cc-pVTZ-pp(-f)++', 'dftname': 'B3LYP', 'igeopt': 1, 'ipolar': -1}
PROP = 'electric_polarizability'
KEY = 'r_matsci_Electric_Polarizability_(bohr^3)'
ELECTRIC_POLARIZABILITY_PROP = 'r_matsci_Electric_Polarizability_(bohr^3)'
POLAR_ALPHA = 'polar_alpha'
DEFAULT_KWARGS = {'jaguar_output_attr': 'polar_alpha', 'tpp': 1}
FLAG_POLYMER_BUILDER_NUM_MONOMERS = '-num_cru'
ELECTRIC_POLARIZABILITY_SLOPE = 'r_matsci_Electric_Polarizability_Slope_(bohr^3/monomer)'
ELECTRIC_POLARIZABILITY_INTERCEPT = 'r_matsci_Electric_Polarizability_Intercept_(bohr^3)'
PLYM = 'plym'
classmethod isMultipleOligomers(input_mae)

Check whether the input mae contains oligomers.

Parameters:input_mae (str) – a mae file name with path
Returns:True if the input files have more than 1 oligomers.
Return type:bool
static cmdFlagsToJaguarOptions(cmd_jaguar)

Convert cmd flags from the config yaml to jaguar option keys.

Parameters:cmd_jaguar (list of str) – list of command flags without the ‘-‘ and always with a value following.
Returns:a dict of jaguar option keys and values
Return type:dict
classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getCruNumFromCmd(cmd)

Return the the cru num (number of monomeric units) from a command.

Parameters:cmd (list of str) – the command with -num_cru and a followed int
Returns:number of monomeric units
Return type:int or None
runAndGetPolymerBuildJobInfos(polymer_job)

Run additional polymer builder jobs and return the information of them.

Note: it is possible that each polymer builder job for an oligomer is followed by one jaguar calculations

Parameters:polymer_job (an instance of a BaseJob subclass (such as) – the polymer subjob before the jaguar subjob

JobControlJob or SubprocessJob)

Returns:each SimpleNamespace has the information of the previous polymer subjobs and the input jaguar input file information.
Return type:list of SimpleNamespace
createPolymerJob(polymer_job, num_cru)

Create one polymer builder job for an oligomer of num_cru length.

Parameters:polymer_job (an instance of a BaseJob subclass (such as) – the polymer subjob before the jaguar subjob

JobControlJob or SubprocessJob)

Parameters:num_cru (int) – number of monomeric units
Returns:the polymer builder job to build an oligomer
Return type:‘jaguarworkflows.RobustSubmissionJob’ or any subclass of queue.JobControlJob
runPolymerJobs(polymer_job)

Run and return a list of finished polymer builder jobs.

Parameters:polymer_job (an instance of a BaseJob subclass (such as) – the polymer subjob before the jaguar subjob

JobControlJob or SubprocessJob)

Returns:Successfully completed jobs, sorted into the order they were marked as completed by JobDJ.
Return type:list of queue.JobControlJob
getPolymerBuilderInfos(done_polym_jobs, original_num_cru)

Get the polymer job information for all oligomers or just itself.

Parameters:
  • done_polym_jobs (list of queue.JobControlJob) – Successfully completed polymer builder jobs for oligomers, sorted into the order they were marked as completed by JobDJ.
  • original_num_cru (int) – original monomeric unit number
Returns:

each SimpleNamespace has the information of the previous polymer subjobs: e.g., the input file for jaguar calculations.

Return type:

list of SimpleNamespace

createJaguarJob(jaguar_task_name, jaguar_infile)

Create a jaguar job based on the task name and input file.

Parameters:
  • jaguar_task_name (str) – the task name
  • jaguar_infile (str) – path and filename pointing to the input struct
Returns:

a JobControlJob instance for jaguar calculation

Return type:

‘JaguarCalculation’

runJaguarJobs(polymer_builder_job_infos)

Run jaguar calculations and return the finished ones.

Parameters:polymer_builder_job_infos (list of SimpleNamespace) – each SimpleNamespace has the information of the previous polymer subjobs.
Returns:list of finished jaguar calculations
Return type:list of JobControlJob
updatePolymerBuilderInfos(polymer_builder_job_infos, jaguar_done_jobs)

Update the polymer builder infos according to the addtion jaguar calculations if exist.

Parameters:
  • polymer_builder_job_infos – each SimpleNamespace has the information of the previous polymer subjobs information.
  • jaguar_done_jobs (list of JobControlJob) – list of finished jaguar calculations
Returns:

each SimpleNamespace has the information of the previous polymer subjobs and finished jaguar subjobs.

Return type:

list of SimpleNamespace

getCruNums()

Return a list of requested ‘num_cru’s (cru means repeat unit).

Returns:list of int
Return type:str or None
jobInfos()

Return the polymer builder subjob information for the subjob that should be the parent jobs of this jaguar subjob.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the jaguar subjob, which may have a polymer builder subjob as parent job.
Returns:a list of SimpleNamespace objects and each has information on a existing polymer builder subjob; if no polymer builder job head, the list is of one single SimpleNamespace object indicting that the original num_cru is None
Return type:a list of ‘SimpleNamespace’
writeJaguarInputStructs(job_infos, all_struct_file='tmp_jaguar_in_sts.maegz')

Get the jaguar input structures from polymer builder job infos.

Parameters:
  • job_infos (list of SimpleNamespace) – the job information (e.g., single struct or oligomers)
  • all_struct_file (str) – a file containing all structure for jaguar calculations
Returns:

a file containing all structure for jaguar calculations

Return type:

str

classmethod setElecPolarizability(structs_from_jaguar, out_struct)

Get the jaguar output structure. If multiple jaguar calculations are performed, the returned one contains the fitted electric polarizability by linear extrapolation.

Parameters:
  • structs_from_jaguar (list of 'structure.Structure') – structures from jaguar calculations
  • out_struct ('structure.Structure') – structure to set electric polarizability
updateCmd(tmp_structs_file=None)

Update the jaguar job command. If tmp_structs_file is not None, update the original command with tmp_structs_file.

Parameters:tmp_structs_file (the input file contains multiple structures) – str or None
moveJaguarFlagsToCmdTail()

As jaguar options has nargs=+, rearrage it to be the last optional flag.

setup()

Finalize this step.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the task protocol according to the user input.

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

list of desmond stages

Return type:

list

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.TwoFileInput(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class to sort the two input files based on extension.

TERMINAL_INFILE_NUM = 2
setup()

See parent class.

DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Update child job’s command with the parent job output, and set output files if not set by the subjob itself.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.RefractiveIndex(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.TwoFileInput

Class to do refractive index calculation.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_refractive_index_driver.py'
REFRACTIVE_INDEX = 'refractive_index'
DEFAULT_JOBNAME = 'permittivity_refractive_index_task'
REFRACTIVE_INDEX_PROP = 'r_matsci_Refractive_Index'
RELATIVE_PERMITTIVITY_INF_PROP = 'r_matsci_Relative_Permittivity_Inf'
static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 2
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup()

See parent class.

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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

class schrodinger.application.matsci.permittivity.StaticPermittivity(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)

Bases: schrodinger.application.matsci.permittivity.TwoFileInput

Class to do refractive index calculation.

OUTFILE_EXT = '-out.cms'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_static_permittivity_driver.py'
STATIC_PERMITTIVITY = 'static_permittivity'
DEFAULT_JOBNAME = 'permittivity_static_permittivity_task'
RELATIVE_STATIC_PERMITTIVITY_PROP = 'r_matsci_Relative_Static_Permittivity'
static finalizeStep(job)

Finalize this step. Can be overwritten for light weight post process.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
REPLICA_TAG = 'Replica %i: '
TERMINAL_INFILE_NUM = 2
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, replica_index=None)
Parameters:
  • basename (str) – the base name of this subjob
  • config_yaml (str) – the config yaml file contain all job config
  • task_name (str) – task name of this sub job
  • infile (str) – the input filename
  • outfile (str) – the output filename
  • additional_infiles (list of str) – this records additional input files (e.g. the second, third, and so on)
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
  • replica_index (int or str or None) – the replica index of this job
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.

cancelSubmitted()

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.

Return True if this was successful, False otherwise.

Return type:bool
copyFiles(copy_infile=True, copy_additional_files=True, more_files=None)

Copy files to current dir.

Parameters:
  • copy_infile (bool) – copy the input files of the class to current folder
  • copy_additional_files (bool) – copy the additional files of the class to current folder
  • more_files (None or list of str) – use this arguments to copy customized files
doCommand(host, local, use_async=True)

Launch job on specified host using jobcontrol.launch_job().

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Removed in JOB_SERVER.
  • use_async (If True, do not block JobDJ for launching.) – bool
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
getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
getFirstMatchedfilename(filenames, exts)

Get the filename that ends with the first extension. If multiple filenames end with that extension return the first match.

Parameters:
  • filenames (list of string) – list of filenames
  • exts (list of string) – list of extensions
Returns:

the matched filename or None

Return type:

string or None

classmethod getForceFieldFlag()

Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getJob()

Return the job record as a schrodinger.job.jobcontrol.Job instance.

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

classmethod getReplicaFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
classmethod getSeedFlag()

Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag

Returns:the flag to set the random seed (without the ‘-‘)
Return type:str or None
getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

getUpStreamPolymerJob()

Search and return the up-stream polymer job

Returns:A subtask step with polymer driver in the cmd
Return type:‘Step’ or None
hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

log(msg, add_log_tag=True)

Log information to the master driver.log

Parameters:
  • msg (str) – the info to print
  • add_log_tag (bool) – If True, additional tags is logged in front of the msg for the replica jobs.
maxFailuresReached(msg)

Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.

classmethod optionsToTaskProtocols(options, task_name, seed=None)

This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
  • seed (int or None) – random seed to randomize the initial velocities
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

outfileExist()

Whether the outfile exists

Returns:Whether the file exists.
Return type:bool
postCommand()

A method to restore things to the pre-command state.

preCommand()

A method to make pre-command changes, like cd’ing to the correct directory to run the command in.

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to not retry jobs that have a status of “died” as that will indicate that Jaguar failed, which it almost certainly will again.

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
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.

setOutfile()

Set the job outfile with an existing file based on the jobcontrol job, if not set.

Raises:FileNotFoundError – Failed to set an existing outfile
setup()

See parent class.

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.

update(use_async=True)

Checks for changes in job status, and updates the object appropriately (marks for restart, etc).

Parameters:use_async (bool) – If True, use asynchronous API for downloading
Raises:RuntimeError – if an unknown Job Status or ExitStatus is encountered.
updateInfileAndCommand(par_outfile_with_dir)

Update the input file in the command and the input file attributes of a child job to the output file path of the parent job.

Parameters:
  • child_job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – the subjob whose command will be updated.
  • par_outfile_with_dir (str) – the output file from the parent job that will be used as the input file of this child job.
updateTaskReplicaSettings()

Update the task settings due to replica.

usesJobServer()

Detect, by looking at the jobId, whether this job uses a job server. Since the jobId is only set once, cache the answer (_uses_job_server) once it is established.

schrodinger.application.matsci.permittivity.get_config(config_yaml)

Get the Config instance from the input yaml file.

Parameters:config_yaml (str) – the input configure yaml file
Returns:the Config instance with property processed.
Return type:Config
schrodinger.application.matsci.permittivity.get_config_from_options(options)

Get the Config instance from the command line options.

Parameters:options (namedtuple) – command line options
Returns:the Config instance with property processed.
Return type:Config
class schrodinger.application.matsci.permittivity.Config(config_yaml)

Bases: object

Class to store the config file, parse workflow, provide method to get fields.

__init__(config_yaml)
Parameters:config_yaml (str) – the config file
load()

Load configure file, set the task protocols by name and type

NOTE: if no type found, name is used as the type

Note: if the task type have multiple stages and each stage has its own index field, the sequence of the stages is sorted according to the index field. task_name has higher priority than task_type type, as multiple task names can share the same task type.

setWorkflow()

workflow is a nested data structure of list, tuple, and dict. Itself looks like an unbalanced tree data type. list gives linear job dependency as desmond msj Tuple gives independence between each task, and all these subjobs can share parent from the same level or one level up list. Dict links additional parent jobs.

NOTE: dict is unhashable and cannot be used as the key of a dict. Each key or value is either a TASK NAME or TASK NAME (int,int,..) whose (int, int,..) defines the task id so that the same task name can be used multiple times, and the additional dependence by dict can indentify unique task. (This is not tested or may not be well implemented)

The same task name can appear several times in the workflow, which means that the same task (with the same settings) run multiple times in the workflow. However, the dict value must link to a single task ( either unique task name or with task id)

The workflow section describes the task sequence and dependence. Each string corresponds to a task name (may with task id), and each task name must have a top level section in configure file to define the settings.

The title of each task setting section describe the name and type. For example, TASK NAME (TASK TYPE): [flag1 : value1, flag2 : value2] The TASK TYPE is used to map for backend class

getTaskNames()

Get all the tasknames in the workflow block

Returns:tasknames in the workflow
Return type:set
sortStages(index_field='index')

Sort the stage order according to the index field.

Parameters:index_field (Use this index field to sort all the stages in a task protocol) – str of None
splitNameAndType(name_and_type)

Split the task section title into task name and task type. ‘task name (task type)’ or ‘task name’ alone in front of the task setting section.

Parameters:name_with_prop (str) – ‘task name (task type)’ or ‘task name’
Returns:(task name, take type) or (task name , None)
Return type:(str, str) or (str , None)
setNameToTypeMap()

Based on the config file, get a dict map from task name to task type. If ‘task name’ instead of ‘task name (task type)’ is found, task type is assumed to be the same as task name.

Parameters:config_yaml (str) – a configure filename with path
Returns:map from task name to task type
Return type:dict
getTaskProtocol(task_name=None, task_type=None)

Get the protocol for selected task by name or type. If both provided, select by type.

Parameters:
  • task_name (str or None) – the task name of a stage. the xxx as in the ‘xxx (task type)’ before the setting block.
  • task_type (str or None) – the task type of a stage. the xxx as in the ‘task type (xxx)’ before the setting block.
  • index_field (Use this index field to sort all the stages in a task protocol) – str of None
Returns:

list of list for workflow block; list of list for desmond multiple stages; dict for regular single stage

Return type:

dict, list of str, or list of list

class schrodinger.application.matsci.permittivity.ConfigWriter(options, jobname)

Bases: object

__init__(options, jobname)

Class to write out config yaml.

Parameters:
  • options (namedtuple) – commandline options
  • jobname (str or False) – the jobname based on which the yaml filename is set
run()

Main method to drive the functionality.

loadWorkflow()

Load the config yaml based on commandline options, and parse the file.

loadAndUpdateTaskProtocol()

Update the task protocols based command line input, and set task type and driver path.

validateGpuHosts()

Validate GPU availability against the type of protocols. (whether desmond tasks exist)

checkInputfileTasktypeDriverpaths()

Validate whether the restart flag for input file task type driver paths is followed by properly formatted values.

write()

Write out the updated config yaml to disk if users don’t specific their input config yaml.

class schrodinger.application.matsci.permittivity.WorkflowParser(config_yaml, basename, infile_job_infos, master_logger=None)

Bases: object

TASK_NAME = 'task_name'
TASK_TYPE = 'task_type'
TASK_DRIVER_PATH = 'task_driver_path'
SPECIFIC_RESTART_LOCATOR_MAP = {'driver_path': 'task_driver_path', 'name': 'task_name', 'type': 'task_type'}
TASK_SUBCLASS = 'task_subclass'
TASK_SUBJOB = 'task_subjob'
TASK_REPLICA = 'task_replica'
REPLICA_DELIMITER = 'r'
FIRST_LVL_CHILD_NODE_INDEXES = 'first_lvl_child_node_indexes'
FIRST_LVL_PARENT_NODE_INDEXES = 'first_lvl_parent_node_indexes'
ORIG_FLPNI_MAP = 'orig_flpni_map'
LIST_PROP_KEYS = ['task_replica', 'first_lvl_child_node_indexes', 'first_lvl_parent_node_indexes']
TASK_TYPE_TO_SUBCLASS = {'Complex Permittivity Protocol': <class 'schrodinger.application.matsci.permittivity.ComplexPermittivity'>, 'Disorder System Builder Protocol': <class 'schrodinger.application.matsci.permittivity.DisorderSystemBuilder'>, 'Jaguar Calculation Protocol': <class 'schrodinger.application.matsci.permittivity.JaguarCalculation'>, 'Jaguar Polarizability Protocol': <class 'schrodinger.application.matsci.permittivity.ElectricPolarizability'>, 'MD Analyze Simulation Protocol': <class 'schrodinger.application.matsci.permittivity.AnalyzeSimulation'>, 'MD Average Cell Protocol': <class 'schrodinger.application.matsci.permittivity.AveCellAnalysis'>, 'MD Density Protocol': <class 'schrodinger.application.matsci.permittivity.DensityAnalysis'>, 'MD Dipole Protocol': <class 'schrodinger.application.matsci.permittivity.DipoleAnalysis'>, 'MD Simulation Protocol': <class 'schrodinger.application.matsci.permittivity.MultiStageMd'>, 'Polymer Builder Protocol': <class 'schrodinger.application.matsci.permittivity.PolymerBuilder'>, 'Refractive Index Protocol': <class 'schrodinger.application.matsci.permittivity.RefractiveIndex'>, 'Static Permittivity Protocol': <class 'schrodinger.application.matsci.permittivity.StaticPermittivity'>}
__init__(config_yaml, basename, infile_job_infos, master_logger=None)
Parameters:
  • config_yaml (str) – config file
  • basename (str) – base name
  • infile_job_infos (list of SimpleNamespace) –
  • logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
setUp()

Parse the workflow section in the config yaml and setup the subjobs.

initialize()

Initialize the class by reading workflow from config file, creating networkx, indexing the workflow task names….

addNodes()

Add each task name using an unique index as a node to the graph.

addEdges()

Add edges between nodes according to the job dependence (parent / child).

addSubclassToGraphNodes()

Add task type, driver path, and subclass to each node.

getLeafTaskNodes()

Return the task node without dependents in an order that the leaf with the longest path to the root is returned first.

Returns:a list of nodes without a child.
Return type:list of nodes in networkx.Graph.nodes
getFirstLevelParentNodes(node)

Return the first level parent task subjob node indexes of this input node.

Parameters:node (tuple) – a node index whose parent nodes are requested
Returns:a node in the job without a child
Return type:list of nodes (dict)
getOrderedTaskSubjobDirs(node)

Return the task subjob dirs in the order from bottom to the top.

Parameters:node (dict as a node in networkx.Graph.nodes) – a node in the job without a child.
Returns:key is the task name and value is the subdir of the task
Return type:OrderedDict
addSubjobsToGraphNode()

Initiate each subclass and add the initiated subclass (subjob) to the node.

getSubjobname(node_index)

Return the subjob name based on task name and node index.

Parameters:node_index (tuple) – the index to get job info node
Returns:subjob name
Return type:str
setFirstLevelParentChildJobs(clear_first=True)

From the edges of the graph, save the info on the first level child jobs for each parent job and the first level parent jobs for each child job.

clearFirstLevelParentChildJobs()

Clear the first level child jobs and first parent job information.

removeIncompatibleStartingSubjobs()

Remove the subjobs that are not defined as starting tasks by task type or task driver path.

setSubjobDependence()

Set the job dependence between each subjob pair.

JobinfoAndNodeMatched(jinfo, node)

Whether the job information and task node match.

Parameters:
  • jinfo (SimpleNamespace) – one job information for specific restart.
  • node (networkx.Graph.nodes) – one task node in the networkx
Returns:

True if the jinfo matches the node settings

Return type:

bool

updateSartupJobs()

Set the input files for the start-up jobs.

addReplicaNode(node, node_rindex)

Add the replica node to the graph and set node properties.

Parameters:
  • node (dict) – the node in graph the replica duplicates
  • node_rindex (tuple) – the nodex index of the replica
connectReplicaNode(node, node_index, node_rindex, replica_type='branching')

Add the edges between one replica node and the parent and child nodes of the original nodes. In addition, the mapping between original node and replica nodes is saved in each child job so that further threading process can utilize before merging.

NOTE: threading mode disconnects one single parent node.

Parameters:
  • node (dict) – the node of the original node
  • node_index (tuple) – the node index of the original node
  • node_rindex (tuple) – the node index of the replica node
  • replica_type (str) – the replica
disconnectOrigNode(node, node_index)

Disconnect the edge and first level things between the original node and all parents and children.

Parameters:
  • node (dict) – the original node
  • node_index (tuple) – the original node index
setReplica()

Process the replica nodes (branch, thread, and merge) and treat original nodes properly.

setAllBranchReplicaNodes()

Iterate all branching replica nodes.

Returns:True if one or more than one branch nodes are processed.
Return type:bool
setAllThreadingReplicaNodes()

Iterate all threading replica nodes.

setAllMergeReplicaNodes()

Iterate all merging replica nodes.

logReplicaInfo()

Print all the node info including replica node for debugging.

setBranchReplicaNodes()

Locate branching nodes, replace then with replica nodes, properly connecting and disconnecting edges, update first level parent and child jobs upstream and downstream of the original nodes.

Returns:True if one or more branch nodes are successfully processed.
Return type:bool
getRelicaNodeIndexes(node_type='threading')

Get the node index of a certain type (threading or merging).

Parameters:node_type (str) – ‘threading’ is a node of single parent who is a replica node. ‘merge’ is a node marked with MERGE replica keywords
Returns:generator of the node index of a certain type (threading or merging)
Return type:generator of tuple
Raises:TypeError – during threading, a branching node is encountered. This may come from a improper workflow design or bug. Branch should happen before thread. Currently, only one single branching node design is implemented and tested.
setThreadingReplicaNodes()

Locate threading nodes (node after branching replica before merge node), replace then with a single replica node, properly connecting and disconnecting edges, update first level parent and child jobs upstream and downstream of the original nodes.

Returns:True, if successfully identify and process one single node with replica.
Return type:bool
setMergeReplicaNodes()

Merge the replica nodes. Multiple last replica job in different threads are the parent of one single merge job, which is the original job.

Returns:True, if successfully identify and merge into one single job.
Return type:bool
addJobsToJobDj(jdj)

Add leaf jobs to the JobDJ and all jobs with dependence set by setSubjobDependence() are added as well.

Parameters:jdj ('queue.JobDJ') – The JobDJ instance to register jobs.
Returns:the job queue for running commands/jobs in parallel under jobcontrol.
Return type:‘queue.JobDJ’
draw(has_replica=False)

Draw the workflow with dependence and task name as png.

classmethod getTaskSubClass(task_type, task_protocol)

Get task subclass if the subclass is known by this driver, or a specific task driver path is provided in the config yaml setting block.

Parameters:
  • task_type (str) – the task type of this stage
  • task_protocol
Raises:

TypeError – when the task_type is not supported

Returns:

Return type:

the class or subclass of ‘Step’

classmethod writeConfig(options, jobname)

Command line options is a subset of all the flags, and thus write a new configure file based on command line options and configure template.

NOTE: if a config_yaml is explicitly passed from the command line, The returned the full path of the final config file pointing to the original path from the command line.

Parameters:
  • options (The parsed command line options) – Named tuple
  • jobname (str or False) – the jobname based on which config yaml is generated. If False, no yaml file written out.