Skip to content

Commit

Permalink
Merge branch 'fix/check-convergence' of https://github.com/aiidateam/…
Browse files Browse the repository at this point in the history
…aiida-quantumespresso-hp into feat/voronoi
  • Loading branch information
bastonero committed Apr 22, 2024
2 parents 6ced0df + 3671a3c commit ff76121
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/aiida_quantumespresso_hp/workflows/hubbard.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def check_convergence(self):
new = np.array(new_onsites, dtype='object')
diff = np.abs(old[:, 4] - new[:, 4])

if (diff > self.inputs.tolerance_onsite).all():
if (diff > self.inputs.tolerance_onsite).any():
check_onsites = False
self.report(f'Hubbard onsites parameters are not converged. Max difference is {diff.max()}.')

Expand All @@ -671,7 +671,7 @@ def check_convergence(self):
new = np.array(new_intersites, dtype='object')
diff = np.abs(old[:, 4] - new[:, 4])

if (diff > self.inputs.tolerance_intersite).all():
if (diff > self.inputs.tolerance_intersite).any():
check_onsites = False
self.report(f'Hubbard intersites parameters are not converged. Max difference is {diff.max()}.')

Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def _generate_structure(structure_id=None):
def generate_hubbard_structure(generate_structure):
"""Return a `HubbardStructureData` representing bulk silicon."""

def _generate_hubbard_structure(only_u=False, u_value=1e-5, v_value=1e-5):
def _generate_hubbard_structure(only_u=False, u_value=1e-5, v_value=1e-5, u_o_value=1e-5):
"""Return a `StructureData` representing bulk silicon."""
from aiida_quantumespresso.data.hubbard_structure import HubbardStructureData

Expand All @@ -386,8 +386,10 @@ def _generate_hubbard_structure(only_u=False, u_value=1e-5, v_value=1e-5):

if only_u:
hubbard_structure.initialize_onsites_hubbard('Co', '3d', u_value)
hubbard_structure.initialize_onsites_hubbard('O', '2p', u_o_value)
else:
hubbard_structure.initialize_onsites_hubbard('Co', '3d', u_value)
hubbard_structure.initialize_onsites_hubbard('O', '2p', u_o_value)
hubbard_structure.initialize_intersites_hubbard('Co', '3d', 'O', '2p', v_value)

return hubbard_structure
Expand Down

0 comments on commit ff76121

Please sign in to comment.