Coverage for gpaw/test/symmetry/test_fractional_translations_big.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.7.1, created at 2025-07-14 00:18 +0000

1from ase.spacegroup import crystal 

2from gpaw import GPAW 

3from gpaw import PW 

4import pytest 

5 

6 

7def test_symmetry_fractional_translations_big(): 

8 'cristobalite' 

9 # no. 92 - tetragonal 

10 

11 a = 5.0833674 

12 c = 7.0984738 

13 p0 = (0.2939118, 0.2939118, 0.0) 

14 p1 = (0.2412656, 0.0931314, 0.1739217) 

15 

16 atoms = crystal(['Si', 'O'], basis=[p0, p1], 

17 spacegroup=92, cellpar=[a, a, c, 90, 90, 90]) 

18 

19 # with fractional translations 

20 calc = GPAW(mode=PW(200), 

21 xc='LDA', 

22 kpts=(3, 3, 2), 

23 nbands=32, 

24 symmetry={'symmorphic': False}, 

25 gpts=(16, 16, 20), 

26 eigensolver='rmm-diis') 

27 

28 atoms.calc = calc 

29 energy_fractrans = atoms.get_potential_energy() 

30 

31 assert len(calc.wfs.kd.ibzk_kc) == 3 

32 assert len(calc.wfs.kd.symmetry.op_scc) == 8 

33 

34 # without fractional translations 

35 calc = GPAW(mode=PW(200), 

36 xc='LDA', 

37 kpts=(3, 3, 2), 

38 nbands=32, 

39 gpts=(16, 16, 20), 

40 eigensolver='rmm-diis') 

41 

42 atoms.calc = calc 

43 energy_no_fractrans = atoms.get_potential_energy() 

44 

45 assert len(calc.wfs.kd.ibzk_kc) == 6 

46 assert len(calc.wfs.kd.symmetry.op_scc) == 2 

47 

48 assert energy_fractrans == pytest.approx(energy_no_fractrans, abs=1e-6)