From 6234495c80fa3c8b946c16f93e80594fc02651ee Mon Sep 17 00:00:00 2001 From: Veronika Juraskova Date: Mon, 25 Nov 2024 22:06:27 +0000 Subject: [PATCH] Update water fixture --- tests/conftest.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 611640cb..4a66cb00 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ import mlptrain as mlt import pytest +import numpy as np from autode.atoms import Atom @@ -13,17 +14,6 @@ def h2(): return mlt.Molecule(atoms=atoms, charge=0, mult=1) -@pytest.fixture -def h2o(): - """Water molecule""" - atoms = [ - Atom('H', 2.32670, 0.51322, 0.0), - Atom('H', 1.03337, 0.70894, -0.89333), - Atom('O', 1.35670, 0.51322, 0.0), - ] - return mlt.Molecule(atoms=atoms, charge=0, mult=1) - - @pytest.fixture def h2_configuration(h2): system = mlt.System(h2, box=[50, 50, 50]) @@ -38,3 +28,18 @@ def h2o_configuration(h2o): config = system.random_configuration() return config + + +@pytest.fixture +def h2o(): + """Create a water molecule (H2O) for testing.""" + # Approximate coordinates for H2O with a 104.5° bond angle and 0.96 Å bond length + oxygen = Atom('O', 0.0, 0.0, 0.0) + hydrogen1 = Atom('H', 0.96, 0.0, 0.0) + hydrogen2 = Atom( + 'H', + -0.96 * np.cos(np.radians(104.5)), + 0.96 * np.sin(np.radians(104.5)), + 0.0, + ) + return mlt.Molecule(atoms=[oxygen, hydrogen1, hydrogen2], charge=0, mult=1)