File: test_single_atom.py

package info (click to toggle)
python-ase 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 15,448 kB
  • sloc: python: 144,945; xml: 2,728; makefile: 113; javascript: 47
file content (27 lines) | stat: -rw-r--r-- 774 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from pytest import mark

from ase import Atoms


@mark.calculator_lite
def test_single_atom(KIM):
    """
    Check that repositioning a single atom inside the cell finishes correctly
    and returns 0 energy, this in particular checks that the neighborlist
    maintenance for KIM models works for this case (see
    calculators/kim/neighbourlist.py).
    """
    model = "ex_model_Ar_P_Morse_07C"

    # twice the cutoff length
    box_len = 1.1

    atoms = Atoms("Ar", cell=[[box_len, 0, 0],
                              [0, box_len, 0],
                              [0, 0, box_len]],
                  calculator=KIM(model))

    for positions in [(0., 0., 0.), (0., 0., 1)]:
        atoms.set_positions([positions])

        assert atoms.get_potential_energy() == 0