schrodinger.application.matsci.permittivity module¶
Permittivity module for permittivity workflow.
Copyright Schrodinger, LLC. All rights reserved.
-
schrodinger.application.matsci.permittivity.
interpret_flag_block
(flag_block)¶ Interpret the flag block from config yaml to a dict data type.
Parameters: flag_block (list of dict and str. In .yaml, {flag: 'None'} means 'store_true' or 'store_false' optional arguments; [flag] means positional arguments; {flag: 'none'; flag: 'value'} means regular optional arguments.) – a list of dict and str contains flags and values Returns: Keys are flags without ‘-‘, and values are None for positional flag, ‘None’ for optional ‘store_true’ or ‘store_false’ flag, ‘none’ or ‘any_value’ for regular optional ‘store’ flag Return type: dict Raises: ValueError – if the item in cmd block is not string or dict.
-
schrodinger.application.matsci.permittivity.
permittivity_transform
(beta, tau0, tau_max=20, tau_num=None, omega_range=(1e-05, 1e+16), omega_num=None, simpson_quadrature=True)¶ Based on the parameters in the KWW equation, non-uniform grid in tau and omega are used to transform the time domain (tau) signal to frequency domain (omega).
Note: the KWW is the equation 1 and implemented transform is equation 7 in the following paper.
Further Considerations of Non Symmetrical Dielectric Relaxation Behaviour arising from a Simple Empirical Decay Function. BY G. WILLIAM AND D. C. WATT
Parameters: - beta (float) – the beta in KWW equation
- tau0 (float) – the tau0 in unit s is the decay constant in KWW equation
- tau_max (float) – tau upper limit in tau (time) domain
- tau_num (int or None) – total number of data points in the tau (time) domain
- omega_range (tuple of two floats) – output frequency domain range
- omega_num (int or None) – total number of data points in the frequency domain
- simpson_quadrature (bool) – If True, simpson rule with quadratic interpolation is used to reduce the oscillation
Returns: three columns are angular frequency, storage permittivity, and loss permittivity
Return type: 3xn numpy.array
-
schrodinger.application.matsci.permittivity.
get_properties_from_inputfiles
(opts, input_required_properties, input_readers=None)¶ Get properties from the input files. If the requested doesn’t exist, a KeyError error is raised.
Parameters: - opts (Named tuple) – The parsed command line options
- input_required_properties (dict) – keys are struct type and values are property keys.
- input_readers (dict) – keys are struct type and values are readers for different struct types.
Raises: KeyError – when the struct misses one required property
Returns: requested property keys and obtained values
Return type: dict
-
schrodinger.application.matsci.permittivity.
is_file_property
(property_name)¶ Whether the property is related to a file.
Parameters: property_name (str) – a property Returns: whether the property should point to a file Return type: bool
-
schrodinger.application.matsci.permittivity.
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.
log_debug
(msg)¶ Add a message to the log file and exit with an error code
Parameters: msg (str) – The message to debug logging
-
schrodinger.application.matsci.permittivity.
elapsed_timer
()¶ Handy way to print time consumption for the execution of a few python line codes.
example to print line number and time elapsed: from inspect import currentframe with elapsed_timer() as elapsed:
xxx print(currentframe().f_lineno, elapsed()) xxx print(currentframe().f_lineno, elapsed())Returns: float Return type: time elapsed in second
-
schrodinger.application.matsci.permittivity.
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
-
schrodinger.application.matsci.permittivity.
update_task_protocol
(task_protocol, user_input, positional_flag='cmd_flags')¶ This function updates the task_protocol according to a user input dict. The update happens for optional arg: store, store_true and store_false. The flag to locate the optional block must be either SUBCLASS_CMD_FLAGS or SUBCLASS_XTRA_FLAGS. The logic is to put all subdriver recognizable optional flags in SUBCLASS_CMD_FLAGS, and put other flags in SUBCLASS_XTRA_FLAGS.
In short, flags in SUBCLASS_CMD_FLAGS are passed to subjob driver directly. Flags in SUBCLASS_XTRA_FLAGS can be used to control worflow (not used in subdriver) or be reformatted and passed to subdriver in a file format depending on specific implementation.
If user_input = {‘animal’: ‘cat’}, the ‘cat’ will be used for drivers. If user_input = {‘animal’: None}, auto set: drivers with animal key use their
own defaults set by the driver or config yaml.- If user_input = {‘is_rainy’: True}, drivers with is_rainy key adds -is_rainy
- to the cmd.
- If user_input = {‘is_rainy’: False}, drivers with is_rainy key remove -is_rainy
- in the cmd.
- If user_input = {‘is_rainy’: None}, auto set: drivers with is_rainy key check
- config yaml for whether to add -is_rainy in cmd.
Current implementation doesn’t support the positional argument substitution, as this is a replacements of certain list values and positional argument are input/output filenames that are changed by update_infile_and_command().
Parameters: - task_protocol (dict) – dict for regular single stage
- positional_flag (str) – the flag block in task_protocol defined by this flag is updated (either SUBCLASS_CMD_FLAGS or SUBCLASS_XTRA_FLAGS)
- user_input (dict) – {flag: value}
-
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’.
-
-
class
schrodinger.application.matsci.permittivity.
Model
(filename)¶ Bases:
object
Wrapper around a structure.
-
__init__
(filename)¶ Parameters: filename (str) – file path pointing to a cms or mae file.
-
load
()¶ Load a model.
-
setProperty
(key, value)¶ Set the property to the model.
Parameters: - key (str) – property name
- value (str, float, int) – the value of the property
-
property
¶ Return the model property.
Returns: a dictionary Return type: dict
-
write
(fname)¶ Write the model into a file.
Parameters: fname (str) – filename to write out the model.
-
-
class
schrodinger.application.matsci.permittivity.
MaeModel
(filename)¶ Bases:
schrodinger.application.matsci.permittivity.Model
Wrapper around Structure.
-
load
()¶ Load a model from the mae file.
-
setProperty
(key, value)¶ Set the property to the mae model.
Parameters: - key (str) – property name
- value (str, float, int) – the value of the property
-
__init__
(filename)¶ Parameters: filename (str) – file path pointing to a cms or mae file.
-
property
¶ Return the model property.
Returns: a dictionary Return type: dict
-
write
(fname)¶ Write the model into a file.
Parameters: fname (str) – filename to write out the model.
-
-
class
schrodinger.application.matsci.permittivity.
CmsModel
(filename)¶ Bases:
schrodinger.application.matsci.permittivity.Model
Wrapper around Cms.
-
load
()¶ load a model from a cms file.
-
setProperty
(key, value)¶ Set the property to the cms model.
Parameters: - key (str) – property name
- value (str, float, int) – the value of the property
-
__init__
(filename)¶ Parameters: filename (str) – file path pointing to a cms or mae file.
-
property
¶ Return the model property.
Returns: a dictionary Return type: dict
-
write
(fname)¶ Write the model into a file.
Parameters: fname (str) – filename to write out the model.
-
-
schrodinger.application.matsci.permittivity.
get_model
(filename)¶ Get the model from a cms or mae file.
Parameters: filename (str) – file path pointing to a cms or mae file. Returns: the model in the file. Return type: ‘CmsModel’ or ‘MaeModel’
-
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, IS_PRODUCTION markers stages as production stages; IS_RELAXATION markers stages as relaxation stages; If USE_CUSTOMIZED_RELAXATION markers some stages, the first with this marker and those before this one will be replaced by customized relaxation stages defined by users.
Parameters: - stages (list) – multistages for desmond serial simulations
- marker (bool) – remove the marker flag, if True
- 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_permittivity_protocols.yaml', product_dir='permittivity')¶ Get the permittivity config yaml from the mmshare data dir.
Parameters: - filename (str) – the yaml filename
- product_dir (str) – subdir name inside the mmshare_data_dir
Returns: the full path and filename for the input yaml
Return type: str
-
schrodinger.application.matsci.permittivity.
get_permittivity_config_file_from_options
(options)¶ Return the permittivity config file based on command line inputs.
Parameters: options ( argparse.ArgumentParser
) – the command parsered optionsReturns: 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: list of list for workflow block; list of list for desmond multiple stages; dict for regular single stage
Return type: dict, list of str, or list of list
-
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 asJobControlJob
orSubprocessJob
)) – 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.
- child_job (an instance of a
-
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¶
-
DRIVER_PATH
= 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
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not string or dict.
-
static
finalizeStep
(job)¶ Copy output file from subdir to top job dir.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – current job
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
-
class
schrodinger.application.matsci.permittivity.
Step
(basename, config_yaml, 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.
-
DRIVER_PATH
= 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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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_permittivity_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'¶
-
BROWNIAN_DYNAMICS
= 'Brownian Dynamics'¶
-
MOLECULAR_DYNAMICS
= 'Molecular Dynamics'¶
-
AVERAGE_CELL
= 'Average Cell'¶
-
MATSCI_ANALYSIS
= 'Matsci Analysis'¶
-
TIME
= 'time'¶
-
TEMP
= 'temp'¶
-
PRESS
= 'pressure'¶
-
TIMESTEP
= 'timestep'¶
-
ENSEMBLE
= 'ensemble'¶
-
SIM_TYPE
= 'sim_type'¶
-
TRJ_INTVL
= 'trajectory.interval'¶
-
FLAG_TO_KEY
= {'-md_ensemble': 'ensemble', '-md_press': 'pressure', '-md_temp': 'temp', '-md_time': 'time', '-md_timestep': 'timestep', '-md_trj_int': 'trajectory.interval'}¶
-
DESMOND_UNIT_CONVERTERS
= {'-md_time': <function MultiStageMd.<lambda>>, '-md_timestep': <function MultiStageMd.<lambda>>}¶
-
TRJ_WRITE_VEL
= 'trajectory_dot_write_velocity'¶
-
LAST_STAGE_DICT
= {'compress': '""', 'dir': '"."'}¶
-
FLOAT_FIELDS
= ['time', 'temp', 'pressure']¶
-
DUMMY_FIELDS
= ['index', 'is_production', 'is_relaxation', 'use_customized_relaxation']¶
-
MSJSTRINGERS
= {'Average Cell': <class 'schrodinger.application.matsci.desmondutils.AveCellMSJStringer'>, 'Brownian Dynamics': <class 'schrodinger.application.matsci.desmondutils.BrownieMSJStringer'>, 'Matsci Analysis': <class 'schrodinger.application.matsci.desmondutils.MSAnalysisMSJStringer'>, 'Molecular Dynamics': <class 'schrodinger.application.matsci.desmondutils.MDMSJStringer'>}¶
-
HOFMANN_PROTOCOL
= 'Hofmann_relaxation_protocol.yaml'¶
-
HOFMANN_SIMULAITON_PROTOCOL
= 'Hofmann Simulation Protocol'¶
-
DEFAULT_MSJ_HEADER
= 'task { task = "desmond:auto"}\n'¶
-
__init__
(basename, config_yaml='default_permittivity_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.
-
modifyMsjStages
(msj_str)¶ Modify users’ input MSJ string. For example, get task stage and customized stages.
Parameters: msj_str (str) – a string in MSJ format Returns: modified string in MSJ format Return type: str
-
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 optionsReturns: key and values for a desmond stage Return type: dict
-
static
getRelaxationStages
(relaxation_file)¶ Get the relaxation stages from relaxation protocol file and return it as desmond stages.
Parameters: relaxation_file (str) – a file containing relaxation protocol Returns: list of desmond stages Return type: list
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ Process the stages, for example, update relaxation stages, update the productions stage, and remove productions markers.
Parameters: - options (Named tuple) – The parsed command line options
- task_name (str) – task name
- seed (int or None) – random seed to randomize the initial velocities
Returns: list of desmond stages
Return type: list
-
static
getAllStages
(options, task_name)¶ Construct the stages in general by looking at the config yaml, commandline relaxation, and productions. Note: only when stages are marked by USE_CUSTOMIZED_RELAXATION and options.relaxation_protocol is provided, the stages in the relaxation_protocol is used to overwrite the stages in options.config_yaml.
Parameters: - options (
argparse.Namespace
) – The object holding all the cmd options - task_name (str) – the task name of the stage
Returns: list of stages
Return type: list
- options (
-
classmethod
modifyStageSettings
(all_stages, options, seed=None)¶ Modify the stages based on command line options, including update the temperature and pressure of the first flexible stages before each production stage, pass velocity to NVE production stage.
Parameters: - all_stages (list) – stages
- options (Named tuple) – The parsed command line options
- seed (int or None) – random seed to randomize the initial velocities
-
DRIVER_PATH
= None¶
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
MdStageModifier
(stages, options, seed=None)¶ Bases:
object
-
RANDOMIZE_VELOCITY_DOT_FIRST
= 'randomize_velocity.first'¶
-
__init__
(stages, options, seed=None)¶ Parameters: - stages (each stage is a dict containing desmond run settings) – list of stages
- options (Named tuple) – The parsed command line options
- seed (int or None) – random seed to randomize the initial velocities
-
run
()¶ Main method to drive the functionality.
-
setRelaxAndProductionIndexes
()¶ Set relaxation and production stage indexes according to markers. Note: if only relaxation stages are found, the stage right after the last relaxation is assumed to be the production stages.
-
setRelaxRandomVel
()¶ Set the randomize velocity seed for the first relaxation stage.
-
updateProductStageTempAndPress
()¶ Update the temp and press of the production stage.
-
updateRelaxStageTempAndPress
()¶ Update the temperature and pressure settings of stages. If no NPT or NVT ahead of the NVE, randomize the NVE production velocity.
-
connectNVEInitialVelocity
()¶ Seamlessly connect the NVE production stage to the previous stages by writing out velocities and skip the randomizing initial velocities.
-
updateLastRelaxStage
()¶ Update the last relaxation stage settings.
-
updateTrjIntvel
()¶ Update the trajectory output interval for the stages before the last relaxation stage.
-
updateLastStage
()¶ Update the settings of the last stage.
-
removeCom
()¶ Add remove center of mass string to relaxation and production stages.
-
removeDummyFields
()¶ Remove the intermediate arguments that desmond doesn’t recognize.
-
-
class
schrodinger.application.matsci.permittivity.
DisorderSystemBuilder
(basename, config_yaml, 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-2/NB/build-063/mmshare-v5.0/python/scripts/disordered_system_builder_gui_dir/disordered_system_builder_driver.py'>¶
-
DRIVER_PATH
= 'disordered_system_builder_gui_dir/disordered_system_builder_driver.py'¶
-
DISORDER_SYSTEM
= 'disorder_system'¶
-
DEFAULT_JOBNAME
= 'permittivity_disorder_system_task'¶
-
FLAG_MOLECULES
= '-molecules'¶
-
FLAG_COMPOSITION
= '-composition'¶
-
DEFAULT_NUMBER_OF_MOLECULES
= 500¶
-
classmethod
getSeedFlag
()¶ Return the flag for random seed.
Returns: the flag to set the random seed (without the ‘-‘) Return type: str
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ Process the stages, for example, update relaxation stages, update the productions stage, and remove productions markers.
Parameters: - options (Named tuple) – The parsed command line options
- task_name (str) – task name
- seed (int or None) – random seed to randomize the initial velocities
Returns: list of desmond stages
Return type: list
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
OUTFILE_EXT
= '-out.mae'¶
-
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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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)
-
DRIVER_PATH
= 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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_density_driver.py'¶
-
DENSITY
= 'density'¶
-
DEFAULT_JOBNAME
= 'permittivity_density_task'¶
-
DENSITY_PROP
= 'r_matsci_Density(g/cm3)'¶
-
DENSITY_STD_PROP
= 'r_matsci_stdev_Density(g/cm3)'¶
-
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 asJobControlJob
orSubprocessJob
)) – 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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
static
getEneFromCms
(input_cms, orig_cms=None)¶ Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when ene file cannot be found.
Return type: str, str or None
Returns: existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)
-
static
getEneFromFilename
(cms_file)¶ Get the ene file based on cms file name (may with path).
Parameters: cms_file (str) – the cms whose ene file is searched. Returns: the ene file Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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
- options (
-
DRIVER_PATH
= 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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
static
getEneFromCms
(input_cms, orig_cms=None)¶ Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when ene file cannot be found.
Return type: str, str or None
Returns: existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)
-
static
getEneFromFilename
(cms_file)¶ Get the ene file based on cms file name (may with path).
Parameters: cms_file (str) – the cms whose ene file is searched. Returns: the ene file Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_ave_cell_driver.py'¶
-
AVE_CELL
= 'ave_cell'¶
-
DEFAULT_JOBNAME
= 'permittivity_ave_cell_task'¶
-
OUTFILE_EXT
= '-out.cms'¶
-
setup
(copy_ene=True, write_cms=True)¶ Over write parent class method.
-
static
finalizeStep
(job)¶ Finalize this step. Can be overwritten for light weight post process.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – 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
- options (
-
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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
static
getEneFromCms
(input_cms, orig_cms=None)¶ Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when ene file cannot be found.
Return type: str, str or None
Returns: existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)
-
static
getEneFromFilename
(cms_file)¶ Get the ene file based on cms file name (may with path).
Parameters: cms_file (str) – the cms whose ene file is searched. Returns: the ene file Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
static
getTrajectoryFromCms
(input_cms, orig_cms=None)¶ Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.
Return type: str, str or None
Returns: existing trajectory if found, whether the input trajectory sits with the original cms
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
AnalyzeSimulation
(*arg, **kwarg)¶ Bases:
schrodinger.application.matsci.permittivity.MdPostTrajectoryAnalysis
Class to analyze trajectory from desmond simulation using analyze_simulation.py
-
DRIVER_PATH
= 'analyze_simulation.py'¶
-
ANALYZE_SIMULATION
= 'analyze_simulation'¶
-
DEFAULT_JOBNAME
= 'permittivity_analyze_simulation_task'¶
-
OUTFILE_EXT
= '-out.cms'¶
-
ST2_EXT
= '.st2'¶
-
OUT_ST2_EXT
= '-out.st2'¶
-
INPUT_ST2
= 'input_st2'¶
-
OUT_ST2_PROP
= 's_matsci_St2_File'¶
-
__init__
(*arg, **kwarg)¶ See paraent class for documentation
-
setup
()¶ Over write parent class method.
-
appendTrjInOutst2ToCmd
()¶ Append the trajectory, input st2, and output st2 information to the cmd.
-
createInputSt2
()¶ Create input st2 file based on the configure yaml.
-
setOutfile
()¶ Set the outfile of a job.
-
static
finalizeStep
(job)¶ Finalize this step. Can be overwritten for light weight post process.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – 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
- options (
-
TEMP_PROP
= 'r_matsci_Temperature(K)'¶
-
TEMP_STD_PROP
= 'r_matsci_stdev_Temperature(K)'¶
-
TERMINAL_INFILE_NUM
= 1¶
-
addEnefileToAdditionalInfiles
()¶ Add the ene file as one of the additional files.
-
addFinalizer
(function, run_dir=None)¶ Add a function to be invoked when the job completes successfully.
See also the add_multi_job_finalizer function.
-
addGroupPrereq
(job)¶ Make all jobs connected to
job
prerequisites of all jobs connected to this Job.
-
addPrereq
(job)¶ Add a job that is an immediate prerequisite for this one.
-
static
autocorrelation
(time_serial_data, normalize=False)¶ Calculate the auto correlation of the input numpy.array data.
Parameters: - time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
- normalize (bool) – if True, the auto correlation data will be normalized
Returns: autocorrelated data (by column)
Return type: n x m numpy.array
-
static
autocorrelationWithSum
(time_serial_data, normalize=False)¶ Calculate the auto correlation of the input numpy.array data.
Parameters: - time_serial_data (n x m numpy.array) – autocorrelation of each column of the data
- normalize (bool) – if True, the auto correlation data will be normalized
Returns: autocorrelated data (by column)
Return type: n x m numpy.array
-
cancelSubmitted
()¶ If the job is still in the ‘submitted’ state, cancel it, purge the jobrecord and set the job handle to None.
Return True if this was successful, False otherwise.
-
doCommand
(host, local)¶ Launch job on specified
host
using jobcontrol.launch_job(). The-LOCAL
flag is added to the job invocation command iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
static
getEneFromCms
(input_cms, orig_cms=None)¶ Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when ene file cannot be found.
Return type: str, str or None
Returns: existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)
-
static
getEneFromFilename
(cms_file)¶ Get the ene file based on cms file name (may with path).
Parameters: cms_file (str) – the cms whose ene file is searched. Returns: the ene file Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
static
getTrajectoryFromCms
(input_cms, orig_cms=None)¶ Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.
Return type: str, str or None
Returns: existing trajectory if found, whether the input trajectory sits with the original cms
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
-
FLAG_SLICE_INTVL
= '-slice_intvl'¶
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_dipole_driver.py'¶
-
DIPOLE
= 'dipole'¶
-
DEFAULT_JOBNAME
= 'permittivity_dipole_task'¶
-
OUTFILE_EXT
= '-out.cms'¶
-
TIME_SERIAL
= 'time_serial'¶
-
AUTOCORRELATION
= 'autocorrelation'¶
-
COMPLEX_PERMITTIVITY
= 'complex_permittivity'¶
-
SUSCEPTIBILITY
= 'susceptibility'¶
-
TIME_SERIA_FILE_PROP
= 's_matsci_Dipole_Time_serial_File'¶
-
AUTOCORRELATION_FILE_PROP
= 's_matsci_Dipole_Autocorrelation_File'¶
-
COMPLEX_PERMITTIVITY_FILE_PROP
= 's_matsci_Complex_permittivity_File'¶
-
DIPOLE_SUSCEPTIBILITY_PROP
= 'r_matsci_Dipole_Susceptibility'¶
-
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 asJobControlJob
orSubprocessJob
)) – 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
- options (
-
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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
static
getEneFromCms
(input_cms, orig_cms=None)¶ Search existing ene file and return the ene found based on the input_cms. Existing ene file may be found in current folder, in the input cms folder or in the PROP_CMS (‘s_m_original_cms_file’) folder when ene is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when ene file cannot be found.
Return type: str, str or None
Returns: existing ene file if found, the original cms file that the ene file sits with or None (sit with the input_cms)
-
static
getEneFromFilename
(cms_file)¶ Get the ene file based on cms file name (may with path).
Parameters: cms_file (str) – the cms whose ene file is searched. Returns: the ene file Return type: str or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
static
getTrajectoryFromCms
(input_cms, orig_cms=None)¶ Search existing trajectory and return the trajectory found based on the input_cms. Existing trajectory (desmondutils.PROP_TRJ) may be found in current folder, sitting with input cms or sitting with the original cms defined by users or pointed to by PROP_CMS (‘s_m_original_cms_file’) when trajectory is not copied from the PROP_CMS folder to the current folder.
Parameters: - input_cms (str) – INPUT_CMS defined for INPUT_TRJ searching.
- orig_cms (str) – the original cms defined by users.
Raises: KeyError, FileNotFoundError, ValueError – when trajectory cannot be found.
Return type: str, str or None
Returns: existing trajectory if found, whether the input trajectory sits with the original cms
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
JaguarCalculation
(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 a Jaguar calculation with keywords.
-
IN_EXT
= '.in'¶
-
DRIVER_PATH
= 'run'¶
-
POSITIONAL_CMD
= 'permittivity_gui_dir/permittivity_positional_driver.py'¶
-
JAGUAR
= 'jaguar'¶
-
DEFAULT_JOBNAME
= 'permittivity_jaguar_task'¶
-
FLAG_PARALLEL
= '-PARALLEL'¶
-
BASIS
= 'basis'¶
-
IGEOPT
= 'igeopt'¶
-
MOLCHG
= 'molchg'¶
-
MULTIP
= 'multip'¶
-
IUHF
= 'iuhf'¶
-
DFTNAME
= 'dftname'¶
-
IPOLAR
= 'ipolar'¶
-
B3LYP
= 'B3LYP'¶
-
INT_KEYWORDS
= ['igeopt', 'molchg', 'multip', 'iuhf', 'ipolar']¶
-
KEYWORD_DEFAULTS
= {'dftname': 'B3LYP', 'igeopt': 0, 'ipolar': None, 'iuhf': None, 'molchg': 0, 'multip': 1}¶
-
FLAG_JAGUAR_OPTIONS
= '-jaguar_options'¶
-
DEFAULT_JAGUAR_OPTIONS
= {'basis': '6-31G**', 'dftname': 'B3LYP', 'igeopt': 1}¶
-
setup
()¶ See parent class.
-
getCommand
()¶ Structure from polymer builder with the target length can be very large and shouldn’t directly go into jaguar. Overwrite the jaguar job command so that this step skipped for now with all the input information saved in the workflow tree.
Returns: the command to run the subjob Return type: list of str
-
customizeInputAndCommand
()¶ Jaguar stage requires its own input file instead of mae. The method writes out the jaguar input file and update the command with the jaguar input file.
-
static
finalizeStep
(job)¶ Finalize this step. Can be overwritten for light weight post process.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – current job
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ Update the task protocol according to the user input.
Parameters: - options (Named tuple) – The parsed command line options
- task_name (str) – task name
- seed (int or None) – random seed to randomize the initial velocities
Returns: list of desmond stages
Return type: list
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
OUTFILE_EXT
= '-out.mae'¶
-
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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not string or dict.
-
getCommandDir
()¶ Return the launch/command directory name. If None is returned, the job will be launched in the current directory.
Return type: str
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
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.
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_electric_polarizability_driver.py'¶
-
ELECTRIC_POLARIZABILITY
= 'electric_polarizability'¶
-
DEFAULT_JOBNAME
= 'permittivity_electric_polarizability_task'¶
-
FLAG_JAGUAR_OPTIONS
= '-jaguar_options'¶
-
FLAG_ELEC_POLARIZABILITY
= '-elec_polarizability'¶
-
DEFAULT_JAGUAR_OPTIONS
= {'basis': 'cc-pVTZ-pp(-f)++', 'dftname': 'B3LYP', 'igeopt': 1, 'ipolar': -1}¶
-
PROP
= 'electric_polarizability'¶
-
KEY
= 'r_matsci_Electric_Polarizability_(bohr^3)'¶
-
ELECTRIC_POLARIZABILITY_PROP
= 'r_matsci_Electric_Polarizability_(bohr^3)'¶
-
POLAR_ALPHA
= 'polar_alpha'¶
-
DEFAULT_KWARGS
= {'jaguar_output_attr': 'polar_alpha', 'tpp': 1}¶
-
FLAG_POLYMER_BUILDER_NUM_MONOMERS
= '-num_cru'¶
-
ELECTRIC_POLARIZABILITY_SLOPE
= 'r_matsci_Electric_Polarizability_Slope_(bohr^3/monomer)'¶
-
ELECTRIC_POLARIZABILITY_INTERCEPT
= 'r_matsci_Electric_Polarizability_Intercept_(bohr^3)'¶
-
classmethod
isMultipleOligomers
(input_mae)¶ Check whether the input mae contains oligomers.
Parameters: input_mae (str) – a mae file name with path Returns: True if the input files have more than 1 oligomers. Return type: bool
-
static
cmdFlagsToJaguarOptions
(cmd_jaguar)¶ Convert cmd flags from the config yaml to jaguar option keys.
Parameters: cmd_jaguar (list of str) – list of command flags without the ‘-‘ and always with a value following. Returns: a dict of jaguar option keys and values Return type: dict
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getCruNumFromCmd
(cmd)¶ Return the the cru num (number of monomeric units) from a command.
Parameters: cmd (list of str) – the command with -num_cru and a followed int Returns: number of monomeric units Return type: int or None
-
runAndGetPolymerBuildJobInfos
(polymer_job)¶ Run additional polymer builder jobs and return the information of them.
Note: it is possible that each polymer builder job for an oligomer is followed by one jaguar calculations
Parameters: polymer_job (an instance of a BaseJob
subclass (such as) – the polymer subjob before the jaguar subjobJobControlJob
orSubprocessJob
)Returns: each SimpleNamespace has the information of the previous polymer subjobs and the input jaguar input file information. Return type: list of SimpleNamespace
-
createPolymerJob
(polymer_job, num_cru)¶ Create one polymer builder job for an oligomer of num_cru length.
Parameters: polymer_job (an instance of a BaseJob
subclass (such as) – the polymer subjob before the jaguar subjobJobControlJob
orSubprocessJob
)Parameters: num_cru (int) – number of monomeric units Returns: the polymer builder job to build an oligomer Return type: ‘jaguarworkflows.RobustSubmissionJob’ or any subclass of queue.JobControlJob
-
runPolymerJobs
(polymer_job)¶ Run and return a list of finished polymer builder jobs.
Parameters: polymer_job (an instance of a BaseJob
subclass (such as) – the polymer subjob before the jaguar subjobJobControlJob
orSubprocessJob
)Returns: Successfully completed jobs, sorted into the order they were marked as completed by JobDJ. Return type: list of queue.JobControlJob
-
getPolymerBuilderInfos
(done_polym_jobs, original_num_cru)¶ Get the polymer job information for all oligomers or just itself.
Parameters: - done_polym_jobs (list of queue.JobControlJob) – Successfully completed polymer builder jobs for oligomers, sorted into the order they were marked as completed by JobDJ.
- original_num_cru (int) – original monomeric unit number
Returns: each SimpleNamespace has the information of the previous polymer subjobs: e.g., the input file for jaguar calculations.
Return type: list of SimpleNamespace
-
createJaguarJob
(jaguar_task_name, jaguar_infile)¶ Create a jaguar job based on the task name and input file.
Parameters: - jaguar_task_name (str) – the task name
- jaguar_infile (str) – path and filename pointing to the input struct
Returns: a JobControlJob instance for jaguar calculation
Return type: ‘JaguarCalculation’
-
runJaguarJobs
(polymer_builder_job_infos)¶ Run jaguar calculations and return the finished ones.
Parameters: polymer_builder_job_infos (list of SimpleNamespace) – each SimpleNamespace has the information of the previous polymer subjobs. Returns: list of finished jaguar calculations Return type: list of JobControlJob
-
updatePolymerBuilderInfos
(polymer_builder_job_infos, jaguar_done_jobs)¶ Update the polymer builder infos according to the addtion jaguar calculations if exist.
Parameters: - polymer_builder_job_infos – each SimpleNamespace has the information of the previous polymer subjobs information.
- jaguar_done_jobs (list of JobControlJob) – list of finished jaguar calculations
Returns: each SimpleNamespace has the information of the previous polymer subjobs and finished jaguar subjobs.
Return type: list of SimpleNamespace
-
getCruNums
()¶ Return a list of requested ‘num_cru’s (cru means repeat unit).
Returns: list of int Return type: str or None
-
jobInfos
()¶ Return the polymer builder subjob information for the subjob that should be the parent jobs of this jaguar subjob.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – the jaguar subjob, which may have a polymer builder subjob as parent job.Returns: a list of SimpleNamespace objects and each has information on a existing polymer builder subjob; if no polymer builder job head, the list is of one single SimpleNamespace object indicting that the original num_cru is None Return type: a list of ‘SimpleNamespace’
-
writeJaguarInputStructs
(job_infos, all_struct_file='tmp_jaguar_in_sts.maegz')¶ Get the jaguar input structures from polymer builder job infos.
Parameters: - job_infos (list of SimpleNamespace) – the job information (e.g., single struct or oligomers)
- all_struct_file (str) – a file containing all structure for jaguar calculations
Returns: a file containing all structure for jaguar calculations
Return type: str
-
classmethod
setElecPolarizability
(structs_from_jaguar, out_struct)¶ Get the jaguar output structure. If multiple jaguar calculations are performed, the returned one contains the fitted electric polarizability by linear extrapolation.
Parameters: - structs_from_jaguar (list of 'structure.Structure') – structures from jaguar calculations
- out_struct ('structure.Structure') – structure to set electric polarizability
-
updateCmd
(tmp_structs_file=None)¶ Update the jaguar job command. If tmp_structs_file is not None, update the original command with tmp_structs_file.
Parameters: tmp_structs_file (the input file contains multiple structures) – str or None
-
moveJaguarFlagsToCmdTail
()¶ As jaguar options has nargs=+, rearrage it to be the last optional flag.
-
setup
()¶ Finalize this step.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – 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 asJobControlJob
orSubprocessJob
)) – current job
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ Update the task protocol according to the user input.
Parameters: - options (Named tuple) – The parsed command line options
- task_name (str) – task name
- seed (int or None) – random seed to randomize the initial velocities
Returns: list of desmond stages
Return type: list
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
OUTFILE_EXT
= '-out.mae'¶
-
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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.
TwoFileInput
(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None)¶ Bases:
schrodinger.application.matsci.permittivity.Step
Class to sort the two input files based on extension.
-
TERMINAL_INFILE_NUM
= 2¶
-
setup
()¶ See parent class.
-
DRIVER_PATH
= None¶
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
OUTFILE_EXT
= '-out.mae'¶
-
__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 iflocal
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 asJobControlJob
orSubprocessJob
)) – 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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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.TwoFileInput
Class to do refractive index calculation.
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_refractive_index_driver.py'¶
-
REFRACTIVE_INDEX
= 'refractive_index'¶
-
DEFAULT_JOBNAME
= 'permittivity_refractive_index_task'¶
-
REFRACTIVE_INDEX_PROP
= 'r_matsci_Refractive_Index'¶
-
RELATIVE_PERMITTIVITY_INF_PROP
= 'r_matsci_Relative_Permittivity_Inf'¶
-
static
finalizeStep
(job)¶ Finalize this step. Can be overwritten for light weight post process.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – current job
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
OUTFILE_EXT
= '-out.mae'¶
-
TERMINAL_INFILE_NUM
= 2¶
-
__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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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
()¶ See parent class.
-
state
¶ Return the current state of the job.
Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling
BaseJob
instances. For example, by examining some external condition (e.g. presence of output files) the state DONE could be returned immediately and the job would not run.
-
update
()¶ 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.
StaticPermittivity
(basename, config_yaml, task_name=None, infile='$infile', outfile=None, additional_infiles=None, master_logger=None)¶ Bases:
schrodinger.application.matsci.permittivity.TwoFileInput
Class to do refractive index calculation.
-
OUTFILE_EXT
= '-out.cms'¶
-
DRIVER_PATH
= 'permittivity_gui_dir/permittivity_static_permittivity_driver.py'¶
-
STATIC_PERMITTIVITY
= 'static_permittivity'¶
-
DEFAULT_JOBNAME
= 'permittivity_static_permittivity_task'¶
-
RELATIVE_STATIC_PERMITTIVITY_PROP
= 'r_matsci_Relative_Static_Permittivity'¶
-
static
finalizeStep
(job)¶ Finalize this step. Can be overwritten for light weight post process.
Parameters: job (an instance of a BaseJob
subclass (such asJobControlJob
orSubprocessJob
)) – current job
-
NUM_CRU_PROP
= 'i_matsci_Num_Cru'¶
-
TERMINAL_INFILE_NUM
= 2¶
-
__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 iflocal
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.
-
getCmdFromFlagBlock
(flag_block)¶ Get cmd from the flag block.
Parameters: flag_block (an iterable) – the flag block in the task setting Returns: the command Return type: list of string Raises: ValueError – if the item in cmd block is not 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
-
getDownStreamPolymerJob
()¶ Search and return the down-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
classmethod
getForceFieldFlag
()¶ Return the flag for force field. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getJob
()¶ Return the job record as a schrodinger.job.jobcontrol.Job instance.
Returns None if the job hasn’t been launched.
-
getJobDJ
()¶ Return the JobDJ instance that this job has been added to.
-
getPrereqs
()¶ Return a set of all immediate prerequisites for this job.
-
classmethod
getSeedFlag
()¶ Return the flag for random seed. Should be overwritten by the subclass only when subtask reads in this flag
Returns: the flag to set the random seed (without the ‘-‘) Return type: str or None
-
getStatusStrings
()¶ Return a tuple of status strings for printing by
JobDJ
.The strings returned are (status, jobid, name, host).
-
getUpStreamPolymerJob
()¶ Search and return the up-stream polymer job
Returns: A subtask step with polymer driver in the cmd Return type: ‘Step’ or None
-
hasStarted
()¶ Returns True if this job has started (not waiting)
-
init_count
= 0¶
-
isComplete
()¶ Returns True if this job finished successfully
-
kill
()¶ Send kill request to jobcontrol managed job
-
maxFailuresReached
(msg)¶ Print an error summary, including the last 20 lines from each log file in the LogFiles list of the job record.
-
classmethod
optionsToTaskProtocols
(options, task_name, seed=None)¶ This is the class method to generate task_protocol based on command line options and default values from config yaml. This method should be overwritten by subclass method as this one returns the protocol in the default configure yaml.
Parameters: - options (The parsed command line options) – Named tuple
- task_name (str) – task name of the current stage
- seed (int or None) – random seed to randomize the initial velocities
Returns: information of cmd_flags, driver_path, prepend…
Return type: dict
-
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:
- Execute the preCommand method for things like changing the working directory.
- Call the doCommand to do the actual work of computation or job launching.
- Call the postCommand method to undo the changes from the preCommand that need to be undone.
-
runsLocally
()¶ 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
()¶ See parent class.
-
state
¶ Return the current state of the job.
Note that this method can be overridden by subclasses that wish to provide for restartability at a higher level than unpickling
BaseJob
instances. For example, by examining some external condition (e.g. presence of output files) the state DONE could be returned immediately and the job would not run.
-
update
()¶ 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 Calculation Protocol': <class 'schrodinger.application.matsci.permittivity.JaguarCalculation'>, 'Jaguar Polarizability Protocol': <class 'schrodinger.application.matsci.permittivity.ElectricPolarizability'>, 'MD Analyze Simulation Protocol': <class 'schrodinger.application.matsci.permittivity.AnalyzeSimulation'>, 'MD Average Cell Protocol': <class 'schrodinger.application.matsci.permittivity.AveCellAnalysis'>, 'MD Density Protocol': <class 'schrodinger.application.matsci.permittivity.DensityAnalysis'>, 'MD Dipole Protocol': <class 'schrodinger.application.matsci.permittivity.DipoleAnalysis'>, 'MD Simulation Protocol': <class 'schrodinger.application.matsci.permittivity.MultiStageMd'>, 'Refractive Index Protocol': <class 'schrodinger.application.matsci.permittivity.RefractiveIndex'>, 'Static Permittivity Protocol': <class 'schrodinger.application.matsci.permittivity.StaticPermittivity'>}¶
-
__init__
(config_yaml, basename, infile_job_infos, master_logger=None)¶ Parameters: - config_yaml (str) – config file
- basename (str) – base name
- infile_job_infos (list of SimpleNamespace) –
- logger (
logging.Logger
) – The logger to use for recording messages into master job -driver.log.
-
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.
-
getLeafJobs
()¶ Return the jobs without dependents in an order that the leaf with the longest path to the root is returned first.
Returns: a list of nodes without a child. Return type: list of nodes in networkx.Graph.nodes
-
getFirstLevelParentNodes
(node)¶ Return the first level parent task subjob node indexes of this input node.
Parameters: node (tuple) – a node index whose parent nodes are requested Returns: a node in the job without a child Return type: list of nodes (dict)
-
getOrderedTaskSubjobDirs
(node)¶ Return the task subjob dirs in the order from bottom to the top.
Parameters: node (dict as a node in networkx.Graph.nodes) – a node in the job without a child. Returns: key is the task name and value is the subdir of the task Return type: OrderedDict
-
addSubjobsToGraphNode
()¶ Initiate each subclass and add the initiated subclass (subjob) to the node.
-
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
-