diff options
Diffstat (limited to 'benchmark.py')
-rw-r--r-- | benchmark.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/benchmark.py b/benchmark.py new file mode 100644 index 0000000..26bde57 --- /dev/null +++ b/benchmark.py @@ -0,0 +1,46 @@ +import sys +import numpy as np +from timeit import default_timer as timer + +from interacticle import MoleculeCollection, LennardJones, Coulomb, Simulation + +from library import Argon + +setup = MoleculeCollection() + +setup.potential(LennardJones(39.948, 0.3395, 0.971)) + +for x in range(10): + for y in range(10): + for z in range(10): + setup.add(Argon, (0.2+0.5*x,0.2+0.5*y,0.2+0.5*z)) + +setup.domain_size = 5 +setup.tau = 0.0005 +setup.cutoff = 0.3395*2.5 +setup.target_temperature = 300 + +setup.max_lennard_jones = 2000 +setup.max_coulomb = 2000 + +setup.statistics_step = 100 +setup.neighborhood_step = int(sys.argv[1]) if len(sys.argv) == 2 else 100 + +simulation = Simulation(setup, opengl = False) +simulation.setup() +simulation.verbose = True + +neighborhood_sizes = [ ] + +start = timer() + +for i in range(10000): + simulation.evolve() + if i % setup.statistics_step == 0: + neighborhood_sizes.append(simulation.get_neighborhood_characteristics()[1]) + +duration = timer() - start + +updates_per_second = 10000 / duration + +print(f"{setup.neighborhood_step}, {updates_per_second:.2f}, {np.max(neighborhood_sizes):.2f}") |