@@ -9,23 +9,46 @@ torch-sim
99 * - Official website
1010 - How is metatomic supported?
1111 * - https://radical-ai.github.io/torch-sim/
12- - In the official version
12+ - Via the `` metatomic-torchsim `` package
1313
14- Supported model outputs
14+ How to install the code
1515^^^^^^^^^^^^^^^^^^^^^^^
1616
17- Only the :ref: ` energy < energy-output >` output is supported.
17+ Install the integration package from PyPI:
1818
19- How to install the code
19+ .. code-block :: bash
20+
21+ pip install metatomic-torchsim
22+
23+ This pulls in ``torch-sim-atomistic `` and ``metatomic-torch `` as dependencies.
24+
25+ For the full TorchSim documentation, see
26+ https://radical-ai.github.io/torch-sim/.
27+
28+ Supported model outputs
2029^^^^^^^^^^^^^^^^^^^^^^^
2130
22- The code is available in the `` torch-sim `` package, see the corresponding
23- ` installation instructions < https://radical-ai.github.io/torch-sim/user/introduction.html#installation >`_ .
31+ Only the :ref: ` energy < energy-output >` output is supported. Forces and stresses
32+ are derived via autograd .
2433
2534How to use the code
2635^^^^^^^^^^^^^^^^^^^
2736
28- You can find the documentation for metatomic models in torch-sim `here
29- <https://radical-ai.github.io/torch-sim/tutorials/metatomic_tutorial.html> `_,
30- and generic documentation on torch-sim `there
31- <radical-ai.github.io/torch-sim/> `_.
37+ .. code-block :: python
38+
39+ import ase.build
40+ import torch_sim as ts
41+ from metatomic.torchsim import MetatomicModel
42+
43+ model = MetatomicModel(" model.pt" , device = " cpu" )
44+
45+ atoms = ase.build.bulk(" Si" , " diamond" , a = 5.43 , cubic = True )
46+ sim_state = ts.io.atoms_to_state([atoms], model.device, model.dtype)
47+
48+ results = model(sim_state)
49+ print (results[" energy" ]) # shape [1]
50+ print (results[" forces" ]) # shape [n_atoms, 3]
51+ print (results[" stress" ]) # shape [1, 3, 3]
52+
53+ For more details, see the `metatomic-torchsim documentation
54+ <https://docs.metatensor.org/metatomic/latest/torchsim/> `_.
0 commit comments