API Reference¶
High-level functions for running global optimization and transition state searches.
Main Functions¶
Single composition:
|
Optimize one composition, return list of (energy, Atoms) tuples |
|---|---|
|
Find transition states for one composition |
|
Run GO then TS for one composition |
Multiple compositions (campaigns):
|
Optimize multiple compositions; failed compositions are logged and skipped (empty list for that formula). See Cluster initialization. |
|---|---|
|
Find TS for multiple compositions |
|
Run GO+TS for multiple compositions |
All functions accept:
composition: formula string ("Pt5"), symbol list (["Pt"]*5), or ASE Atomsparams/go_params: GO parameter dictionary (Noneor partial dict; merged withget_default_params()at run time)ts_params: TS parameter dictionary (Noneor partial dict; merged withget_ts_search_params()at run time)seed: random seed for reproducibility (must agree acrossseed=,go_params['seed'], andts_params['seed']when more than one is set)system_type:"gas_cluster","surface_cluster","gas_cluster_adsorbate", or"surface_cluster_adsorbate"(run argument only — not inside preset dicts)surface_config: required for surface system types; must agree across run argument and preset dicts when both are setadsorbates: ASE Atoms or list of Atoms, required for adsorbate system typesverbosity: 0=quiet (warnings only), 1=normal (parameter merge and timing summaries), 2=debug (library detail), 3=trace (custom TRACE level for deep diagnostics). Progress bars are shown whenverbosity >= 1(seeshould_show_progress()).
See All Parameters (Parameter resolution) for merge rules and logging behaviour.
Output directories¶
output_dir semantics differ by runner. Full table and directory-tree examples:
Quick Start (Output directories).
Runner |
|
Also accepts |
|---|---|---|
|
|
— |
|
Campaign parent → |
— |
|
Campaign root → |
|
|
Campaign parent → |
|
|
Campaign root (or existing |
|
|
Shared campaign root for all compositions |
— |
Complete Examples¶
from scgo import run_go
from scgo.param_presets import get_testing_params
results = run_go(
"Pt5",
params=get_testing_params(),
seed=42,
system_type="gas_cluster",
)
See Quick Start for surface, adsorbate, TS, campaign, and output-layout examples.
Utility Functions¶
|
Symbol lists for mono-element size scans (e.g. |
|---|---|
|
Symbol lists for bimetallic size scans (all |
|
Parse a compact formula ( |
|
Ensure seed consistency across params |
|
Print summary of a GO+TS run |
Timing and Profiling¶
Configure timing in params / go_params only (optimizer_params['ga'] or bh):
write_timing_json=True: writetiming.jsonunder each run directory (alongsidemetadata.json)detailed_timing=True: addper_generationrows (requireswrite_timing_json=True)
For TS, set write_timing_json in ts_params when needed.
See scgo.utils.timing_report for the JSON layout and
scgo.utils.output_paths for campaign directory helpers.
Module Reference¶
High-level SCGO workflows: GO, TS, GO+TS, and campaigns.
go_params = global-optimization params; ts_params = flat TS preset
(scgo.param_presets.get_ts_search_params()). The run seed and
go_params['seed'] / ts_params['seed'] must agree when more than one is set
(resolve_workflow_seed()). System mode is set only by the run function
system_type=... argument together with explicit surface_config=... and,
for *_adsorbate modes, core-only composition plus adsorbates=...
(single or multiple ASE Atoms fragments).
System-definition keys in go_params are partly restricted:
system_type remains rejected, while top-level surface_config is allowed
and fanned out into optimizer slots. Adsorbate placement tuning
(cluster_adsorbate_config, connectivity_factor, freeze_adsorbate_internal_geometry)
belongs in go_params only—not as separate run_* keywords. For
ts_params, system_type remains rejected while surface_config is
allowed and validated against the run argument.
GA/BH timing JSON is configured only in params/go_params under
optimizer_params['ga'] (or bh): write_timing_json and detailed_timing.
See scgo.utils.timing_report.
- scgo.runner_api.log_go_ts_summary(logger, summary, *, wall_time_s=None)[source]¶
Log NEB success counts from a
run_go_ts*summary dict.- Return type:
- scgo.runner_api.parse_composition_arg(comp_str)[source]¶
Supports two formats: - Comma-separated symbols: “Pt,Pt,Au” - Compact formula: “Pt3Au” or “AuPt2”
- scgo.runner_api.build_one_element_compositions(element, min_atoms, max_atoms)[source]¶
Composition list for mono-element size scans (min_atoms..max_atoms).
- scgo.runner_api.build_two_element_compositions(element1, element2, min_atoms, max_atoms)[source]¶
Composition list for bimetallic size scans (min_atoms..max_atoms).
- scgo.runner_api.resolve_workflow_seed(*, seed_kw=None, go_params=None, ts_params=None)[source]¶
Unify run
seed=...,go_params['seed'], andts_params['seed']; all non-null must agree.
- scgo.runner_api.run_go(composition, params=None, seed=None, verbosity=1, run_id=None, clean=False, output_dir=None, calculator_for_global_optimization=None, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
Run global optimization trials for one composition.
- scgo.runner_api.run_go_campaign(compositions, params=None, seed=None, verbosity=1, run_id=None, clean=False, output_dir=None, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
Run global optimization for multiple compositions.
Each composition gets a reproducible sub-seed derived from
seed/params['seed']. If a composition fails (ValueError,RuntimeError, I/O, or database errors), the error is logged, that formula maps to an empty list, and remaining compositions continue.
- scgo.runner_api.run_go_ts(composition, *, go_params=None, ts_params=None, seed=None, verbosity=1, output_dir=None, output_root=None, output_stem=None, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
Run global optimization then transition-state search for one composition.
- scgo.runner_api.run_go_ts_campaign(compositions, *, go_params=None, ts_params=None, seed=None, verbosity=1, output_dir=None, output_root=None, output_stem=None, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
Run GO+TS for multiple compositions.
- scgo.runner_api.run_ts_campaign(compositions, *, ts_params=None, output_dir=None, seed=None, verbosity=1, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
- scgo.runner_api.run_ts_search(composition, *, ts_params=None, output_dir=None, searches_dir=None, seed=None, verbosity=1, surface_config=None, system_type=None, adsorbates=None, log_summary=True)[source]¶
Run transition-state search for one composition.
output_diris the campaign root. Minima are loaded from{formula}_searches/(or fromsearches_dirwhen provided). TS artifacts are written to sibling{formula}_ts_results/withrun_*/pair_*/subdirectories. Ifoutput_dirpoints at an existing*_searchesdirectory, its parent is treated as the campaign root.