LAMMPS simulation can typically have multiple million atoms, while the ase package was initially designed for quantum mechanical simulations with thousand or less atoms. So here we present some simple benchmarks to check the performance of the ase package and the lammpsparser package.
Here is the code I used for benchmarking:
import sys
from time import time
from ase.build import bulk
from pickle import dumps
from tqdm import tqdm
def create(size):
structure = bulk("Al", cubic=True)
t1 = time()
structure = structure.repeat([size, size, size])
t2 = time()
size_in_mb = sys.getsizeof(dumps(structure)) / 1024/ 1024
size_in_number_of_atoms = len(structure)
time_in_seconds = t2-t1
return size_in_number_of_atoms, size_in_mb, time_in_seconds
if __name__ == "__main__":
print([create(size=i) for i in tqdm(range(10,150,10))])
The results are:
[
(4000, 0.12269783020019531, 0.003361940383911133),
(32000, 0.977198600769043, 0.025606155395507812),
(108000, 3.2965383529663086, 0.08634591102600098),
(256000, 7.813139915466309, 0.2064661979675293),
(500000, 15.259428977966309, 0.398144006729126),
(864000, 26.36782741546631, 0.6865091323852539),
(1372000, 41.87075710296631, 1.0926802158355713),
(2048000, 62.50063991546631, 1.6208710670471191),
(2916000, 88.98989772796631, 2.3232688903808594),
(4000000, 122.07095241546631, 3.1425390243530273),
(5324000, 162.4762258529663, 4.220289707183838),
(6912000, 210.9381399154663, 5.514358997344971),
(8788000, 268.1891164779663, 6.996487855911255),
(10976000, 334.9615774154663, 8.698269128799438)
]
I then adjusted the test to benchmark the write performance of the lammpsparser package:
import os
from time import time
from ase.build import bulk
from pickle import dumps
from tqdm import tqdm
from lammpsparser import write_lammps_structure
def create(size):
structure = bulk("Al", cubic=True)
structure = structure.repeat([size, size, size])
file_name = "lammps.data"
t1 = time()
write_lammps_structure(
structure=structure,
potential_elements=["Al"],
units="metal",
file_name=file_name,
working_directory=".",
)
t2 = time()
size_in_mb = os.path.getsize(file_name) / 1024/ 1024
size_in_number_of_atoms = len(structure)
time_in_seconds = t2-t1
return size_in_number_of_atoms, size_in_mb, time_in_seconds
if __name__ == "__main__":
print([create(size=i) for i in tqdm(range(10,150,10))])
The results are:
[
(4000, 0.24039363861083984, 0.034101009368896484),
(32000, 1.961777687072754, 0.27594637870788574),
(108000, 6.7177534103393555, 0.8314297199249268),
(256000, 16.236376762390137, 1.995485782623291),
(500000, 32.009196281433105, 3.9114339351654053),
(864000, 55.61549663543701, 6.88223123550415),
(1372000, 88.98933124542236, 11.129390001296997),
(2048000, 133.64513111114502, 16.53383994102478),
(2916000, 191.05537128448486, 23.77317786216736),
(4000000, 262.8222246170044, 32.67567992210388),
(5324000, 350.5478639602661, 42.83903193473816),
(6912000, 455.8344621658325, 54.94189381599426),
(8788000, 580.2841920852661, 71.13963007926941),
(10976000, 726.4300146102905, 88.48472595214844)
]
All the benchmarks were done on an MacBook Pro with an Apple M2 Max processor and 32GB of memory. So your results may vary depending on your hardware.
LAMMPS simulation can typically have multiple million atoms, while the
asepackage was initially designed for quantum mechanical simulations with thousand or less atoms. So here we present some simple benchmarks to check the performance of theasepackage and thelammpsparserpackage.Here is the code I used for benchmarking:
The results are:
I then adjusted the test to benchmark the write performance of the
lammpsparserpackage:The results are:
All the benchmarks were done on an MacBook Pro with an Apple M2 Max processor and 32GB of memory. So your results may vary depending on your hardware.