Skip to content

Commit 3674fa4

Browse files
committed
Remove hard-coded force constants from tests.
1 parent 9b5089a commit 3674fa4

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

tests/test_ghostly.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ def test_toluene_to_pyridine():
7474
angles = mols[0].property("angle1")
7575
dihedrals = mols[0].property("dihedral1")
7676

77+
# Force constant for stiffening angles where the bridge atom is in a ring.
78+
k_kard_ring = 75
79+
7780
# Apply the ghost atom modifications.
78-
new_mols, _ = modify(mols)
81+
new_mols, _ = modify(mols, k_hard_ring=k_kard_ring)
7982

8083
# Get the new angles and dihedrals.
8184
new_angles = new_mols[0].property("angle1")
@@ -124,7 +127,7 @@ def test_toluene_to_pyridine():
124127

125128
# Functional form of the modified angles.
126129
# Bridge atom 1 is in a ring, so k_hard_ring (75) is used.
127-
expression = "75 [theta - 1.5708]^2"
130+
expression = f"{k_kard_ring} [theta - 1.5708]^2"
128131

129132
# Check that the original angles don't have the modified functional form.
130133
for p in angles.potentials():
@@ -161,8 +164,11 @@ def test_acetone_to_propenol():
161164
dihedrals0 = mols[0].property("dihedral0")
162165
dihedrals1 = mols[0].property("dihedral1")
163166

167+
# Force constant for stiffening angles.
168+
k_hard = 100
169+
164170
# Apply the ghost atom modifications.
165-
new_mols, _ = modify(mols)
171+
new_mols, _ = modify(mols, k_hard=k_hard)
166172

167173
# Get the new angles and dihedrals.
168174
new_angles0 = new_mols[0].property("angle0")
@@ -246,7 +252,7 @@ def test_acetone_to_propenol():
246252
]
247253

248254
# Functional form of the modified angles.
249-
expression = "100 [theta - 1.5708]^2"
255+
expression = f"{k_hard} [theta - 1.5708]^2"
250256

251257
# Check that the original angles don't have the modified functional form.
252258
for p in angles1.potentials():

0 commit comments

Comments
 (0)