Skip to content
This repository was archived by the owner on Dec 8, 2024. It is now read-only.

Commit 27fc2cb

Browse files
larsbratholmandersx
authored andcommitted
Bug fix to acsf fortran code (#77)
* Fixed bug, need to make gradients * gradients still no work * Updated tests to work with bug-free gradients * Removed imported modules not used anymore * Removed imported modules not used anymore
1 parent 4760e6c commit 27fc2cb

File tree

4 files changed

+1757
-1754
lines changed

4 files changed

+1757
-1754
lines changed

qml/ml/representations/facsf.f90

+2-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ subroutine fgenerate_acsf(coordinates, nuclear_charges, elements, &
234234
! The highest of the element indices for atoms j and k
235235
q = max(n,m) - 1
236236
! calculate the indices that the three body terms should be added to
237-
s = nelements * nbasis2 + nbasis3 * nabasis * (nelements * p + q) + 1
237+
s = nelements * nbasis2 + nbasis3 * nabasis * (-(p * (p + 1))/2 + q + nelements * p) + 1
238238
do l = 1, nbasis3
239239
! calculate the indices that the three body terms should be added to
240240
z = s + (l-1) * nabasis
@@ -523,7 +523,7 @@ subroutine fgenerate_acsf_and_gradients(coordinates, nuclear_charges, elements,
523523
d_ikdecay = - pi * (b - c) * sin(pi * rik * invcut) * 0.5d0 * invrik * invcut
524524

525525
! Get index of where the contributions of atoms i,j,k should be added
526-
s = nbasis3 * nabasis * (nelements * p + q) + 1
526+
s = nbasis3 * nabasis * (-(p * (p + 1))/2 + q + nelements * p) + 1
527527
do l = 1, nbasis3
528528
! Get index of where the contributions of atoms i,j,k should be added
529529
z = s + (l-1) * nabasis

0 commit comments

Comments
 (0)