# Use deep potential with ASE

:::{note}
See [Environment variables](../env.md) for the runtime environment variables.
:::

Deep potential can be set up as a calculator with ASE to obtain potential energies and forces.

::::{tab-set}

:::{tab-item} TensorFlow {{ tensorflow_icon }}

```python
from ase import Atoms
from deepmd.calculator import DP

water = Atoms(
    "H2O",
    positions=[(0.7601, 1.9270, 1), (1.9575, 1, 1), (1.0, 1.0, 1.0)],
    cell=[100, 100, 100],
    calculator=DP(model="frozen_model.pb"),
)
print(water.get_potential_energy())
print(water.get_forces())
```
:::

:::{tab-item} PyTorch {{ pytorch_icon }}

```python
from ase import Atoms
from deepmd.calculator import DP

water = Atoms(
    "H2O",
    positions=[(0.7601, 1.9270, 1), (1.9575, 1, 1), (1.0, 1.0, 1.0)],
    cell=[100, 100, 100],
    calculator=DP(model="frozen_model.pth"),
)
print(water.get_potential_energy())
print(water.get_forces())
```
:::

:::{tab-item} Paddle {{ paddle_icon }}

```python
from ase import Atoms
from deepmd.calculator import DP

water = Atoms(
    "H2O",
    positions=[(0.7601, 1.9270, 1), (1.9575, 1, 1), (1.0, 1.0, 1.0)],
    cell=[100, 100, 100],
    calculator=DP(model="frozen_model.json"),
)
print(water.get_potential_energy())
print(water.get_forces())
```
:::

::::

Optimization is also available:

```python
from ase.optimize import BFGS

dyn = BFGS(water)
dyn.run(fmax=1e-6)
print(water.get_positions())
```
