--- forces-edip.1.8.f Fri Apr 19 10:43:54 2002 +++ forces-edip.1.9.f Fri Apr 19 10:44:07 2002 @@ -2,7 +2,7 @@ C forces-edip.f C ------------- -C Version 1.8f +C Version 1.9f C Force and Energy Calculation with the C Environment-Dependent Interatomic Potential @@ -109,511 +109,510 @@ C u4 = 0.66; C ****************************************** - - subroutine init_EDIP() - implicit none + + subroutine init_EDIP() + implicit none C NOTE: you do not need these header files, since you will have to C customize the way that atoms are passed to the force subroutine C for your particular MD program. - include "edip_pot_include.h" - include "edip_neighbors_include.h" - - call input_edip_params() - par_bg=par_a - par_eta = par_delta/par_Qo - pot_cutoff = par_a - delta_safe = 0.2d0 - - end subroutine - + include "edip_pot_include.h" + include "edip_neighbors_include.h" + + call input_edip_params() + par_bg=par_a + par_eta = par_delta/par_Qo + pot_cutoff = par_a + delta_safe = 0.2d0 + + end subroutine + C ****************************************** - subroutine input_EDIP_params() - implicit none - - include "edip_pot_include.h" - - print *, "EDIP-Si parameters:" -C taken from Justo et al., Phys. Rev. B 58, 2539 (1998). - par_cap_A = 5.6714030d0 - par_cap_B = 2.0002804d0 - par_rh = 1.2085196d0 - par_a = 3.1213820d0 - par_sig = 0.5774108d0 - par_lam = 1.4533108d0 - par_gam = 1.1247945d0 - par_b = 3.1213820d0 - par_c = 2.5609104d0 - par_delta = 78.7590539d0 - par_mu = -0.6966326d0 - par_Qo = 312.1341346d0 - par_palp = 1.4074424d0 - par_bet = -0.0070975d0 - par_alp = 3.1083847d0 - print *, par_cap_A,par_cap_B,par_rh,par_a,par_sig - print *, par_lam,par_gam,par_b,par_c,par_delta - print *, par_mu,par_Qo,par_palp,par_bet,par_alp + subroutine input_EDIP_params() + implicit none + + include "edip_pot_include.h" + + print *, "EDIP-Si parameters:" +C taken from Justo et al., Phys. Rev. B 58, 2539 (1998). + par_cap_A = 5.6714030d0 + par_cap_B = 2.0002804d0 + par_rh = 1.2085196d0 + par_a = 3.1213820d0 + par_sig = 0.5774108d0 + par_lam = 1.4533108d0 + par_gam = 1.1247945d0 + par_b = 3.1213820d0 + par_c = 2.5609104d0 + par_delta = 78.7590539d0 + par_mu = -0.6966326d0 + par_Qo = 312.1341346d0 + par_palp = 1.4074424d0 + par_bet = -0.0070975d0 + par_alp = 3.1083847d0 + print *, par_cap_A,par_cap_B,par_rh,par_a,par_sig + print *, par_lam,par_gam,par_b,par_c,par_delta + print *, par_mu,par_Qo,par_palp,par_bet,par_alp + + end subroutine - end subroutine - C ****************************************** - - subroutine compute_forces_EDIP(N_own, pos, L_x, L_y, L_z, - & E_potential, f) - implicit none - + + subroutine compute_forces_EDIP(N_own, pos, L_x, L_y, L_z, + & E_potential, f) + implicit none + C ------------------------- VARIABLE DECLARATIONS ------------------------- - - - integer N_own - double precision pos(3,N_own) - double precision E_potential - double precision f(3,N_own) - double precision L_x, L_y, L_z - - include "edip_pot_include.h" - - include "edip_neighbors_include.h" - - integer i,j,k,l,n - double precision dx,dy,dz,r,rsqr,asqr - double precision rinv,rmainv,xinv,xinv3,den,Z,fZ - double precision dV2j,dV2ijx,dV2ijy,dV2ijz,pZ,dp - double precision temp0,temp1,temp2 - double precision Qort,muhalf,u5 - double precision rmbinv,winv,dwinv,tau,dtau,lcos,x,H - double precision winv_2lam,TdW_WdT_over_W - double precision dV3rij,dV3rik,dV3l - double precision dVdZ_sum - double precision dEdrl,dEdrlx,dEdrly,dEdrlz - double precision bmc,cmb3inv - double precision fjx,fjy,fjz,fkx,fky,fkz - - double precision s2_t0(MAX_NBRS_1) - double precision s2_t1(MAX_NBRS_1) - double precision s2_t2(MAX_NBRS_1) - double precision s2_t3(MAX_NBRS_1) - double precision s2_dx(MAX_NBRS_1) - double precision s2_dy(MAX_NBRS_1) - double precision s2_dz(MAX_NBRS_1) - double precision s2_r(MAX_NBRS_1) - integer n2 + + + integer N_own + double precision pos(3,N_own) + double precision E_potential + double precision f(3,N_own) + double precision L_x, L_y, L_z + + include "edip_pot_include.h" + include "edip_neighbors_include.h" + + integer i,j,k,l,n + double precision dx,dy,dz,r,rsqr,asqr + double precision rinv,rmainv,xinv,xinv3,den,Z,fZ + double precision dV2j,dV2ijx,dV2ijy,dV2ijz,pZ,dp + double precision temp0,temp1,temp2 + double precision Qort,muhalf,u5 + double precision rmbinv,winv,dwinv,tau,dtau,lcos,x,H + double precision winv_2lam,TdW_WdT_over_W + double precision dV3rij,dV3rik,dV3l + double precision dVdZ_sum + double precision dEdrl,dEdrlx,dEdrly,dEdrlz + double precision bmc,cmb3inv + double precision fjx,fjy,fjz,fkx,fky,fkz + + double precision s2_t0(MAX_NBRS_1) + double precision s2_t1(MAX_NBRS_1) + double precision s2_t2(MAX_NBRS_1) + double precision s2_t3(MAX_NBRS_1) + double precision s2_dx(MAX_NBRS_1) + double precision s2_dy(MAX_NBRS_1) + double precision s2_dz(MAX_NBRS_1) + double precision s2_r(MAX_NBRS_1) + integer n2 C size of s2[] - integer num2(MAX_NBRS_1) + integer num2(MAX_NBRS_1) C atom ID numbers for s2[] - - double precision s3_g(MAX_NBRS_1) - double precision s3_dg(MAX_NBRS_1) - double precision s3_rinv(MAX_NBRS_1) - double precision s3_dx(MAX_NBRS_1) - double precision s3_dy(MAX_NBRS_1) - double precision s3_dz(MAX_NBRS_1) - double precision s3_r(MAX_NBRS_1) - - integer n3 + + double precision s3_g(MAX_NBRS_1) + double precision s3_dg(MAX_NBRS_1) + double precision s3_rinv(MAX_NBRS_1) + double precision s3_dx(MAX_NBRS_1) + double precision s3_dy(MAX_NBRS_1) + double precision s3_dz(MAX_NBRS_1) + double precision s3_r(MAX_NBRS_1) + + integer n3 C size of s3[] - integer num3(MAX_NBRS_1) + integer num3(MAX_NBRS_1) C atom ID numbers for s3[] - - double precision sz_df(MAX_NBRS_1) - double precision sz_dx(MAX_NBRS_1) - double precision sz_dy(MAX_NBRS_1) - double precision sz_dz(MAX_NBRS_1) - double precision sz_r(MAX_NBRS_1) - integer nz + + double precision sz_df(MAX_NBRS_1) + double precision sz_dx(MAX_NBRS_1) + double precision sz_dy(MAX_NBRS_1) + double precision sz_dz(MAX_NBRS_1) + double precision sz_r(MAX_NBRS_1) + integer nz C size of sz[] - integer numz(MAX_NBRS_1) + integer numz(MAX_NBRS_1) C atom ID numbers for sz[] - - integer nj,nk,nl + + integer nj,nk,nl C indices for the store arrays - - double precision V2, V3, virial, virial_xyz(3) - double precision L_x_div_2, L_y_div_2, L_z_div_2 - - double precision coord_total - - integer fixZ, tricks_Zfix - parameter (fixZ = 0, tricks_Zfix = 5) - - L_x_div_2 = L_x/2.0D0 - L_y_div_2 = L_y/2.0D0 - L_z_div_2 = L_z/2.0D0 - - do i=1, N_own - f(1,i) = 0.0d0 - f(2,i) = 0.0d0 - f(3,i) = 0.0d0 - end do - - coord_total=0.0d0 - virial=0.0d0 - virial_xyz(1)= 0.0d0 - virial_xyz(2)= 0.0d0 - virial_xyz(3)= 0.0d0 - V2=0.0d0 - V3=0.0d0 - - + + double precision V2, V3, virial, virial_xyz(3) + double precision L_x_div_2, L_y_div_2, L_z_div_2 + + double precision coord_total + + integer fixZ, tricks_Zfix + parameter (fixZ = 0, tricks_Zfix = 5) + + L_x_div_2 = L_x/2.0D0 + L_y_div_2 = L_y/2.0D0 + L_z_div_2 = L_z/2.0D0 + + do i=1, N_own + f(1,i) = 0.0d0 + f(2,i) = 0.0d0 + f(3,i) = 0.0d0 + end do + + coord_total=0.0d0 + virial=0.0d0 + virial_xyz(1)= 0.0d0 + virial_xyz(2)= 0.0d0 + virial_xyz(3)= 0.0d0 + V2=0.0d0 + V3=0.0d0 + + C COMBINE COEFFICIENTS - - asqr = par_a*par_a - Qort = sqrt(par_Qo) - muhalf = par_mu*0.5D0 - u5 = u2*u4 - bmc = par_b-par_c - cmb3inv = 3.0D0/(par_c-par_b) - - - + + asqr = par_a*par_a + Qort = sqrt(par_Qo) + muhalf = par_mu*0.5D0 + u5 = u2*u4 + bmc = par_b-par_c + cmb3inv = 3.0D0/(par_c-par_b) + + C --- LEVEL 1: OUTER LOOP OVER ATOMS --- - - do i=1, N_own - + + do i=1, N_own + C RESET COORDINATION AND NEIGHBOR NUMBERS - - Z = 0.0d0 - n2 = 0 - n3 = 0 - nz = 0 - - + + Z = 0.0d0 + n2 = 0 + n3 = 0 + nz = 0 + + C --- LEVEL 2: LOOP PREPASS OVER PAIRS --- - - do n=p_nbrs(i), p_nbrs(i+1)-1 - j = neighbors(n) - - + + do n=p_nbrs(i), p_nbrs(i+1)-1 + j = neighbors(n) + + C TEST IF WITHIN OUTER CUTOFF - - dx = pos(1,j)-pos(1,i) - if (dx .gt. L_x_div_2) then - dx = dx - L_x - else if (dx .lt. -L_x_div_2) then - dx = dx + L_x - end if + + dx = pos(1,j)-pos(1,i) + if (dx .gt. L_x_div_2) then + dx = dx - L_x + else if (dx .lt. -L_x_div_2) then + dx = dx + L_x + end if C dx periodic - if(dabs(dx) < par_a) then - dy = pos(2,j)-pos(2,i) - if (dy .gt. L_y_div_2) then - dy = dy - L_y - else if (dy .lt. -L_y_div_2) then - dy = dy + L_y - end if + if(dabs(dx) < par_a) then + dy = pos(2,j)-pos(2,i) + if (dy .gt. L_y_div_2) then + dy = dy - L_y + else if (dy .lt. -L_y_div_2) then + dy = dy + L_y + end if C dy periodic - if(dabs(dy) < par_a) then - dz = pos(3,j)-pos(3,i) - if (dz .gt. L_z_div_2) then - dz = dz - L_z - else if (dz .lt. -L_z_div_2) then - dz = dz + L_z - end if + if(dabs(dy) < par_a) then + dz = pos(3,j)-pos(3,i) + if (dz .gt. L_z_div_2) then + dz = dz - L_z + else if (dz .lt. -L_z_div_2) then + dz = dz + L_z + end if C dy periodic - if(dabs(dz) < par_a) then - rsqr = dx*dx + dy*dy + dz*dz - if(rsqr < asqr) then - r = sqrt(rsqr) - rinv = 1.0d0/r - dx = dx * rinv - dy = dy * rinv - dz = dz * rinv - + if(dabs(dz) < par_a) then + rsqr = dx*dx + dy*dy + dz*dz + if(rsqr < asqr) then + r = sqrt(rsqr) + rinv = 1.0d0/r + dx = dx * rinv + dy = dy * rinv + dz = dz * rinv + C PARTS OF TWO-BODY INTERACTION r