Skip to content

Commit

Permalink
FHIaims: Scf threshold energy change
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonKratochvil authored and ondracka committed Sep 9, 2024
1 parent 5d15750 commit dafe7ef
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
9 changes: 0 additions & 9 deletions electronicparsers/fhiaims/metainfo/fhi_aims.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,15 +1127,6 @@ class Method(runschema.method.Method):
categories=[x_fhi_aims_controlIn_method],
)

x_fhi_aims_controlIn_sc_accuracy_etot = Quantity(
type=np.float64,
shape=[],
description="""
-
""",
categories=[x_fhi_aims_controlIn_method],
)

x_fhi_aims_controlIn_sc_accuracy_forces = Quantity(
type=np.float64,
shape=[],
Expand Down
10 changes: 8 additions & 2 deletions electronicparsers/fhiaims/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
KMesh,
FrequencyMesh,
BasisSetContainer,
Scf,
)
from runschema.system import System, Atoms
from runschema.calculation import (
Expand Down Expand Up @@ -84,7 +85,7 @@
from ..utils import BeyondDFTWorkflowsParser


re_float = r'[-+]?\d+\.\d*(?:[Ee][-+]\d+)?'
re_float = r'[-+]?\d+\.*\d*(?:[Ee][-+]\d+)?'
re_n = r'[\n\r]'


Expand Down Expand Up @@ -177,9 +178,10 @@ def str_to_species(val_in):
repeats=False,
),
Quantity(
xsection_method.x_fhi_aims_controlIn_sc_accuracy_etot,
'threshold_energy_change',
rf'{re_n} *sc_accuracy_etot\s*({re_float})',
repeats=False,
unit='eV',
),
Quantity(
xsection_method.x_fhi_aims_controlIn_sc_accuracy_forces,
Expand Down Expand Up @@ -2227,6 +2229,10 @@ def _prep_elemental_tier(basis_settings: MSection) -> dict[str, Any]:
if hybrid_coeff is not None:
# is it necessary to check if xc is a hybrid type aside from hybrid_coeff
sec_method.x_fhi_aims_controlIn_hybrid_xc_coeff = hybrid_coeff
elif key == 'threshold_energy_change':
sec_scf = Scf()
sec_method.scf = sec_scf
sec_scf.threshold_energy_change = val

inout_exclude = [
'x_fhi_aims_controlInOut_relativistic',
Expand Down
3 changes: 3 additions & 0 deletions tests/test_fhiaimsparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_scf_spinpol(parser):
assert sec_method.electronic.n_spin_channels == 2
assert sec_method.electronic.relativity_method == 'scalar_relativistic_atomic_ZORA'
assert sec_method.dft.xc_functional.correlation[0].name == 'LDA_C_PW'
assert sec_method.scf.threshold_energy_change.magnitude == approx(1.602176634e-24)
sec_basis_func = sec_method.x_fhi_aims_section_controlIn_basis_set[
0
].x_fhi_aims_section_controlIn_basis_func
Expand Down Expand Up @@ -104,6 +105,7 @@ def test_geomopt(parser):
sec_methods = archive.run[0].method
assert len(sec_methods) == 1
assert list(sec_methods[0].k_mesh.grid) == [8] * 3
assert sec_methods[0].scf.threshold_energy_change.magnitude == approx(1.602176634e-25)

sec_sccs = archive.run[0].calculation
assert len(sec_sccs) == 6
Expand Down Expand Up @@ -218,6 +220,7 @@ def test_dos(parser):

sec_method = archive.run[0].method[0]
assert list(sec_method.k_mesh.grid) == [10] * 3
assert sec_method.scf.threshold_energy_change.magnitude == approx(1.602176634e-25)

sec_scc = archive.run[0].calculation[0]
sec_dos = sec_scc.dos_electronic
Expand Down

0 comments on commit dafe7ef

Please sign in to comment.