File: test_cp2k_H2_None.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 (59 lines) | stat: -rw-r--r-- 1,378 bytes parent folder | download | duplicates (3)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Test suit for the CP2K ASE calulator.

http://www.cp2k.org
Author: Ole Schuett <ole.schuett@mat.ethz.ch>
"""

from ase.build import molecule

inp = """
&FORCE_EVAL
   METHOD Quickstep
   &DFT
      BASIS_SET_FILE_NAME BASIS_MOLOPT
      &MGRID
         CUTOFF 400
      &END MGRID
      &XC
         &XC_FUNCTIONAL LDA
         &END XC_FUNCTIONAL
      &END XC
      &POISSON
         PERIODIC NONE
         PSOLVER  MT
      &END POISSON
   &END DFT
     &SUBSYS
      &KIND H
         BASIS_SET DZVP-MOLOPT-SR-GTH
         POTENTIAL GTH-LDA
      &END KIND
   &END SUBSYS
&END FORCE_EVAL
"""


def test_h2_none(cp2k_factory):
    # Basically, the entire CP2K input is passed in explicitly.
    # Disable ASE's input generation by setting everything to None.
    # ASE should only add the CELL and the COORD section.
    calc = cp2k_factory.calc(
        basis_set=None,
        basis_set_file=None,
        max_scf=None,
        cutoff=None,
        force_eval_method=None,
        potential_file=None,
        poisson_solver=None,
        pseudo_potential=None,
        stress_tensor=False,
        xc=None,
        label='test_H2_inp',
        inp=inp
    )
    h2 = molecule('H2', calculator=calc)
    h2.center(vacuum=2.0)
    energy = h2.get_potential_energy()
    energy_ref = -30.6989595886
    diff = abs((energy - energy_ref) / energy_ref)
    assert diff < 1e-10