schrodinger.application.matsci.permittivity module

Permittivity module for permittivity workflow.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.permittivity.create_debug_logger(name=None, logfile=None, set_with_cur_name=False, env_verbose='SCHRODINGER_DEV_DEBUG', formatter=None, add_to_backend=False, stream=True)

Create a logger for module level debug usage.

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

The logger created for this function

Return type:

logging.Logger

schrodinger.application.matsci.permittivity.elapsed_timer()

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

example to print line number and time elapsed: from inspect 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.get_next_dirname(path, 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

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’.
schrodinger.application.matsci.permittivity.is_iterable(item)

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

Parameters:item – str, list, tuple, or other data type
Returns:Whether the input is iterable
Return type:bool
schrodinger.application.matsci.permittivity.flatten(an_iterable_item)

Robust function to flatten list recursively.

Parameters:an_iterable_item (list, tuple or set) – the iterable item to be flatten. (an iterable that describes the whole or part of the workflow)
Returns:the flatten items in a list ([uniterable value 1, uniterable value 2, uniterable value 3 …])
Return type:list of uniterable values (str or dict)
schrodinger.application.matsci.permittivity.flatten_with_no_dict(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
schrodinger.application.matsci.permittivity.get_first_level_tasknames(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
schrodinger.application.matsci.permittivity.get_ext_matched_first_filename(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

schrodinger.application.matsci.permittivity.get_stage_indices_by_marker(stages, marker='is_production', remove_marker=False)

Indexes of the stages marked with certain markers. For example, MD_PRODUCTION_STAGE_MARKER markers stages as production stages; MD_RELAXATION_STAGE_MARKER markers stages as relaxation stages; If MD_USE_CUSTOMIZED_RELAXATION_STAGE_MARKER 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
  • 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

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

Get the permittivity config yaml from the mmshare data dir.

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

the full path and filename for the input yaml

Return type:

str

schrodinger.application.matsci.permittivity.get_permittivity_config_file_from_options(options)

Return the permittivity config file based on command line inputs.

Parameters:options (argparse.ArgumentParser) – the command parsered options
Returns:the path to a config yaml
Return type:str
schrodinger.application.matsci.permittivity.get_task_protocol(config_yaml, task_name=None, task_type=None, index_field='index')

Load configure file, get the protocol for selected task by name or type (if no selection, return the first task protocol). 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.

Parameters:
  • config_yaml (str) – the full path to a config file
  • 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:

the options for a stage, or multiple stages as multiple lists (for desmond msj)

Return type:

list of str, or list of list

schrodinger.application.matsci.permittivity.split_name_and_prop(name_with_prop)

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)
schrodinger.application.matsci.permittivity.get_task_name_to_type_map(config_yaml)

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
schrodinger.application.matsci.permittivity.update_infile_and_command(child_job, 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.
class schrodinger.application.matsci.permittivity.StepBase(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None)

Bases: object

OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
DEFAULT_CMD = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
setup(copy_infile=True, copy_additional_files=True, more_files=None)

Over write parent class method.

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
static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
static finalizeStep(job)

Copy output file from subdir to top job dir.

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

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

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

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

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

__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
DEFAULT_CMD = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Copy output file from subdir to top job dir.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

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

Over write parent class method.

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

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

class schrodinger.application.matsci.permittivity.MultiStageMd(basename, config_yaml='default_protocols.yaml', task_name='MD Simulation', infile=None, outfile=None, master_logger=None)

Bases: schrodinger.application.matsci.permittivity.Step

Multi-stage simulations with relaxation.

TASK_NAME = 'MD Simulation'
TASK_TYPE = 'MD Simulation Protocol'
BROWNIAN_DYNAMICS = 'Brownian Dynamics'
MOLECULAR_DYNAMICS = 'Molecular Dynamics'
AVERAGE_CELL = 'Average Cell'
MATSCI_ANALYSIS = 'Matsci Analysis'
TIME = 'time'
TEMP = 'temp'
PRESS = 'pressure'
TIMESTEP = 'timestep'
ENSEMBLE = 'ensemble'
SIM_TYPE = 'sim_type'
FLAG_TO_KEY = {'-md_ensemble': 'ensemble', '-md_press': 'pressure', '-md_temp': 'temp', '-md_time': 'time', '-md_timestep': 'timestep'}
DESMOND_UNIT_CONVERTERS = {'-md_time': <function MultiStageMd.<lambda>>, '-md_timestep': <function MultiStageMd.<lambda>>}
TRJ_WRITE_VEL = 'trajectory_dot_write_velocity'
TRJ_INTVL = 'trajectory.interval'
RANDOMIZE_VEL = 'randomize_velocity_dot_first'
LAST_STAGE_DICT = {'compress': '""', 'dir': '"."'}
FLOAT_FIELDS = ['time', 'temp', 'pressure']
DUMMY_FIELDS = ['index', 'is_production', 'is_relaxation', 'use_customized_relaxation']
MSJSTRINGERS = {'Average Cell': <class 'schrodinger.application.matsci.desmondutils.AveCellMSJStringer'>, 'Brownian Dynamics': <class 'schrodinger.application.matsci.desmondutils.BrownieMSJStringer'>, 'Matsci Analysis': <class 'schrodinger.application.matsci.desmondutils.MSAnalysisMSJStringer'>, 'Molecular Dynamics': <class 'schrodinger.application.matsci.desmondutils.MDMSJStringer'>}
HOFMANN_PROTOCOL = 'Hofmann_relaxation_protocol.yaml'
HOFMANN_SIMULAITON_PROTOCOL = 'Hofmann Simulation Protocol'
__init__(basename, config_yaml='default_protocols.yaml', task_name='MD Simulation', infile=None, outfile=None, master_logger=None)
Parameters:
  • basename (str) – the base name for the subjob
  • config_yaml (str) – the path to a yaml config
  • task_name (str) – the task name
  • infile (str) – input file name
  • outfile (str) – the input file name to write to
  • master_logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
setup()

Over write parent class method.

createMSJ()

Creat msj for desmond.

getStages()

Get stages from config yaml.

Returns:the MSJSTRINGERS contains desmond stage infomation, the orig_msj_str is for msj string provided by users.
Return type:list of ‘MSJSTRINGERS’, str
classmethod optionsToStage(options)

Convert command line options to a stage like dict.

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

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

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

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

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
Returns:

list of desmond stages

Return type:

list

static getRrelaxationStages(options, task_name)

Construct the stages in general by looking at the config yaml, commandline relaxation, and productions.

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

list of stages

Return type:

list

classmethod modifyStageSettings(all_stages, options)

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

Parameters:
  • all_stages (list) – stages
  • options (Named tuple) – The parsed command line options
DEFAULT_CMD = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Copy output file from subdir to top job dir.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

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

Bases: schrodinger.application.matsci.permittivity.Step

Class for customized disorder system builder.

DSB_DRIVER = <module 'disordered_system_builder_driver' from '/scr/buildbot/savedbuilds/2020-1/NB/build-140/mmshare-v4.9/python/scripts/disordered_system_builder_gui_dir/disordered_system_builder_driver.py'>
DEFAULT_CMD = 'disordered_system_builder_gui_dir/disordered_system_builder_driver.py'
DISORDER_SYSTEM = 'disorder_system'
DEFAULT_JOBNAME = 'permittivity_disorder_system_task'
FLAG_MOLECULES = '-molecules'
FLAG_COMPOSITION = '-composition'
DEFAULT_NUMBER_OF_MOLECULES = 500
classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (Named tuple) – The parsed command line options
  • task_name (str) – task name
Returns:

list of desmond stages

Return type:

list

NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Copy output file from subdir to top job dir.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

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

Over write parent class method.

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

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

class schrodinger.application.matsci.permittivity.MdPostAnalysis(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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 a cms file to current dir with ‘cms.Cms.PROP_CMS’ pointing to the original cms file path.

static autocorrelation(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static getEneFromFilename(cms_file)

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

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

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

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

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

Return type:

str, str or None

Returns:

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

DEFAULT_CMD = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Copy output file from subdir to top job dir.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

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

Bases: schrodinger.application.matsci.permittivity.MdPostAnalysis

Class to do post desmond density analysis.

DEFAULT_CMD = '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)'
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'
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

static autocorrelation(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
static getEneFromCms(input_cms, orig_cms=None)

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

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

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

Return type:

str, str or None

Returns:

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

static getEneFromFilename(cms_file)

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

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

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

writeCms()

Write a cms file to current dir with ‘cms.Cms.PROP_CMS’ pointing to the original cms file path.

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

Bases: schrodinger.application.matsci.permittivity.MdPostAnalysis

Base class to hold molecular dynamics post trajectory analysis functionality.

setup(copy_ene=False, write_cms=True)

Over write parent class method.

static getTrajectoryFromCms(input_cms, orig_cms=None)

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

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

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

Return type:

str, str or None

Returns:

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

classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
DEFAULT_CMD = None
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

static autocorrelation(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

static finalizeStep(job)

Copy output file from subdir to top job dir.

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
static getEneFromCms(input_cms, orig_cms=None)

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

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

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

Return type:

str, str or None

Returns:

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

static getEneFromFilename(cms_file)

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

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

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

writeCms()

Write a cms file to current dir with ‘cms.Cms.PROP_CMS’ pointing to the original cms file path.

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

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to do post cell average analysis on desmond trajectory.

DEFAULT_CMD = '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'
classmethod RegisterCmsAndTrjToJob(options, job_builder, orig_cms=None)

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

static autocorrelation(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
static getEneFromCms(input_cms, orig_cms=None)

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

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

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

Return type:

str, str or None

Returns:

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

static getEneFromFilename(cms_file)

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

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

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

writeCms()

Write a cms file to current dir with ‘cms.Cms.PROP_CMS’ pointing to the original cms file path.

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

Bases: schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis

Class to do post dipole analysis on desmond trajectory.

DEFAULT_CMD = 'permittivity_gui_dir/permittivity_dipole_driver.py'
DIPOLE = 'dipole'
DEFAULT_JOBNAME = 'permittivity_dipole_task'
OUTFILE_EXT = '-out.cms'
TIME_SERIAL = 'time_serial'
AUTOCORRELATION = 'autocorrelation'
FOURIER_TRANSFORM = 'fourier_transform'
SUSCEPTIBILITY = 'susceptibility'
TIME_SERIA_FILE_PROP = 's_matsci_Dipole_Time_serial_File'
AUTOCORRELATION_FILE_PROP = 's_matsci_Dipole_Autocorrelation_File'
FOURIER_TRANSFORM_FILE_PROP = 's_matsci_Dipole_Fourier_transform_File'
DIPOLE_SUSCEPTIBILITY_PROP = 'r_matsci_Dipole_Susceptibility'
KWW = 'kww'
TAU = 'tau'
BETA = 'beta'
KWW_TAU_PROP = 'r_matsci_Kww_Tau'
KWW_BETA_PROP = 'r_matsci_Kww_Beta_(ps)'
static finalizeStep(job)

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

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

Register cms file and trajectory folder to job if needed.

Parameters:
  • options (argparse.ArgumentParser) – The parser to get the cms options from and set the trj options for.
  • job_builder (launchapi.JobSpecification) – JobSpecification object
TEMP_PROP = 'r_matsci_Temperature(K)'
TEMP_STD_PROP = 'r_matsci_stdev_Temperature(K)'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addEnefileToAdditionalInfiles()

Add the ene file as one of the additional files.

addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

static autocorrelation(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

static autocorrelationWithSum(time_serial_data, normalize=False)

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

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

autocorrelated data (by column)

Return type:

n x m numpy.array

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
static getEneFromCms(input_cms, orig_cms=None)

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

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

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

Return type:

str, str or None

Returns:

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

static getEneFromFilename(cms_file)

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

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

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

setup(copy_ene=False, write_cms=True)

Over write parent class method.

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

writeCms()

Write a cms file to current dir with ‘cms.Cms.PROP_CMS’ pointing to the original cms file path.

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

Bases: schrodinger.application.matsci.permittivity.Step

Class to do jaguar calculation of electric polarizability.

DEFAULT_CMD = 'permittivity_gui_dir/permittivity_electric_polarizability_driver.py'
Electric_Polarizability = 'electric_polarizability'
DEFAULT_JOBNAME = 'permittivity_electric_polarizability_task'
PROP = 'electric_polarizability'
KEY = 'r_matsci_Electric_Polarizability_(bohr^3)'
POLAR_ALPHA = 'polar_alpha'
DEFAULT_KWARGS = {'jaguar_output_attr': 'polar_alpha', 'tpp': 1}
FLAG_POLYMER_BUILDER_NUM_MONOMERS = '-num_cru'
classmethod isMultipleOligomers(input_mae)

Check whether the input mae contains oligomers.

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

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

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

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

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

JobControlJob or SubprocessJob)

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

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

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

Get the jaguar input structures from polymer builder job infos.

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

a file containing all structure for jaguar calculations

Return type:

str

classmethod setElecPolarizability(structs_from_jaguar, out_struct)

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

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

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

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

Finalize this step.

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

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

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
TERMINAL_INFILE_NUM = 1
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

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

Bases: schrodinger.application.matsci.permittivity.Step

Class to do refractive index calculation.

DEFAULT_CMD = 'permittivity_gui_dir/permittivity_refractive_index_driver.py'
Refractive_Index = 'refractive_index'
DEFAULT_JOBNAME = 'permittivity_refractive_index_task'
KEY = 'r_matsci_Refractive_Index_{temp:.2f}K'
TERMINAL_INFILE_NUM = 2
setup()

Over write parent class method.

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
static finalizeStep(job)

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

Parameters:job (an instance of a BaseJob subclass (such as JobControlJob or SubprocessJob)) – current job
NUM_CRU_PROP = 'i_matsci_Num_Cru'
OUTFILE_EXT = '-out.mae'
__init__(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=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.
addFinalizer(function, run_dir=None)

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

See also the add_multi_job_finalizer function.

addGroupPrereq(job)

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

addPrereq(job)

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

cancelSubmitted()

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

Return True if this was successful, False otherwise.

doCommand(host, local)

Launch job on specified host using jobcontrol.launch_job(). The -LOCAL flag is added to the job invocation command if local is True.

Parameters:
  • host (str) – Host on which the job will be executed.
  • local (bool) – Should “-LOCAL” be appended to the command?
finalize()

Clean up after a job successfully runs.

genAllJobs(seen=None)

A generator that yields all jobs connected to this one.

genAllPrereqs(seen=None)

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

static getCmdFlagsFromCmdBlock(cmd_block)

Get cmd flags from the cmd block.

Parameters:cmd_block (an iterable) – the cmd flag block in the task setting
Returns:the cmd flags
Return type:list of string
Raises:ValueError – if the item in cmd block is no string or dict.
getCommand()

Return the command used to run this job.

Return type:list(str)
getCommandDir()

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

Return type:str
getJob()

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

Returns None if the job hasn’t been launched.

getJobDJ()

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

getPrereqs()

Return a set of all immediate prerequisites for this job.

getStatusStrings()

Return a tuple of status strings for printing by JobDJ.

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

hasStarted()

Returns True if this job has started (not waiting)

init_count = 0
isComplete()

Returns True if this job finished successfully

kill()

Send kill request to jobcontrol managed job

maxFailuresReached(msg)

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

classmethod optionsToTaskProtocols(options, task_name)

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

Parameters:
  • options (The parsed command line options) – Named tuple
  • task_name (str) – task name of the current stage
Returns:

information of cmd_flags, driver_path, prepend…

Return type:

dict

postCommand()

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

preCommand()

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

retryFailure(max_retries=0)

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

Parameters:max_retries (int) – The queue’s max_retries parameter
Return type:bool
Returns:True if the job should be retried, False if not
run(*args, **kwargs)

Run the job.

The steps taken are as follows:
  1. Execute the preCommand method for things like changing the working directory.
  2. Call the doCommand to do the actual work of computation or job launching.
  3. Call the postCommand method to undo the changes from the preCommand that need to be undone.
runsLocally()

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

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

state

Return the current state of the job.

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

update()

Checks for changes in job status, and updates the object appropriately (marks for restart, etc). Raises a RuntimeError if an unknown Job Status or ExitStatus is encountered.

usesJobServer()

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

class schrodinger.application.matsci.permittivity.WorkflowParser(config_yaml, basename, infile_job_infos, master_logger=None)

Bases: object

TASK_NAME = 'task_name'
TASK_TYPE = 'task_type'
TASK_SUBCLASS = 'task_subclass'
TASK_DRIVER_PATH = 'task_driver_path'
TASK_SUBJOB = 'task_subjob'
FIRST_LVL_CHILD_NODE_INDEXES = 'first_lvl_child_node_indexes'
FIRST_LVL_PARENT_NODE_INDEXES = 'first_lvl_parent_node_indexes'
TASK_TYPE_TO_SUBCLASS = {'Disorder System Builder Protocol': <class 'schrodinger.application.matsci.permittivity.DisorderSystemBuilder'>, 'Jaguar Polarizability Protocol': <class 'schrodinger.application.matsci.permittivity.ElectricPolarizability'>, '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'>, 'Refractive Index Protocol': <class 'schrodinger.application.matsci.permittivity.RefractiveIndex'>}
__init__(config_yaml, basename, infile_job_infos, master_logger=None)
Parameters:
  • config_yaml (str) – config file
  • basename (str) – base name
  • infile_job_infos (list of SimpleNamespace) –
  • logger (logging.Logger) – The logger to use for recording messages into master job -driver.log.
initialize()

Initialize the class by reading workflow from config file, creating networkx, indexing the workflow task names….

addNodes()

Add each task name using an unique index as a node to the graph.

addEdges()

Add edges between nodes according to the job dependence (parent / child).

addSubclassToGraphNodes()

Add task type, driver path, and subclass to each node.

addSubjobsToGraphNode()

Initiate each subclass and add the initiated subclass (subjob) to the node.

setFirstLevelParentChildJobs()

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.

removeIncompatibleStartingSubjobs()

Remove the subjobs that are not defined as starting tasks by task type or task driver path.

setSubjobDependence()

Set the job dependence between each subjob pair.

addJobsToJobDj(jdj)

Set the input files for the no-parent subjobs and them to the JobDJ. (the job dependence set by setSubjobDependence() put all jobs in)

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.

setUp()

Parse the workflow section in the config yaml and setup the subjobs.

getWorkflowItemByindex(index)

Get the item in the workflow 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
getWorkflowTasknameByindex(index)

Get the task name of this item in the workflow.

Parameters:index (list or tuple of int) – index of an item containing a task name.
Raises:TypeError – when it is not a str or dict, meaning this not a leaf item in the workflow tree data struct.
Returns:the task name for this item
Return type:str
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
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
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
classmethod getTaskSubClass(task_type, config_yaml)

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
  • config_yaml (str) – filename for the config
Raises:

TypeError – when the task_type is not supported

Returns:

Return type:

the class or subclass of ‘Step’

classmethod writeConfig(options)

Command line options is a subset of all the flags, and thus write a new configure file based on command line options and configure template.

NOTE: if a config_yaml is explicitly passed from the command line, The returned the full path of the final config file pointing to the original path from the command line.

Parameters:options (The parsed command line options) – Named tuple
Returns:the full path of the final config file
Return type:str