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

Comparing trunk/OOPSE/libmdtools/do_Forces.F90 (file contents):
Revision 439 by chuckv, Mon Mar 31 22:09:39 2003 UTC vs.
Revision 887 by mmeineke, Fri Dec 19 17:25:00 2003 UTC

# Line 4 | Line 4
4  
5   !! @author Charles F. Vardeman II
6   !! @author Matthew Meineke
7 < !! @version $Id: do_Forces.F90,v 1.6 2003-03-31 22:09:39 chuckv Exp $, $Date: 2003-03-31 22:09:39 $, $Name: not supported by cvs2svn $, $Revision: 1.6 $
7 > !! @version $Id: do_Forces.F90,v 1.39 2003-12-19 17:25:00 mmeineke Exp $, $Date: 2003-12-19 17:25:00 $, $Name: not supported by cvs2svn $, $Revision: 1.39 $
8  
9   module do_Forces
10    use force_globals
# Line 17 | Line 17 | module do_Forces
17    use dipole_dipole
18    use reaction_field
19    use gb_pair
20 +  use vector_class
21 +  use eam
22 +  use status
23   #ifdef IS_MPI
24    use mpiSimulation
25   #endif
# Line 27 | Line 30 | module do_Forces
30   #define __FORTRAN90
31   #include "fForceField.h"
32  
33 <  logical, save :: do_forces_initialized = .false.
33 >  logical, save :: do_forces_initialized = .false., haveRlist = .false.
34 >  logical, save :: havePolicies = .false.
35    logical, save :: FF_uses_LJ
36    logical, save :: FF_uses_sticky
37    logical, save :: FF_uses_dipoles
# Line 35 | Line 39 | module do_Forces
39    logical, save :: FF_uses_GB
40    logical, save :: FF_uses_EAM
41  
42 +  real(kind=dp), save :: rlist, rlistsq
43 +
44    public :: init_FF
45    public :: do_force_loop
46 +  public :: setRlistDF
47  
48 + #ifdef PROFILE
49 +  public :: getforcetime
50 +  real, save :: forceTime = 0
51 +  real :: forceTimeInitial, forceTimeFinal
52 + #endif
53 +
54   contains
55  
56 +  subroutine setRlistDF( this_rlist )
57 +    
58 +    real(kind=dp) :: this_rlist
59 +
60 +    rlist = this_rlist
61 +    rlistsq = rlist * rlist
62 +    
63 +    haveRlist = .true.
64 +    if( havePolicies ) do_forces_initialized = .true.
65 +
66 +  end subroutine setRlistDF    
67 +
68    subroutine init_FF(LJMIXPOLICY, use_RF_c, thisStat)
69  
70      integer, intent(in) :: LJMIXPOLICY
# Line 87 | Line 112 | contains
112      !! check to make sure the FF_uses_RF setting makes sense
113      
114      if (FF_uses_dipoles) then
90       rrf = getRrf()
91       rt = getRt()      
92       call initialize_dipole(rrf, rt)
115         if (FF_uses_RF) then
116            dielect = getDielect()
117 <          call initialize_rf(rrf, rt, dielect)
117 >          call initialize_rf(dielect)
118         endif
119      else
120         if (FF_uses_RF) then          
# Line 100 | Line 122 | contains
122            thisStat = -1
123            return
124         endif
125 <    endif
125 >    endif
126  
127      if (FF_uses_LJ) then
128        
107       call getRcut(rcut)
108
129         select case (LJMIXPOLICY)
130         case (LB_MIXING_RULE)
131 <          call init_lj_FF(LB_MIXING_RULE, rcut, my_status)            
131 >          call init_lj_FF(LB_MIXING_RULE, my_status)            
132         case (EXPLICIT_MIXING_RULE)
133 <          call init_lj_FF(EXPLICIT_MIXING_RULE, rcut, my_status)
133 >          call init_lj_FF(EXPLICIT_MIXING_RULE, my_status)
134         case default
135            write(default_error,*) 'unknown LJ Mixing Policy!'
136            thisStat = -1
# Line 129 | Line 149 | contains
149            return
150         end if
151      endif
152 +
153 +
154 +    if (FF_uses_EAM) then
155 +         call init_EAM_FF(my_status)
156 +       if (my_status /= 0) then
157 +          write(*,*) "init_EAM_FF returned a bad status"
158 +          thisStat = -1
159 +          return
160 +       end if
161 +    endif
162 +
163 +
164      
165      if (FF_uses_GB) then
166         call check_gb_pair_FF(my_status)
# Line 140 | Line 172 | contains
172  
173      if (FF_uses_GB .and. FF_uses_LJ) then
174      endif
175 +    if (.not. do_forces_initialized) then
176 +       !! Create neighbor lists
177 +       call expandNeighborList(getNlocal(), my_status)
178 +       if (my_Status /= 0) then
179 +          write(default_error,*) "SimSetup: ExpandNeighborList returned error."
180 +          thisStat = -1
181 +          return
182 +       endif
183 +    endif
184 +    
185  
186 +    havePolicies = .true.
187 +    if( haveRlist ) do_forces_initialized = .true.
188  
145    do_forces_initialized = .true.    
146
189    end subroutine init_FF
190    
191  
# Line 168 | Line 210 | contains
210      logical :: do_pot
211      logical :: do_stress
212   #ifdef IS_MPI
213 <    real( kind = DP ) :: pot_local = 0.0_dp
213 >    real( kind = DP ) :: pot_local
214      integer :: nrow
215      integer :: ncol
216 +    integer :: nprocs
217   #endif
218      integer :: nlocal
219      integer :: natoms    
220      logical :: update_nlist  
221      integer :: i, j, jbeg, jend, jnab
222      integer :: nlist
223 <    real( kind = DP ) ::  rijsq, rlistsq, rcutsq, rlist, rcut
223 >    real( kind = DP ) ::  rijsq
224      real(kind=dp),dimension(3) :: d
225      real(kind=dp) :: rfpot, mu_i, virial
226      integer :: me_i
# Line 186 | Line 229 | contains
229      integer :: listerror, error
230      integer :: localError
231  
232 +    real(kind=dp) :: listSkin = 1.0  
233 +
234      !! initialize local variables  
235  
236   #ifdef IS_MPI
237 +    pot_local = 0.0_dp
238      nlocal = getNlocal()
239      nrow   = getNrow(plan_row)
240      ncol   = getNcol(plan_col)
# Line 197 | Line 243 | contains
243      natoms = nlocal
244   #endif
245  
200    call getRcut(rcut,rc2=rcutsq)
201    call getRlist(rlist,rlistsq)
202    
246      call check_initialization(localError)
247      if ( localError .ne. 0 ) then
248 +       call handleError("do_force_loop","Not Initialized")
249         error = -1
250         return
251      end if
# Line 210 | Line 254 | contains
254      do_pot = do_pot_c
255      do_stress = do_stress_c
256  
257 +
258      ! Gather all information needed by all force loops:
259      
260   #ifdef IS_MPI    
# Line 226 | Line 271 | contains
271      endif
272      
273   #endif
274 <    
274 >
275 > !! Begin force loop timing:
276 > #ifdef PROFILE
277 >    call cpu_time(forceTimeInitial)
278 >    nloops = nloops + 1
279 > #endif
280 >  
281      if (FF_RequiresPrepairCalc() .and. SimRequiresPrepairCalc()) then
282         !! See if we need to update neighbor lists
283 <       call checkNeighborList(nlocal, q, rcut, rlist, update_nlist)  
283 >       call checkNeighborList(nlocal, q, listSkin, update_nlist)  
284         !! if_mpi_gather_stuff_for_prepair
285         !! do_prepair_loop_if_needed
286         !! if_mpi_scatter_stuff_from_prepair
287         !! if_mpi_gather_stuff_from_prepair_to_main_loop
288 <    else
289 <       !! See if we need to update neighbor lists
290 <       call checkNeighborList(nlocal, q, rcut, rlist, update_nlist)  
288 >    
289 > !--------------------PREFORCE LOOP----------->>>>>>>>>>>>>>>>>>>>>>>>>>>
290 > #ifdef IS_MPI
291 >    
292 >    if (update_nlist) then
293 >      
294 >       !! save current configuration, construct neighbor list,
295 >       !! and calculate forces
296 >       call saveNeighborList(nlocal, q)
297 >      
298 >       neighborListSize = size(list)
299 >       nlist = 0      
300 >      
301 >       do i = 1, nrow
302 >          point(i) = nlist + 1
303 >          
304 >          prepair_inner: do j = 1, ncol
305 >            
306 >             if (skipThisPair(i,j)) cycle prepair_inner
307 >            
308 >             call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
309 >            
310 >             if (rijsq < rlistsq) then            
311 >                
312 >                nlist = nlist + 1
313 >                
314 >                if (nlist > neighborListSize) then
315 >                   call expandNeighborList(nlocal, listerror)
316 >                   if (listerror /= 0) then
317 >                      error = -1
318 >                      write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded."
319 >                      return
320 >                   end if
321 >                   neighborListSize = size(list)
322 >                endif
323 >                
324 >                list(nlist) = j
325 >                call do_prepair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot_local)                      
326 >             endif
327 >          enddo prepair_inner
328 >       enddo
329 >
330 >       point(nrow + 1) = nlist + 1
331 >      
332 >    else  !! (of update_check)
333 >
334 >       ! use the list to find the neighbors
335 >       do i = 1, nrow
336 >          JBEG = POINT(i)
337 >          JEND = POINT(i+1) - 1
338 >          ! check thiat molecule i has neighbors
339 >          if (jbeg .le. jend) then
340 >            
341 >             do jnab = jbeg, jend
342 >                j = list(jnab)
343 >
344 >                call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
345 >                call do_prepair(i, j, rijsq, d, do_pot, do_stress, &
346 >                     u_l, A, f, t, pot_local)
347 >
348 >             enddo
349 >          endif
350 >       enddo
351      endif
352      
353 < #ifdef IS_MPI
353 > #else
354      
355      if (update_nlist) then
356        
357 +       ! save current configuration, contruct neighbor list,
358 +       ! and calculate forces
359 +       call saveNeighborList(natoms, q)
360 +      
361 +       neighborListSize = size(list)
362 +  
363 +       nlist = 0
364 +
365 +       do i = 1, natoms-1
366 +          point(i) = nlist + 1
367 +          
368 +          prepair_inner: do j = i+1, natoms
369 +            
370 +             if (skipThisPair(i,j))  cycle prepair_inner
371 +                          
372 +             call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
373 +          
374 +
375 +             if (rijsq < rlistsq) then
376 +
377 +          
378 +                nlist = nlist + 1
379 +              
380 +                if (nlist > neighborListSize) then
381 +                   call expandNeighborList(natoms, listerror)
382 +                   if (listerror /= 0) then
383 +                      error = -1
384 +                      write(DEFAULT_ERROR,*) "ERROR: nlist > list size and max allocations exceeded."
385 +                      return
386 +                   end if
387 +                   neighborListSize = size(list)
388 +                endif
389 +                
390 +                list(nlist) = j
391 +                
392 +                call do_prepair(i, j, rijsq, d, do_pot, do_stress, &
393 +                        u_l, A, f, t, pot)
394 +                
395 +             endif
396 +          enddo prepair_inner
397 +       enddo
398 +      
399 +       point(natoms) = nlist + 1
400 +      
401 +    else !! (update)
402 +  
403 +       ! use the list to find the neighbors
404 +       do i = 1, natoms-1
405 +          JBEG = POINT(i)
406 +          JEND = POINT(i+1) - 1
407 +          ! check thiat molecule i has neighbors
408 +          if (jbeg .le. jend) then
409 +            
410 +             do jnab = jbeg, jend
411 +                j = list(jnab)
412 +
413 +                call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
414 +                call do_prepair(i, j, rijsq, d, do_pot, do_stress, &
415 +                     u_l, A, f, t, pot)
416 +
417 +             enddo
418 +          endif
419 +       enddo
420 +    endif    
421 + #endif
422 +    !! Do rest of preforce calculations
423 +    !! do necessary preforce calculations  
424 +    call do_preforce(nlocal,pot)
425 +   ! we have already updated the neighbor list set it to false...
426 +   update_nlist = .false.
427 +    else
428 +       !! See if we need to update neighbor lists for non pre-pair
429 +       call checkNeighborList(nlocal, q, listSkin, update_nlist)  
430 +    endif
431 +
432 +
433 +
434 +
435 +
436 + !---------------------------------MAIN Pair LOOP->>>>>>>>>>>>>>>>>>>>>>>>>>>>
437 +
438 +
439 +
440 +
441 +  
442 + #ifdef IS_MPI
443 +    
444 +    if (update_nlist) then
445         !! save current configuration, construct neighbor list,
446         !! and calculate forces
447 <       call saveNeighborList(q)
447 >       call saveNeighborList(nlocal, q)
448        
449         neighborListSize = size(list)
450         nlist = 0      
# Line 259 | Line 458 | contains
458              
459               call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
460              
461 <             if (rijsq <  rlistsq) then            
461 >             if (rijsq < rlistsq) then            
462                  
463                  nlist = nlist + 1
464                  
# Line 275 | Line 474 | contains
474                  
475                  list(nlist) = j
476                                  
477 <                if (rijsq <  rcutsq) then
478 <                   call do_pair(i, j, rijsq, d, do_pot, do_stress, &
479 <                        u_l, A, f, t,pot)
281 <                endif
477 >                call do_pair(i, j, rijsq, d, do_pot, do_stress, &
478 >                     u_l, A, f, t, pot_local)
479 >                
480               endif
481            enddo inner
482         enddo
# Line 299 | Line 497 | contains
497  
498                  call get_interatomic_vector(q_Row(:,i), q_Col(:,j), d, rijsq)
499                  call do_pair(i, j, rijsq, d, do_pot, do_stress, &
500 <                     u_l, A, f, t,pot)
500 >                     u_l, A, f, t, pot_local)
501  
502               enddo
503            endif
# Line 309 | Line 507 | contains
507   #else
508      
509      if (update_nlist) then
510 <      
510 >
511         ! save current configuration, contruct neighbor list,
512         ! and calculate forces
513 <       call saveNeighborList(q)
513 >       call saveNeighborList(natoms, q)
514        
515         neighborListSize = size(list)
516    
# Line 328 | Line 526 | contains
526               call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
527            
528  
529 <             if (rijsq <  rlistsq) then
529 >             if (rijsq < rlistsq) then
530                  
531                  nlist = nlist + 1
532                
# Line 344 | Line 542 | contains
542                  
543                  list(nlist) = j
544                  
545 <                if (rijsq <  rcutsq) then
546 <                   call do_pair(i, j, rijsq, d, do_pot, do_stress, &
547 <                        u_l, A, f, t,pot)
350 <                endif
545 >                call do_pair(i, j, rijsq, d, do_pot, do_stress, &
546 >                        u_l, A, f, t, pot)
547 >                
548               endif
549            enddo inner
550         enddo
# Line 368 | Line 565 | contains
565  
566                  call get_interatomic_vector(q(:,i), q(:,j), d, rijsq)
567                  call do_pair(i, j, rijsq, d, do_pot, do_stress, &
568 <                     u_l, A, f, t,pot)
568 >                     u_l, A, f, t, pot)
569  
570               enddo
571            endif
# Line 378 | Line 575 | contains
575   #endif
576      
577      ! phew, done with main loop.
578 <    
578 >
579 > !! Do timing
580 > #ifdef PROFILE
581 >    call cpu_time(forceTimeFinal)
582 >    forceTime = forceTime + forceTimeFinal - forceTimeInitial
583 > #endif
584 >
585 >
586   #ifdef IS_MPI
587      !!distribute forces
588    
# Line 472 | Line 676 | contains
676   #ifdef IS_MPI
677  
678      if (do_pot) then
679 <       pot = pot_local
679 >       pot = pot + pot_local
680         !! we assume the c code will do the allreduce to get the total potential
681         !! we could do it right here if we needed to...
682      endif
683  
684      if (do_stress) then
685 <       call mpi_allreduce(tau, tau_Temp,9,mpi_double_precision,mpi_sum, &
685 >      call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, &
686              mpi_comm_world,mpi_err)
687 <       call mpi_allreduce(virial, virial_Temp,1,mpi_double_precision,mpi_sum, &
687 >       call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, &
688              mpi_comm_world,mpi_err)
689      endif
690  
# Line 490 | Line 694 | contains
694         tau = tau_Temp
695         virial = virial_Temp
696      endif
697 <
697 >    
698   #endif
699      
700 +    
701 +    
702    end subroutine do_force_loop
703  
704 <  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t,pot)
704 >  subroutine do_pair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot)
705  
706      real( kind = dp ) :: pot
707 <    real( kind = dp ), dimension(:,:) :: u_l
708 <    real (kind=dp), dimension(:,:) :: A
709 <    real (kind=dp), dimension(:,:) :: f
710 <    real (kind=dp), dimension(:,:) :: t
707 >    real( kind = dp ), dimension(3,getNlocal()) :: u_l
708 >    real (kind=dp), dimension(9,getNlocal()) :: A
709 >    real (kind=dp), dimension(3,getNlocal()) :: f
710 >    real (kind=dp), dimension(3,getNlocal()) :: t
711  
712      logical, intent(inout) :: do_pot, do_stress
713      integer, intent(in) :: i, j
# Line 511 | Line 717 | contains
717      logical :: is_LJ_i, is_LJ_j
718      logical :: is_DP_i, is_DP_j
719      logical :: is_GB_i, is_GB_j
720 +    logical :: is_EAM_i,is_EAM_j
721      logical :: is_Sticky_i, is_Sticky_j
722      integer :: me_i, me_j
723  
724      r = sqrt(rijsq)
725  
726   #ifdef IS_MPI
727 +    if (tagRow(i) .eq. tagColumn(j)) then
728 +       write(0,*) 'do_pair is doing', i , j, tagRow(i), tagColumn(j)
729 +    endif
730  
731      me_i = atid_row(i)
732      me_j = atid_col(j)
# Line 541 | Line 751 | contains
751         call getElementProperty(atypes, me_j, "is_DP", is_DP_j)
752        
753         if ( is_DP_i .and. is_DP_j ) then
544          
754            call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, &
755                 do_pot, do_stress)
756            if (FF_uses_RF .and. SimUsesRF()) then
# Line 566 | Line 775 | contains
775  
776      if (FF_uses_GB .and. SimUsesGB()) then
777  
778 +
779         call getElementProperty(atypes, me_i, "is_GB", is_GB_i)
780         call getElementProperty(atypes, me_j, "is_GB", is_GB_j)
781        
# Line 575 | Line 785 | contains
785         endif
786      endif
787      
788 +
789 +  
790 +   if (FF_uses_EAM .and. SimUsesEAM()) then
791 +      call getElementProperty(atypes, me_i, "is_EAM", is_EAM_i)
792 +      call getElementProperty(atypes, me_j, "is_EAM", is_EAM_j)
793 +      
794 +      if ( is_EAM_i .and. is_EAM_j ) &
795 +           call do_eam_pair(i, j, d, r, rijsq, pot, f, do_pot, do_stress)
796 +   endif
797 +
798 +
799 +
800 +
801    end subroutine do_pair
802 +
803 +
804 +
805 +  subroutine do_prepair(i, j, rijsq, d, do_pot, do_stress, u_l, A, f, t, pot)
806 +   real( kind = dp ) :: pot
807 +   real( kind = dp ), dimension(3,getNlocal()) :: u_l
808 +   real (kind=dp), dimension(9,getNlocal()) :: A
809 +   real (kind=dp), dimension(3,getNlocal()) :: f
810 +   real (kind=dp), dimension(3,getNlocal()) :: t
811 +  
812 +   logical, intent(inout) :: do_pot, do_stress
813 +   integer, intent(in) :: i, j
814 +   real ( kind = dp ), intent(inout)    :: rijsq
815 +   real ( kind = dp )                :: r
816 +   real ( kind = dp ), intent(inout) :: d(3)
817 +  
818 +   logical :: is_EAM_i, is_EAM_j
819 +  
820 +   integer :: me_i, me_j
821 +  
822 +   r = sqrt(rijsq)
823 +  
824 +
825 + #ifdef IS_MPI
826 +   if (tagRow(i) .eq. tagColumn(j)) then
827 +      write(0,*) 'do_pair is doing', i , j, tagRow(i), tagColumn(j)
828 +   endif
829 +  
830 +   me_i = atid_row(i)
831 +   me_j = atid_col(j)
832 +  
833 + #else
834 +  
835 +   me_i = atid(i)
836 +   me_j = atid(j)
837 +  
838 + #endif
839 +    
840 +   if (FF_uses_EAM .and. SimUsesEAM()) then
841 +      call getElementProperty(atypes, me_i, "is_EAM", is_EAM_i)
842 +      call getElementProperty(atypes, me_j, "is_EAM", is_EAM_j)
843 +      
844 +      if ( is_EAM_i .and. is_EAM_j ) &
845 +           call calc_EAM_prepair_rho(i, j, d, r, rijsq )
846 +   endif
847  
848 + end subroutine do_prepair
849  
850 +
851 +
852 +
853 +  subroutine do_preforce(nlocal,pot)
854 +    integer :: nlocal
855 +    real( kind = dp ) :: pot
856 +
857 +    if (FF_uses_EAM .and. SimUsesEAM()) then
858 +       call calc_EAM_preforce_Frho(nlocal,pot)
859 +    endif
860 +
861 +
862 +  end subroutine do_preforce
863 +  
864 +  
865    subroutine get_interatomic_vector(q_i, q_j, d, r_sq)
866      
867      real (kind = dp), dimension(3) :: q_i
868      real (kind = dp), dimension(3) :: q_j
869      real ( kind = dp ), intent(out) :: r_sq
870 <    real( kind = dp ) :: d(3)
871 <    real( kind = dp ) :: d_old(3)
872 <    d(1:3) = q_i(1:3) - q_j(1:3)
873 <    d_old = d
870 >    real( kind = dp ) :: d(3), scaled(3)
871 >    integer i
872 >
873 >    d(1:3) = q_j(1:3) - q_i(1:3)
874 >
875      ! Wrap back into periodic box if necessary
876      if ( SimUsesPBC() ) then
877        
878 <       d(1:3) = d(1:3) - box(1:3) * sign(1.0_dp,d(1:3)) * &
879 <            int(abs(d(1:3)/box(1:3)) + 0.5_dp)
878 >       if( .not.boxIsOrthorhombic ) then
879 >          ! calc the scaled coordinates.
880 >          
881 >          scaled = matmul(HmatInv, d)
882 >          
883 >          ! wrap the scaled coordinates
884 >
885 >          scaled = scaled  - anint(scaled)
886 >          
887 >
888 >          ! calc the wrapped real coordinates from the wrapped scaled
889 >          ! coordinates
890 >
891 >          d = matmul(Hmat,scaled)
892 >
893 >       else
894 >          ! calc the scaled coordinates.
895 >          
896 >          do i = 1, 3
897 >             scaled(i) = d(i) * HmatInv(i,i)
898 >            
899 >             ! wrap the scaled coordinates
900 >            
901 >             scaled(i) = scaled(i) - anint(scaled(i))
902 >            
903 >             ! calc the wrapped real coordinates from the wrapped scaled
904 >             ! coordinates
905 >
906 >             d(i) = scaled(i)*Hmat(i,i)
907 >          enddo
908 >       endif
909        
910      endif
911 +    
912      r_sq = dot_product(d,d)
913 <        
913 >    
914    end subroutine get_interatomic_vector
915 <
915 >  
916    subroutine check_initialization(error)
917      integer, intent(out) :: error
918      
919      error = 0
920      ! Make sure we are properly initialized.
921      if (.not. do_forces_initialized) then
922 +       write(*,*) "Forces not initialized"
923         error = -1
924         return
925      endif
# Line 651 | Line 967 | contains
967  
968   #endif
969  
970 +
971 +    if (FF_uses_EAM .and. SimUsesEAM()) then
972 +       call clean_EAM()
973 +    endif
974 +
975 +
976 +
977 +
978 +
979      rf = 0.0_dp
980      tau_Temp = 0.0_dp
981      virial_Temp = 0.0_dp
657    
982    end subroutine zero_work_arrays
983    
984    function skipThisPair(atom1, atom2) result(skip_it)
# Line 698 | Line 1022 | contains
1022   #else
1023      unique_id_2 = atom2
1024   #endif
1025 <    
1025 >
1026   #ifdef IS_MPI
1027      !! this situation should only arise in MPI simulations
1028      if (unique_id_1 == unique_id_2) then
# Line 708 | Line 1032 | contains
1032      
1033      !! this prevents us from doing the pair on multiple processors
1034      if (unique_id_1 < unique_id_2) then
1035 <       if (mod(unique_id_1 + unique_id_2,2) == 0) skip_it = .true.
1036 <       return
1035 >       if (mod(unique_id_1 + unique_id_2,2) == 0) then
1036 >          skip_it = .true.
1037 >          return
1038 >       endif
1039      else                
1040 <       if (mod(unique_id_1 + unique_id_2,2) == 1) skip_it = .true.
1041 <       return
1040 >       if (mod(unique_id_1 + unique_id_2,2) == 1) then
1041 >          skip_it = .true.
1042 >          return
1043 >       endif
1044      endif
1045   #endif
1046 <
1046 >
1047      !! the rest of these situations can happen in all simulations:
1048      do i = 1, nExcludes_global      
1049         if ((excludesGlobal(i) == unique_id_1) .or. &
# Line 724 | Line 1052 | contains
1052            return
1053         endif
1054      enddo
1055 <
1055 >
1056      do i = 1, nExcludes_local
1057         if (excludesLocal(1,i) == unique_id_1) then
1058            if (excludesLocal(2,i) == unique_id_2) then
# Line 760 | Line 1088 | end module do_Forces
1088      doesit = FF_uses_RF
1089    end function FF_RequiresPostpairCalc
1090    
1091 + #ifdef PROFILE
1092 +  function getforcetime() return(totalforcetime)
1093 +    real(kind=dp) :: totalforcetime
1094 +    totalforcetime = forcetime
1095 +  end function getforcetime
1096 + #endif
1097 +
1098 + !! This cleans componets of force arrays belonging only to fortran
1099 +
1100   end module do_Forces

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines