ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE_old/src/mdtools/libmdCode/do_Forces.F90
(Generate patch)

Comparing trunk/OOPSE_old/src/mdtools/libmdCode/do_Forces.F90 (file contents):
Revision 306 by chuckv, Mon Mar 10 19:26:45 2003 UTC vs.
Revision 309 by gezelter, Mon Mar 10 23:19:23 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.8 2003-03-10 19:26:45 chuckv Exp $, $Date: 2003-03-10 19:26:45 $, $Name: not supported by cvs2svn $, $Revision: 1.8 $
7 > !! @version $Id: do_Forces.F90,v 1.9 2003-03-10 23:19:23 gezelter Exp $, $Date: 2003-03-10 23:19:23 $, $Name: not supported by cvs2svn $, $Revision: 1.9 $
8  
9  
10  
# Line 16 | Line 16 | module do_Forces
16    use neighborLists
17  
18    
19 <  use lj_FF
19 >  use lj
20    use sticky_FF
21 <  use dp_FF
21 >  use dipole_dipole
22    use gb_FF
23  
24   #ifdef IS_MPI
# Line 144 | Line 144 | contains
144  
145   ! communicate MPI positions
146   #ifdef IS_MPI    
147 <    call gather(q,qRow,plan_row3d)
148 <    call gather(q,qCol,plan_col3d)
147 >    call gather(q,q_Row,plan_row3d)
148 >    call gather(q,q_Col,plan_col3d)
149  
150 <    call gather(mu,muRow,plan_row3d)
151 <    call gather(mu,muCol,plan_col3d)
150 >    call gather(u_l,u_l_Row,plan_row3d)
151 >    call gather(u_l,u_l_Col,plan_col3d)
152  
153 <    call gather(u_l,u_lRow,plan_row3d)
154 <    call gather(u_l,u_lCol,plan_col3d)
155 <
156 <    call gather(A,ARow,plan_row_rotation)
157 <    call gather(A,ACol,plan_col_rotation)
153 >    call gather(A,A_Row,plan_row_rotation)
154 >    call gather(A,A_Col,plan_col_rotation)
155   #endif
156  
157  
# Line 180 | Line 177 | contains
177            inner: do j = 1, ncol
178               Atype_j => identPtrListColumn(j)%this
179              
180 <             call get_interatomic_vector(i,j,qRow(:,i),qCol(:,j),&
180 >             call get_interatomic_vector(i,j,q_Row(:,i),q_Col(:,j),&
181                    rxij,ryij,rzij,rijsq,r)
182              
183               ! skip the loop if the atoms are identical
# Line 224 | Line 221 | contains
221               do jnab = jbeg, jend
222                  j = list(jnab)
223                  Atype_j = identPtrListColumn(j)%this
224 <                call get_interatomic_vector(i,j,qRow(:,i),qCol(:,j),&
224 >                call get_interatomic_vector(i,j,q_Row(:,i),q_Col(:,j),&
225                       rxij,ryij,rzij,rijsq,r)
226                  
227                  call do_pair(Atype_i,Atype_j,i,j,r,rxij,ryij,rzij)
# Line 334 | Line 331 | contains
331   #endif
332  
333  
337
338
334   #ifdef IS_MPI
335      !!distribute forces
336  
337 <    call scatter(fRow,fTemp1,plan_row3d)
338 <    call scatter(fCol,fTemp2,plan_col3d)
344 <
345 <
337 >    call scatter(f_Row,f,plan_row3d)
338 >    call scatter(f_Col,f_temp,plan_col3d)
339      do i = 1,nlocal
340 <       fTemp(1:3,i) = fTemp1(1:3,i) + fTemp2(1:3,i)
340 >       f(1:3,i) = f(1:3,i) + f_temp(1:3,i)
341      end do
342  
343 <    if (do_torque) then
344 <       call scatter(tRow,tTemp1,plan_row3d)
345 <       call scatter(tCol,tTemp2,plan_col3d)
343 >    if (doTorque()) then
344 >       call scatter(t_Row,t,plan_row3d)
345 >       call scatter(t_Col,t_temp,plan_col3d)
346      
347         do i = 1,nlocal
348 <          tTemp(1:3,i) = tTemp1(1:3,i) + tTemp2(1:3,i)
348 >          t(1:3,i) = t(1:3,i) + t_temp(1:3,i)
349         end do
350      endif
351 <
351 >    
352      if (do_pot) then
353         ! scatter/gather pot_row into the members of my column
354 <       call scatter(eRow,eTemp,plan_row)
354 >       call scatter(pot_Row, pot_Temp, plan_row)
355        
356         ! scatter/gather pot_local into all other procs
357         ! add resultant to get total pot
358         do i = 1, nlocal
359 <          pe_local = pe_local + eTemp(i)
359 >          pot_local = pot_local + pot_Temp(i)
360         enddo
361  
362 <       eTemp = 0.0E0_DP
363 <       call scatter(eCol,eTemp,plan_col)
362 >       pot_Temp = 0.0_DP
363 >
364 >       call scatter(pot_Col, pot_Temp, plan_col)
365         do i = 1, nlocal
366 <          pe_local = pe_local + eTemp(i)
366 >          pot_local = pot_local + pot_Temp(i)
367         enddo
368        
369 <       pe = pe_local
369 >       pot = pot_local
370      endif
377 #else
378 ! Copy local array into return array for c
379    f = f+fTemp
380    t = t+tTemp
381 #endif
371  
372 <    potE = pe
373 <
385 <
386 <    if (do_stress) then
387 < #ifdef IS_MPI
388 <       mpi_allreduce = (tau,tauTemp,9,mpi_double_precision,mpi_sum, &
372 >    if (doStress()) then
373 >       mpi_allreduce(tau, tau_Temp,9,mpi_double_precision,mpi_sum, &
374              mpi_comm_world,mpi_err)
375 < #else
376 <       tau = tauTemp
392 < #endif      
375 >       mpi_allreduce(virial, virial_Temp,1,mpi_double_precision,mpi_sum, &
376 >            mpi_comm_world,mpi_err)
377      endif
378  
379 <  end subroutine do_force_loop
396 <
397 <
379 > #endif
380  
381 +    if (doStress()) then
382 +       tau = tau_Temp
383 +       virial = virial_Temp
384 +    endif
385  
386 +  end subroutine do_force_loop
387  
388  
402
403
404
405
389   !! Calculate any pre-force loop components and update nlist if necessary.
390    subroutine do_preForce(updateNlist)
391      logical, intent(inout) :: updateNlist
# Line 468 | Line 451 | contains
451   #ifdef IS_MPI
452  
453      if (Atype_i%is_LJ .and. Atype_j%is_LJ) then
454 <       call getLJForce(r,pot,dudr,ljAtype_i,ljAtype_j,fx,fy,fz)
454 >       call do_lj_pair(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
455 >            pot, f)
456      endif
457  
458      if (Atype_i%is_dp .and. Atype_j%is_dp) then
459  
460 <       call dipole_dipole(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
461 <            ulRow(:,i), ulCol(:,j), rt, rrf, pot)
460 >       call do_dipole_pair(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
461 >            rt, rrf, pot, u_l, f, t)
462  
463         if (do_reaction_field) then
464 <          call accumulate_rf(i, j, r_ij, rflRow(:,i), rflCol(:j), &
481 <               ulRow(:i), ulCol(:,j), rt, rrf)
464 >          call accumulate_rf(i, j, r_ij, rt, rrf)
465         endif
466  
467      endif
# Line 490 | Line 473 | contains
473   #else
474  
475      if (Atype_i%is_LJ .and. Atype_j%is_LJ) then
476 <       call getLJForce(r,pot,dudr,ljAtype_i,ljAtype_j,fx,fy,fz)
476 >       call do_lj_pair(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
477 >            pot, f)
478      endif
479  
480      if (Atype_i%is_dp .and. Atype_j%is_dp) then
481 <       call dipole_dipole(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
482 <            ul(:,i), ul(:,j), rt, rrf, pot)
481 >       call do_dipole_pair(i, j, atype_i, atype_j, rx_ij, ry_ij, rz_ij, r_ij, &
482 >            rt, rrf, pot, u_l, f, t)
483  
484         if (do_reaction_field) then
485 <          call accumulate_rf(i, j, r_ij, rfl(:,i), rfl(:j), &
502 <               ul(:,i), ul(:,j), rt, rrf)
485 >          call accumulate_rf(i, j, r_ij, rt, rrf)
486         endif
487  
488      endif
# Line 510 | Line 493 | contains
493  
494   #endif
495  
496 <      
514 < #ifdef IS_MPI
515 <                eRow(i) = eRow(i) + pot*0.5
516 <                eCol(i) = eCol(i) + pot*0.5
517 < #else
518 <                    pe = pe + pot
519 < #endif                
520 <            
521 <                drdx = -rxij / r
522 <                drdy = -ryij / r
523 <                drdz = -rzij / r
524 <                
525 <                fx = dudr * drdx
526 <                fy = dudr * drdy
527 <                fz = dudr * drdz
528 <                
529 < #ifdef IS_MPI
530 <                fCol(1,j) = fCol(1,j) - fx
531 <                fCol(2,j) = fCol(2,j) - fy
532 <                fCol(3,j) = fCol(3,j) - fz
533 <                
534 <                fRow(1,j) = fRow(1,j) + fx
535 <                fRow(2,j) = fRow(2,j) + fy
536 <                fRow(3,j) = fRow(3,j) + fz
537 < #else
538 <                fTemp(1,j) = fTemp(1,j) - fx
539 <                fTemp(2,j) = fTemp(2,j) - fy
540 <                fTemp(3,j) = fTemp(3,j) - fz
541 <                fTemp(1,i) = fTemp(1,i) + fx
542 <                fTemp(2,i) = fTemp(2,i) + fy
543 <                fTemp(3,i) = fTemp(3,i) + fz
544 < #endif
545 <                
546 <                if (do_stress) then
547 <                   tauTemp(1) = tauTemp(1) + fx * rxij
548 <                   tauTemp(2) = tauTemp(2) + fx * ryij
549 <                   tauTemp(3) = tauTemp(3) + fx * rzij
550 <                   tauTemp(4) = tauTemp(4) + fy * rxij
551 <                   tauTemp(5) = tauTemp(5) + fy * ryij
552 <                   tauTemp(6) = tauTemp(6) + fy * rzij
553 <                   tauTemp(7) = tauTemp(7) + fz * rxij
554 <                   tauTemp(8) = tauTemp(8) + fz * ryij
555 <                   tauTemp(9) = tauTemp(9) + fz * rzij
556 <                endif
557 <
558 <
559 <
496 >      
497    end subroutine do_pair
498  
499  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines