Skip to content

Commit 02a31ab

Browse files
authored
add EmpiricalDispersionModel (#332)
* EmpiricalDispersionModel * rename settings as well
1 parent dd98608 commit 02a31ab

File tree

4 files changed

+34
-55
lines changed

4 files changed

+34
-55
lines changed

src/nomad_simulations/schema_packages/model_method.py

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,13 @@ def normalize(self, archive, logger):
218218
)
219219

220220

221-
class ExplicitDispersionModel(BaseModelMethod):
222-
"""Explicit dispersion / vdW treatment used together with an ab-initio method.
221+
class EmpiricalDispersionModel(BaseModelMethod):
222+
"""Empirical dispersion correction used together with an ab-initio method.
223223
224224
Covers pairwise-additive (D2/D3/D3(BJ)/D4), density-dependent (TS/TS-SCS),
225-
many-body dispersion (MBD, e.g. MBD@rsSCS), and non-local correlation
226-
functionals (VV10, rVV10, vdW-DF family, XDM).
225+
many-body dispersion (MBD, e.g. MBD@rsSCS), and exchange-hole based XDM.
226+
In literature, `DFT-D` is often used as an umbrella label; this schema stores
227+
the concrete generation explicitly when available (e.g. D2, D3, D3BJ, D4).
227228
228229
References
229230
----------
@@ -232,13 +233,12 @@ class ExplicitDispersionModel(BaseModelMethod):
232233
• S. Grimme et al., J. Chem. Phys. 136, 154105 (2012) - DFT-D3(BJ)
233234
• A. Tkatchenko, M. Scheffler, Phys. Rev. Lett. 102, 073005 (2009) - TS
234235
• A. Tkatchenko et al., Phys. Rev. Lett. 108, 236402 (2012) - MBD
235-
• O. A. Vydrov, T. Van Voorhis, J. Chem. Phys. 133, 244103 (2010) - VV10
236236
• C. Steinmann, WIREs Comput. Mol. Sci. 10, e1438 (2020) - overview
237237
"""
238238

239239
model = Quantity(
240240
type=MEnum(
241-
# Pairwise / density-dependent
241+
# Pairwise / density-dependent empirical models
242242
'D2',
243243
'D3',
244244
'D3BJ',
@@ -252,26 +252,12 @@ class ExplicitDispersionModel(BaseModelMethod):
252252
'MBD@rsSCS',
253253
# Exchange-hole based
254254
'XDM',
255-
# Non-local correlation functionals
256-
'VV10',
257-
'rVV10',
258-
'vdW-DF',
259-
'vdW-DF2',
260-
'optB88-vdW',
261-
'optB86b-vdW',
262-
'SCAN+rVV10',
263-
'BEEF-vdW',
264255
),
265256
description="""
266-
Identifier of the explicit dispersion / vdW model.
257+
Identifier of the empirical dispersion correction model.
267258
""",
268259
)
269260

270-
is_embedded_in_xc = Quantity(
271-
type=bool,
272-
description='True if dispersion is part of the XC functional (e.g. SCAN+rVV10).',
273-
)
274-
275261
damping_function = Quantity(
276262
type=MEnum('zero', 'BJ', 'fermi', 'rational'),
277263
description='Short-range damping: D3{zero,BJ}, TS{fermi}, XDM{rational}.',
@@ -283,12 +269,6 @@ class ExplicitDispersionModel(BaseModelMethod):
283269
description="Base XC functional used/tuned for (e.g. 'PBE', 'SCAN', 'B3LYP').",
284270
)
285271

286-
# Kernel family choice, when applicable. This is a model identifier, not a numerical knob.
287-
nonlocal_kernel = Quantity(
288-
type=MEnum('DRSLL', 'LMKLL', 'VV10', 'rVV10'),
289-
description='Nonlocal correlation kernel flavor (when applicable).',
290-
)
291-
292272

293273
class RelativityModel(BaseModelMethod):
294274
"""

src/nomad_simulations/schema_packages/numerical_settings.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,9 @@ class SolvationSettings(NumericalSettings):
12871287
)
12881288

12891289

1290-
class DispersionKnob(ArchiveSection):
1290+
class EmpiricalDispersionKnob(ArchiveSection):
12911291
"""
1292-
A single typed numerical knob for an explicit dispersion / vdW correction.
1292+
A single typed numerical knob for an empirical dispersion correction.
12931293
12941294
This is a "typed physical constraint" record: it stores one scalar value
12951295
together with semantics that disambiguate what the value controls.
@@ -1305,14 +1305,12 @@ class DispersionKnob(ArchiveSection):
13051305
'a1',
13061306
'a2',
13071307
'sR',
1308-
# Nonlocal kernel parameter
1309-
'b',
13101308
# Many-body screening / range separation
13111309
'beta',
13121310
),
13131311
description="""
13141312
Identifies the dispersion parameter using standard notation.
1315-
(e.g. s6, a1, beta, b).
1313+
(e.g. s6, a1, beta).
13161314
13171315
All dispersion knobs are dimensionless.
13181316
""",
@@ -1323,7 +1321,6 @@ class DispersionKnob(ArchiveSection):
13231321
'pairwise',
13241322
'three_body_atm',
13251323
'many_body',
1326-
'nonlocal_kernel',
13271324
'density_partitioning',
13281325
),
13291326
description="""
@@ -1339,13 +1336,13 @@ class DispersionKnob(ArchiveSection):
13391336
)
13401337

13411338

1342-
class DispersionSettings(NumericalSettings):
1339+
class EmpiricalDispersionSettings(NumericalSettings):
13431340
"""
1344-
Numerical and evaluation settings for an explicit dispersion / vdW correction.
1341+
Numerical and evaluation settings for an empirical dispersion correction.
13451342
13461343
This section contains discrete switches and environment choices (e.g. whether
13471344
to include higher-order dispersion terms, which density partitioning is used),
1348-
as well as typed scalar parameters stored as `DispersionKnob`.
1345+
as well as typed scalar parameters stored as `EmpiricalDispersionKnob`.
13491346
"""
13501347

13511348
# switches for term inclusion / order
@@ -1405,14 +1402,14 @@ class DispersionSettings(NumericalSettings):
14051402

14061403
# typed scalar parameters
14071404
knobs = SubSection(
1408-
sub_section=DispersionKnob.m_def,
1405+
sub_section=EmpiricalDispersionKnob.m_def,
14091406
repeats=True,
14101407
description="""
14111408
Typed scalar parameters (knobs) for the dispersion correction.
14121409
14131410
Examples:
14141411
• D3BJ: s6/s8 (pairwise), a1/a2 (pairwise), optionally s9 (three_body_atm)
1415-
rVV10: b (nonlocal_kernel)
1412+
MBD@rsSCS: beta (many_body)
14161413
""",
14171414
)
14181415

tests/test_model_method.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
DFT,
1111
TB,
1212
ActiveSpace,
13-
ExplicitDispersionModel,
13+
EmpiricalDispersionModel,
1414
ImplicitSolvationModel,
1515
MultireferencePT,
1616
MultireferenceSCF,
@@ -630,7 +630,7 @@ def test_dft_contributions_solvation_dispersion_relativity_normalize():
630630
refractive_index=1.33,
631631
)
632632

633-
edm = ExplicitDispersionModel(
633+
edm = EmpiricalDispersionModel(
634634
model='D3BJ',
635635
damping_function='BJ',
636636
)
@@ -650,7 +650,7 @@ def test_dft_contributions_solvation_dispersion_relativity_normalize():
650650

651651
assert len(dft.contributions) == 3
652652
assert isinstance(dft.contributions[0], ImplicitSolvationModel)
653-
assert isinstance(dft.contributions[1], ExplicitDispersionModel)
653+
assert isinstance(dft.contributions[1], EmpiricalDispersionModel)
654654
assert isinstance(dft.contributions[2], RelativityModel)
655655

656656
# Solvation

tests/test_numerical_settings.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from nomad.units import ureg
55

66
from nomad_simulations.schema_packages.numerical_settings import (
7-
DispersionKnob,
8-
DispersionSettings,
7+
EmpiricalDispersionKnob,
8+
EmpiricalDispersionSettings,
99
KLinePath,
1010
KMesh,
1111
KSpaceFunctionalities,
@@ -491,27 +491,27 @@ def test_resolve_points(self, k_line_path: KLinePath):
491491
assert np.allclose(k_line_path.points, points)
492492

493493

494-
class TestDispersionSettings:
494+
class TestEmpiricalDispersionSettings:
495495
"""
496496
Tests for dispersion numerical settings schema:
497-
- typed physical constraints via DispersionKnob
498-
- container section DispersionSettings
497+
- typed physical constraints via EmpiricalDispersionKnob
498+
- container section EmpiricalDispersionSettings
499499
"""
500500

501501
def test_knobs_roundtrip_and_normalize_noop(self):
502502
"""
503503
Knobs should be storable and survive normalize() unchanged
504504
(no special normalization is defined currently).
505505
"""
506-
dns = DispersionSettings(
506+
dns = EmpiricalDispersionSettings(
507507
include_c8=True,
508508
include_three_body_atm=False,
509509
partition_scheme='Hirshfeld',
510510
density_source='valence-only',
511511
knobs=[
512-
DispersionKnob(kind='s6', applies_to='pairwise', value=1.0),
513-
DispersionKnob(kind='a1', applies_to='pairwise', value=0.40),
514-
DispersionKnob(kind='a2', applies_to='pairwise', value=4.00),
512+
EmpiricalDispersionKnob(kind='s6', applies_to='pairwise', value=1.0),
513+
EmpiricalDispersionKnob(kind='a1', applies_to='pairwise', value=0.40),
514+
EmpiricalDispersionKnob(kind='a2', applies_to='pairwise', value=4.00),
515515
],
516516
)
517517

@@ -543,7 +543,7 @@ def test_switch_fields(
543543
"""
544544
Basic storage test for the inclusion switches and max_dispersion_order.
545545
"""
546-
dns = DispersionSettings(
546+
dns = EmpiricalDispersionSettings(
547547
include_three_body_atm=include_three_body_atm,
548548
include_c8=include_c8,
549549
include_c10=include_c10,
@@ -570,7 +570,7 @@ def test_environment_fields(self, partition_scheme, charge_model, density_source
570570
"""
571571
Storage test for environment/charge/density-source categorical fields.
572572
"""
573-
dns = DispersionSettings(
573+
dns = EmpiricalDispersionSettings(
574574
partition_scheme=partition_scheme,
575575
charge_model=charge_model,
576576
density_source=density_source,
@@ -586,10 +586,12 @@ def test_multiple_knobs_same_kind_allowed(self):
586586
It should be allowed to store multiple knobs of the same kind if they
587587
apply to different contributions (or even if not, schema-wise).
588588
"""
589-
dns = DispersionSettings(
589+
dns = EmpiricalDispersionSettings(
590590
knobs=[
591-
DispersionKnob(kind='s9', applies_to='three_body_atm', value=1.0),
592-
DispersionKnob(kind='s9', applies_to='pairwise', value=0.0),
591+
EmpiricalDispersionKnob(
592+
kind='s9', applies_to='three_body_atm', value=1.0
593+
),
594+
EmpiricalDispersionKnob(kind='s9', applies_to='pairwise', value=0.0),
593595
]
594596
)
595597
dns.normalize(EntryArchive(), logger=logger)

0 commit comments

Comments
 (0)