Next Steps
Now that you've completed your first ML relaxation, you're ready to explore the full capabilities of the platform. This guide covers essential patterns and workflows you'll use throughout your materials research.
1. Managing Authentication
All SDK operations require proper authentication. Set up your token environment variable as a standard practice:
from atomict.auth import resolve_token
import os
# Resolve your authentication token
token = resolve_token()
os.environ["AT_TOKEN"] = token
This pattern ensures your credentials are available for all subsequent operations in your session.
2. Working with Structure Identifiers
Understanding how to properly reference structures is crucial for chaining operations together.
UserUpload UUIDs vs Structure IDs
Most structure operations require UserUpload UUIDs rather than numeric structure IDs:
from atomict.user.files import upload_single_file
from atomict.structure.conversion import create_supercell
# Upload structure and capture the ID
upload_result = upload_single_file(
"path/to/structure.cif",
project_id=project_id
)
# Correct - Use UserUpload ID
user_upload_uuid = upload_result["UserUpload"]["id"]
supercell_result = create_supercell(user_upload_uuid, [2, 2, 2])
# Incorrect - Don't use numeric structure IDs
# structure_id = 12345 # This will fail
Chaining Structure Operations
You can chain multiple structure transformations by using the output of one operation as input for the next:
# Start with uploaded structure
original_upload = upload_single_file("unit_cell.cif", project_id=project_id)
# Create supercell
supercell_result = create_supercell(
original_upload["UserUpload"]["id"],
[2, 2, 2]
)
# Use supercell for ML relaxation
relaxation_result = create_mlrelaxation(
project_id=project_id,
source_geometry_id=supercell_result["id"],
action="LAUNCH",
f_max=0.05
)
3. Monitoring Simulation Progress
All simulations return task objects that track execution status. Understanding these statuses helps you manage long-running calculations:
Task Status Codes
| Code | Status | Description |
|---|---|---|
| 0 | DRAFT | Simulation created but not submitted |
| 1 | READY | Queued for execution |
| 2 | RUNNING | Currently executing |
| 3 | COMPLETED | Finished successfully |
| 4 | FAILED | Execution failed |
Checking Simulation Status
from atomict.simulation.mlrelax import get_mlrelax
# Check simulation status
simulation = get_mlrelax("your-simulation-id")
status_code = simulation["task"]["status"]
if status_code == 3:
print("Simulation completed successfully!")
# Download results
elif status_code == 4:
print("Simulation failed - check logs")
elif status_code == 2:
print("Simulation still running...")