Skip to content

Commit

Permalink
Update water fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
juraskov committed Nov 25, 2024
1 parent 24a9044 commit 6234495
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mlptrain as mlt
import pytest
import numpy as np
from autode.atoms import Atom


Expand All @@ -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])
Expand All @@ -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)

0 comments on commit 6234495

Please sign in to comment.