schrodinger.application.desmond.launch_utils module

Functions to help with launching and restarting an FEP+ simulation.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.desmond.launch_utils.prepare_command_for_launch(host: str, subhost: str, jobname: str, msj: Optional[str], maxjob: int, input_fname: Optional[str] = None, program: str = 'multisim', lics: Optional[List[str]] = None) → List[str]
Parameters:
  • host – Hostname for the job.
  • subhost – Subhost for the job.
  • jobname – Jobname for the job.
  • msj – The msj filename to pass to multisim.
  • maxjob – The maximum number of concurrent jobs.
  • input_fname – If set, the structure or fmp input filename. If an fmp file, the pv_file will be written to the same directory and used as the structure input.
  • program – The name of the program that will be used by fep_plus to run the workflow. Default: “multisim”
  • lics – Additional licenses to request for the master job. In the form of ‘LICENSE:NTOKENS’.
Returns:

Multisim command to launch the job.

schrodinger.application.desmond.launch_utils.prepare_command_for_restart(engine: schrodinger.application.desmond.cmj.Engine, stage_data_fnames: List[str], host: str, subhost: str, cpt_fname: str, maxjob: Optional[int] = None, jobname: Optional[str] = None, msj: Optional[str] = None, rst_stage_idx: Optional[int] = None, rst_whole: bool = False, input_fname: Optional[str] = None) → List[str]
Parameters:
  • engine – Represents the current job state.
  • stage_data_fnames – List of filenames to be used for restarting the job.
  • host – Hostname for the job.
  • subhost – Subhost for the job.
  • cpt_fname – Checkpoint filename.
  • jobname – Jobname if set, otherwise get it from the engine.
  • msj – If set, the msj filename to pass to multisim.
  • rst_stage_idx – If set, the restart stage number.
  • rst_whole – Set to True to restart the job from scratch or False to continue a partially complete job.
  • input_fname – If set, the structure input filename. Only needed for a full restart at stage 2.
Returns:

Multisim command to restart the job.

Raises:

SystemExit – If file from stage_data_fnames could not be found.

schrodinger.application.desmond.launch_utils.additional_command_arguments(stage_data_fnames: List[str], retries: str, wait: bool, local: bool, debug: bool, tmpdir: Optional[str], forcefield: Optional[str], opls_dir: Optional[str], nice: bool, save: bool) → List[str]
Parameters:
  • stage_data_fnames – List of filenames to be used for restarting the job.
  • retries – Set to control the number of retries for a failed job.
  • wait – Set to True to wait until the job has completed before returning.
  • local – Set to True to run the job in the current directory.
  • debug – Set to True to enable debugging.
  • tmpdir – Set to override the temporary directory location.
  • forcefield – Set to the name for the forcefield.
  • opls_dir – If present, the path to the opls directory.
  • nice – Set to True to run the job at reduced priority.
  • save – Set to True to return a zip archive of the job directory on completion.
Returns:

Additional arguments for the multisim command to launch the job.

schrodinger.application.desmond.launch_utils.find_checkpoint_file() → str

Find and return a multisim checkpoint file (whose name should end with the “-multisim_checkpoint” substring) in the current working directory. If multiple multisim checkpoint files exist in the directory, return the latest one.

Raises:SystemExit – If no checkpoint files was found.
schrodinger.application.desmond.launch_utils.read_checkpoint_file(cpt_fname: str) → schrodinger.application.desmond.cmj.Engine

Read a checkpoint file and return the initialized Engine object.

Parameters:cpt_fname – The checkpoint filename.
Raises:SystemExit – If checkpoint could not be read.
schrodinger.application.desmond.launch_utils.get_checkpoint_file_and_restart_number(checkpoint: Optional[str] = None) -> (<class 'str'>, typing.Union[int, NoneType])

Return the checkpoint filename and the restart stage number if specified.

Parameters:checkpoint – If specified, the checkpoint string, in the format “checkpoint_filename:restart_stage_number” or “checkpoint_filename”. Otherwise, find the checkpoint file in the current working directory.
Raises:SystemExit – If checkpoint is not valid or could not be found.
schrodinger.application.desmond.launch_utils.get_restart_stage_from_engine(engine: schrodinger.application.desmond.cmj.Engine) → Optional[int]
Parameters:engine – Represents the current job state.
Returns:The restart stage number from the job engine if found. Otherwise, None.
schrodinger.application.desmond.launch_utils.get_multisim_stage_numbers(engine: schrodinger.application.desmond.cmj.Engine) → List[int]
Parameters:engine – Represents the current job state.
Returns:List of multisim stage numbers.
schrodinger.application.desmond.launch_utils.validate_restart_stage(engine: schrodinger.application.desmond.cmj.Engine, rst_stage_idx: Optional[int] = None) → None

Validate the rst_stage_idx for the given job engine.

Parameters:
  • engine – Represents the current job state.
  • rst_stage_idx – The restart stage index.
Raises:

SystemExit – If the restart stage is not valid.

schrodinger.application.desmond.launch_utils.prepare_multisim_files_for_restart(engine: schrodinger.application.desmond.cmj.Engine, multisim_stage_numbers: List[int], cpt_fname: str, rst_stage_idx: int, rst_whole: bool, skip_traj: bool = False) → List[str]

Prepare the files needed to restart a multisim job and return list of those files.

Parameters:
  • engine – Represents the current job state.
  • multisim_stage_numbers – List of multisim stage numbers.
  • cpt_fname – Checkpoint filename.
  • rst_stage_idx – The restart stage index.
  • rst_whole – Set to True to restart the job from scratch or False to continue a partially complete job.
  • skip_traj – Set to True to not compress the trajectory information in the tar.
Returns:

List of filenames to be used for restarting the job.

Raises:

SystemExit – If files could not be prepared.

schrodinger.application.desmond.launch_utils.find_stage(stages: List[schrodinger.application.desmond.cmj.StageBase], stage_name: str) → schrodinger.application.desmond.cmj.StageBase

Given the raw stages, find the first stage that matches one of the given stage names.

Parameters:
  • stages – List of schrodinger.application.desmond.stage objects.
  • stage_name – Stage name to look for.
schrodinger.application.desmond.launch_utils.find_stage_number(stages: List[schrodinger.application.desmond.cmj.StageBase], stage_name: str, picker: Optional[int] = None) → int

Given the raw stages, find the index of the first matching stage (1-based index).

Parameters:
  • stages – List of schrodinger.application.desmond.stage objects
  • stage_name – Stage name to look for.
  • picker – Set to return the `picker`+1 th matching stage. Default of None means to return the first found stage.