schrodinger.application.matsci.permittivity module

Permittivity module for permittivity workflow.

Copyright Schrodinger, LLC. All rights reserved.

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

Add a message to debug logger file.

Parameters

msg (str) – The message to debug logging

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=(1000000.0, 100000000000000.0), omega_num=None, simpson_quadrature=True, angular_frequency=False)

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, which must be positive

  • 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

  • angular_frequency (bool) – If True, the first column is angular frequency else regular frequency

Raises
  • ValueError – Non-uniform fourier transform yields nan (e.g. beta is negative)

  • AssertionError – beta <= 0

Returns

Three columns are 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, startwith=False)

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.

  • startwith (bool) – If True, property keys starting with the requested string are considered matches.

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

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_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 (argparse.Namespace) – 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

static get_file(filename=None, product_dir=None)

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

classmethod get_file_from_options(options)

Return the permittivity config file based on command line inputs.

Parameters

options (argparse.Namespace) – The command parsered options

Returns

The path to a config yaml

Return type

str

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 task names 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 (argparse.Namespace) – 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)

DEPRECATED due to MATSCI-9604

checkInputfileTasktypeDriverpaths()

Validate whether the restart flag for input file task type driver paths is followed by properly formatted values.

DEPRECATED as MATSCI-8523 is planned as the customer facing api

write()

Write out the updated config yaml to disk if users don’t specific their input config yaml.

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

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

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

getTaskName(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.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

getInterpFlagBlock(label='cmd_flags')

Get the flag block with desired label and interpret the block into dict data type.

Parameters

label (str) – The block header label to search

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

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.

rmReplicaKeywords()

Remove the replica keywords from xtra flag block.

getSeed(seed_flag)

Return the random seed for this task.

Returns

The random seed in the config or the default value

Return type

int

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
  • user_input (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 – {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.StepBase(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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 %s: '
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_index=None)
Parameters
  • basename (str) – The basename 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.

  • node_index (The node index) – tuple

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.

setLogTag()

Set the log tag based on node index.

updateTaskReplicaSettings()

Update the task protocol 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

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 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 force field (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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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, node_index=None)

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

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

RESOURCE = 'cpu'
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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.

  • node_index (The node index) – tuple

DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
TERMINAL_INFILE_NUM = 1
acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

class schrodinger.application.matsci.permittivity.PolymerBuilder(*arg, **kwargs)

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'
SEQUENCE_PROP = 's_matsci_polymer_sequence'
FLAG_POLYMER_CRU_NUM = '-polymer_cru_num'
DEFAULT_NUMBER_OF_POLYMERS = 25
__init__(*arg, **kwargs)
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.

  • node_index (The node index) – tuple

updateTaskReplicaSettings()

Update the task settings due to replica.

static getTemplates(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

classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the polymer driver commands based on users’ input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 force field (without the ‘-‘)

Return type

str or None

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
TERMINAL_INFILE_NUM = 1
acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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() bool

Detect, by looking at the jobId, whether this job uses a job server.

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

Bases: schrodinger.application.matsci.permittivity.Step

Class to parse equilibrated cms file.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_cms_parser.py'
CMS_PARSER = 'cms_parser'
ICMS = 'icms'
DEFAULT_JOBNAME = 'permittivity_cms_parser_task'
FLAG_ELECTRIC_POLAR = '-electric_polar'
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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

updateTaskReplicaSettings()

Update the task settings due to replica.

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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() bool

Detect, by looking at the jobId, whether this job uses a job server.

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, node_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/2024-1/NB/build-133/mmshare-v6.5/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'
FLAG_DENSITY = '-density'
FLAG_MONOMER_CHARGE = '-monomer_ff_q'
DEFAULT_DENSITY = 0.5
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 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 force field (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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

updateTaskReplicaSettings()

Update the task protocol due to replica.

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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() bool

Detect, by looking at the jobId, whether this job uses a job server.

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'
SIMULATE = 'simulate'
CFG_FILE = 'cfg_file'
TIME = 'time'
TEMP = 'temp'
PRESS = 'pressure'
TIMESTEP = 'timestep'
ENSEMBLE = 'ensemble'
DIPOLE_INTERVAL = 'dipole_moment_dot_interval'
SIM_TYPE = 'sim_type'
TRJ_INTVL = 'trajectory.interval'
SEED = 'seed'
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.desconfig.AveCellMSJStringer'>, 'Brownian Dynamics': <class 'schrodinger.application.matsci.desconfig.BrownieMSJStringer'>, 'Matsci Analysis': <class 'schrodinger.application.matsci.desconfig.MSAnalysisMSJStringer'>, 'Molecular Dynamics': <class 'schrodinger.application.matsci.desconfig.MDMSJStringer'>}
DEFAULT_MSJ_HEADER = 'task { task = "desmond:auto"}\n'
HOFMANN = 'Hofmann'
COMPRESSIVE = 'Compressive'
ADD_NEW = 'Add New...'
HOFMANN_PROTOCOL = 'hofmann.yaml'
COMPRESSIVE_PROTOCOL = 'compressive.msj'
RELAXATION_MAP = {'Compressive': 'relaxation_protocols/compressive.msj', 'Hofmann': 'relaxation_protocols/hofmann.yaml'}
OUTFILE_EXT = '-out.cms'
RESOURCE = 'gpu'
__init__(*arg, **kwarg)

See parent class.

setup()

Over write parent class method.

createMSJ()

Create msj for desmond.

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 desconfig.MSJStringer, str

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

copyCfgFiles(msj_stages)

Copy the config files into the subtask dir.

Parameters

msj_stages ('schrodinger.application.desmond.multisim.parser.Msj') – The msj that may contain cfg files

updateReplicaSeed(stages, msj_stages)

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

Parameters
  • stages (list of desconfig.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.Namespace) – The command parsered options

Returns

Key and values for a desmond stage

Return type

dict

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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, time=100.0)

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

  • time (float) – A short md threshold threshold for debug mode (simulation time longer than this is reduced to this value for fast testing)

Returns

task_protocol.protocol is a list of stages

Return type

‘TaskProtocol’

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 modifyStageSettings(task_protocol, 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
  • task_protocol ('TaskProtocol') – task_protocol.protocol is a list of stages

  • options (argparse.Namespace) – 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 %s: '
TERMINAL_INFILE_NUM = 1
acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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

Bases: object

TEMPERATURE = 'temperature'
RANDOMIZE_VELOCITY = 'randomize_velocity'
FIRST = 'first'
RANDOMIZE_VELOCITY_DOT_FIRST = 'randomize_velocity.first'
RANDOMIZE_VELOCITY_DOT_SEED = 'randomize_velocity.seed'
LAST_RELAX_STAGE_TRJ_INTVL = 100.0
OTHER_RELAX_STAGE_TRJ_INTVL = 500.0
__init__(task_protocol, options, seed=None)
Parameters
  • task_protocol ('TaskProtocol') – task_protocol.protocol is a list of stages

  • options (argparse.Namespace) – The parsed command line options

  • seed (int or None) – Random seed to randomize the initial velocities

run()

Main method to drive the functionality.

setStages()

Set stages. If the protocol contains only one stage and the only item in this stage list is a dict with ‘msj’ being the only key, the stage is parsed by standard msj parser. Otherwise, each stage is a list.

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.

setRelaxRandomVel()

Set the randomize velocity seed for the first relaxation stage.

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

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.

duplicateRelaxStage()

Update and duplicate the last relaxation stage settings.

updateLastStage()

Update the settings of the last stage.

saveMsjStages()

Save the msj stages to the task protocol

updateTrjIntvel()

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

removeCom()

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

updateDipoleInterval()

Update the dipole interval in production run

removeDummyFields()

Remove the intermediate arguments that desmond doesn’t recognize.

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, node_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 ‘msprops.ORIGINAL_CMS_PROP’ 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 getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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, node_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\\)'
DENSITY_EXT = '_@_{density:.5g}(g/cm3)'
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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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, node_index=None)

Bases: schrodinger.application.matsci.permittivity.MdPostAnalysis

Base class to hold molecular dynamics post trajectory analysis functionality.

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.Namespace) – 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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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=False)

Over write parent class method.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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, node_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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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 parent 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 %s: '
RESOURCE = 'cpu'
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

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

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

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to do post dipole analysis on desmond trajectory.

FLAG_SLICE_INTVL = '-slice_intvl'
FLAG_NORMALIZATION = '-normalization'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
DIPOLE = 'dipole'
DIPOLE_CAP = 'Dipole'
STATISTICS_CSV_EX = '_dp-out.csv'
STATISTICS_FILE_PROP = 's_matsci_Dipole_Statistics_File'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
OUTFILE_EXT = '-out.cms'
TIME_SERIAL = 'time_serial'
AUTOCORRELATION = 'autocorrelation'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
SUSCEPTIBILITY = 'susceptibility'
SUSCEPT_CAP = 'Susceptibility'
TIME_SERIAL_CAPITALIZE = 'Time_Serial'
TIME_SERIAL_FILE_PROP = 's_matsci_Dipole_Time_Serial_File'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
MD_COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Md_Complex_permittivity_File'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STORE_PROP = 'r_matsci_Dipole_Susceptibility_Store'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
SYSTEMWIDE_DIPOLE = 'systemwide_dipole'
SYSTEMWIDE_DIPOLE_X_PROP = 'r_matsci_Systemwide_Dipole_X'
SYSTEMWIDE_DIPOLE_Y_PROP = 'r_matsci_Systemwide_Dipole_Y'
SYSTEMWIDE_DIPOLE_Z_PROP = 'r_matsci_Systemwide_Dipole_Z'
SYSTEMWIDE_DIPOLE_PROPS = ['r_matsci_Systemwide_Dipole_X', 'r_matsci_Systemwide_Dipole_Y', 'r_matsci_Systemwide_Dipole_Z']
SYSTEMWIDE_DIPOLE_X_STD_PROP = 'r_matsci_Systemwide_Dipole_X_SD'
SYSTEMWIDE_DIPOLE_Y_STD_PROP = 'r_matsci_Systemwide_Dipole_Y_SD'
SYSTEMWIDE_DIPOLE_Z_STD_PROP = 'r_matsci_Systemwide_Dipole_Z_SD'
SYSTEMWIDE_DIPOLE_STD_PROPS = ['r_matsci_Systemwide_Dipole_X_SD', 'r_matsci_Systemwide_Dipole_Y_SD', 'r_matsci_Systemwide_Dipole_Z_SD']
KWW = 'kww'
TAU = 'tau'
BETA = 'beta'
TAU_START_PROP = 'r_matsci_Permittivity_Tau_Start_(ns)'
TAU_END_PROP = 'r_matsci_Permittivity_Tau_End_(ns)'
KWW_TAU_PROP = 'r_matsci_Kww_Tau_(ps)'
KWW_BETA_PROP = 'r_matsci_Kww_Beta'
TIME_SERIAL_LABELS = ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']
TAU_PS = 'Tau (ps)'
DIPOLE_SQ = 'Dipole^2 (debye^2)'
DIPOLE_SQ_MEAN = 'Dipole^2 - <Dipole>^2 (debye^2)'
AUTOCORRELATION_LABELS = ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)']
TAU_PS_INDEX = 0
DIPOLE_SQ_INDEX = 4
DIPOLE_SQ_MEAN_INDEX = 5
LABEL_MAP = {'autocorrelation': ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)'], 'time_serial': ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']}
STD_DEV = 'Std Dev of '
class SysDipole(mean, sd)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

mean

Alias for field number 0

sd

Alias for field number 1

setup(copy_ene=False, 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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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, node_index=None)

Bases: schrodinger.application.matsci.permittivity.BaseDipoleAnalysis

Class to do post dipole analysis on desmond trajectory.

FLAG_DATA_LAST_FRAC = 'data_last_frac'
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the task protocol according to the user input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

AUTOCORRELATION = 'autocorrelation'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
AUTOCORRELATION_LABELS = ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)']
BETA = 'beta'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
DIPOLE = 'dipole'
DIPOLE_CAP = 'Dipole'
DIPOLE_SQ = 'Dipole^2 (debye^2)'
DIPOLE_SQ_INDEX = 4
DIPOLE_SQ_MEAN = 'Dipole^2 - <Dipole>^2 (debye^2)'
DIPOLE_SQ_MEAN_INDEX = 5
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STORE_PROP = 'r_matsci_Dipole_Susceptibility_Store'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
FLAG_NORMALIZATION = '-normalization'
FLAG_SLICE_INTVL = '-slice_intvl'
KWW = 'kww'
KWW_BETA_PROP = 'r_matsci_Kww_Beta'
KWW_TAU_PROP = 'r_matsci_Kww_Tau_(ps)'
LABEL_MAP = {'autocorrelation': ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)'], 'time_serial': ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']}
MD_COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Md_Complex_permittivity_File'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.cms'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
STATISTICS_CSV_EX = '_dp-out.csv'
STATISTICS_FILE_PROP = 's_matsci_Dipole_Statistics_File'
STD_DEV = 'Std Dev of '
SUSCEPTIBILITY = 'susceptibility'
SUSCEPT_CAP = 'Susceptibility'
SYSTEMWIDE_DIPOLE = 'systemwide_dipole'
SYSTEMWIDE_DIPOLE_PROPS = ['r_matsci_Systemwide_Dipole_X', 'r_matsci_Systemwide_Dipole_Y', 'r_matsci_Systemwide_Dipole_Z']
SYSTEMWIDE_DIPOLE_STD_PROPS = ['r_matsci_Systemwide_Dipole_X_SD', 'r_matsci_Systemwide_Dipole_Y_SD', 'r_matsci_Systemwide_Dipole_Z_SD']
SYSTEMWIDE_DIPOLE_X_PROP = 'r_matsci_Systemwide_Dipole_X'
SYSTEMWIDE_DIPOLE_X_STD_PROP = 'r_matsci_Systemwide_Dipole_X_SD'
SYSTEMWIDE_DIPOLE_Y_PROP = 'r_matsci_Systemwide_Dipole_Y'
SYSTEMWIDE_DIPOLE_Y_STD_PROP = 'r_matsci_Systemwide_Dipole_Y_SD'
SYSTEMWIDE_DIPOLE_Z_PROP = 'r_matsci_Systemwide_Dipole_Z'
SYSTEMWIDE_DIPOLE_Z_STD_PROP = 'r_matsci_Systemwide_Dipole_Z_SD'
class SysDipole(mean, sd)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

mean

Alias for field number 0

sd

Alias for field number 1

TAU = 'tau'
TAU_END_PROP = 'r_matsci_Permittivity_Tau_End_(ns)'
TAU_PS = 'Tau (ps)'
TAU_PS_INDEX = 0
TAU_START_PROP = 'r_matsci_Permittivity_Tau_Start_(ns)'
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'
TIME_SERIAL_LABELS = ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

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

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

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

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

Bases: schrodinger.application.matsci.permittivity.BaseDipoleAnalysis

Class to merge susceptibility.

setup(copy_ene=False, write_cms=True)

Over write parent class method.

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)

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

AUTOCORRELATION = 'autocorrelation'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
AUTOCORRELATION_LABELS = ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)']
BETA = 'beta'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
DIPOLE = 'dipole'
DIPOLE_CAP = 'Dipole'
DIPOLE_SQ = 'Dipole^2 (debye^2)'
DIPOLE_SQ_INDEX = 4
DIPOLE_SQ_MEAN = 'Dipole^2 - <Dipole>^2 (debye^2)'
DIPOLE_SQ_MEAN_INDEX = 5
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STORE_PROP = 'r_matsci_Dipole_Susceptibility_Store'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
FLAG_NORMALIZATION = '-normalization'
FLAG_SLICE_INTVL = '-slice_intvl'
KWW = 'kww'
KWW_BETA_PROP = 'r_matsci_Kww_Beta'
KWW_TAU_PROP = 'r_matsci_Kww_Tau_(ps)'
LABEL_MAP = {'autocorrelation': ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)'], 'time_serial': ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']}
MD_COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Md_Complex_permittivity_File'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.cms'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
STATISTICS_CSV_EX = '_dp-out.csv'
STATISTICS_FILE_PROP = 's_matsci_Dipole_Statistics_File'
STD_DEV = 'Std Dev of '
SUSCEPTIBILITY = 'susceptibility'
SUSCEPT_CAP = 'Susceptibility'
SYSTEMWIDE_DIPOLE = 'systemwide_dipole'
SYSTEMWIDE_DIPOLE_PROPS = ['r_matsci_Systemwide_Dipole_X', 'r_matsci_Systemwide_Dipole_Y', 'r_matsci_Systemwide_Dipole_Z']
SYSTEMWIDE_DIPOLE_STD_PROPS = ['r_matsci_Systemwide_Dipole_X_SD', 'r_matsci_Systemwide_Dipole_Y_SD', 'r_matsci_Systemwide_Dipole_Z_SD']
SYSTEMWIDE_DIPOLE_X_PROP = 'r_matsci_Systemwide_Dipole_X'
SYSTEMWIDE_DIPOLE_X_STD_PROP = 'r_matsci_Systemwide_Dipole_X_SD'
SYSTEMWIDE_DIPOLE_Y_PROP = 'r_matsci_Systemwide_Dipole_Y'
SYSTEMWIDE_DIPOLE_Y_STD_PROP = 'r_matsci_Systemwide_Dipole_Y_SD'
SYSTEMWIDE_DIPOLE_Z_PROP = 'r_matsci_Systemwide_Dipole_Z'
SYSTEMWIDE_DIPOLE_Z_STD_PROP = 'r_matsci_Systemwide_Dipole_Z_SD'
class SysDipole(mean, sd)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

mean

Alias for field number 0

sd

Alias for field number 1

TAU = 'tau'
TAU_END_PROP = 'r_matsci_Permittivity_Tau_End_(ns)'
TAU_PS = 'Tau (ps)'
TAU_PS_INDEX = 0
TAU_START_PROP = 'r_matsci_Permittivity_Tau_Start_(ns)'
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'
TIME_SERIAL_LABELS = ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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, node_index=None)

Bases: schrodinger.application.matsci.permittivity.SusceptibilityMerge

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

MAX_DIEL_LOSS_VAL_PROP = 'r_matsci_Maximum_Dielectric_Loss'
MAX_DIEL_LOSS_FREQ_PROP = 'r_matsci_Frequency_of_Maximum_Dielectric_Loss_(Hz)'
KWW_INIT_GUESSES = [[10, 0.8], [30000, 0.8]]
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'
AUTOCORRELATION_LABELS = ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)']
BETA = 'beta'
COMPLEX_PERMITTIVITY = 'complex_permittivity'
COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Complex_permittivity_File'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
DIPOLE = 'dipole'
DIPOLE_CAP = 'Dipole'
DIPOLE_SQ = 'Dipole^2 (debye^2)'
DIPOLE_SQ_INDEX = 4
DIPOLE_SQ_MEAN = 'Dipole^2 - <Dipole>^2 (debye^2)'
DIPOLE_SQ_MEAN_INDEX = 5
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STD_PROP = 'r_matsci_stdev_Dipole_Susceptibility'
DIPOLE_SUSCEPTIBILITY_STORE_PROP = 'r_matsci_Dipole_Susceptibility_Store'
DRIVER_PATH = 'permittivity_gui_dir/permittivity_dipole_driver.py'
FLAG_NORMALIZATION = '-normalization'
FLAG_SLICE_INTVL = '-slice_intvl'
KWW = 'kww'
KWW_BETA_PROP = 'r_matsci_Kww_Beta'
KWW_TAU_PROP = 'r_matsci_Kww_Tau_(ps)'
LABEL_MAP = {'autocorrelation': ['Tau (ps)', 'Dipole_x^2 (debye^2)', 'Dipole_y^2 (debye^2)', 'Dipole_z^2 (debye^2)', 'Dipole^2 (debye^2)', 'Dipole^2 - <Dipole>^2 (debye^2)'], 'time_serial': ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']}
MD_COMPLEX_PERMITTIVITY_FILE_PROP = 's_matsci_Md_Complex_permittivity_File'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.cms'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
STATISTICS_CSV_EX = '_dp-out.csv'
STATISTICS_FILE_PROP = 's_matsci_Dipole_Statistics_File'
STD_DEV = 'Std Dev of '
SUSCEPTIBILITY = 'susceptibility'
SUSCEPT_CAP = 'Susceptibility'
SYSTEMWIDE_DIPOLE = 'systemwide_dipole'
SYSTEMWIDE_DIPOLE_PROPS = ['r_matsci_Systemwide_Dipole_X', 'r_matsci_Systemwide_Dipole_Y', 'r_matsci_Systemwide_Dipole_Z']
SYSTEMWIDE_DIPOLE_STD_PROPS = ['r_matsci_Systemwide_Dipole_X_SD', 'r_matsci_Systemwide_Dipole_Y_SD', 'r_matsci_Systemwide_Dipole_Z_SD']
SYSTEMWIDE_DIPOLE_X_PROP = 'r_matsci_Systemwide_Dipole_X'
SYSTEMWIDE_DIPOLE_X_STD_PROP = 'r_matsci_Systemwide_Dipole_X_SD'
SYSTEMWIDE_DIPOLE_Y_PROP = 'r_matsci_Systemwide_Dipole_Y'
SYSTEMWIDE_DIPOLE_Y_STD_PROP = 'r_matsci_Systemwide_Dipole_Y_SD'
SYSTEMWIDE_DIPOLE_Z_PROP = 'r_matsci_Systemwide_Dipole_Z'
SYSTEMWIDE_DIPOLE_Z_STD_PROP = 'r_matsci_Systemwide_Dipole_Z_SD'
class SysDipole(mean, sd)

Bases: tuple

__contains__(key, /)

Return key in self.

__len__()

Return len(self).

count(value, /)

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.

mean

Alias for field number 0

sd

Alias for field number 1

TAU = 'tau'
TAU_END_PROP = 'r_matsci_Permittivity_Tau_End_(ns)'
TAU_PS = 'Tau (ps)'
TAU_PS_INDEX = 0
TAU_START_PROP = 'r_matsci_Permittivity_Tau_Start_(ns)'
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'
TIME_SERIAL_LABELS = ['Time (ps)', 'Dipole_x (debye)', 'Dipole_y (debye)', 'Dipole_z (debye)', '<Dipole^2> (debye^2)']
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

static getRelatedFile(cms_file, file_ext='.ene')

Get the requested file based on cms file name and file extension

Parameters
  • cms_file (str) – The cms file whose related file is searched.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

Returns

Found file with correct extension

Return type

str or None

static getRelatedJobFile(input_cms, orig_cms=None, file_ext='.ene')

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.

  • file_ext (str) – the extension of file to search for. The file extension must include the separator as well. For example, to get ene file, file_ext must be “.ene”

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)

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

The strings returned are (status, jobid, 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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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.

classmethod registerCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters
  • options (argparse.Namespace) – The parser to get the cms options from and set the trj options for.

  • job_builder (launchapi.JobSpecification) – JobSpecification object

retryFailure(max_retries=0)

Determine if the job should be retried or not. This overwrites the parent method to by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

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.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

writeCms()

Write out cms files to current dir and each of them has a ‘msprops.ORIGINAL_CMS_PROP’ 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, node_index=None)

Bases: schrodinger.application.matsci.permittivity.Step

Class to do a Jaguar calculation with keywords.

OPT_ATTR = 'jaguar_options'
IN_EXT = '.in'
DRIVER_PATH = 'run'
DEFAULT_JOBNAME = 'permittivity_jaguar_task'
FLAG_PARALLEL = '-PARALLEL'
BASIS = 'basis'
IGEOPT = 'igeopt'
MOLCHG = 'molchg'
MULTIP = 'multip'
IUHF = 'iuhf'
DFTNAME = 'dftname'
IPOLAR = 'ipolar'
IFDPOL = 'ifdpol'
IACC_FDPOL = 'iacc_fdpol'
B3LYP = 'B3LYP'
DEF2_SVPD = 'DEF2-SVPD'
IACCG = 'iaccg'
NOFAIL = 'nofail'
NOPS_OPT_SWITCH = 'nops_opt_switch'
MAXITG = 'maxitg'
MAXIT = 'maxit'
INT_KEYWORDS = ['igeopt', 'molchg', 'multip', 'iuhf', 'ipolar']
KEYWORD_DEFAULTS = {'dftname': 'B3LYP', 'igeopt': 0, 'ipolar': None, 'iuhf': None, 'molchg': 0, 'multip': 1}
POLYMER_INT_KEYWORDS_DIFF = {'basis': 'DEF2-SVPD'}
FLAG_JAGUAR_OPTIONS = '-jaguar_options'
DEFAULT_JAGUAR_OPTIONS = {'basis': '6-31G**', 'dftname': 'B3LYP', 'igeopt': 1, 'maxit': 300, 'maxitg': 300, 'nofail': 1, 'nops_opt_switch': 10}
MAX_ATOM_NUM = 25000
setup()

See parent class.

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

Returns

The Jaguar output data

Return type

JaguarOutput or None

classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the task protocol according to the user input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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

Bases: schrodinger.application.matsci.permittivity.JaguarCalculation

Class to do a Jaguar calculation with finer basis set and functional.

OPT_ATTR = 'jaguar_finer_options'
FLAG_JAGUAR_FINER_OPTIONS = '-jaguar_finer_options'
DEFAULT_JAGUAR_OPTIONS = {'basis': 'cc-pVTZ-pp(-f)++', 'dftname': 'B3LYP', 'igeopt': 1, 'maxit': 300, 'maxitg': 300, 'nofail': 1, 'nops_opt_switch': 10}
B3LYP = 'B3LYP'
BASIS = 'basis'
DEF2_SVPD = 'DEF2-SVPD'
DEFAULT_JOBNAME = 'permittivity_jaguar_task'
DFTNAME = 'dftname'
DRIVER_PATH = 'run'
FLAG_JAGUAR_OPTIONS = '-jaguar_options'
FLAG_PARALLEL = '-PARALLEL'
IACCG = 'iaccg'
IACC_FDPOL = 'iacc_fdpol'
IFDPOL = 'ifdpol'
IGEOPT = 'igeopt'
INT_KEYWORDS = ['igeopt', 'molchg', 'multip', 'iuhf', 'ipolar']
IN_EXT = '.in'
IPOLAR = 'ipolar'
IUHF = 'iuhf'
KEYWORD_DEFAULTS = {'dftname': 'B3LYP', 'igeopt': 0, 'ipolar': None, 'iuhf': None, 'molchg': 0, 'multip': 1}
MAXIT = 'maxit'
MAXITG = 'maxitg'
MAX_ATOM_NUM = 25000
MOLCHG = 'molchg'
MULTIP = 'multip'
NOFAIL = 'nofail'
NOPS_OPT_SWITCH = 'nops_opt_switch'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
POLYMER_INT_KEYWORDS_DIFF = {'basis': 'DEF2-SVPD'}
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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

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.

doCommand(host: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

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

Returns

The Jaguar output data

Return type

JaguarOutput or None

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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)

Update the task protocol according to the user input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

class schrodinger.application.matsci.permittivity.ElectricPolarizability(*arg, **kwargs)

Bases: schrodinger.application.matsci.permittivity.JaguarCalculation

Class to do jaguar calculation of electric polarizability.

OPT_ATTR = 'elec_polarizability'
TPP = 'tpp'
ELECTRIC_POLARIZABILITY = 'electric_polarizability'
DEFAULT_JOBNAME = 'permittivity_electric_polarizability_task'
FLAG_JAGUAR_OPTIONS = '-jaguar_options'
FLAG_ELEC_POLARIZABILITY = '-elec_polarizability'
DEFAULT_IPOLAR = -1
DEFAULT_JAGUAR_OPTIONS = {'basis': 'cc-pVTZ-pp(-f)++', 'dftname': 'B3LYP', 'maxit': 300, 'nofail': 1}
FDPOL_FREQ1 = 'fdpol_freq1'
FDPOLAR_FREQ1 = 'fdpolar_freq1'
PROP = 'electric_polarizability'
KEY = 'r_matsci_Electric_Polarizability_(bohr^3)'
ELECTRIC_POLARIZABILITY_PROP = 'r_matsci_Electric_Polarizability_(bohr^3)'
DELIM = '_@_'
ELECTRIC_POLARIZABILITY_FREQ_PROP = 'r_matsci_Electric_Polarizability_(bohr^3)_@_%.4eeV'
POLAR_ALPHA = 'polar_alpha'
FDPOLAR_ALPHA1 = 'fdpolar_alpha1'
MITERTD = 'mitertd'
DEFAULT_KWARGS = {'jaguar_output_attr': 'polar_alpha', 'tpp': 1}
FLAG_NUM_CRU = '-num_cru'
ELECTRIC_POLARIZABILITY_SLOPE = 'r_matsci_Electric_Polarizability_Slope_(bohr^3/monomer)'
ELECTRIC_POLARIZABILITY_INTERCEPT = 'r_matsci_Electric_Polarizability_Intercept_(bohr^3)'
ELECTRIC_POLARIZABILITY_SLOPE_FREQ = 'r_matsci_Electric_Polarizability_Slope_(bohr^3/monomer)_@_%.4eeV'
ELECTRIC_POLARIZABILITY_INTERCEPT_FREQ = 'r_matsci_Electric_Polarizability_Intercept_(bohr^3)_@_%.4eeV'
PLYM = 'plym'
__init__(*arg, **kwargs)
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.

  • node_index (The node index) – tuple

updateTaskReplicaSettings()

Update the task settings due to replica.

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 getWavAndPolar(struct)

Get the wavelength and polarizability.

Parameters

struct ('structure.Structure') – The input structure to search properties.

Returns

Wavelength in nm, polarizability in bohr^3

Return type

(float or None, float or None)

classmethod getWavAndProp(struct, prop)

Get the wavelength and wavelength-related property.

Parameters
  • struct ('structure.Structure') – The input structure to search properties.

  • prop (str) – A property key

Returns

Wavelength in nm, a wavelength related property value

Return type

(float or None, float or None)

classmethod getWavAndPolars(struct, include_ipolar=False)

Get the wavelength and polarizability.

Parameters
  • struct ('structure.Structure') – The input structure to search properties.

  • include_ipolar (bool) – Whether to include the ipolar result, the coupled perturbed Hartree-Fock (CPHF) equations Cao, Y.; Friesner, R. A. Molecular (hyper)polarizabilities computed by pseudospectral methods. J. Chem. Phys. 2005

Returns

Wavelength in nm, polarizability in bohr^3

Return type

list, list

classmethod getWavAndProps(struct, prop)

Get the wavelength and wavelength-related properties. Note property keys starting with the user requested str is considered matches.

Parameters
  • struct ('structure.Structure') – The input structure to search properties.

  • prop (str) – A property key without frequency info.

Returns

Wavelength in nm, wavelength related property values

Return type

list, list

classmethod getFreqFromPropkey(propkey)

Get the frequency value from the property key.

Returns

The frequency of this property

Return type

float or None

classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the task protocol according to the user input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

classmethod getWavelengths(options)

Get the wavelengths based on the parsed command line options.

Parameters

options (argparse.Namespace) – The parsed command line options.

Returns

All wavelengths for calculation

Return type

list of floats and NONE

static getUserWavelengths(options, default_intvl=50)

Get the wavelengths from the user input limits.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • default_intvl (float) – Default wavelength interval

Returns

The wavelengths based on the user input limits

Return type

list of floats

static getAbbeWavelengths(options)

Get the wavelengths from the users’ request on abbe number.

Parameters

options (argparse.Namespace) – The parsed command line options

Returns

The number wavelengths in nm for abbe number

Return type

list of float

B3LYP = 'B3LYP'
BASIS = 'basis'
DEF2_SVPD = 'DEF2-SVPD'
DFTNAME = 'dftname'
DRIVER_PATH = 'run'
FLAG_PARALLEL = '-PARALLEL'
IACCG = 'iaccg'
IACC_FDPOL = 'iacc_fdpol'
IFDPOL = 'ifdpol'
IGEOPT = 'igeopt'
INT_KEYWORDS = ['igeopt', 'molchg', 'multip', 'iuhf', 'ipolar']
IN_EXT = '.in'
IPOLAR = 'ipolar'
IUHF = 'iuhf'
KEYWORD_DEFAULTS = {'dftname': 'B3LYP', 'igeopt': 0, 'ipolar': None, 'iuhf': None, 'molchg': 0, 'multip': 1}
MAXIT = 'maxit'
MAXITG = 'maxitg'
MAX_ATOM_NUM = 25000
MOLCHG = 'molchg'
MULTIP = 'multip'
NOFAIL = 'nofail'
NOPS_OPT_SWITCH = 'nops_opt_switch'
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
POLYMER_INT_KEYWORDS_DIFF = {'basis': 'DEF2-SVPD'}
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
TERMINAL_INFILE_NUM = 1
acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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

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.

doCommand(host: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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() bool

Detect, by looking at the jobId, whether this job uses a job server.

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

Bases: schrodinger.application.matsci.permittivity.Step

Class to merge multiple Jaguar Calculations.

DRIVER_PATH = 'permittivity_gui_dir/permittivity_merge_polarizability_driver.py'
JAGUAR_MERGE = 'jaguar_merge'
DEFAULT_JOBNAME = 'permittivity_jaguar_merge_task'
OUTFILE_EXT = '-out.mae'
CSV_OUT_EXT = '_polar-out.csv'
WAV_EP_FILE_PROP = 's_matsci_Electric_Polarizability_File'
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the merge commands based on users’ input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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, node_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.

udpateCmd()

Update the command.

DRIVER_PATH = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
__init__(basename, config_yaml='default_permittivity_protocols.yaml', task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

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: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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, node_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'
FILE_EXT = '_ri-out.csv'
RI_CAP = 'Refractive_Index'
DEFAULT_JOBNAME = 'permittivity_refractive_index_task'
REFRACTIVE_INDEX_PROP = 'r_matsci_Refractive_Index'
DELIM = '_@_'
NM = 'nm'
MATSCI_ABBE_NUMBER = 'r_matsci_Abbe_Number'
ABBE_NUMBER_PROP = 'r_matsci_Abbe_Number_@_%.1fnm_%.1fnm_%.1fnm'
RELATIVE_PERMITTIVITY_INF_PROP = 'r_matsci_Relative_Permittivity_Inf'
WAV_IR_FILE_PROP = 's_matsci_Wavelength_Refractive_Index_File'
FLAG_ABBE_NUMBER_WAVELENGTH = '-abbe_number_wavelength'
FLAG_REFRACTIVE_INDEX_WAVELENGTH = '-refractive_index_wavelength'
AbbeNumber

alias of schrodinger.application.matsci.permittivity.ABBE_NUMBER

ABBE_NFREQ = 3
classmethod optionsToTaskProtocols(options, task_name, seed=None)

Update the refractive index commands based on users’ input.

Parameters
  • options (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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

static getRefractiveIndex(struct, density, polar)

Get refractive index from density, polarizability, and total_weight.

Parameters
  • struct ('structure.Structure') – Structure of a single molecule

  • density (float) – Density in g/cm^3

  • polar (float) – The isotropically averaged polarizability in atomic units of bohr^3

Returns

Refractive index

Return type

float

static setAbbeNum(struct, abbe_num, wavs, ext=None)

Set the Abbe number value with wavelength information as structural property.

Parameters
  • struct ('structure.Structure') – The structure to save property to

  • abbe_num (float) – The Abbe number value

  • ext (str) – The str extension for the property

  • wavs (list of three float) – The wavelengths at which Abbe number is calculated

classmethod getAbbeNum(struct)

Get Abbe number and wavelengths from a structure.

Parameters

struct ('structure.Structure') – The structure to get Abbe number and wavelengths.

Returns

Abbe number and wavelengths

Return type

collections.namedtuple

classmethod calAbbeNum(data)

Calculate abbe number from refractive indexes.

Parameters

data (3 x 2 array) – First column: wavelengths, second column: refractive indexes

Returns

The abbe number and wavelength info

Return type

‘collections.namedtuple’

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
REPLICA_TAG = 'Replica %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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.

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

udpateCmd()

Update the command.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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, node_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 = 'static'
STATIC_PERMITTIVITY = 'static_permittivity'
DEFAULT_JOBNAME = 'permittivity_static_task'
RELATIVE_STATIC_PERMITTIVITY_PROP = 'r_matsci_Relative_Static_Permittivity'
RELATIVE_STATIC_PERMITTIVITY_STORE_PROP = 'r_matsci_Relative_Static_Store_Permittivity'
COMPLEX_PERMITTIVITY_DATA_HEADER = 'Frequency (Hz),Eps (Real),Eps (Imaginary)'
setup()

See parent class.

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 %s: '
RESOURCE = 'cpu'
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, node_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.

  • node_index (The node index) – tuple

acquireLicenseForSmartDistribution() bool

Acquire and hold licenses for a smart distribution job. This makes sure the job won’t fail due to unavailable licenses.

Returns True if the licenses registered for the job are acquired, and False if they are not. If no licenses are registered, it always returns True to avoid preventing jobs from using the smart distribution feature. For legacy jobcontrol, the license check is not performed, and is always returned True. We want to use this feature as a pitch to move users to JOB_SERVER.

addFinalizer(function: Callable[[schrodinger.job.queue.BaseJob], None], run_dir: Optional[str] = None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job: schrodinger.job.queue.BaseJob)

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

addLaunchEnv(key: str, val: str)

Adds the given environment key and and value to the list of launch environment.

Parameters
  • key – environment key to add to the launch environment.

  • val – environment value associcated with the key to add to the launch environment.

addPrereq(job: schrodinger.job.queue.BaseJob)

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

cancel()

Send kill request to jobcontrol managed job. This method will eventually deprecate JobControlJob.kill

cancelSubmitted(do_license_check: bool = False) schrodinger.job.queue.CancelSubmittedStatus

If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None. This tries to acquire licenses for the job before canceling from the queue if do_license_check is turned on.

Parameters

do_license_check – Acquire licenses for the job before canceling from the queue.

Returns one of the status of CancelSubmittedStatus.

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: str, local: bool = False)

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

Parameters
  • host – Host on which the job will be executed.

  • local – Removed in JOB_SERVER.

finalize()

Clean up after a job successfully runs.

genAllJobs(seen: Optional[Set[schrodinger.job.queue.BaseJob]] = None) Generator[schrodinger.job.queue.BaseJob, None, None]

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None) Generator[schrodinger.job.queue.BaseJob, None, None]

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

getCommand() List[str]

Return the command used to run this job.

getCommandDir() str

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

getDownStreamPolymerJob()

Search and return the down-stream polymer job

Returns

A subtask step with polymer driver in the cmd

Return type

‘Step’ or None

getDuration() Optional[int]

Return the duration of the Job as recorded by job server. The duration does not include queue wait time.

If the job is running or has not launched, returns None.

Note that this method makes a blocking call to the job server.

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 force field (without the ‘-‘)

Return type

str or None

getJob() Optional[schrodinger.job.jobcontrol.Job]

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

Returns None if the job hasn’t been launched.

getJobDJ() schrodinger.job.queue.JobDJ

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

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() Tuple[str, str, str]

Return a tuple of status strings for printing by JobDJ.

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

hasExited() bool

Returns True if this job finished, successfully or not.

hasStarted() bool

Returns True if this job has started (not waiting)

init_count = 0
isComplete() bool

Returns True if this job finished successfully

kill()

Send 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: str)

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 (argparse.Namespace) – The parsed command line options

  • task_name (str) – Task name of the current stage

  • seed (int or None) – Random seed to randomize the initial velocities

Returns

Updated task protocol

Return type

TaskProtocol

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 by default 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() bool

Return True if the job runs on the JobDJ control host, False if not. Jobs that run locally don’t need hosts.

There is no limit on the number of locally run jobs.

setLogTag()

Set the log tag based on node index.

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

property state: schrodinger.job.queue.JobState

Return the current state of the job.

Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling BaseJob instances. For example, by examining some external condition (e.g. presence of output files) the state JobState.DONE could be returned immediately and the job would not run.

udpateCmd()

Update the command.

update()

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

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 protocol due to replica.

usesJobServer() bool

Detect, by looking at the jobId, whether this job uses a job server.

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_DELIM = 'r'
CHILD_NODE_INDEXES = 'child_node_indexes'
PARENT_NODE_INDEXES = 'parent_node_indexes'
PROP_KEYS = ['task_replica', 'child_node_indexes', 'parent_node_indexes']
TASK_TYPE_TO_SUBCLASS = {'CMS Parser': <class 'schrodinger.application.matsci.permittivity.CMSParser'>, '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 Finer Calculation Protocol': <class 'schrodinger.application.matsci.permittivity.JaguarFinerCalculation'>, 'Jaguar Merge Protocol': <class 'schrodinger.application.matsci.permittivity.JaguarMerge'>, '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'>, 'Susceptibility Merge Protocol': <class 'schrodinger.application.matsci.permittivity.SusceptibilityMerge'>}
__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) – The input file information

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

addSubclass()

Add task type, driver path, and subclass to each graph node.

removeNodes()

Remove the nodes marked with remove replica keyword.

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

addSubjobs()

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

setParentChildJobs(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.

removeStartingJobs()

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

getReplicaType(node)

Get the replica type.

Parameters

node (dict) – The node in the nextworkx graph

Returns

The replica type

Return type

str or None

setReplicaType(node, ntype)

Set the replica type.

Parameters
  • node (dict) – The node in the nextworkx graph

  • ntype (str) – The replica type of the node

compatibleChildNodes(node)

Keep compatible children nodes.

Parameters

node (The node whose children's compatibility is checked.) – dict

connectReplicaNode(node_rindex)

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.

updateThreadingNodes()

Update the threading nodes so that single branching is not considered as threading.

logReplicaInfo()

Print all the node info including replica node for debugging.

updateReplicaNodes()

Update replica nodes based on replica keywords.

setBranchReplicaNode()

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='branch')

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

Node indexes of a certain type (threading or merging)

Return type

list 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()

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 ('TaskProtocol') – The task protocol containing task information

Raises

TypeError – When the task_type is not supported

Returns

The corresponding task class

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 (argparse.Namespace) – The parsed command line options

  • jobname (str or False) – The jobname based on which config yaml is generated. If False, no yaml file written out.