--- trunk/OOPSE/libmdtools/calc_eam.F90 2003/08/07 00:47:33 669 +++ trunk/OOPSE/libmdtools/calc_eam.F90 2003/08/08 21:22:37 673 @@ -51,11 +51,11 @@ module eam !! Arrays for derivatives used in force calculation - real( kind = dp),save, dimension(:), allocatable :: frho - real( kind = dp),save, dimension(:), allocatable :: rho + real( kind = dp), dimension(:), allocatable :: frho + real( kind = dp), dimension(:), allocatable :: rho - real( kind = dp),save, dimension(:), allocatable :: dfrhodrho - real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho + real( kind = dp), dimension(:), allocatable :: dfrhodrho + real( kind = dp), dimension(:), allocatable :: d2frhodrhodrho !! Arrays for MPI storage @@ -89,7 +89,7 @@ module eam public :: newEAMtype public :: calc_eam_prepair_rho public :: calc_eam_preforce_Frho - + public :: clean_EAM contains @@ -233,8 +233,6 @@ contains ! do i = 1, EAMList%currentAddition ! EAMList%EAMParam(i)s%eam_atype_map(eam_atype(i)) = i ! end do - - !! Allocate arrays for force calculation call allocateEAM(alloc_stat) if (alloc_stat /= 0 ) then @@ -365,6 +363,7 @@ contains subroutine clean_EAM() + ! clean non-IS_MPI first frho = 0.0_dp rho = 0.0_dp @@ -484,15 +483,10 @@ contains integer :: myid_atom2 ! check to see if we need to be cleaned at the start of a force loop - - if (cleanme) then - call clean_EAM - cleanme = .false. - end if - + #ifdef IS_MPI myid_atom1 = atid_Row(atom1) myid_atom2 = atid_Col(atom2) @@ -502,9 +496,9 @@ contains #endif if (r.lt.EAMList%EAMParams(myid_atom1)%eam_rcut) then - + call eam_splint(EAMList%EAMParams(myid_atom1)%eam_nr, & EAMList%EAMParams(myid_atom1)%eam_rvals, & EAMList%EAMParams(myid_atom1)%eam_rho_r, & @@ -518,6 +512,7 @@ contains #else rho(atom2) = rho(atom2) + rho_i_at_j #endif +! write(*,*) atom1,atom2,r,rho_i_at_j endif if (r.lt.EAMList%EAMParams(myid_atom2)%eam_rcut) then @@ -537,7 +532,6 @@ contains #endif endif - end subroutine calc_eam_prepair_rho @@ -554,10 +548,10 @@ contains integer :: atype1 integer :: me integer :: n_rho_points - ! reset clean forces to be true at top of calc rho. - cleanme = .true. + -!! Scatter the electron density from pre-pair calculation back to local atoms + cleanme = .true. + !! Scatter the electron density from pre-pair calculation back to local atoms #ifdef IS_MPI call scatter(rho_row,rho,plan_row,eam_err) if (eam_err /= 0 ) then @@ -595,13 +589,14 @@ contains end if - frho(i) = u - dfrhodrho(i) = u1 - d2frhodrhodrho(i) = u2 + frho(atom) = u + dfrhodrho(atom) = u1 + d2frhodrhodrho(atom) = u2 pot = pot + u + enddo - + #ifdef IS_MPI !! communicate f(rho) and derivatives back into row and column arrays @@ -632,6 +627,7 @@ contains endif #endif + end subroutine calc_eam_preforce_Frho @@ -663,11 +659,10 @@ contains integer :: id1,id2 integer :: mytype_atom1 integer :: mytype_atom2 - !Local Variables - + ! write(*,*) "Frho: ", Frho(atom1) phab = 0.0E0_DP dvpdr = 0.0E0_DP