ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/calc_eam.F90
(Generate patch)

Comparing trunk/OOPSE/libmdtools/calc_eam.F90 (file contents):
Revision 669 by chuckv, Thu Aug 7 00:47:33 2003 UTC vs.
Revision 801 by chuckv, Sat Oct 4 18:46:12 2003 UTC

# Line 51 | Line 51 | module eam
51  
52  
53    !! Arrays for derivatives used in force calculation
54 <  real( kind = dp),save, dimension(:), allocatable :: frho
55 <  real( kind = dp),save, dimension(:), allocatable :: rho
54 >  real( kind = dp), dimension(:), allocatable :: frho
55 >  real( kind = dp), dimension(:), allocatable :: rho
56  
57 <  real( kind = dp),save, dimension(:), allocatable :: dfrhodrho
58 <  real( kind = dp),save, dimension(:), allocatable :: d2frhodrhodrho
57 >  real( kind = dp), dimension(:), allocatable :: dfrhodrho
58 >  real( kind = dp), dimension(:), allocatable :: d2frhodrhodrho
59  
60  
61   !! Arrays for MPI storage
# Line 78 | Line 78 | module eam
78    end type EAMTypeList
79  
80  
81 <  type (eamTypeList) :: EAMList
81 >  type (eamTypeList), save :: EAMList
82  
83    !! standard eam stuff  
84  
# Line 89 | Line 89 | module eam
89    public :: newEAMtype
90    public :: calc_eam_prepair_rho
91    public :: calc_eam_preforce_Frho
92 <  
92 >  public :: clean_EAM
93  
94   contains
95  
# Line 164 | Line 164 | contains
164      integer :: alloc_stat
165      integer :: number_r, number_rho
166  
167 +
168 +    status = 0
169      if (EAMList%currentAddition == 0) then
170         call handleError("init_EAM_FF","No members in EAMList")
171         status = -1
172         return
173      end if
174  
175 <
174 <
175 >
176         do i = 1, EAMList%currentAddition
177  
178   ! Build array of r values
# Line 233 | Line 234 | contains
234   !       do i = 1, EAMList%currentAddition
235   !          EAMList%EAMParam(i)s%eam_atype_map(eam_atype(i)) = i
236   !       end do
236
237
237         !! Allocate arrays for force calculation
238 <          call allocateEAM(alloc_stat)
239 <          if (alloc_stat /= 0 ) then
240 <             status = -1
241 <             return
242 <          endif
243 <
238 >      
239 >       call allocateEAM(alloc_stat)
240 >       if (alloc_stat /= 0 ) then
241 >          write(*,*) "allocateEAM failed"
242 >          status = -1
243 >          return
244 >       endif
245 >    
246    end subroutine init_EAM_FF
247  
248   !! routine checks to see if array is allocated, deallocates array if allocated
# Line 258 | Line 259 | contains
259  
260  
261      nlocal = getNlocal()
262 <
262 >    status = 0
263   #ifdef IS_MPI
264      nrow = getNrow(plan_row)
265      ncol = getNcol(plan_col)
# Line 365 | Line 366 | contains
366  
367  
368    subroutine clean_EAM()
369 +  
370     ! clean non-IS_MPI first
371      frho = 0.0_dp
372      rho  = 0.0_dp
# Line 484 | Line 486 | contains
486      integer :: myid_atom2
487  
488   ! check to see if we need to be cleaned at the start of a force loop
487    
488    if (cleanme) then
489       call clean_EAM
490       cleanme = .false.
491    end if
489        
490  
494    
491  
492 +
493   #ifdef IS_MPI
494      myid_atom1 = atid_Row(atom1)
495      myid_atom2 = atid_Col(atom2)
# Line 502 | Line 499 | contains
499   #endif
500  
501      if (r.lt.EAMList%EAMParams(myid_atom1)%eam_rcut) then
505
502  
503  
504 +
505         call eam_splint(EAMList%EAMParams(myid_atom1)%eam_nr, &
506              EAMList%EAMParams(myid_atom1)%eam_rvals, &
507              EAMList%EAMParams(myid_atom1)%eam_rho_r, &
# Line 518 | Line 515 | contains
515   #else
516         rho(atom2) = rho(atom2) + rho_i_at_j
517   #endif
518 + !       write(*,*) atom1,atom2,r,rho_i_at_j
519         endif
520  
521         if (r.lt.EAMList%EAMParams(myid_atom2)%eam_rcut) then
# Line 537 | Line 535 | contains
535   #endif
536         endif
537  
540    
538  
539    end subroutine calc_eam_prepair_rho
540  
# Line 554 | Line 551 | contains
551      integer :: atype1
552      integer :: me
553      integer :: n_rho_points
554 <    ! reset clean forces to be true at top of calc rho.
558 <    cleanme = .true.
554 >
555    
556 < !! Scatter the electron density from  pre-pair calculation back to local atoms
556 >    cleanme = .true.
557 >    !! Scatter the electron density from  pre-pair calculation back to local atoms
558   #ifdef IS_MPI
559      call scatter(rho_row,rho,plan_row,eam_err)
560      if (eam_err /= 0 ) then
# Line 595 | Line 592 | contains
592         end if
593  
594  
595 <       frho(i) = u
596 <       dfrhodrho(i) = u1
597 <       d2frhodrhodrho(i) = u2
595 >       frho(atom) = u
596 >       dfrhodrho(atom) = u1
597 >       d2frhodrhodrho(atom) = u2
598         pot = pot + u
599 +
600      enddo
601  
602 <  
602 >  
603  
604   #ifdef IS_MPI
605      !! communicate f(rho) and derivatives back into row and column arrays
# Line 632 | Line 630 | contains
630      endif
631   #endif
632  
633 +  
634    end subroutine calc_eam_preforce_Frho
635  
636  
# Line 664 | Line 663 | contains
663      integer  :: mytype_atom1
664      integer  :: mytype_atom2
665  
667
666   !Local Variables
667      
668 +   ! write(*,*) "Frho: ", Frho(atom1)
669  
671
670      phab = 0.0E0_DP
671      dvpdr = 0.0E0_DP
672      d2vpdrdr = 0.0E0_DP
# Line 837 | Line 835 | contains
835   #endif
836            
837            if (molMembershipList(id1) .ne. molMembershipList(id2)) then
840            
838  
842
843
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines