Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address OMP issue for large systems #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/cmake/Findmstore.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ endif()
unset(_lib)
unset(_pkg)
unset(_url)
unset(_rev)
11 changes: 9 additions & 2 deletions src/multicharge/model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ subroutine get_amat_0d(self, mol, amat)
amat(:, :) = 0.0_wp

!$omp parallel do default(none) schedule(runtime) &
!$omp reduction(+:amat) shared(mol, self) &
!$omp shared(amat, mol, self) &
!$omp private(iat, izp, jat, jzp, gam, vec, r2, tmp)
do iat = 1, mol%nat
izp = mol%id(iat)
Expand All @@ -143,10 +143,13 @@ subroutine get_amat_0d(self, mol, amat)
r2 = vec(1)**2 + vec(2)**2 + vec(3)**2
gam = 1.0_wp / (self%rad(izp)**2 + self%rad(jzp)**2)
tmp = erf(sqrt(r2*gam))/sqrt(r2)
!$omp atomic
amat(jat, iat) = amat(jat, iat) + tmp
!$omp atomic
amat(iat, jat) = amat(iat, jat) + tmp
end do
tmp = self%eta(izp) + sqrt2pi / self%rad(izp)
!$omp atomic
amat(iat, iat) = amat(iat, iat) + tmp
end do

Expand Down Expand Up @@ -174,7 +177,7 @@ subroutine get_amat_3d(self, mol, wsc, alpha, amat)
call get_rec_trans(mol%lattice, rtrans)

!$omp parallel do default(none) schedule(runtime) &
!$omp reduction(+:amat) shared(mol, self, wsc, dtrans, rtrans, alpha, vol) &
!$omp shared(amat, mol, self, wsc, dtrans, rtrans, alpha, vol) &
!$omp private(iat, izp, jat, jzp, gam, wsw, vec, dtmp, rtmp)
do iat = 1, mol%nat
izp = mol%id(iat)
Expand All @@ -186,7 +189,9 @@ subroutine get_amat_3d(self, mol, wsc, alpha, amat)
vec = mol%xyz(:, iat) - mol%xyz(:, jat) - wsc%trans(:, wsc%tridx(img, jat, iat))
call get_amat_dir_3d(vec, gam, alpha, dtrans, dtmp)
call get_amat_rec_3d(vec, vol, alpha, rtrans, rtmp)
!$omp atomic
amat(jat, iat) = amat(jat, iat) + (dtmp + rtmp) * wsw
!$omp atomic
amat(iat, jat) = amat(iat, jat) + (dtmp + rtmp) * wsw
end do
end do
Expand All @@ -197,10 +202,12 @@ subroutine get_amat_3d(self, mol, wsc, alpha, amat)
vec = wsc%trans(:, wsc%tridx(img, iat, iat))
call get_amat_dir_3d(vec, gam, alpha, dtrans, dtmp)
call get_amat_rec_3d(vec, vol, alpha, rtrans, rtmp)
!$omp atomic
amat(iat, iat) = amat(iat, iat) + (dtmp + rtmp) * wsw
end do

dtmp = self%eta(izp) + sqrt2pi / self%rad(izp) - 2 * alpha / sqrtpi
!$omp atomic
amat(iat, iat) = amat(iat, iat) + dtmp
end do

Expand Down
1 change: 1 addition & 0 deletions subprojects/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/*/
json-fortran-8.2.5.wrap