Skip to content

Contexts

ContextValidator

Base class for validating simulation contexts.

extra_anions(value, context) staticmethod

Validate extra_anions

extra_cations(value, context) staticmethod

Validate extra_cations

validate(context_manager) classmethod

Validate contexts for simulations.

PARAMETER DESCRIPTION
context_manager

A simulation context manager to validate.

TYPE: SimulationContextManager

RETURNS DESCRIPTION
bool

If the context is valid.

write(value, context) staticmethod

Validate write

SimulationContextManager(yaml_path=None, **kwargs)

Contexts for setting up molecular simulations.

PARAMETER DESCRIPTION
yaml_path

Path to YAML file to load into the context.

TYPE: str | None DEFAULT: None

anion_identity: str = 'Cl-' instance-attribute

Identity of the anion in the system.

cation_identity: str = 'Na+' instance-attribute

Identity of the cation in the system.

compute_platform: str = 'mpi' instance-attribute

Desired platform to run simulations on.

Options:

  • mpi: Message passing interface for central processing units (CPUs).
  • cuda: Compute Unified Device Architecture (CUDA) for graphics processing units (GPUs).

coord_path: str | None = None instance-attribute

Path to coordinate file for current stage.

cpu_cores: int | None = None instance-attribute

Number of CPU cores to use if requested

extra_anions: int = 0 instance-attribute

Number of extra anions to add to the system.

extra_cations: int = 0 instance-attribute

Number of extra cations to add to the system.

ff_dna: str | None = None instance-attribute

Molecular mechanics force fields for DNA.

ff_glycam: str | None = None instance-attribute

Molecular mechanics force fields for sugars

ff_ions: str | None = None instance-attribute

Molecular mechanics force fields for ions.

ff_lipid: str | None = None instance-attribute

Molecular mechanics force fields for lipids.

ff_protein: str | None = None instance-attribute

Molecular mechanics force field used to describe polypeptides.

ff_rna: str | None = None instance-attribute

Molecular mechanics force fields for RNA.

ff_small_molecule: str | None = None instance-attribute

Molecular mechanics force fields for small molecules.

ff_water: str | None = None instance-attribute

Molecular mechanics force fields for water.

input_dir: str | None = None instance-attribute

Path to input directory for current stage.

input_kwargs: dict[str, Any] | None = None instance-attribute

Simulation keyword arguments for input files.

input_path: str | None = None instance-attribute

Path to input file for current stage.

neutralize_charge: bool = True instance-attribute

Flag to determine if system charge should be neutralized by placing additional ions.

output_dir: str | None = None instance-attribute

Path to output directory for current stage.

output_path: str | None = None instance-attribute

Path to output file for current stage.

prev_coordinate_path: str | None = None instance-attribute

Path to coordinate file of previous stage

prev_restart_path: str | None = None instance-attribute

Path to restart file from previous stage or initial coordinates.

ref_coord_path: str | None = None instance-attribute

Path to reference coordinate file. This is often used for enforcing restraints.

restart_path: str | None = None instance-attribute

Path to restart file for this stage.

run_path: str | None = None instance-attribute

Path to run file.

sbatch_options: dict[str, Any] | None = None instance-attribute

sbatch options for a slurm submission script. Some common options are: job-name, nodes, ntasks-per-node, cpus-per-task, gpus, gres, cpus-per-gpu, chdir, output, error, time, clusters, partition, account.

These options are written in the format of #SBATCH --{key}={value}.

scratch_dir: str | None = None instance-attribute

Specify path for scratch directory if desired. If None, we do not use scratch.

slurm_lines: list[str] | None = None instance-attribute

Lines for a slurm submission script.

slurm_path: str | None = None instance-attribute

Path to slurm submission file.

solvent_ionic_strength: float = 0.15 instance-attribute

Ionic strength of the solvent in mole/L.

solvent_padding: float = 10.0 instance-attribute

Padding between solute and box edge to fill with solvent in Angstroms.

splits: int = 1 instance-attribute

Split simulation stage into several chunks.

stage_name: str | None = None instance-attribute

Name or label for simulation stage.

stages: Collection[dict[str, Any]] | None = None instance-attribute

Contexts for successive stages. Stage \(i > 0\) is assumed to be restarted from stage \(i - 1\).

submit: bool = False instance-attribute

Submit the job.

system_charge: int = 0 instance-attribute

Net charge of the molecular system.

topo_path: str | None = None instance-attribute

Path to topology file.

verbosity: int | str | None = None instance-attribute

Verbosity level for logging.

work_dir: str | None = None instance-attribute

Working directory for preparing calculations.

write: bool = False instance-attribute

Write files.

write_dir: str | None = None instance-attribute

Write directory.

yaml_path = yaml_path instance-attribute

Path of YAML file that was loaded. Defaults to None.

__enter__()

Enter the context and return the current context as a dictionary.

__exit__(exc_type, exc_value, exc_tb)

Exit the context.

PARAMETER DESCRIPTION
exc_type

Type of the exception.

exc_value

Value of the exception.

exc_tb

Traceback information.

from_yaml(yaml_path)

Load context information from a YAML file. This will only update data contained in the YAML file.

PARAMETER DESCRIPTION
yaml_path

Path to YAML file to load.

TYPE: str | None

get()

Retrieve the context.

RETURNS DESCRIPTION
dict[str, Any]

A dictionary representing the current context.

update(attr_dict)

Update attributes with values from the provided dictionary.

PARAMETER DESCRIPTION
attr_dict

Dictionary containing attribute names and their

TYPE: dict[str, Any]

cli_validate_yaml_context()

Command-line interface for validating YAML context files.

run_context_yaml_validator(yaml_path, validator_obj_string)

Validate YAML context.

PARAMETER DESCRIPTION
yaml_path

Path to YAML file.

TYPE: str

validator_obj_string

String to validator object.

TYPE: str

RETURNS DESCRIPTION
bool

If the YAML context is valid.