autojob.coordinator package

Coordinate the creation of study groups.

This subpackage provides utilities for the creation of study groups. The autojob.coordinator module is especially useful for parametrizing calculations en masse. The Coordinator GUI can be launched programmatically with the gui.run() function

from autojob.coordinator.gui import gui

gui.run()

or from the command line with the autojob coordinator CLI command

autojob coordinator

Subpackages

Submodules

autojob.coordinator.classification module

DEPRECATED: metaclasses are not needed, CalculatorType and StudyType.

are in calculation and study, respectively. CalculationTypes should be implemented as class-level constants in calculation (or separate modules) as subclasses of Calculation.

class autojob.coordinator.classification.ABCEnumMeta(*args, **kw)[source]

Bases: ABCMeta, EnumType

A metaclass for abstract base classes for enums.

Create enum with abstract methods.

Raises:

TypeError – Missing abstract methods.

Returns:

The created class instance.

class autojob.coordinator.classification.CalculationType(value)[source]

Bases: ImplementableEnum

A type of calculation.

DOS = 'density of states'
EOS = 'equation of state'
MD = 'molecular dynamics'
RELAXATION = 'relaxation'
VIB = 'vibrational analysis'
is_default() bool[source]

Returns the default CalculationType.

is_implemented() bool[source]

Returns if the CalculationType is implemented or not.

class autojob.coordinator.classification.CalculatorType(value)[source]

Bases: ImplementableEnum

Types of calculators.

ABINIT = 'abinit'
AIMS = 'aims'
AMBER = 'amber'
ASAP = 'asap'
CASTEP = 'castep'
CP2K = 'cp2k'
CRYSTAL = 'crystal'
DEMON = 'demon'
DEMON_NANO = 'demonnano'
DFTB = 'dftb'
DFTD3 = 'dftd3'
DMOL3 = 'dmol'
EAM = 'eam'
ELK = 'elk'
EMT = 'emt'
ESPRESSO = 'espresso'
EXCITING = 'exciting'
FLEUR = 'fleur'
FORCE_FIELD = 'ff'
GAMESS_US = 'gamess_us'
GAUSSIAN = 'gaussian'
GPAW = 'gpaw'
GROMACS = 'gromacs'
GULP = 'gulp'
HOTBIT = 'hotbit'
KIM = 'kim'
LAMMPS = 'lammpsrun'
LAMMPS_LIB = 'lammpslib'
LENNARD_JONES = 'lj'
MOPAC = 'mopac'
MORSE_POTENTIAL = 'morse'
NWCHEM = 'nwchem'
OCTOPUS = 'octopus'
ONETEP = 'onetep'
OPENMX = 'openmx'
ORCA = 'orca'
PSI4 = 'psi4'
QCHEM = 'qchem'
SIESTA = 'siesta'
TIP3P = 'tip3p'
TIP4P = 'tip4p'
TURBOMOLE = 'turbomole'
VASP = 'vasp'
is_default() bool[source]

Returns the default CalculatorType.

is_implemented() bool[source]

Returns if the CalculatorType is implemented or not.

class autojob.coordinator.classification.ImplementableEnum(value)[source]

Bases: Enum

An Enum that can be implemented.

abstractmethod is_default() bool[source]

Determine if ImplementableEnum is default value.

Returns:

ImplementableEnum – True if the ImplementableEnum is the default value.

abstractmethod is_implemented() bool[source]

Indicates if particular feature is implemented or not.

Returns:

bool – True if feature is implemented. False otherwise.

class autojob.coordinator.classification.StudyType(value)[source]

Bases: ImplementableEnum

A type of study.

ADSORPTION = 'adsorption'
MECHANISM = 'mechanism'
SENSITIVITY = 'sensitivity'
is_default() bool[source]

Returns the default StudyType.

is_implemented() bool[source]

Returns if the StudyType is implemented or not.

autojob.coordinator.cli module

Define the CLI function for the Coordinator GUI.

autojob.coordinator.coordinator module

Coordinate the creation and submission of jobs.

The Coordinator class stores references to the calculator and submission parameter groups used and can generate and submit jobs created from these parameter groups.

class autojob.coordinator.coordinator.Coordinator(app: GUI, dest: Path | None = None)[source]

Bases: object

Create and submit jobs from parameter groups.

Variables:
  • app – The running gui.GUI instance.

  • submit_dir – The directory in which new study groups will be created.

  • slurm_scripts – A list of paths to slurm scripts.

  • study_uuids – A list of UUIDs of the studies in the study groups.

  • compute_canada_format – Whether or not the slurm scripts are to be created in ComputeCanada format.

Initialize a Coordinator.

Parameters:
  • app – The running gui.GUI instance.

  • dest – The directory in which new study groups will be created. Defaults to the current working directory.

property adsorbates: dict[str, list[str]]

A dictionary mapping structure group names to adsorbate lists.

property adsorption_groups: dict[str, list[dict[str, list]]]

A dictionary mapping structure group names to adsorption groups.

property adsorption_jobs: list[dict]

A list of adsorption jobs.

property ase_calculator: Calculator

The ASE calculator corresponding to the calculator type.

calc_param_from(param_name: str, cp_groups: list[str] | None = None) job.CalculationParameter[source]

Returns the parameter associated with the name and structure group.

Parameters:
  • param_name – Name of the jobCalculationParameter to be found.

  • cp_groups – A list of names of structure groups to search. Defaults to a list of all structure groups.

Returns:

The job.CalculationParameter matching param_name. If cp_groups is given, this method finds the first job.CalculationParameter defined in a structure group named cp_groups with the name attribute matching param_name. Otherwise, this method finds the first job.CalculationParameter with name attribute matching param_name.

Raises:

ValueError – No job.CalculationParameter found matching param_name.

calc_param_values_for(structures: list[Path], params: list[job.CalculationParameter]) dict[str, list[float | int | str]][source]

Finds values corresponding to provided structures and parameters.

Parameters:
  • structures – Structure for which the calculation parameters are to obtained.

  • params – Parameter whose values are to be obtained.

Returns:

A dictionary mapping calculator parameter names to a list of its values for provided structures. Each value in each list of values corresponds to at least one structure in structures.

Note

Not all values will be applicable for all selected structures as the function aggregates all potential values for all selected structures.

property calc_params: dict[str, CalculationParameterGroup]

A mapping from names to calculator parameter groups.

calc_params_for(structures: list[Path]) list[str][source]

Finds calculation parameters corresponding to provided structures.

Parameters:

structures – A list of structures whose parameters are to be found.

Returns:

The names of all CalculationParameters applicable to at least one structure in structures.

property calculation_type: str

The calculation type.

property calculator_type: str

The calculator type.

property complexes: dict[str, dict[str, dict[str, str]]]

A dictionary mapping structure group names to nested dictionaries.

Each nested dictionary maps structure names to a maps between adsorbate names and adsorbate-complex structure files.

Example

group_name = “group 1” structure = “structure 1” adsorbate = “adsorbate 1” complexes = coordinator.complexes group = complexes[group_name]

# A map from adsorbate names to adsorbate complex filenames adsorbate_to_structure_complex = group[structure]

# The filename for an adsorbate complex complex_structure = adsorbate_to_structure_complex[adsorbate]

create_structure_tasks(atoms: Atoms, calculation_parameter_sets: list[dict[str, Any]], metadata: dict[str, Any], legacy_mode: bool = True) list[TaskBase][source]

Create all tasks corresponding to a given structure.

Parameters:
  • atoms – The Atoms object

  • calculation_parameter_sets – A list of dictionaries where each dictionary maps parameter names to their value.

  • metadata – Study metadata to be shared with each created TaskBase.

  • legacy_mode – Whether or not to create legacy mode-compatible TaskBases.

Returns:

A list of TaskBase objects.

create_study_group(*, legacy_mode: bool = True) StudyGroup[source]

Create a study group from the Coordinator GUI.

Parameters:

legacy_mode – Whether or not to use the legacy directory structure when creating task directories. Defaults to True.

Returns:

The created StudyGroup.

create_tasks(*, legacy_mode: bool = True) Path[source]

Create the task directories of a study group.

Parameters:

legacy_mode – Whether or not to use legacy mode. Defaults to True.

property jobs: list[dict[str, str | CalculatorType | dict[str, dict[str, Any]]]]

A list of jobs.

Each job is represented as a mapping from parameters to their values.

run_jobs() None[source]

Create and submit jobs of a new study group.

property sensitivity_jobs: list[dict[str, str | CalculatorType | dict[str, dict[str, Any]]]]

A list of sensitivity jobs.

property structure_groups: dict[str, StructureGroup]

A dictionary mapping structure group names to structure groups.

structure_groups_with(structures: Iterable[Path]) list[str][source]

Retrieve all structure groups containing structures.

Parameters:

structures – A list of structures to be found in Coordinator.structure_groups.

Returns:

The list of structure groups containing at least one of the selected structures.

property structures: list[str]

A list of structure filenames.

property structures_without_calc_params: list[str]

A list of structure filenames without calculation parameters.

property structures_without_subm_params: list[dict]

A list of structure filenames without submission parameters.

property studies: dict[str, list[dict[str, str | CalculatorType | dict[str, dict[str, Any]]]]]

A dictionary mapping study names to all jobs within that study.

property study_type: str

The study type.

property subm_params: dict[str, dict[str, dict | float | int | tuple | str]]

A mapping from names to submission parameters.

subm_params_for(structure: Path, calc_params: dict[job.CalculationParameter, str]) dict[str, dict | int | list | None][source]

Finds submission parameters for a given structure and parameters.

Parameters:
  • structure – The structure for the calculation.

  • calc_params – The structure-specific parameters for the calculation.

Returns:

The submission parameters for the calculation.

Note

If the calculation satisfies the conditions set forth by multiple parameter groups, the function returns the submission parameters corresponding to the alphanumeric first.

property submission_parameter_groups: dict[str, SubmissionParameterGroup]

A mapping from names to submission parameter groups.

autojob.coordinator.coordinator.submission_parameters_to_scheduler_inputs(parameters: JobSubmissionParameters) SchedulerInputs[source]

Convert submission parameters to SchedulerInputs.

Parameters:

parameters – A submission parameter dictionary.

Returns:

A SchedulerInputs instance.

autojob.coordinator.espresso module

Define Gaussian calculation parameters.

class autojob.coordinator.espresso.EspressoJob(job_id: str, calculation_id: str, study_id: str, study_group_id: str, input_parameters: dict, results: dict, job_stats: dict[str, str | int] | None, calculator_type: CalculatorType | None = None, calculation_type: CalculationType | None = None, study_type: StudyType | None = None, error: JobError | None = None, name: str = '', notes: str = '')[source]

Bases: Job

A class to represent a Espresso job.

Initialize a Job.

Parameters:
  • job_id – The job ID.

  • calculation_id – The calculation ID.

  • study_id – The study ID.

  • study_group_id – The study group ID.

  • input_parameters – The input parameters for the job.

  • results – The job results.

  • job_stats – The job statistics.

  • calculator_type – The calculator type. Defaults to None.

  • calculation_type – The calculation type. Defaults to None.

  • study_type – The study type. Defaults to None.

  • error – The job error. Defaults to None.

  • name – The job name. Defaults to “”.

  • notes – Notes on the job. Defaults to “”.

FILES: ClassVar[list[tuple[str, bool]]] = [('pwscf.save', False)]
static input_parameters() list[CalculationParameter][source]

Generate Gaussian job input parameters.

autojob.coordinator.filters module

Utilities for filtering parameter dictionaries by their values.

Example

>>> from autojob.coordinator.filters import Filter
>>> from autojob.parametrizations import VariableReference
>>> flt = Filter(
...     source=VariableReference(set_path=[], get_path=("inputs", "filename")),
...     values=("a", "b"),
... )
>>> value1 = {"inputs": {"filename": "A"}}
>>> value2 = {"inputs": {"filename": "b"}}
>>> flt.apply(value1)
False
>>> flt.apply(value2)
True
class autojob.coordinator.filters.Filter(source: VariableReference, values: tuple[Any])[source]

Bases: NamedTuple

A condition that must be satisfied.

Variables:

Create new instance of Filter(source, values)

apply(value: dict[str, Any] | object) bool[source]

Determine if the value passes the filter.

Parameters:

value – The value to which the filter will be applied.

Returns:

True if the value passes the filter. False otherwise.

source: VariableReference

Alias for field number 0

values: tuple[Any]

Alias for field number 1

autojob.coordinator.filters.submission_group_to_filters(group: SubmissionParameterGroup) list[Filter][source]

Convert a SubmissionParameterGroup to Filter instances.

Parameters:

group – The group to convert.

Returns:

The autojob.parametrizations.VariableReference.

autojob.coordinator.gaussian module

Define Gaussian calculation parameters.

class autojob.coordinator.gaussian.GaussianJob(job_id: str, calculation_id: str, study_id: str, study_group_id: str, input_parameters: dict, results: dict, job_stats: dict[str, str | int] | None, calculator_type: CalculatorType | None = None, calculation_type: CalculationType | None = None, study_type: StudyType | None = None, error: JobError | None = None, name: str = '', notes: str = '')[source]

Bases: Job

A class to represent a Gaussian job.

Initialize a Job.

Parameters:
  • job_id – The job ID.

  • calculation_id – The calculation ID.

  • study_id – The study ID.

  • study_group_id – The study group ID.

  • input_parameters – The input parameters for the job.

  • results – The job results.

  • job_stats – The job statistics.

  • calculator_type – The calculator type. Defaults to None.

  • calculation_type – The calculation type. Defaults to None.

  • study_type – The study type. Defaults to None.

  • error – The job error. Defaults to None.

  • name – The job name. Defaults to “”.

  • notes – Notes on the job. Defaults to “”.

FILES: ClassVar[list[tuple[str, bool]]] = [('Gaussian.log', False), ('Gaussian.chk', False)]
static input_parameters() list[CalculationParameter][source]

Generate Gaussian job input parameters.

autojob.coordinator.job module

This module defines the Job class and the JobError enum.

Deprecated since version Use: autojob.task, autojob.calculation, autojob.hpc instead.

class autojob.coordinator.job.CalculationParameter(name: str, explicit: bool, allowed_types: list[type], values: tuple, default: float | int | str | None = None, description: str | None = None, specials: list | None = None)[source]

Bases: object

Abstraction of an input parameter for a supported ASE calculator.

Variables:
  • _name – The name of the InputParameter.

  • _explicit – Whether the set of allowed values for the InputParameter is explicitly specified. True if the set of allowed values for the input parameter is explicitly specified; False otherwise.

  • _allowed_types – The allowed types for the InputParameter. For

  • displaying (validation and)

  • string (there exists special values for the InputParameter (e.g.,)

  • types (values that correspond to particular values), the allowed)

  • values. (should not be designated so as to include these special)

  • integer (For example, say that a particular InputParameter accepts)

  • particular (values, but that the string 'normal' corresponds to a)

  • specified (value. The allowed types for the InputParameter should be)

  • str]. (as [int] and not [int,)

  • '_allowed_types'. (Only primitive types are allowed as entries in)

  • float (That is, the entries must be one of str, int, bool, or) – _allowed_types = [int] <— allowed _allowed_types = [int, str] <— allowed _allowed_types = [Union[int, str]] <— not allowed _allowed_types = [list, str] <— not allowed _allowed_types = [List, str] <— not allowed _allowed_types = [List[int], str] <— not allowed _allowed_types = [Tuple[int, int, int]] <— not allowed _allowed_types = [List[List[int]]] <— not allowed

  • _values

    Indicates the allowed values of an InputParameter.

    If the allowed values are explicitly specified, then the tuple contains the only allowed values.

    If the allowed values are specified as a range, then the tuple should contain three entries.

    The first and second items in the tuple indicate the lower and upper bounds of the range, respectively, which should be set to -math.inf and math.inf to specify that the range is unbounded with respect to the bound.

    The third item should be a string, indicating how to treat the endpoints of the range in the same style as traditional mathematical notation:

    ”[]” = both bounds included “[)” = lower bound included, upper bound excluded “(]” = lower bound excluded, upper bound included “()” = both bounds excluded

  • _specials – Indicates any special, allowed parameter values that

  • tuple. (may not satisfy the conditions specified in the '_values')

  • list. (Defaults to an empty)

  • _default – A default value for the InputParameter.

  • _description – Returns a description of the InputParameter to be

  • tooltips. (used for displaying)

Initialize a CalculationParameter.

Parameters:
  • name – The name of the CalculationParameter.

  • explicit – Whether the set of allowed values for the InputParameter is explicitly specified. True if the set of allowed values for the input parameter is explicitly specified; False otherwise.

  • allowed_types – An iterable containing the allowed parameter types.

  • values – A tuple either containing the explicit values or a 3-tuple indicating the bounds of the parameter.

  • default – The default value of the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to None.

  • specials – Special values of the parameter that are not subject to validation. Defaults to None.

property allowed_types: list[type]

The allowed types of the parameter.

property default: Any

The default value of the parameter.

property description: str

A description of the parameter.

property explicit_values: bool

Whether or not the parameter value is to be chosen from a list.

is_finite_int_range() bool[source]

Whether the parameter is restricted to a finite range of ints.

property name

The name of the CalculationParameter.

property specials: list

Special values of the parameter.

validate(val: Any) bool[source]

Validates a value.

Parameters:

val (Any) – The value to be validated

Returns:

bool – True if ‘val’ is valid. False otherwise.

property values: tuple

A tuple indicating the values of the parameter or its bounds.

class autojob.coordinator.job.Job(job_id: str, calculation_id: str, study_id: str, study_group_id: str, input_parameters: dict, results: dict, job_stats: dict[str, str | int] | None, calculator_type: CalculatorType | None = None, calculation_type: CalculationType | None = None, study_type: StudyType | None = None, error: JobError | None = None, name: str = '', notes: str = '')[source]

Bases: ABC, MSONable

A SLURM job.

Subclasses must implement the abstract method input_parameters()

Variables:
  • _id – Job ID

  • _input_structure – Input structure for job run.

  • _output_structure – Output structure from job run.

  • _submission_params – Parameters for the submission of the job to the

  • scheduler. (job)

  • _stats – Statistics from the job run.

  • _error – Error incurred during job run.

  • _note – Additional note for job.

Initialize a Job.

Parameters:
  • job_id – The job ID.

  • calculation_id – The calculation ID.

  • study_id – The study ID.

  • study_group_id – The study group ID.

  • input_parameters – The input parameters for the job.

  • results – The job results.

  • job_stats – The job statistics.

  • calculator_type – The calculator type. Defaults to None.

  • calculation_type – The calculation type. Defaults to None.

  • study_type – The study type. Defaults to None.

  • error – The job error. Defaults to None.

  • name – The job name. Defaults to “”.

  • notes – Notes on the job. Defaults to “”.

abstractmethod as_dict() dict[source]

Convert the Job to a JSON-able dictionary.

abstractmethod as_flat_dict() dict[source]

Convert the Job to a flattened dictionary.

abstractmethod classmethod from_dict(d: dict) Job[source]

Create a Job instance from a dictionary.

Job.as_dict() and Job.from_dict() should be designed such that “round-trips” as supported. That is, given an instance of Job, job, the following is True:

job == Job.from_dict(job.as_dict())
abstractmethod static input_parameters() list[CalculationParameter][source]

Returns the input parameters for the type of job.

Subclasses should implement this method.

class autojob.coordinator.job.JobError(value)[source]

Bases: Enum

A job error.

MEMORY_LIMIT = 'memory limit'
TIME_LIMIT = 'time limit'
class autojob.coordinator.job.JobStats(src_dict: dict[str, str])[source]

Bases: MSONable

Job statistics.

Variables:
  • memory – The memory used for the job in kilobytes.

  • start_time – The datetime instance representing the time that the job started.

  • end_time – The datetime instance representing the time that the job ended.

  • submit_time – The datetime instance representing the time that the job was submitted.

  • cores – The number of cores that the job ran on.

  • nodes – The number of nodes that the job ran on.

  • partition – A Partition instance representing the cluster partition that the job ran on.

Initialize a JobStats instance.

Parameters:

src_dict – A dictionary mapping sacct headers to their values for a SLURM job. The dictionary should have the keys listed in job.JOB_STATS_FIELDS.

as_dict() dict[source]

Return the JobStats instance as a JSON-able dictionary.

classmethod from_dict(d: dict) JobStats[source]

Create a JobStats instance from a dictionary.

JobStats.as_dict() and JobStats.from_dict() are designed such that “round-trips” as supported. That is, given an instance of JobStats, job_stats, the following is True:

job_stats == JobStats.from_dict(job_stats.as_dict())
static parse_max_rss(max_rss: str) float[source]

Convert a memory string to memory in kilobytes.

property queued_time: timedelta

The time for which the job was queued.

property run_time: timedelta

The run time for the job.

property wall_time: timedelta

The time between job submission and completion.

autojob.coordinator.parameters module

Define calculator parameters.

class autojob.coordinator.parameters.CalculatorParameter(name: str = '', allowed_types: tuple[type] = (typing.Any,), special_values: Iterable | None = None, default: Any = None, description: str = '')[source]

Bases: MSONable

Abstraction of an calculator parameter for a supported ASE calculator.

Variables:
  • name (str; defaults to '') – The name of the CalculatorParameter.

  • allowed_types (Iterable[Type]; defaults to (Any,)) – The allowed types for the CalculatorParameter. For validation and displaying (in the GUI application) purposes, if there exists special values for the CalculatorParameter (e.g., string values that correspond to particular values), the allowed types should not be designated so as to include these special values.

  • integer (For example, say that a particular CalculatorParameter accepts)

  • particular (values, but that the string 'normal' corresponds to a)

  • be (value. The allowed types for the CalculatorParameter should)

  • as (specified)

  • special_values (Iterable; defaults to tuple()) – A tuple indicating the

  • whose (special values of a CalculatorParameter. These may be values)

  • attribute (types do not conform to the types specified in the)

  • 'allowed_types'.

  • _default (Any; defaults to None) – A default value for the

  • CalculatorParameter.

  • description (str; defaults to '') – Returns a description of the

  • tooltips. (CalculatorParameter to be used for displaying)

Initialize a CalculatorParameter.

Parameters:
  • name – The name of the CalculatorParameter. Defaults to “”.

  • allowed_types – An iterable of the allowed types for the parameter. Defaults to (Any,).

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

property allowed_types: tuple

The allowed types for the parameter.

property default: Any

The default value of the parameter.

property special_values: tuple

The special values of the parameter.

validate(val: Any) bool[source]

Validate a parameter value.

class autojob.coordinator.parameters.CalculatorType(value)[source]

Bases: Enum

A type of ASE calculator.

ABINIT = 'abinit'
ACE = 'ace'
AIMS = 'aims'
AMBER = 'amber'
ASAP = 'asap'
CASTEP = 'castep'
CP2K = 'cp2k'
CRYSTAL = 'crystal'
DEFAULT = 'vasp'
DEMON = 'demon'
DEMON_NANO = 'demonnano'
DFTB = 'dftb'
DFTD3 = 'dftd3'
DMOL3 = 'dmol'
EAM = 'eam'
ELK = 'elk'
EMT = 'emt'
ESPRESSO = 'espresso'
EXCITING = 'exciting'
FLEUR = 'fleur'
FORCE_FIELD = 'ff'
GAMESS_US = 'gamess_us'
GAUSSIAN = 'gaussian'
GPAW = 'gpaw'
GROMACS = 'gromacs'
GULP = 'gulp'
HOTBIT = 'hotbit'
KIM = 'kim'
LAMMPS = 'lammpsrun'
LAMMPS_LIB = 'lammpslib'
LENNARD_JONES = 'lj'
MOPAC = 'mopac'
MORSE_POTENTIAL = 'morse'
NWCHEM = 'nwchem'
OCTOPUS = 'octopus'
ONETEP = 'onetep'
OPENMX = 'openmx'
ORCA = 'orca'
PSI4 = 'psi4'
QCHEM = 'qchem'
SIESTA = 'siesta'
TIP3P = 'tip3p'
TIP4P = 'tip4p'
TURBOMOLE = 'turbomole'
VASP = 'vasp'
is_implemented() bool[source]

Return whether the CalculatorType is implemented or not.

class autojob.coordinator.parameters.MappingParameter(*, member_types: Iterable[type], name: str = '', special_values: Iterable | None = None, default: Any = None, description: str = '')[source]

Bases: CalculatorParameter

A parameter that can be a mapping.

Initialize a MappingParameter.

Parameters:
  • name – The name of the MappingParameter. Defaults to “”.

  • member_types – The allowed types of the items in the sequence.

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

as_dict() dict[source]

Return the MappingParameter as a dictionary.

classmethod from_dict(d) MappingParameter[source]

Initiate a MappingParameter from a dictionary.

property member_types: Iterable

The allowed member types of the parameter.

validate(val: Any) bool[source]

Validate a value.

class autojob.coordinator.parameters.NumberMappingParameter(*, name: str = '', allow_floats: bool = False, special_values: Iterable | None = None, default: Any = None, description: str = '', number_range: NumberRange = None)[source]

Bases: MappingParameter

A parameter that can be a mapping to numbers.

Initialize a NumberMappingParameter.

Parameters:
  • name – The name of the NumberMappingParameter. Defaults to “”.

  • allow_floats – Whether to allow floats. Defaults to False.

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

  • number_range – A NumberRange to use to limit the parameter. Defaults to None.

as_dict() dict[source]

Return the NumberMappingParameter as a dictionary.

classmethod from_dict(d) NumberMappingParameter[source]

Initiate a NumberMappingParameter from a dictionary.

validate(val: Any) bool[source]

Validate a value.

class autojob.coordinator.parameters.NumberParameter(*, name: str = '', allow_floats: bool = False, special_values: Iterable[type] | None = None, default: Any = None, description: str = '', number_range: NumberRange = None)[source]

Bases: CalculatorParameter

A parameter that can be a number.

Initialize a NumberParameter.

Parameters:
  • name – The name of the NumberParameter. Defaults to “”.

  • allow_floats – Whether to allow floats. Defaults to False.

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

  • number_range – A NumberRange to use to limit the parameter. Defaults to None.

as_dict() dict[source]

Return the NumberParameter as a dictionary.

classmethod from_dict(d) NumberParameter[source]

Initiate a NumberParameter from a dictionary.

property number_range: NumberRange

The number range of the parameter.

validate(val: Any) bool[source]

Validate a value.

class autojob.coordinator.parameters.NumberRange(*, lower_bound: int | float = -inf, lower_bound_exclusive: bool = True, upper_bound: int | float = inf, upper_bound_exclusive: bool = True)[source]

Bases: MSONable

A range of numbers.

Initialize a NumberRange.

Parameters:
  • lower_bound – The lower bound for the range.

  • lower_bound_exclusive – Whether the lower bound is excluded from the range.

  • upper_bound – The upper bound for the range.

  • upper_bound_exclusive – Whether the upper bound is excluded from the range.

validate_number(number: int | float) bool[source]

Returns True if a number is within the range. False, otherwise.

Parameters:

number – A number to check.

class autojob.coordinator.parameters.NumberSequenceParameter(*, name: str = '', allow_floats: bool = False, special_values: Iterable | None = None, default: Any = None, description: str = '', number_range: NumberRange = None)[source]

Bases: SequenceParameter

A parameter that can be a sequence of numbers.

Initialize a NumberSequenceParameter.

Parameters:
  • name – The name of the NumberSequenceParameter. Defaults to “”.

  • allow_floats – Whether to allow floats. Defaults to False.

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

  • number_range – A NumberRange to use to limit the parameter. Defaults to None.

as_dict() dict[source]

Return the NumberSequenceParameter as a dictionary.

classmethod from_dict(d) NumberSequenceParameter[source]

Initiate a SequenceParameter from a dictionary.

validate(val: Any) bool[source]

Validate a value.

class autojob.coordinator.parameters.SequenceParameter(member_types: Iterable[type], name: str = '', special_values: Iterable | None = None, default: Any = None, description: str = '')[source]

Bases: CalculatorParameter

A parameter that can be a sequence.

Initialize a SequenceParameter.

Parameters:
  • name – The name of the SequenceParameter. Defaults to “”.

  • member_types – The allowed types of the items in the sequence.

  • special_values – An iterable of the special values for the parameter. Defaults to None.

  • default – The default value for the parameter. Defaults to None.

  • description – A description of the parameter. Defaults to “”.

as_dict() dict[source]

Return the SequenceParameter as a dictionary.

classmethod from_dict(d) SequenceParameter[source]

Initiate a SequenceParameter from a dictionary.

property member_types: Iterable

The allowed member types of the parameter.

validate(val: Any) bool[source]

Validate a value.

autojob.coordinator.validation module

Validate and convert values to desired types.

autojob.coordinator.validation.alphanum_key(val: str) tuple[str, _T][source]

A key for alphanumerically sorting strings.

Parameters:

val (str) – String representation of object for which to provide key.

Raises:

TypeError – The type of ‘val’ is invalid.

Returns:

Tuple[str, Union[bool, float, int, None, str]] – Key for ‘val’.

autojob.coordinator.validation.alphanum_sort(vals: Iterable[str]) list[str][source]

Alphanumerically sorts ‘vals’.

Parameters:

vals (Iterable) – Iterable to be sorted

Returns:

List[str] – Alphanumerically sorted copy of ‘vals’.

autojob.coordinator.validation.iter_to_native(vals: Iterable[float | int | str | None]) Iterable[float | int | str | None][source]

Converts elements of an iterable to their native types.

Parameters:

vals (Iterable[Optional[float, int, str]]) – Iterable to be converted

Returns:

Iterable – A shallow copy of the converted Iterable.

Example

>>> from autojob.coordinator.validation import iter_to_native
>>> vals = ["0.1", "None", "-1", "dog"]
>>> iter_to_native(vals)
[0.1, None, -1, 'dog']
autojob.coordinator.validation.val_to_native(val: float | int | str | None) _T[source]

Converts string representations of float/int/str to its native type.

Parameters:

val (Optional[Union[float, int, str]]) – Parameter to be converted.

Returns:

PRIMITIVE_TYPE – The converted parameter.

autojob.coordinator.vasp module

Parametrize VASP calculations.

Deprecated since version Use: autojob.calculation.vasp instead.

exception autojob.coordinator.vasp.VaspError[source]

Bases: Exception

A VASP error.

class autojob.coordinator.vasp.VaspJob(job_id: str, calculation_id: str, study_id: str, study_group_id: str, input_parameters: dict, results: dict, job_stats: dict[str, str | int] | None, calculator_type: CalculatorType | None = None, calculation_type: CalculationType | None = None, study_type: StudyType | None = None, error: JobError | None = None, name: str = '', notes: str = '')[source]

Bases: Job

A VASP job.

Initialize a Job.

Parameters:
  • job_id – The job ID.

  • calculation_id – The calculation ID.

  • study_id – The study ID.

  • study_group_id – The study group ID.

  • input_parameters – The input parameters for the job.

  • results – The job results.

  • job_stats – The job statistics.

  • calculator_type – The calculator type. Defaults to None.

  • calculation_type – The calculation type. Defaults to None.

  • study_type – The study type. Defaults to None.

  • error – The job error. Defaults to None.

  • name – The job name. Defaults to “”.

  • notes – Notes on the job. Defaults to “”.

FILES: ClassVar[tuple[str, bool]] = [('CHGCAR', False), ('WAVECAR', False)]
static input_parameters() list[CalculationParameter][source]

A list of VASP calculation parameters.