Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add performance checks #539

Closed
wants to merge 9 commits into from
2 changes: 1 addition & 1 deletion gmso/tests/base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _topology(n_sites=100):
packed_system = mb.fill_box(
compound=ar,
n_compounds=n_sites,
box=mb.Box([3, 3, 3]),
density=1700,
)

return packed_system
Expand Down
48 changes: 48 additions & 0 deletions gmso/tests/test_performance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import pytest

from gmso.core.atom import Atom

Check notice

Code scanning / CodeQL

Unused import

Import of 'Atom' is not used.
from gmso.core.atom_type import AtomType

Check notice

Code scanning / CodeQL

Unused import

Import of 'AtomType' is not used.
from gmso.core.topology import Topology

Check notice

Code scanning / CodeQL

Unused import

Import of 'Topology' is not used.
from gmso.external import from_mbuild
from gmso.formats.gro import write_gro
from gmso.formats.lammpsdata import write_lammpsdata
from gmso.formats.mcf import write_mcf
from gmso.formats.top import write_top
from gmso.formats.xyz import write_xyz
from gmso.tests.base_test import BaseTest


class TestPerformance(BaseTest):
@pytest.mark.timeout(15)
def test_lammps_performance(self, n_typed_ar_system):
top = n_typed_ar_system(n_sites=10000)
write_lammpsdata(top, "data.ar")

@pytest.mark.timeout(15)
def test_mcf_performance(self, n_typed_ar_system):
top = n_typed_ar_system(n_sites=10000)
write_mcf(top, "ar.mcf")

@pytest.mark.timeout(15)
def test_top_performance(self, n_typed_ar_system):
top = n_typed_ar_system(n_sites=10000)
write_top(top, "ar.top")

@pytest.mark.timeout(5)
def test_xyz_performance(self, n_ar_system):
cmpd = n_ar_system(n_sites=10000)
top = from_mbuild(cmpd)
write_xyz(top, "ar.xyz")

@pytest.mark.timeout(5)
def test_gro_performance(self, n_ar_system):
cmpd = n_ar_system(n_sites=10000)
top = from_mbuild(cmpd)
write_gro(top, "ar.gro")

# TODO: Add test to check performance of loading in XML when more performant

@pytest.mark.timeout(20)
def test_from_mbuild_performance(self, n_ar_system):
cmpd = n_ar_system(n_sites=50000)
top = from_mbuild(cmpd)

Check notice

Code scanning / CodeQL

Unused local variable

Variable top is not used.