Simulations
AT-Atoms
Server-tracked ASE Atoms wrapper for automatic state management and trajectory recording.
1. Overview
AT-Atoms provides a transparent wrapper around ASE Atoms objects that automatically tracks all structural modifications and synchronizes changes with the Atomic Tessellator server. Every position update, cell change, or property modification is recorded as a diff and stored server-side.
AT-Atoms acts as a drop-in replacement for ASE Atoms while providing automatic state tracking, server synchronization, and trajectory recording linked to your projects.
atatoms.py
from ase.atoms import Atoms
from atomict.ase.atatoms import ATAtoms
# Create or load ASE Atoms object
atoms = Atoms('H2O', positions=[[0, 0, 0], [0.96, 0, 0], [-0.24, 0.93, 0]])
# Wrap with server-side tracking
at_atoms = ATAtoms(
atoms=atoms,
project_id="your-project-id",
batch_diffs=True
)
# All modifications are automatically tracked
at_atoms.positions[0] = [0.1, 0.1, 0.1] # Triggers diff generation
at_atoms.rattle(stdev=0.1) # ASE method with tracking
1.1 Function Arguments
| Parameter | Type | Default | Description |
|---|---|---|---|
atoms | Atoms | Required | ASE Atoms object to wrap and track |
project_id | str | "" | Project ID for server-side organization |
batch_size | int | 20 | Number of diffs to accumulate before server sync |
sync_interval | float | 10.0 | Maximum time (seconds) between server syncs |
batch_diffs | bool | False | Enable batching for rapid modifications |
1.2 Parameter Details
Batch Diffs (batch_diffs)
Controls how modifications are synchronized with the server:
batch_diffs=False- Each modification immediately queued for server transmission (best for interactive work)batch_diffs=True- Modifications accumulated until batch_size or sync_interval reached (efficient for rapid changes)
Context Manager Support
Use context managers for automatic cleanup and final synchronization:
atatoms_context.py
with ATAtoms(atoms, project_id="project-id") as at_atoms:
at_atoms.set_cell([10, 10, 10])
at_atoms.center()
# Context manager ensures final sync on exit
2. State Management
2.1 Manual State Saving
Save current atomic state to server:
atatoms_state.py
# Save current state and get server response
response = at_atoms.save_current_state()
if 'id' in response:
state_id = response['id']
print(f"State saved with ID: {state_id}")
2.2 ASE Compatibility
AT-Atoms provides complete ASE compatibility:
atatoms_ase.py
from ase.optimize import BFGS
# All ASE methods work transparently with tracking
at_atoms.set_calculator(calculator) # Calculator assignment tracked
at_atoms.get_potential_energy() # Energy calculation tracked
# ASE optimization with automatic tracking
opt = BFGS(at_atoms)
opt.run(fmax=0.05) # Every optimization step tracked