ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/UseTheForce/doForces.F90
(Generate patch)

Comparing trunk/OOPSE-4/src/UseTheForce/doForces.F90 (file contents):
Revision 3126 by gezelter, Fri Apr 6 21:53:43 2007 UTC vs.
Revision 3131 by chrisfen, Wed May 2 00:18:08 2007 UTC

# Line 45 | Line 45
45  
46   !! @author Charles F. Vardeman II
47   !! @author Matthew Meineke
48 < !! @version $Id: doForces.F90,v 1.85 2007-04-06 21:53:41 gezelter Exp $, $Date: 2007-04-06 21:53:41 $, $Name: not supported by cvs2svn $, $Revision: 1.85 $
48 > !! @version $Id: doForces.F90,v 1.88 2007-05-02 00:18:08 chrisfen Exp $, $Date: 2007-05-02 00:18:08 $, $Name: not supported by cvs2svn $, $Revision: 1.88 $
49  
50  
51   module doForces
# Line 113 | Line 113 | module doForces
113  
114    real(kind=dp), save :: defaultRcut, defaultRsw, largestRcut
115    real(kind=dp), save :: skinThickness
116 <  logical, save :: defaultDoShift
116 >  logical, save :: defaultDoShiftPot
117 >  logical, save :: defaultDoShiftFrc
118  
119    public :: init_FF
120    public :: setCutoffs
# Line 562 | Line 563 | contains
563      haveGtypeCutoffMap = .true.
564     end subroutine createGtypeCutoffMap
565  
566 <   subroutine setCutoffs(defRcut, defRsw)
566 >   subroutine setCutoffs(defRcut, defRsw, defSP, defSF)
567  
568       real(kind=dp),intent(in) :: defRcut, defRsw
569 +     logical, intent(in) :: defSP, defSF
570       character(len = statusMsgSize) :: errMsg
571       integer :: localError
572  
573       defaultRcut = defRcut
574       defaultRsw = defRsw
575      
576 <     defaultDoShift = .false.
576 >     defaultDoShiftPot = defSP
577 >     defaultDoShiftFrc = defSF
578 >
579       if (abs(defaultRcut-defaultRsw) .lt. 0.0001) then
580 <        
581 <        write(errMsg, *) &
582 <             'cutoffRadius and switchingRadius are set to the same', newline &
583 <             // tab, 'value.  OOPSE will use shifted ', newline &
584 <             // tab, 'potentials instead of switching functions.'
585 <        
586 <        call handleInfo("setCutoffs", errMsg)
587 <        
588 <        defaultDoShift = .true.
589 <        
580 >        if (defaultDoShiftFrc) then
581 >           write(errMsg, *) &
582 >                'cutoffRadius and switchingRadius are set to the', newline &
583 >                // tab, 'same value.  OOPSE will use shifted force', newline &
584 >                // tab, 'potentials instead of switching functions.'
585 >          
586 >           call handleInfo("setCutoffs", errMsg)
587 >        else
588 >           write(errMsg, *) &
589 >                'cutoffRadius and switchingRadius are set to the', newline &
590 >                // tab, 'same value.  OOPSE will use shifted', newline &
591 >                // tab, 'potentials instead of switching functions.'
592 >          
593 >           call handleInfo("setCutoffs", errMsg)
594 >          
595 >           defaultDoShiftPot = .true.
596 >        endif
597 >                
598       endif
599      
600       localError = 0
601 <     call setLJDefaultCutoff( defaultRcut, defaultDoShift )
601 >     call setLJDefaultCutoff( defaultRcut, defaultDoShiftPot, &
602 >          defaultDoShiftFrc )
603       call setElectrostaticCutoffRadius( defaultRcut, defaultRsw )
604       call setCutoffEAM( defaultRcut )
605       call setCutoffSC( defaultRcut )
# Line 1088 | Line 1101 | contains
1101                              fij(1) = fij(1) + fpair(1)
1102                              fij(2) = fij(2) + fpair(2)
1103                              fij(3) = fij(3) + fpair(3)
1104 <                            if (do_stress.and.SIM_uses_AtomicVirial) then
1104 >                            if (do_stress) then
1105                                 call add_stress_tensor(d_atm, fpair, tau)
1106                              endif
1107                           endif
# Line 1098 | Line 1111 | contains
1111                     if (loop .eq. PAIR_LOOP) then
1112                        if (in_switching_region) then
1113                           swderiv = vij*dswdr/rgrp
1114 <                         fij(1) = fij(1) + swderiv*d_grp(1)
1115 <                         fij(2) = fij(2) + swderiv*d_grp(2)
1116 <                         fij(3) = fij(3) + swderiv*d_grp(3)
1114 >                         fg = swderiv*d_grp
1115 >
1116 >                         fij(1) = fij(1) + fg(1)
1117 >                         fij(2) = fij(2) + fg(2)
1118 >                         fij(3) = fij(3) + fg(3)
1119                          
1120 +                         if ((n_in_i .eq. 1).and.(n_in_j .eq. 1)) then
1121 +                            call add_stress_tensor(d_atm, fg, tau)
1122 +                         endif  
1123 +                        
1124                           do ia=groupStartRow(i), groupStartRow(i+1)-1
1125                              atom1=groupListRow(ia)
1126                              mf = mfactRow(atom1)
# Line 1117 | Line 1136 | contains
1136                              f(2,atom1) = f(2,atom1) + fg(2)
1137                              f(3,atom1) = f(3,atom1) + fg(3)
1138   #endif
1139 <                            if (do_stress.and.SIM_uses_AtomicVirial) then
1140 <                               ! find the distance between the atom and the center of
1141 <                               ! the cutoff group:
1139 >                            if (n_in_i .gt. 1) then
1140 >                               if (do_stress.and.SIM_uses_AtomicVirial) then
1141 >                                  ! find the distance between the atom and the center of
1142 >                                  ! the cutoff group:
1143   #ifdef IS_MPI
1144 <                               call get_interatomic_vector(q_Row(:,atom1), &
1145 <                                    q_group_Row(:,i), dag, rag)
1144 >                                  call get_interatomic_vector(q_Row(:,atom1), &
1145 >                                       q_group_Row(:,i), dag, rag)
1146   #else
1147 <                               call get_interatomic_vector(q(:,atom1), &
1148 <                                    q_group(:,i), dag, rag)
1147 >                                  call get_interatomic_vector(q(:,atom1), &
1148 >                                       q_group(:,i), dag, rag)
1149   #endif
1150 <                               call add_stress_tensor(dag,fg,tau)
1150 >                                  call add_stress_tensor(dag,fg,tau)
1151 >                               endif
1152                              endif
1153                           enddo
1154                          
# Line 1146 | Line 1167 | contains
1167                              f(2,atom2) = f(2,atom2) + fg(2)
1168                              f(3,atom2) = f(3,atom2) + fg(3)
1169   #endif
1170 <                            if (do_stress.and.SIM_uses_AtomicVirial) then
1171 <                               ! find the distance between the atom and the center of
1172 <                               ! the cutoff group:
1170 >                            if (n_in_j .gt. 1) then
1171 >                               if (do_stress.and.SIM_uses_AtomicVirial) then
1172 >                                  ! find the distance between the atom and the center of
1173 >                                  ! the cutoff group:
1174   #ifdef IS_MPI
1175 <                               call get_interatomic_vector(q_Col(:,atom2), &
1176 <                                    q_group_Col(:,j), dag, rag)
1175 >                                  call get_interatomic_vector(q_Col(:,atom2), &
1176 >                                       q_group_Col(:,j), dag, rag)
1177   #else
1178 <                               call get_interatomic_vector(q(:,atom2), &
1179 <                                    q_group(:,j), dag, rag)
1178 >                                  call get_interatomic_vector(q(:,atom2), &
1179 >                                       q_group(:,j), dag, rag)
1180   #endif
1181 <                               call add_stress_tensor(dag,fg,tau)                              
1182 <                            endif
1183 <                            
1181 >                                  call add_stress_tensor(dag,fg,tau)                              
1182 >                               endif
1183 >                            endif                            
1184                           enddo
1163                      endif
1164                      if (do_stress.and.(.not.SIM_uses_AtomicVirial)) then
1165                         call add_stress_tensor(d_grp, fij, tau)
1185                        endif
1186                     endif
1187                  endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines