Coverage for gpaw/test/directopt/test_gmf_directopt_lcao.py: 100%

13 statements  

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

1import pytest 

2 

3from gpaw import GPAW 

4from gpaw.directmin.tools import excite 

5from gpaw.directmin.etdm_lcao import LCAOETDM 

6 

7 

8@pytest.mark.do 

9def test_gmf_directopt_lcao(in_tmp_dir, gpw_files): 

10 # Water molecule: 

11 calc = GPAW(gpw_files['h2o_do_gmf_lcao']) 

12 H2O = calc.atoms 

13 H2O.calc = calc 

14 

15 # Excited state occupation numbers 

16 f_sn = excite(calc, 0, 0, spin=(0, 0)) 

17 

18 calc.set(eigensolver=LCAOETDM( 

19 partial_diagonalizer={'name': 'Davidson', 'logfile': None, 'seed': 42}, 

20 linesearch_algo={'name': 'max-step'}, 

21 searchdir_algo={'name': 'LBFGS-P_GMF'}, 

22 need_init_orbs=False), 

23 occupations={'name': 'mom', 'numbers': f_sn, 

24 'use_fixed_occupations': True}) 

25 

26 e = H2O.get_potential_energy() 

27 

28 assert e == pytest.approx(-4.8545, abs=1.0e-4)