C forces-edip.f C ------------- C Version 1.9f C Force and Energy Calculation with the C Environment-Dependent Interatomic Potential C written by Martin Z. Bazant, C Department of Physics, Harvard University C April - October 1997 C (based on forces.c by Martin Z. Bazant, June 1994) c New address (2000): c Professor Martin Z. Bazant c Department of Mathematics 2-363B c Massachusetts Institute of Technology c Cambridge, MA 02139-4307 c E-mail: c bazant@math.mit.edu C translated from C to FORTRAN C by Noam Bernstein, noamb@cmt.harvard.edu, December 1997 C optimized by Xianglong Yuan, yuanx@mit.edu, April 2002 C COPYRIGHT NOTICE C ---------------- C forces-edip, copyright 1997 by Martin Z. Bazant and Harvard University. C Permission is granted to use forces-edip for academic use only, at C no cost. Unauthorized sale or commerical use of this software C is prohibited by United States copyright law. Any publication describing C research involving this software should contain the following citations, C at once and in this order, to give proper credit to the theoretical work and C fitting that produced EDIP and this subroutine: C 1. M. Z. Bazant and E. Kaxiras, Phys. Rev. Lett. 77, 4370 (1996). C 2. M. Z. Bazant, E. Kaxiras, J. F. Justo, Phys. Rev. B 56, 8542 (1997). C 3. J. F. Justo, M. Z. Bazant, E. Kaxiras, V. V. Bulatov, and S. Yip, C Phys. Rev. B 58, 2539 (1998). C C This software has been extensively tested for molecular dynamics simulations C on Sun, SGI and IBM architectures, but no guarantees are made. C WEBSITE C ------- C Updated versions of this software are available at the EDIP distribution site, C http://pelion.eas.harvard.edu/software/EDIP/ C Postscript files of related papers are available at the Kaxiras group web site C in the Department of Physics at Harvard University, http://pelion.eas.harvard.edu, C under 'Empirical Methods'. C A description of the algorithm used in this subroutine can be found C in the Ph.D. Thesis of M. Z. Bazant (1997), chapter 6, on the web at C http://pelion.eas.harvard.edu/~bazant/thesis/ C INTERFACE C --------- C compute_forces_EDIP(N, p, lx, ly, lz, E, f) C N : number of particles C p : array (3,N) of positions in Angstroms C E : returned energy in eV C f : returned forces array (3,N) in eV/Angstroms C C neighbors(p_nbrs(i)),...,neighbors(p_nbrs(i+1)) are the C atoms which are "neighbors" of atom i, using a standard Verlet C neighbor list. These are a global arrays, not passed, that are declared C in "edip_neighbors_include.h". This way of storing atomic positions C is not unique, and will require a customized patch to the main MD program. C C The parameters of the potential initialized in input_EDIP_params() are global C variables declared in "edip_pot_include.h". C C PARAMETERS C ---------- C par_cap_A,par_cap_B,par_rh,par_a,par_sig C par_lam,par_gam,par_b,par_c,par_delta C par_mu,par_Qo,par_palp,par_bet,par_alp C 5.6714030 2.0002804 1.2085196 3.1213820 0.5774108 C 1.4533108 1.1247945 3.1213820 2.5609104 78.7590539 C 0.6966326 312.1341346 1.4074424 0.0070975 3.1083847 C Connection between these parameters and those given in the paper, C Justo et al., Phys. Rev. B 58, 2539 (1998): C A((B/r)**rh-palp*exp(-bet*Z*Z)) = A'((B'/r)**rh-exp(-bet*Z*Z)) C so in the paper (') C A' = A*palp C B' = B * palp**(-1/rh) C eta = detla/Qo C Non-adjustable parameters for tau(Z) from Ismail & Kaxiras, 1993, C also in Bazant, Kaxiras, Justo, PRB (1997): C u1 = -0.165799; C u2 = 32.557; C u3 = 0.286198; C u4 = 0.66; C ****************************************** 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 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 end subroutine C ****************************************** 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 C size of s2[] 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 C size of s3[] 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 C size of sz[] integer numz(MAX_NBRS_1) C atom ID numbers for sz[] 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 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) C --- LEVEL 1: OUTER LOOP OVER ATOMS --- do i=1, N_own C RESET COORDINATION AND NEIGHBOR NUMBERS 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) 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 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 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 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 C PARTS OF TWO-BODY INTERACTION r