Utilities

alomancy.utils.clean_structures.clean_structures(structures: list[Atoms], config_type: str, override_config_type: bool = False, already_computed: bool = True) list[Atoms][source]

adds DFT results to copy of structures info dictionary.

alomancy.utils.test_train_manager.add_new_training_data(base_name: str, high_accuracy_eval_job_dict: dict, train_xyzs: list[Atoms])[source]

Add new training data from DFT calculations to the existing training data.

Parameters:
  • base_name (str) – Base name for the job.

  • high_accuracy_eval_job_dict (dict) – Dictionary containing job names for different runs.

alomancy.utils.test_train_manager.extend_test_and_train_sets_with_extra_dataset(extra_dataset: str | Path, train_xyzs: list[Atoms], test_xyzs: list[Atoms], test_fraction: float, seed: int, filter_out_config_types: list[str] | None = None, fall_back_config_type: None | str = None) tuple[list[Atoms], list[Atoms]][source]
alomancy.utils.test_train_manager.split_atoms_list_into_test_and_train(atoms_list: list[Atoms], test_fraction: float, seed: int) tuple[list[Atoms], list[Atoms]][source]

Split a list of Atoms objects into training and test sets.

Parameters:
  • atoms_list (list[Atoms]) – List of Atoms objects to split.

  • test_fraction (float) – Fraction of the data to use for the test set.

  • seed (int) – Random seed for reproducibility.

Returns:

A tuple containing the training and test sets.

Return type:

tuple[list[Atoms], list[Atoms]]

class alomancy.utils.remote_job_executor.RemoteJobExecutor(remote_info: RemoteInfo)[source]

Bases: object

General-purpose remote job submission utility.

Handles submitting arbitrary functions to remote compute resources using the ExPyRe framework.

cleanup_jobs() None[source]

Mark all jobs as processed for cleanup.

run_and_wait(function: Callable, job_configs: list[dict[str, Any]], **kwargs) list[Any][source]

Convenience method to submit, start, and wait for multiple jobs.

Parameters:
  • function (Callable) – The function to execute remotely

  • job_configs (List[Dict[str, Any]]) – List of job configurations

  • **kwargs – Additional arguments for submit_multiple_jobs

Returns:

Results from all jobs

Return type:

List[Any]

start_all_jobs(**start_kwargs) None[source]

Start all submitted jobs.

Parameters:

**start_kwargs – Additional arguments for job.start()

submit_job(function: Callable, function_kwargs: dict[str, Any], input_files: list[str | Path] | None = None, output_files: list[str | Path] | None = None, job_name: str | None = None, **expyre_kwargs) ExPyRe[source]

Submit a single job to remote execution.

Parameters:
  • function (Callable) – The function to execute remotely

  • function_kwargs (Dict[str, Any]) – Keyword arguments to pass to the function

  • input_files (List[Union[str, Path]], optional) – Files to transfer to remote system

  • output_files (List[Union[str, Path]], optional) – Files to transfer back from remote system

  • job_name (str, optional) – Name for this specific job (overrides remote_info.job_name)

  • **expyre_kwargs – Additional ExPyRe-specific arguments

Returns:

The ExPyRe job object

Return type:

ExPyRe

submit_multiple_jobs(function: Callable, job_configs: list[dict[str, Any]], common_input_files: list[str | Path] | None = None, common_output_pattern: str | None = None, job_name_pattern: str | None = None) list[ExPyRe][source]

Submit multiple similar jobs with different parameters.

Parameters:
  • function (Callable) – The function to execute remotely

  • job_configs (List[Dict[str, Any]]) – List of job configurations, each containing: - function_kwargs: Dict of kwargs for the function - input_files: Optional list of input files (in addition to common) - output_files: Optional list of output files - job_name: Optional specific job name

  • common_input_files (List[Union[str, Path]], optional) – Input files common to all jobs

  • common_output_pattern (str, optional) – Pattern for output files, use {job_id} for job index

  • job_name_pattern (str, optional) – Pattern for job names, use {job_id} for job index

Returns:

List of ExPyRe job objects

Return type:

List[ExPyRe]

wait_for_all_jobs() list[Any][source]

Wait for all jobs to complete and gather results.

Returns:

List of results from all jobs

Return type:

List[Any]

alomancy.utils.logging_config.setup_logging(verbose: int = 0, log_file: str | None = 'results/alomancy.log') None[source]

Configure the alomancy logger hierarchy.

verbose=0 → console shows WARNING+ (silent during normal runs) verbose=1 → console shows INFO (step-level progress) verbose=2 → console shows DEBUG (per-job detail, ExPyRe stdout/stderr)

The file handler always captures DEBUG regardless of verbose, so every run produces a complete timestamped record even when the console is quiet.