summaryrefslogtreecommitdiff
path: root/benchmark.py
blob: 26bde5708629f05c0a07180511a8ed610f281f2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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}")