Skip to content

Commit

Permalink
Improves performance of unit tests (#49)
Browse files Browse the repository at this point in the history
* Improved atomic function API

* Centroid function accepts multiple collections of atom groups

* Fixed centroid function and tests

* Changed AtomicFunction API

* Fixed merging issue

* Improve overall testing performance
  • Loading branch information
craabreu authored Jan 20, 2024
1 parent 62006ef commit 8fd36f9
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions cvpack/tests/test_cvpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def perform_common_tests(
serializer.serialize(collectiveVariable, pipe)
pipe.seek(0)
new_cv = serializer.deserialize(pipe)
new_cv.setUnusedForceGroup(0, context.getSystem())
context.getSystem().addForce(new_cv)
context.reinitialize(preserveState=True)
value1 = collectiveVariable.getValue(context)
Expand Down Expand Up @@ -468,7 +469,7 @@ def test_helix_rmsd_content():
)
assert str(excinfo.value) == "Atom N not found in residue TMP163"

start, end = 59, 80
start, end = 39, 51
helix_content = cvpack.HelixRMSDContent(residues[start:end], num_atoms)
helix_content.setUnusedForceGroup(0, model.system)
model.system.addForce(helix_content)
Expand Down Expand Up @@ -509,16 +510,6 @@ def select_atoms(stard, end):
assert cv_value / cv_value.unit == pytest.approx(computed_value)
perform_common_tests(helix_content, context)

start, end = 0, 80
helix_content2 = cvpack.HelixRMSDContent(residues[start:end], num_atoms)
helix_content2.setUnusedForceGroup(0, model.system)
model.system.addForce(helix_content2)
context.reinitialize(preserveState=True)
cv_value = helix_content2.getValue(context)
computed_value = compute_cv_value(select_atoms(start, end))
assert cv_value / cv_value.unit == pytest.approx(computed_value)
perform_common_tests(helix_content, context)


def test_helix_torsion_similarity():
"""
Expand Down

0 comments on commit 8fd36f9

Please sign in to comment.