autojob.next package

Utilities for creating tasks from existing task directories.

autojob.next.create_parametrization(previous: Calculation, calc_mods: dict[str, Any], slurm_mods: dict[str, Any]) list[VariableReference[Any]][source]

Create a parametrization from parameter modifications.

Parameters:
  • previous – A calculation.Calculation representing the previous calculation.

  • calc_mods – A dictionary containing modifications to calculator parameters.

  • slurm_mods – A dictionary containing modifications to SLURM parameters.

Returns:

A list of VariableReference s that can be used to set the values of the new calculation.

autojob.next.substitute_context(mods: dict[str, Any], context: dict[str, Any]) dict[str, Any][source]

Substitute context values into formatted strings.

Parameters:
  • mods – A dictionary mapping parameter names to values. String values will be subsituted according to context values.

  • context – A dictionary mapping variable names to their values. Variables with names corresponding to template names will be substituted.

Returns:

A copy of mods with templatted values substituted for their variable values.

Submodules

autojob.next.relaxation module

Restart relaxation calculations.

Examples

from pathlib import Path
from autojob.next.relaxation import restart_relaxation

calc_mods = {
    "nsw": 250,
    "ibrion": 2,
}
slurm_mods = {"time-limit": "1-00:00:00", "mem": "1GB"}

new_job = restart_relaxation(
    submit=True,
    old_job=Path.cwd(),
    bader=True,
    calc_mods=calc_mods,
    slurm_mods=slurm_mods,
)
autojob.next.relaxation.restart_relaxation(submit: bool = False, file_size_limit: float = 100000000.0, old_job: Path | None = None, *, bader: bool = False, chargemol: bool = False, auto_restart: bool = False, calc_mods: dict[str, Any] | None = None, slurm_mods: dict[str, Any] | None = None, files_to_carry_over: Iterable[str] | None = None, **_) Path[source]

Utility function for restarting a DFT relaxation calculation.

Parameters:
  • submit – Whether or not to submit the new job after creation.

  • file_size_limit – A float specifying the threshold above which files of this size will be deleted. Size is specified in bytes.

  • old_job – The path to the old job.

  • bader – Whether or not to add logic to run Bader charge analysis after the calculation has converged.

  • chargemol – Whether or not to add logic to run DDEC6 analysis with chargemol after the calculation has converged.

  • auto_restart – Whether or not to add logic to automatically restart the calculation after the calculation has converged.

  • calc_mods – A dictionary mapping calculator parameters to values that should be used to overwrite the existing parameters.

  • slurm_mods – A dictionary mapping Slurm options to values that should be used to overwrite the existing parameters.

  • files_to_carry_over – A list of strings indicating which files to carry over from the old job directory to the new job directory. Defaults to None, in which case, the files to copy are determined from the previous task.

Returns:

The path to the newly created job.

autojob.next.vibration module

Create vibrational calculations.

Examples

from pathlib import Path
from autojob.next.vibration import create_vibration

calc_mods = {
    "nsw": 250,
    "ibrion": 2,
}
slurm_mods = {"time-limit": "1-00:00:00", "mem": "1GB"}

new_job = create_vibration(
    submit=True,
    old_job=Path.cwd(),
    bader=True,
    calc_mods=calc_mods,
    slurm_mods=slurm_mods,
)
autojob.next.vibration.create_vibration(submit: bool = False, file_size_limit: float = 100000000.0, old_job: str | Path | None = None, *, calc_mods: dict[str, Any] | None = None, slurm_mods: dict[str, Any] | None = None, files_to_carry_over: Iterable[str] | None = None, infrared: bool = False, **_) Path[source]

Creates a vibrational calculation used to calculate \(TS + ZPE\).

All atoms in the structure with the tag -99 will be frozen.

Parameters:
  • submit – Whether or not to submit the new job after creation.

  • file_size_limit – A float specifying the threshold in bytes above which files of this size will be deleted. Size is specified in bytes.

  • old_job – The path to the old job.

  • calc_mods – A dictionary mapping calculator parameters to values that should be used to overwrite the existing parameters.

  • slurm_mods – A dictionary mapping SLURM options to values that should be used to overwrite the existing parameters.

  • files_to_carry_over – A list of strings indicating which files to copy from the old job directory to the new job directory. Defaults to None, in which case, the files to copy are determined from the previous task.

  • infrared – Whether or not to calculate IR intensities. Requires that the calculator used has the method get_dipole_moment.

Returns:

The path to the newly created job.