Skip to content

Rebo2Scr seems to calculate randomly wrong forces when using OpenMP Parallel #19

Description

@threich

When calculating the forces in an amorphous C slab using Rebo2Scr within the python ase-interface and several threads, the result seems to be random. When using the following script (the script and the structure are attached in the zip file below)

from atomistica import Rebo2Scr
import ase.io

a = ase.io.read('struct.extxyz')
calc = Rebo2Scr()
a.set_calculator(calc)

for i in range(30):
    print(a.get_forces() ** 2).sum(1).max()

the result obtained using OMP_NUM_THREADS=1 is in all print statements 9.83344680117e-05.
However, when using e.g. OMP_NUM_THREADS=20 the results are very different, e.g.:
0.0787229654406
9.83344680117e-05
9.83344680117e-05
0.204342136593
0.00617123803722
9.83344680117e-05
0.293423808598
0.00141455572593
9.83344680117e-05
9.83344680117e-05
0.0624515880291
0.0556148664835
9.83344680117e-05
0.00617123803722
9.83344680117e-05
9.83344680117e-05
9.83344680117e-05
9.83344680117e-05
0.0952089154343
0.10312023489
9.83344680117e-05
0.134743528249
0.0787578185209
9.83344680117e-05
1.17992497141
0.634367892818
9.83344680117e-05
9.83344680117e-05
0.0156597251095
0.0891190587402

The scattering seems to increase with the number of atoms and the number of threads.
The tested versions include v0.4.1, 0.6.0 and 0.7.0 using ase 3.16.2.
MWE.zip

The problem vanishes when using Rebo2 instead of Rebo2Scr.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions