Coverage for gpaw/test/sjm/test_change_potential.py: 24%
17 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-08 00:17 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-08 00:17 +0000
1import pytest
4@pytest.mark.skip('https://gitlab.com/gpaw/gpaw/-/issues/1381')
5@pytest.mark.old_gpaw_only
6def test_change_potential(atoms):
7 atoms.calc.set(sj={'tol': 0.1})
9 pot = atoms.calc.parameters['sj']['target_potential']
10 tol = atoms.calc.parameters['sj']['tol']
11 E1 = atoms.get_potential_energy()
12 print(pot, atoms.calc.get_electrode_potential())
13 assert abs(atoms.calc.get_electrode_potential() - pot) < tol
15 atoms.calc.set(sj={'target_potential': pot - 0.1})
16 atoms.get_potential_energy()
17 assert abs(atoms.calc.get_electrode_potential() - pot + 0.1) < tol
19 atoms.calc.set(sj={'target_potential': pot})
20 E2 = atoms.get_potential_energy()
21 assert abs(atoms.calc.get_electrode_potential() - pot) < tol
22 assert abs(E1 - E2) < 1e-2