4 |
|
|
5 |
|
!! @author Charles F. Vardeman II |
6 |
|
!! @author Matthew Meineke |
7 |
< |
!! @version $Id: do_Forces.F90,v 1.9 2003-04-04 22:22:30 chuckv Exp $, $Date: 2003-04-04 22:22:30 $, $Name: not supported by cvs2svn $, $Revision: 1.9 $ |
7 |
> |
!! @version $Id: do_Forces.F90,v 1.19 2003-07-14 23:06:09 gezelter Exp $, $Date: 2003-07-14 23:06:09 $, $Name: not supported by cvs2svn $, $Revision: 1.19 $ |
8 |
|
|
9 |
|
module do_Forces |
10 |
|
use force_globals |
140 |
|
|
141 |
|
if (FF_uses_GB .and. FF_uses_LJ) then |
142 |
|
endif |
143 |
< |
|
143 |
> |
if (.not. do_forces_initialized) then |
144 |
> |
!! Create neighbor lists |
145 |
> |
call expandNeighborList(getNlocal(), my_status) |
146 |
> |
if (my_Status /= 0) then |
147 |
> |
write(default_error,*) "SimSetup: ExpandNeighborList returned error." |
148 |
> |
thisStat = -1 |
149 |
> |
return |
150 |
> |
endif |
151 |
> |
endif |
152 |
|
|
153 |
|
do_forces_initialized = .true. |
154 |
|
|
487 |
|
endif |
488 |
|
|
489 |
|
if (do_stress) then |
490 |
< |
call mpi_allreduce(tau, tau_Temp,9,mpi_double_precision,mpi_sum, & |
490 |
> |
call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, & |
491 |
|
mpi_comm_world,mpi_err) |
492 |
< |
call mpi_allreduce(virial, virial_Temp,1,mpi_double_precision,mpi_sum, & |
492 |
> |
call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, & |
493 |
|
mpi_comm_world,mpi_err) |
494 |
|
endif |
495 |
|
|
526 |
|
r = sqrt(rijsq) |
527 |
|
|
528 |
|
#ifdef IS_MPI |
529 |
+ |
if (tagRow(i) .eq. tagColumn(j)) then |
530 |
+ |
write(0,*) 'do_pair is doing', i , j, tagRow(i), tagColumn(j) |
531 |
+ |
endif |
532 |
|
|
533 |
|
me_i = atid_row(i) |
534 |
|
me_j = atid_col(j) |
554 |
|
|
555 |
|
if ( is_DP_i .and. is_DP_j ) then |
556 |
|
|
557 |
< |
call do_dipole_pair(natoms,i, j, d, r, rijsq, pot, u_l, f, t, & |
557 |
> |
call do_dipole_pair(i, j, d, r, rijsq, pot, u_l, f, t, & |
558 |
|
do_pot, do_stress) |
559 |
|
if (FF_uses_RF .and. SimUsesRF()) then |
560 |
|
call accumulate_rf(i, j, r, u_l) |
587 |
|
endif |
588 |
|
endif |
589 |
|
|
590 |
+ |
|
591 |
+ |
|
592 |
|
end subroutine do_pair |
593 |
|
|
594 |
|
|
597 |
|
real (kind = dp), dimension(3) :: q_i |
598 |
|
real (kind = dp), dimension(3) :: q_j |
599 |
|
real ( kind = dp ), intent(out) :: r_sq |
600 |
< |
real( kind = dp ) :: d(3) |
601 |
< |
real( kind = dp ) :: d_old(3) |
602 |
< |
d(1:3) = q_i(1:3) - q_j(1:3) |
603 |
< |
d_old = d |
600 |
> |
real( kind = dp ) :: d(3), scaled(3) |
601 |
> |
integer i |
602 |
> |
|
603 |
> |
d(1:3) = q_j(1:3) - q_i(1:3) |
604 |
> |
|
605 |
|
! Wrap back into periodic box if necessary |
606 |
|
if ( SimUsesPBC() ) then |
607 |
|
|
608 |
< |
d(1:3) = d(1:3) - box(1:3) * sign(1.0_dp,d(1:3)) * & |
609 |
< |
int(abs(d(1:3)/box(1:3)) + 0.5_dp) |
608 |
> |
if( .not.boxIsOrthorhombic ) then |
609 |
> |
! calc the scaled coordinates. |
610 |
> |
|
611 |
> |
scaled = matmul(HmatInv, d) |
612 |
> |
|
613 |
> |
! wrap the scaled coordinates |
614 |
> |
|
615 |
> |
scaled = scaled - anint(scaled) |
616 |
> |
|
617 |
> |
|
618 |
> |
! calc the wrapped real coordinates from the wrapped scaled |
619 |
> |
! coordinates |
620 |
> |
|
621 |
> |
d = matmul(Hmat,scaled) |
622 |
> |
|
623 |
> |
else |
624 |
> |
! calc the scaled coordinates. |
625 |
> |
|
626 |
> |
do i = 1, 3 |
627 |
> |
scaled(i) = d(i) * HmatInv(i,i) |
628 |
> |
|
629 |
> |
! wrap the scaled coordinates |
630 |
> |
|
631 |
> |
scaled(i) = scaled(i) - anint(scaled(i)) |
632 |
> |
|
633 |
> |
! calc the wrapped real coordinates from the wrapped scaled |
634 |
> |
! coordinates |
635 |
> |
|
636 |
> |
d(i) = scaled(i)*Hmat(i,i) |
637 |
> |
enddo |
638 |
> |
endif |
639 |
|
|
640 |
|
endif |
641 |
+ |
|
642 |
|
r_sq = dot_product(d,d) |
643 |
< |
|
643 |
> |
|
644 |
|
end subroutine get_interatomic_vector |
645 |
< |
|
645 |
> |
|
646 |
|
subroutine check_initialization(error) |
647 |
|
integer, intent(out) :: error |
648 |
|
|
699 |
|
rf = 0.0_dp |
700 |
|
tau_Temp = 0.0_dp |
701 |
|
virial_Temp = 0.0_dp |
658 |
– |
|
702 |
|
end subroutine zero_work_arrays |
703 |
|
|
704 |
|
function skipThisPair(atom1, atom2) result(skip_it) |