File: test_properties.py

package info (click to toggle)
python-ase 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,936 kB
  • sloc: python: 122,428; xml: 946; makefile: 111; javascript: 47
file content (16 lines) | stat: -rw-r--r-- 499 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from ase.build import bulk
from ase.calculators.emt import EMT


def test_calc_properties():
    # XXX Test other calculators.
    # Or maybe this should just be a generic test, not standardization?
    # We'll see.
    atoms = bulk('Au', cubic=True)
    atoms.calc = EMT()
    props = atoms.get_properties(['energy', 'stress', 'forces'])

    natoms = len(atoms)
    assert props['stress'].shape == (6,)
    assert props['forces'].shape == (natoms, 3)
    assert isinstance(props['energy'], float)