| 66 |
|
real( kind = dp),save, dimension(:), allocatable :: frho_col |
| 67 |
|
real( kind = dp),save, dimension(:), allocatable :: rho_row |
| 68 |
|
real( kind = dp),save, dimension(:), allocatable :: rho_col |
| 69 |
+ |
real( kind = dp),save, dimension(:), allocatable :: rho_tmp |
| 70 |
|
real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_col |
| 71 |
|
real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho_row |
| 72 |
|
#endif |
| 223 |
|
0.0E0_DP, 0.0E0_DP, 'N') |
| 224 |
|
enddo |
| 225 |
|
|
| 225 |
– |
|
| 226 |
|
! current_rcut_max = EAMList%EAMParams(1)%eam_rcut |
| 227 |
|
!! find the smallest rcut for any eam atype |
| 228 |
|
! do i = 2, EAMList%currentAddition |
| 250 |
|
subroutine allocateEAM(status) |
| 251 |
|
integer, intent(out) :: status |
| 252 |
|
|
| 253 |
– |
integer :: nlocal |
| 253 |
|
#ifdef IS_MPI |
| 254 |
|
integer :: nrow |
| 255 |
|
integer :: ncol |
| 257 |
|
integer :: alloc_stat |
| 258 |
|
|
| 259 |
|
|
| 261 |
– |
nlocal = getNlocal() |
| 260 |
|
status = 0 |
| 261 |
|
#ifdef IS_MPI |
| 262 |
|
nrow = getNrow(plan_row) |
| 291 |
|
end if |
| 292 |
|
|
| 293 |
|
#ifdef IS_MPI |
| 294 |
+ |
|
| 295 |
+ |
if (allocated(rho_tmp)) deallocate(rho_tmp) |
| 296 |
+ |
allocate(rho_tmp(nlocal),stat=alloc_stat) |
| 297 |
+ |
if (alloc_stat /= 0) then |
| 298 |
+ |
status = -1 |
| 299 |
+ |
return |
| 300 |
+ |
end if |
| 301 |
|
|
| 302 |
+ |
|
| 303 |
|
if (allocated(frho_row)) deallocate(frho_row) |
| 304 |
|
allocate(frho_row(nrow),stat=alloc_stat) |
| 305 |
|
if (alloc_stat /= 0) then |
| 383 |
|
frho_col = 0.0_dp |
| 384 |
|
rho_row = 0.0_dp |
| 385 |
|
rho_col = 0.0_dp |
| 386 |
+ |
rho_tmp = 0.0_dp |
| 387 |
|
dfrhodrho_row = 0.0_dp |
| 388 |
|
dfrhodrho_col = 0.0_dp |
| 389 |
|
#endif |
| 532 |
|
EAMList%EAMParams(myid_atom2)%eam_rho_r_pp, & |
| 533 |
|
r, rho_j_at_i,drho,d2rho) |
| 534 |
|
|
| 535 |
< |
|
| 535 |
> |
|
| 536 |
|
|
| 537 |
|
|
| 538 |
|
#ifdef IS_MPI |
| 543 |
|
endif |
| 544 |
|
|
| 545 |
|
|
| 546 |
+ |
|
| 547 |
+ |
|
| 548 |
+ |
|
| 549 |
+ |
|
| 550 |
|
end subroutine calc_eam_prepair_rho |
| 551 |
|
|
| 552 |
|
|
| 572 |
|
write(errMsg,*) " Error scattering rho_row into rho" |
| 573 |
|
call handleError(RoutineName,errMesg) |
| 574 |
|
endif |
| 575 |
< |
call scatter(rho_col,rho,plan_col,eam_err) |
| 575 |
> |
call scatter(rho_col,rho_tmp,plan_col,eam_err) |
| 576 |
|
if (eam_err /= 0 ) then |
| 577 |
|
write(errMsg,*) " Error scattering rho_col into rho" |
| 578 |
|
call handleError(RoutineName,errMesg) |
| 579 |
|
endif |
| 580 |
+ |
|
| 581 |
+ |
rho(1:nlocal) = rho(1:nlocal) + rho_tmp(1:nlocal) |
| 582 |
|
#endif |
| 583 |
|
|
| 584 |
|
|
| 585 |
+ |
|
| 586 |
|
!! Calculate F(rho) and derivative |
| 587 |
|
do atom = 1, nlocal |
| 588 |
|
me = atid(atom) |
| 651 |
|
|
| 652 |
|
|
| 653 |
|
!! Does EAM pairwise Force calculation. |
| 654 |
< |
subroutine do_eam_pair(atom1,atom2,d,rij,r2,pot,f,do_pot,do_stress) |
| 654 |
> |
subroutine do_eam_pair(atom1, atom2, d, rij, r2, sw, vpair, fpair, & |
| 655 |
> |
pot, f, do_pot) |
| 656 |
|
!Arguments |
| 657 |
|
integer, intent(in) :: atom1, atom2 |
| 658 |
|
real( kind = dp ), intent(in) :: rij, r2 |
| 659 |
< |
real( kind = dp ) :: pot |
| 660 |
< |
real( kind = dp ), dimension(3,getNlocal()) :: f |
| 659 |
> |
real( kind = dp ) :: pot, sw, vpair |
| 660 |
> |
real( kind = dp ), dimension(3,nLocal) :: f |
| 661 |
|
real( kind = dp ), intent(in), dimension(3) :: d |
| 662 |
< |
logical, intent(in) :: do_pot, do_stress |
| 662 |
> |
real( kind = dp ), intent(inout), dimension(3) :: fpair |
| 663 |
> |
|
| 664 |
> |
logical, intent(in) :: do_pot |
| 665 |
|
|
| 666 |
|
real( kind = dp ) :: drdx,drdy,drdz |
| 667 |
|
real( kind = dp ) :: d2 |
| 814 |
|
f(3,atom2) = f(3,atom2) - fz |
| 815 |
|
#endif |
| 816 |
|
|
| 817 |
+ |
vpair = vpair + phab |
| 818 |
+ |
fpair(1) = fpair(1) + fx |
| 819 |
+ |
fpair(2) = fpair(2) + fy |
| 820 |
+ |
fpair(3) = fpair(3) + fz |
| 821 |
+ |
|
| 822 |
|
if (nmflag) then |
| 823 |
|
|
| 824 |
|
drhoidr = drha |
| 842 |
|
drhojdr*drhojdr*d2frhodrhodrho(atom1) |
| 843 |
|
#endif |
| 844 |
|
end if |
| 823 |
– |
|
| 824 |
– |
|
| 845 |
|
|
| 846 |
< |
|
| 827 |
< |
if (do_stress) then |
| 828 |
< |
|
| 829 |
< |
#ifdef IS_MPI |
| 830 |
< |
id1 = tagRow(atom1) |
| 831 |
< |
id2 = tagColumn(atom2) |
| 832 |
< |
#else |
| 833 |
< |
id1 = atom1 |
| 834 |
< |
id2 = atom2 |
| 835 |
< |
#endif |
| 836 |
< |
|
| 837 |
< |
if (molMembershipList(id1) .ne. molMembershipList(id2)) then |
| 838 |
< |
|
| 839 |
< |
tau_Temp(1) = tau_Temp(1) - d(1) * fx |
| 840 |
< |
tau_Temp(2) = tau_Temp(2) - d(1) * fy |
| 841 |
< |
tau_Temp(3) = tau_Temp(3) - d(1) * fz |
| 842 |
< |
tau_Temp(4) = tau_Temp(4) - d(2) * fx |
| 843 |
< |
tau_Temp(5) = tau_Temp(5) - d(2) * fy |
| 844 |
< |
tau_Temp(6) = tau_Temp(6) - d(2) * fz |
| 845 |
< |
tau_Temp(7) = tau_Temp(7) - d(3) * fx |
| 846 |
< |
tau_Temp(8) = tau_Temp(8) - d(3) * fy |
| 847 |
< |
tau_Temp(9) = tau_Temp(9) - d(3) * fz |
| 848 |
< |
|
| 849 |
< |
virial_Temp = virial_Temp + & |
| 850 |
< |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
| 851 |
< |
|
| 852 |
< |
endif |
| 853 |
< |
endif |
| 854 |
< |
endif |
| 855 |
< |
|
| 856 |
< |
|
| 846 |
> |
endif |
| 847 |
|
end subroutine do_eam_pair |
| 848 |
|
|
| 849 |
|
|