Integrate Atomic Simulation Environment (ASE) as a Job Adapter#836
Integrate Atomic Simulation Environment (ASE) as a Job Adapter#836
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for running calculations via ASE (Atomic Simulation Environment) as a new ARC job adapter, along with YAML parsing adjustments to consume ASE-produced YAML outputs.
Changes:
- Register a new
asejob adapter and supporting standalone execution script (ase_script.py) producing YAML outputs. - Extend settings to recognize ASE as supported ESS and define ASE-specific filenames/options/environment mappings.
- Update YAML parsing and XYZ-from-file fallback to better handle
.yml/.yamlinputs.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| arc/settings/settings.py | Adds ASE to supported ESS + filenames/options; updates cluster delete command and ASE env mapping. |
| arc/parser/parser.py | Adds .yml/.yaml path in parse_xyz_from_file() to parse geometry via YAML adapter. |
| arc/parser/adapters/yaml.py | Expands supported YAML keys; modifies energy parsing logic. |
| arc/level.py | Changes deduce_software() control flow to return early when software is already set. |
| arc/job/adapters/scripts/ase_script.py | New standalone runner for ASE jobs (SP/opt/freq) producing output.yml. |
| arc/job/adapters/ase.py | New ASEAdapter integrating ASE script into ARC job execution (incore/queue). |
| arc/job/adapters/init.py | Imports/registers the new ASE adapter module. |
| arc/job/adapter.py | Adds ase to JobEnum. |
| .gitignore | Ignores spec.md. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
arc/settings/settings.py
Outdated
| } | ||
|
|
||
| delete_command = {'OGE': 'export SGE_ROOT=/opt/sge; /opt/sge/bin/lx24-amd64/qdel', | ||
| delete_command = {'OGE': 'export SGE_ROOT=/opt/sge; /opt/sge/bin/scancel', |
| ASE_CALCULATORS_ENV = {'torchani': 'TANI_PYTHON', | ||
| 'xtb': 'SELLA_PYTHON', |
There was a problem hiding this comment.
Not true. xtb-python is installed with the sella env (see devtools/sella_environment.yml)
arc/parser/adapters/yaml.py
Outdated
| if energy is not None: | ||
| # If the value is very small, it might already be in kJ/mol (unlikely for E_elect), | ||
| # but standard internal representation is Hartree. | ||
| if abs(energy) < 1e6: # Arbitrary threshold to detect Hartree vs kJ/mol | ||
| return energy * E_h_kJmol | ||
| return energy |
arc/level.py
Outdated
| Args: | ||
| job_type (str, optional): An ARC job type, assists in determining the software. | ||
| """ | ||
| if self.software is not None: |
| if job_type in ['sp', 'opt', 'conf_opt', 'freq', 'optfreq', 'directed_scan']: | ||
| output['sp'] = to_hartree(atoms.get_potential_energy()) | ||
|
|
||
| if job_type in ['opt', 'conf_opt', 'optfreq', 'directed_scan']: | ||
| fmax = float(settings.get('fmax', 0.001)) | ||
| steps = int(settings.get('steps', 1000)) | ||
| engine_name = settings.get('optimizer', 'BFGS').lower() | ||
|
|
||
| engine_dict = { | ||
| 'bfgs': BFGS, 'lbfgs': LBFGS, 'gpmin': GPMin, | ||
| 'scipyfminbfgs': SciPyFminBFGS, 'scipyfmincg': SciPyFminCG, | ||
| 'sella': None, | ||
| } | ||
| if engine_name == 'sella': | ||
| from sella import Sella | ||
| opt_class = Sella | ||
| else: | ||
| opt_class = engine_dict.get(engine_name, BFGS) | ||
| opt = opt_class(atoms, logfile=os.path.join(os.path.dirname(input_path), 'opt.log')) | ||
|
|
||
| try: | ||
| opt.run(fmax=fmax, steps=steps) | ||
| save_current_geometry(output, atoms, xyz) | ||
| output['sp'] = to_hartree(atoms.get_potential_energy()) | ||
| except Exception as exc: |
| job_type = input_dict.get('job_type') | ||
| xyz = input_dict.get('xyz') | ||
| settings = input_dict.get('settings', {}) | ||
|
|
||
| atoms = Atoms(symbols=xyz['symbols'], positions=xyz['coords']) | ||
| calc = get_calculator(settings) | ||
| atoms.calc = calc | ||
|
|
||
| apply_constraints(atoms, input_dict.get('constraints')) |
| # Default mapping if not yet fully defined in settings.py | ||
| DEFAULT_ASE_ENV = { | ||
| 'torchani': 'TANI_PYTHON', | ||
| 'xtb': 'XTB_PYTHON', |
| class ASEAdapter(JobAdapter): | ||
| """ | ||
| A generic adapter for ASE (Atomic Simulation Environment) jobs. | ||
| Supports multiple calculators and environments. | ||
| """ | ||
| def __init__(self, |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #836 +/- ##
==========================================
+ Coverage 58.65% 58.67% +0.02%
==========================================
Files 97 98 +1
Lines 29197 29296 +99
Branches 7752 7764 +12
==========================================
+ Hits 17125 17189 +64
- Misses 9872 9901 +29
- Partials 2200 2206 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
This PR introduces a new job adapter that allows ARC to utilize the Atomic Simulation Environment (ASE) as a backend engine. By integrating ASE, ARC can now run single-point energy calculations, geometry optimizations, and vibrational (frequency) analyses using any ASE-compatible calculator.
Key Changes
environment.
generic ASE calculators.
coordinates).
masses, and force constants directly from the Hessian, matching physical constants and standards used by TorchANI/ASE.
Impact
This integration significantly broadens ARC's computational capabilities by tapping directly into the ASE ecosystem, making it trivial to incorporate Machine Learning Potentials (like TorchANI) and any method that interacts with ASE very easily.