Skip to content

Commit a770bd1

Browse files
committed
add AtomsState.partial_charge
1 parent 46a4938 commit a770bd1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/nomad_simulations/schema_packages/atoms_state.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,16 @@ class AtomsState(ParticleState):
11141114
""",
11151115
)
11161116

1117+
partial_charge = Quantity(
1118+
type=np.float64,
1119+
unit='elementary_charge',
1120+
description="""
1121+
Atom-centered partial charge used in force fields or population analyses
1122+
(e.g., Mulliken, Hirshfeld, CM5, NPA, RESP). This quantity is distinct from
1123+
the formal integer oxidation-like `charge`.
1124+
""",
1125+
)
1126+
11171127
spin = Quantity(
11181128
type=np.int32,
11191129
default=0,

tests/test_atoms_state.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,21 @@ def test_atomic_number_to_symbol(self, atomic_number: int, chemical_symbol: str)
487487
atom_state.normalize(EntryArchive(), logger)
488488
assert atom_state.chemical_symbol == chemical_symbol
489489

490+
def test_partial_charge_is_independent_of_formal_charge(self):
491+
atom_state = AtomsState(
492+
chemical_symbol='O',
493+
charge=-1,
494+
partial_charge=-0.42 * ureg.elementary_charge,
495+
)
496+
atom_state.normalize(EntryArchive(), logger)
497+
498+
assert atom_state.charge == -1
499+
assert atom_state.partial_charge is not None
500+
assert (
501+
pytest.approx(atom_state.partial_charge.to('elementary_charge').magnitude)
502+
== -0.42
503+
)
504+
490505

491506
class TestCGBeadState:
492507
"""

0 commit comments

Comments
 (0)