File: test_read_text_output.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 (46 lines) | stat: -rw-r--r-- 1,362 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from ase.calculators.singlepoint import SinglePointDFTCalculator


def test_read_gpaw_out(datadir):
    """Test reading of gpaw text output"""
    from ase import io

    # read input

    output_file_name = datadir / 'gpaw_expected_text_output'
    atoms = io.read(output_file_name)

    # test calculator
    
    calc = atoms.calc
    assert isinstance(calc, SinglePointDFTCalculator)
    assert calc.name == 'vdwtkatchenko09prl'
    assert calc.parameters['calculator'] == 'gpaw'

    for contribution in [
            'kinetic', 'potential', 'external', 'xc',
            'entropy (-st)', 'local']:
        assert contribution in calc.energy_contributions


# for the record, include somehow XXX
# output in datadir / 'gpaw_expected_text_output' written by
"""
if 1:
    from ase.build import molecule
    from ase.calculators.vdwcorrection import vdWTkatchenko09prl

    from gpaw import GPAW, FermiDirac
    from gpaw.cluster import Cluster
    from gpaw.analyse.vdwradii import vdWradii
    from gpaw.analyse.hirshfeld import HirshfeldDensity, HirshfeldPartitioning

    atoms = Cluster(molecule('H2'))
    atoms.minimal_box(3)
    
    calc = GPAW(xc='PBE', occupations=FermiDirac(0.1))
    atoms.calc = vdWTkatchenko09prl(
        HirshfeldPartitioning(calc),
        vdWradii(atoms.get_chemical_symbols(), 'PBE'))
    atoms.get_potential_energy()
"""