You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very limited understanding of the materials side of our project. We have some code to generate slabs using pymatgen, however I noticed that on two different machines with identical software environments we get back a different integer number of slabs from SlabGenerator.get_slabs() . I think the root of the problem is when a Lattice is constructed with specific gamma/beta parameters that result in some of the entries in the lattice matrix being dominated by numerical error.
from pymatgen.core.lattice import Lattice
a = 4.49919228
b = 7.361330199082434
c = 30.60553418277412
alpha = 100.89339464913091
beta = 90.0
# gamma = 90.0
gamma = 0.0
Lattice.from_parameters(a, b, c, alpha, beta, gamma)
Using gamma = 0 , puts a value ~ 1e-16 into lattice matrix position [1,0], that is seems to be completely error or due to floating point error on the machine / underlying library.
These types of lattice matrices are initialized inside our call to get_slabs() and then passed through StructureMatcher, which eventually find their way into the call (inside of .fit/match/strict_match),
Here the small differences (1e-15) in the avg_l matrix lead to large differences in the returned value (0.2->0.6). The same python code run on two different machines, with identical environments), and change if a structure matches or not.
I am attaching an example where 6 slabs are generated, as they would be inside of a get_slabs() call, and then run through StructureMatcher. This code produces different results on two different machines with identical software setup. If the lattice matrix is rounded, it produces different but consistent results across the two machines.
Expected Behavior
I would expect SlabGenerator.get_slabs() to behave more robustly to numerical error introduced inside of the get_slabs() call that I cannot control as a caller. Maybe rounding the generated lattice matrices to 12 digits? or something one or two orders of magnitude above machine epsilon.
Python version
Python 3.9.12
Pymatgen version
2023.5.10
Operating system version
Ubuntu
Current behavior
I have a very limited understanding of the materials side of our project. We have some code to generate slabs using pymatgen, however I noticed that on two different machines with identical software environments we get back a different integer number of slabs from SlabGenerator.get_slabs() . I think the root of the problem is when a Lattice is constructed with specific gamma/beta parameters that result in some of the entries in the lattice matrix being dominated by numerical error.
Using gamma = 0 , puts a value ~ 1e-16 into lattice matrix position [1,0], that is seems to be completely error or due to floating point error on the machine / underlying library.
These types of lattice matrices are initialized inside our call to get_slabs() and then passed through StructureMatcher, which eventually find their way into the call (inside of .fit/match/strict_match),
Here the small differences (1e-15) in the avg_l matrix lead to large differences in the returned value (0.2->0.6). The same python code run on two different machines, with identical environments), and change if a structure matches or not.
https://app.circleci.com/pipelines/github/Open-Catalyst-Project/Open-Catalyst-Dataset/140/workflows/d34fe055-e7a3-4e87-87b2-fd51dbe99837/jobs/286 (local machine vs circleci with identical enviornments)
I am attaching an example where 6 slabs are generated, as they would be inside of a get_slabs() call, and then run through StructureMatcher. This code produces different results on two different machines with identical software setup. If the lattice matrix is rounded, it produces different but consistent results across the two machines.
Expected Behavior
I would expect SlabGenerator.get_slabs() to behave more robustly to numerical error introduced inside of the get_slabs() call that I cannot control as a caller. Maybe rounding the generated lattice matrices to 12 digits? or something one or two orders of magnitude above machine epsilon.
Minimal example
Relevant files to reproduce this bug
No response
The text was updated successfully, but these errors were encountered: