-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
542 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
subroutine energy_ele_DH(Eele) | ||
|
||
use const | ||
use pbc, only : pbc_vec_d | ||
use var_state, only : xyz, lambdaD | ||
use var_potential, only : ele_mp, nele, ele_cutoff, ele_coef | ||
|
||
implicit none | ||
|
||
real(PREC), intent(out) :: Eele | ||
|
||
integer :: imp1, imp2, iele | ||
real(PREC) :: dist | ||
real(PREC) :: e_ele, rcdist | ||
|
||
rcdist = 1.0_PREC / lambdaD | ||
e_ele = 0.0_PREC | ||
|
||
!$omp parallel do private(imp1,imp2,dist) reduction(+:e_ele) | ||
do iele = 1, nele | ||
|
||
imp1 = ele_mp(1, iele) | ||
imp2 = ele_mp(2, iele) | ||
|
||
dist = norm2(pbc_vec_d(xyz(:, ele_mp(1, iele)), xyz(:, ele_mp(2, iele)))) | ||
|
||
if (dist > ele_cutoff) cycle | ||
|
||
e_ele = e_ele + ele_coef /dist*exp(-dist*rcdist) | ||
|
||
end do | ||
!$omp end parallel do | ||
|
||
Eele = e_ele | ||
|
||
end subroutine energy_ele_DH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
subroutine force_ele_DH(forces) | ||
|
||
use const, only : PREC | ||
use pbc, only : pbc_vec_d | ||
use var_top, only : nmp | ||
use var_state, only : xyz, lambdaD | ||
use var_potential, only : ele_coef, ele_cutoff, nele, ele_mp | ||
|
||
implicit none | ||
|
||
real(PREC), intent(inout) :: forces(3, nmp) | ||
|
||
integer :: iele, imp1, imp2 | ||
real(PREC) :: dist1, dist2, rdist1 | ||
real(PREC) :: dvdw_dr, rcdist, cutoff2 | ||
real(PREC) :: v21(3), for(3) | ||
!character(ARRAY_MSG_ERROR) :: error_message | ||
|
||
! -------------------------------------------------------------------- | ||
|
||
cutoff2 = ele_cutoff ** 2 | ||
rcdist = 1.0_PREC / lambdaD | ||
|
||
!$omp do private(imp1,imp2,v21,dist2,dist1,rdist1,dvdw_dr,for) | ||
do iele = 1, nele | ||
imp1 = ele_mp(1, iele) | ||
imp2 = ele_mp(2, iele) | ||
|
||
v21(:) = pbc_vec_d(xyz(:,imp2), xyz(:,imp1)) | ||
|
||
dist2 = dot_product(v21,v21) | ||
|
||
if(dist2 > cutoff2) cycle | ||
|
||
! ----------------------------------------------------------------- | ||
dist1 = sqrt(dist2) | ||
rdist1 = 1.0 / dist1 | ||
|
||
dvdw_dr = ele_coef * rdist1 * rdist1 & | ||
* (rdist1 + rcdist) * exp(-dist1 * rcdist) | ||
|
||
|
||
!if(dvdw_dr > DE_MAX) then | ||
! write(error_message,*) 'force_ele_DH > DE_MAX', istep, grep, imp1, imp2, dist1, dvdw_dr, DE_MAX | ||
! write(6, '(a)') trim(error_message) | ||
! dvdw_dr = DE_MAX | ||
!end if | ||
|
||
for(1:3) = dvdw_dr * v21(1:3) | ||
forces(1:3, imp1) = forces(1:3, imp1) - for(1:3) | ||
forces(1:3, imp2) = forces(1:3, imp2) + for(1:3) | ||
end do | ||
!$omp end do nowait | ||
|
||
end subroutine force_ele_DH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
subroutine list_ele() | ||
|
||
use const | ||
use var_top, only : nmp_chain, imp_chain, nchains, has_charge | ||
use var_potential, only : nele, ele_mp | ||
|
||
implicit none | ||
|
||
integer :: ichain, jchain | ||
integer :: n, i, j, j_start, imp, jmp | ||
integer :: iele | ||
|
||
if (allocated(ele_mp)) then | ||
deallocate(ele_mp) | ||
endif | ||
|
||
do n = 1, 2 | ||
|
||
iele = 0 | ||
|
||
do ichain = 1, nchains | ||
|
||
do jchain = ichain, nchains | ||
|
||
do i = 1, nmp_chain(ichain) | ||
|
||
imp = imp_chain(i, ichain) | ||
|
||
if (.not. has_charge(imp)) cycle | ||
|
||
if (ichain == jchain) then | ||
j_start = i + 3 | ||
else | ||
j_start = 1 | ||
endif | ||
|
||
do j = j_start, nmp_chain(jchain) | ||
|
||
jmp = imp_chain(j, jchain) | ||
|
||
if (.not. has_charge(jmp)) cycle | ||
|
||
iele = iele + 1 | ||
|
||
if (n == 2) then | ||
ele_mp(1,iele) = imp | ||
ele_mp(2,iele) = jmp | ||
endif | ||
|
||
enddo | ||
enddo | ||
|
||
enddo | ||
enddo | ||
|
||
if (n == 1) then | ||
nele = iele | ||
allocate(ele_mp(2, nele)) | ||
endif | ||
enddo | ||
|
||
write(*,*) '#nele: ', nele | ||
|
||
end subroutine list_ele |
Oops, something went wrong.