4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @version $Id: do_Forces.F90,v 1.1.1.1 2003-03-21 17:42:12 mmeineke Exp $, $Date: 2003-03-21 17:42:12 $, $Name: not supported by cvs2svn $, $Revision: 1.1.1.1 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.5 2003-03-31 21:50:59 chuckv Exp $, $Date: 2003-03-31 21:50:59 $, $Name: not supported by cvs2svn $, $Revision: 1.5 $ |
8 |
|
|
9 |
|
module do_Forces |
10 |
|
use force_globals |
323 |
|
|
324 |
|
inner: do j = i+1, natoms |
325 |
|
|
326 |
< |
if (skipThisPair(i,j)) cycle inner |
327 |
< |
|
326 |
> |
if (skipThisPair(i,j)) cycle inner |
327 |
> |
|
328 |
|
call get_interatomic_vector(q(:,i), q(:,j), d, rijsq) |
329 |
|
|
330 |
+ |
|
331 |
|
if (rijsq < rlistsq) then |
332 |
|
|
333 |
|
nlist = nlist + 1 |
381 |
|
|
382 |
|
#ifdef IS_MPI |
383 |
|
!!distribute forces |
384 |
< |
|
385 |
< |
call scatter(f_Row,f,plan_row3d) |
384 |
> |
|
385 |
> |
f_temp = 0.0_dp |
386 |
> |
call scatter(f_Row,f_temp,plan_row3d) |
387 |
> |
do i = 1,nlocal |
388 |
> |
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
389 |
> |
end do |
390 |
> |
|
391 |
> |
f_temp = 0.0_dp |
392 |
|
call scatter(f_Col,f_temp,plan_col3d) |
393 |
|
do i = 1,nlocal |
394 |
|
f(1:3,i) = f(1:3,i) + f_temp(1:3,i) |
395 |
|
end do |
396 |
|
|
397 |
|
if (FF_UsesDirectionalAtoms() .and. SimUsesDirectionalAtoms()) then |
398 |
< |
call scatter(t_Row,t,plan_row3d) |
398 |
> |
t_temp = 0.0_dp |
399 |
> |
call scatter(t_Row,t_temp,plan_row3d) |
400 |
> |
do i = 1,nlocal |
401 |
> |
t(1:3,i) = t(1:3,i) + t_temp(1:3,i) |
402 |
> |
end do |
403 |
> |
t_temp = 0.0_dp |
404 |
|
call scatter(t_Col,t_temp,plan_col3d) |
405 |
|
|
406 |
|
do i = 1,nlocal |
472 |
|
#ifdef IS_MPI |
473 |
|
|
474 |
|
if (do_pot) then |
475 |
+ |
write(*,*) "Fortran is on pot:, pot, pot_local ", pot,pot_local |
476 |
|
pot = pot_local |
477 |
|
!! we assume the c code will do the allreduce to get the total potential |
478 |
|
!! we could do it right here if we needed to... |
545 |
|
|
546 |
|
call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & |
547 |
|
do_pot, do_stress) |
535 |
– |
|
548 |
|
if (FF_uses_RF .and. SimUsesRF()) then |
537 |
– |
|
549 |
|
call accumulate_rf(i, j, r, u_l) |
550 |
|
call rf_correct_forces(i, j, d, r, u_l, f, do_stress) |
540 |
– |
|
551 |
|
endif |
552 |
|
|
553 |
|
endif |
557 |
|
|
558 |
|
call getElementProperty(atypes, me_i, "is_Sticky", is_Sticky_i) |
559 |
|
call getElementProperty(atypes, me_j, "is_Sticky", is_Sticky_j) |
560 |
< |
|
560 |
> |
|
561 |
|
if ( is_Sticky_i .and. is_Sticky_j ) then |
562 |
|
call do_sticky_pair(i, j, d, r, rijsq, A, pot, f, t, & |
563 |
|
do_pot, do_stress) |
590 |
|
d_old = d |
591 |
|
! Wrap back into periodic box if necessary |
592 |
|
if ( SimUsesPBC() ) then |
593 |
< |
|
593 |
> |
|
594 |
|
d(1:3) = d(1:3) - box(1:3) * sign(1.0_dp,d(1:3)) * & |
595 |
|
int(abs(d(1:3)/box(1:3)) + 0.5_dp) |
596 |
< |
|
596 |
> |
|
597 |
|
endif |
598 |
|
r_sq = dot_product(d,d) |
599 |
|
|
659 |
|
end subroutine zero_work_arrays |
660 |
|
|
661 |
|
function skipThisPair(atom1, atom2) result(skip_it) |
652 |
– |
|
662 |
|
integer, intent(in) :: atom1 |
663 |
|
integer, intent(in), optional :: atom2 |
664 |
|
logical :: skip_it |
665 |
|
integer :: unique_id_1, unique_id_2 |
666 |
+ |
integer :: me_i,me_j |
667 |
|
integer :: i |
668 |
|
|
669 |
|
skip_it = .false. |
681 |
|
!! in the normal loop, the atom numbers are unique |
682 |
|
unique_id_1 = atom1 |
683 |
|
#endif |
684 |
< |
|
684 |
> |
|
685 |
|
!! We were called with only one atom, so just check the global exclude |
686 |
|
!! list for this atom |
687 |
|
if (.not. present(atom2)) then |
725 |
|
return |
726 |
|
endif |
727 |
|
enddo |
728 |
< |
|
728 |
> |
|
729 |
|
do i = 1, nExcludes_local |
730 |
|
if (excludesLocal(1,i) == unique_id_1) then |
731 |
|
if (excludesLocal(2,i) == unique_id_2) then |