Skip to content

Commit

Permalink
Test factories ddkpert, ddepert, dtepert (#301)
Browse files Browse the repository at this point in the history
* Read SHG AR contrib

* new factories for Atomate2 SHG WF

* update factories.py __all__

* Atomate2 convention: gs_inp -> gs_input

* nband in ddkpert_from_gsinput because of factory_kwrags in atomate2

* Add ONCVPSP LDA v0.4

* test spinat

* modif set_autospinat

* modif for atomate2

* fix EventParser for RelaxConvergenceWarning + quick fix wrapper as_dict pmg_serialize

* remove VT

* remove autoparal 1 of GS from ddk, dde, dte

* activate ONCVPSP-LDA-SR-v0.3

* backward compatibility

* remove comments

* test factories
  • Loading branch information
VicTrqt authored Oct 17, 2024
1 parent 2dc6bd2 commit 7337f2f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion abipy/abio/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ def ddepert_from_gsinput(gs_input, dde_pert, use_symmetries=True, dde_tol=None,

def dtepert_from_gsinput(gs_input, dte_pert, manager=None) -> AbinitInput:
"""
Returns an |AbinitInput| to perform a DTE calculations for a specific perturbation and based on a ground state |AbinitInput|.
Returns an |AbinitInput| to perform a DTE calculations for a specific perturbation based on a ground state |AbinitInput|.
Args:
gs_input: an |AbinitInput| representing a ground state calculation, likely the SCF performed to get the WFK.
Expand Down
45 changes: 33 additions & 12 deletions abipy/abio/tests/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,26 +545,47 @@ def test_ddkpert_from_gsinput(self):

ddk_pert = {'idir': 1, 'ipert': 3, 'qpt': [0.0, 0.0, 0.0]}
ddk_input = ddkpert_from_gsinput(gs_inp, ddk_pert)
assert ddk_input["tolwfr"] == 1.0e-22
assert "autoparal" not in ddk_input
assert "npfft" not in ddk_input
assert ddk_input["tolwfr"] == 1.0e-22
self.abivalidate_input(ddk_input)

def test_ddepert_from_gsinput(self):
gs_inp = gs_input(self.si_structure, self.si_pseudo, kppa=None, ecut=2, spin_mode="unpolarized")
gs_inp["nband"] = 4
gs_inp["autoparal"] = 1
gs_inp["npfft"] = 10

dde_pert = {'idir': 1, 'ipert': 4, 'qpt': [0.0, 0.0, 0.0]}
dde_input = ddepert_from_gsinput(gs_inp, dde_pert)
assert "autoparal" not in dde_input
assert "npfft" not in dde_input
assert dde_input["tolvrs"] == 1.0e-22
self.abivalidate_input(dde_input)

#dte_pert = {'i1dir': 1, 'ipert': 4, 'qpt': [0.0, 0.0, 0.0]}
#dte_input = dtepert_from_gsinput(gs_inp, dte_pert)
#assert "autoparal" not in dte_input
#assert "npfft" not in dte_input
#assert dte_input["tolvrs"] == 1.0e-22
#self.abivalidate_input(dte_input)

#def test_dte_from_gsinput(self):
# gs_inp = gs_input(self.si_structure, self.si_pseudo, kppa=None, ecut=2, spin_mode="unpolarized")
# multi = dte_from_gsinput(gs_inp, use_phonons=True)
# self.abivalidate_input(multi)
def test_dtepert_from_gsinput(self):
gs_inp = scf_for_phonons(self.si_structure, self.si_pseudo, kppa=None, ecut=2, smearing="nosmearing", spin_mode="unpolarized")
gs_inp["nband"] = 4
gs_inp["autoparal"] = 1
gs_inp["npfft"] = 1

dte_pert = {'i1dir': 1, 'i1pert': 4, 'qpt': [0.0, 0.0, 0.0],
'i2dir': 1, 'i2pert': 4,
'i3dir': 1, 'i3pert': 4,}
dte_input = dtepert_from_gsinput(gs_inp, dte_pert)
dte_input["ixc"] = 7

assert "autoparal" not in dte_input
assert "npfft" not in dte_input
assert dte_input["optdriver"] == 5
assert dte_input["d3e_pert1_elfd"] == 1
assert dte_input["d3e_pert2_elfd"] == 1
assert dte_input["d3e_pert3_elfd"] == 1
assert dte_input["d3e_pert1_dir"] == [1,0,0]
assert dte_input["d3e_pert2_dir"] == [1,0,0]
assert dte_input["d3e_pert3_dir"] == [1,0,0]
assert dte_input["d3e_pert1_phon"] == 0
assert dte_input["d3e_pert2_phon"] == 0
assert dte_input["d3e_pert3_phon"] == 0
self.abivalidate_input(dte_input)

0 comments on commit 7337f2f

Please sign in to comment.