File: test_graphene.py

package info (click to toggle)
python-ase 3.26.0-3
  • 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 (45 lines) | stat: -rw-r--r-- 1,280 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# fmt: off
from ase import Atoms
from ase.calculators.crystal import CRYSTAL


def test_graphene(crystal_factory):
    with open('basis', 'w') as fd:
        fd.write("""6 4
    0 0 6 2.0 1.0
     3048.0 0.001826
     456.4 0.01406
     103.7 0.06876
     29.23 0.2304
     9.349 0.4685
     3.189 0.3628
    0 1 2 4.0 1.0
     3.665 -0.3959 0.2365
     0.7705 1.216 0.8606
    0 1 1 0.0 1.0
     0.26 1.0 1.0
    0 3 1 0.0 1.0
     0.8 1.0
    """)

    geom = Atoms('C2',
                 cell=[[0.21680326E+01, -0.12517142E+01, 0.000000000E+00],
                       [0.00000000E+00, 0.25034284E+01, 0.000000000E+00],
                       [0.00000000E+00, 0.00000000E+00, 0.50000000E+03]],
                 positions=[(-0.722677550504, -1.251714234963, 0.),
                            (-1.445355101009, 0., 0.)],
                 pbc=[True, True, False])

    geom.calc = CRYSTAL(
        label='graphene',
        guess=True,
        xc='PBE',
        kpts=(1, 1, 1),
        otherkeys=['scfdir', 'anderson',
                   ['maxcycles', '500'],
                   ['toldee', '6'],
                   ['tolinteg', '7 7 7 7 14'],
                   ['fmixing', '95']])

    final_energy = geom.get_potential_energy()
    assert abs(final_energy + 2063.13266758) < 1.0