Skip to content

Commit

Permalink
update the minimal example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
yanghan-microsoft committed Dec 23, 2024
1 parent 75a3474 commit 7ebad2b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,21 @@ and additional materials capabilities are available in
### A minimal test
```python
import torch
from loguru import logger
from ase.build import bulk
from ase.units import GPa
from mattersim.forcefield import MatterSimCalculator

device = "cuda" if torch.cuda.is_available() else "cpu"
print(f"Running MatterSim on {device}")
logger.info(f"Running MatterSim on {device}")

si = bulk("Si", "diamond", a=5.43)
si.calc = MatterSimCalculator(device=device)
print(f"Energy (eV) = {si.get_potential_energy()}")
print(f"Energy per atom (eV/atom) = {si.get_potential_energy()/len(si)}")
print(f"Forces of first atom (eV/A) = {si.get_forces()[0]}")
print(f"Stress[0][0] (eV/A^3) = {si.get_stress(voigt=False)[0][0]}")
print(f"Stress[0][0] (GPa) = {si.get_stress(voigt=False)[0][0] / GPa}")
logger.info(f"Energy (eV) = {si.get_potential_energy()}")
logger.info(f"Energy per atom (eV/atom) = {si.get_potential_energy()/len(si)}")
logger.info(f"Forces of first atom (eV/A) = {si.get_forces()[0]}")
logger.info(f"Stress[0][0] (eV/A^3) = {si.get_stress(voigt=False)[0][0]}")
logger.info(f"Stress[0][0] (GPa) = {si.get_stress(voigt=False)[0][0] / GPa}")
```

In this release, we provide two checkpoints: `MatterSim-v1.0.0-1M.pth` and `MatterSim-v1.0.0-5M.pth`. By default, the `1M` version is loaded.
Expand Down

0 comments on commit 7ebad2b

Please sign in to comment.