File: test_loggingcalc.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (21 lines) | stat: -rw-r--r-- 562 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
# fmt: off
from ase.build import bulk
from ase.calculators.emt import EMT
from ase.calculators.loggingcalc import LoggingCalculator


def test_loggingcalc(tmp_path, figure):
    atoms = bulk('Au', orthorhombic=True)
    calc = LoggingCalculator(EMT())
    atoms.calc = calc

    for _ in range(4):
        atoms.get_forces()
        atoms.get_potential_energy()
        atoms.positions[0, 0] += 0.1

    # This is kind of improper testing.
    # Should split plotting away from processing so we can
    # test the processing.
    calc.tabulate()
    calc.plot()