Skip to content

Commit

Permalink
Added test_normalize for HubbardInteractions
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Feb 27, 2024
1 parent 8cb0c12 commit 840f15c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_atoms_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ def test_degeneracy(
resolved_degeneracy = orbital_state.resolve_degeneracy()
assert resolved_degeneracy == degeneracy

def test_normalize(self, orbital_state):
"""
Test the normalization of the `OrbitalsState`. Inputs are defined as the quantities of the `OrbitalsState` section.
"""
orbital_state.normalize(None, self.logger)
# assert orbital_state.degeneracy == 6
# assert orbital_state.occupation == 0.0


class TestCoreHole:
"""
Expand Down Expand Up @@ -173,7 +181,7 @@ def test_normalize(
self, core_hole, orbital_ref, n_excited_electrons, dscf_state, results
):
"""
Test the normalization of the `CoreHole` state. Inputs are defined as the quantities of the `CoreHole` section.
Test the normalization of the `CoreHole`. Inputs are defined as the quantities of the `CoreHole` section.
"""
core_hole.orbital_ref = orbital_ref
core_hole.n_excited_electrons = n_excited_electrons
Expand Down Expand Up @@ -261,3 +269,16 @@ def test_u_effective(
assert np.isclose(resolved_u_effective.to("eV").magnitude, u_effective)
else:
assert resolved_u_effective == u_effective

def test_normalize(self, hubbard_interactions):
"""
Test the normalization of the `HubbardInteractions`. Inputs are defined as the quantities of the `HubbardInteractions` section.
"""
hubbard_interactions.u_interaction = 3.0 * ureg("eV")
hubbard_interactions.u_interorbital_interaction = 1.0 * ureg("eV")
hubbard_interactions.j_hunds_coupling = 3.0 * ureg("eV")

hubbard_interactions.normalize(None, self.logger)
assert hubbard_interactions.u_effective == 2.0 * ureg("eV")
assert hubbard_interactions.u_interaction == 3.0 * ureg("eV")
assert hubbard_interactions.j_local_exchange_interaction == 1.0 * ureg("eV")
31 changes: 31 additions & 0 deletions tests/test_model_system.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright The NOMAD Authors.
#
# This file is part of NOMAD. See https://nomad-lab.eu for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import pytest

from simulationdataschema.model_system import AtomicCell


class TestAtomicCell:
@pytest.fixture(autouse=True)
def atomic_cell(self):
return AtomicCell(
lattice_vectors=[[1, 0, 0], [0, 1, 0], [0, 0, 1]],
positions=[[0, 0, 0], [0.5, 0.5, 0.5]],
species=["H", "O"],
)

0 comments on commit 840f15c

Please sign in to comment.