45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.81 2006-05-17 15:37:14 gezelter Exp $, $Date: 2006-05-17 15:37:14 $, $Name: not supported by cvs2svn $, $Revision: 1.81 $ |
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 |
89 |
|
logical, save :: haveElectrostaticSummationMethod = .false. |
90 |
|
logical, save :: haveCutoffPolicy = .false. |
91 |
|
logical, save :: VisitCutoffsAfterComputing = .false. |
92 |
+ |
logical, save :: do_box_dipole = .false. |
93 |
|
|
94 |
|
logical, save :: FF_uses_DirectionalAtoms |
95 |
|
logical, save :: FF_uses_Dipoles |
106 |
|
logical, save :: SIM_requires_postpair_calc |
107 |
|
logical, save :: SIM_requires_prepair_calc |
108 |
|
logical, save :: SIM_uses_PBC |
109 |
+ |
logical, save :: SIM_uses_AtomicVirial |
110 |
|
|
111 |
|
integer, save :: electrostaticSummationMethod |
112 |
|
integer, save :: cutoffPolicy = TRADITIONAL_CUTOFF_POLICY |
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 |
121 |
|
public :: cWasLame |
122 |
|
public :: setElectrostaticMethod |
123 |
+ |
public :: setBoxDipole |
124 |
+ |
public :: getBoxDipole |
125 |
|
public :: setCutoffPolicy |
126 |
|
public :: setSkinThickness |
127 |
|
public :: do_force_loop |
152 |
|
end type gtypeCutoffs |
153 |
|
type(gtypeCutoffs), dimension(:,:), allocatable :: gtypeCutoffMap |
154 |
|
|
155 |
+ |
real(kind=dp), dimension(3) :: boxDipole |
156 |
|
|
157 |
|
contains |
158 |
|
|
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 ) |
627 |
|
haveGtypeCutoffMap = .false. |
628 |
|
|
629 |
|
end subroutine setCutoffPolicy |
630 |
< |
|
630 |
> |
|
631 |
> |
subroutine setBoxDipole() |
632 |
> |
|
633 |
> |
do_box_dipole = .true. |
634 |
> |
|
635 |
> |
end subroutine setBoxDipole |
636 |
> |
|
637 |
> |
subroutine getBoxDipole( box_dipole ) |
638 |
> |
|
639 |
> |
real(kind=dp), intent(inout), dimension(3) :: box_dipole |
640 |
> |
|
641 |
> |
box_dipole = boxDipole |
642 |
> |
|
643 |
> |
end subroutine getBoxDipole |
644 |
> |
|
645 |
|
subroutine setElectrostaticMethod( thisESM ) |
646 |
|
|
647 |
|
integer, intent(in) :: thisESM |
668 |
|
SIM_requires_prepair_calc = SimRequiresPrepairCalc() |
669 |
|
SIM_uses_PBC = SimUsesPBC() |
670 |
|
SIM_uses_SC = SimUsesSC() |
671 |
< |
|
671 |
> |
SIM_uses_AtomicVirial = SimUsesAtomicVirial() |
672 |
> |
|
673 |
|
haveSIMvariables = .true. |
674 |
|
|
675 |
|
return |
828 |
|
integer :: istart, iend |
829 |
|
integer :: ia, jb, atom1, atom2 |
830 |
|
integer :: nlist |
831 |
< |
real( kind = DP ) :: ratmsq, rgrpsq, rgrp, vpair, vij |
831 |
> |
real( kind = DP ) :: ratmsq, rgrpsq, rgrp, rag, vpair, vij |
832 |
|
real( kind = DP ) :: sw, dswdr, swderiv, mf |
833 |
|
real( kind = DP ) :: rVal |
834 |
< |
real(kind=dp),dimension(3) :: d_atm, d_grp, fpair, fij |
835 |
< |
real(kind=dp) :: rfpot, mu_i, virial |
834 |
> |
real(kind=dp),dimension(3) :: d_atm, d_grp, fpair, fij, fg, dag |
835 |
> |
real(kind=dp) :: rfpot, mu_i |
836 |
|
real(kind=dp):: rCut |
837 |
|
integer :: me_i, me_j, n_in_i, n_in_j |
838 |
|
logical :: is_dp_i |
843 |
|
integer :: loopStart, loopEnd, loop |
844 |
|
integer :: iHash |
845 |
|
integer :: i1 |
813 |
– |
|
846 |
|
|
847 |
+ |
!! the variables for the box dipole moment |
848 |
+ |
#ifdef IS_MPI |
849 |
+ |
integer :: pChgCount_local |
850 |
+ |
integer :: nChgCount_local |
851 |
+ |
real(kind=dp) :: pChg_local |
852 |
+ |
real(kind=dp) :: nChg_local |
853 |
+ |
real(kind=dp), dimension(3) :: pChgPos_local |
854 |
+ |
real(kind=dp), dimension(3) :: nChgPos_local |
855 |
+ |
real(kind=dp), dimension(3) :: dipVec_local |
856 |
+ |
#endif |
857 |
+ |
integer :: pChgCount |
858 |
+ |
integer :: nChgCount |
859 |
+ |
real(kind=dp) :: pChg |
860 |
+ |
real(kind=dp) :: nChg |
861 |
+ |
real(kind=dp) :: chg_value |
862 |
+ |
real(kind=dp), dimension(3) :: pChgPos |
863 |
+ |
real(kind=dp), dimension(3) :: nChgPos |
864 |
+ |
real(kind=dp), dimension(3) :: dipVec |
865 |
+ |
real(kind=dp), dimension(3) :: chgVec |
866 |
+ |
|
867 |
+ |
!! initialize box dipole variables |
868 |
+ |
if (do_box_dipole) then |
869 |
+ |
#ifdef IS_MPI |
870 |
+ |
pChg_local = 0.0_dp |
871 |
+ |
nChg_local = 0.0_dp |
872 |
+ |
pChgCount_local = 0 |
873 |
+ |
nChgCount_local = 0 |
874 |
+ |
do i=1, 3 |
875 |
+ |
pChgPos_local = 0.0_dp |
876 |
+ |
nChgPos_local = 0.0_dp |
877 |
+ |
dipVec_local = 0.0_dp |
878 |
+ |
enddo |
879 |
+ |
#endif |
880 |
+ |
pChg = 0.0_dp |
881 |
+ |
nChg = 0.0_dp |
882 |
+ |
pChgCount = 0 |
883 |
+ |
nChgCount = 0 |
884 |
+ |
chg_value = 0.0_dp |
885 |
+ |
|
886 |
+ |
do i=1, 3 |
887 |
+ |
pChgPos(i) = 0.0_dp |
888 |
+ |
nChgPos(i) = 0.0_dp |
889 |
+ |
dipVec(i) = 0.0_dp |
890 |
+ |
chgVec(i) = 0.0_dp |
891 |
+ |
boxDipole(i) = 0.0_dp |
892 |
+ |
enddo |
893 |
+ |
endif |
894 |
+ |
|
895 |
|
!! initialize local variables |
896 |
|
|
897 |
|
#ifdef IS_MPI |
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) then |
1105 |
+ |
call add_stress_tensor(d_atm, fpair, tau) |
1106 |
+ |
endif |
1107 |
|
endif |
1108 |
|
enddo inner |
1109 |
|
enddo |
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) |
1127 |
+ |
! fg is the force on atom ia due to cutoff group's |
1128 |
+ |
! presence in switching region |
1129 |
+ |
fg = swderiv*d_grp*mf |
1130 |
|
#ifdef IS_MPI |
1131 |
< |
f_Row(1,atom1) = f_Row(1,atom1) + swderiv*d_grp(1)*mf |
1132 |
< |
f_Row(2,atom1) = f_Row(2,atom1) + swderiv*d_grp(2)*mf |
1133 |
< |
f_Row(3,atom1) = f_Row(3,atom1) + swderiv*d_grp(3)*mf |
1131 |
> |
f_Row(1,atom1) = f_Row(1,atom1) + fg(1) |
1132 |
> |
f_Row(2,atom1) = f_Row(2,atom1) + fg(2) |
1133 |
> |
f_Row(3,atom1) = f_Row(3,atom1) + fg(3) |
1134 |
|
#else |
1135 |
< |
f(1,atom1) = f(1,atom1) + swderiv*d_grp(1)*mf |
1136 |
< |
f(2,atom1) = f(2,atom1) + swderiv*d_grp(2)*mf |
1137 |
< |
f(3,atom1) = f(3,atom1) + swderiv*d_grp(3)*mf |
1135 |
> |
f(1,atom1) = f(1,atom1) + fg(1) |
1136 |
> |
f(2,atom1) = f(2,atom1) + fg(2) |
1137 |
> |
f(3,atom1) = f(3,atom1) + fg(3) |
1138 |
|
#endif |
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) |
1146 |
+ |
#else |
1147 |
+ |
call get_interatomic_vector(q(:,atom1), & |
1148 |
+ |
q_group(:,i), dag, rag) |
1149 |
+ |
#endif |
1150 |
+ |
call add_stress_tensor(dag,fg,tau) |
1151 |
+ |
endif |
1152 |
+ |
endif |
1153 |
|
enddo |
1154 |
|
|
1155 |
|
do jb=groupStartCol(j), groupStartCol(j+1)-1 |
1156 |
|
atom2=groupListCol(jb) |
1157 |
|
mf = mfactCol(atom2) |
1158 |
+ |
! fg is the force on atom jb due to cutoff group's |
1159 |
+ |
! presence in switching region |
1160 |
+ |
fg = -swderiv*d_grp*mf |
1161 |
|
#ifdef IS_MPI |
1162 |
< |
f_Col(1,atom2) = f_Col(1,atom2) - swderiv*d_grp(1)*mf |
1163 |
< |
f_Col(2,atom2) = f_Col(2,atom2) - swderiv*d_grp(2)*mf |
1164 |
< |
f_Col(3,atom2) = f_Col(3,atom2) - swderiv*d_grp(3)*mf |
1162 |
> |
f_Col(1,atom2) = f_Col(1,atom2) + fg(1) |
1163 |
> |
f_Col(2,atom2) = f_Col(2,atom2) + fg(2) |
1164 |
> |
f_Col(3,atom2) = f_Col(3,atom2) + fg(3) |
1165 |
|
#else |
1166 |
< |
f(1,atom2) = f(1,atom2) - swderiv*d_grp(1)*mf |
1167 |
< |
f(2,atom2) = f(2,atom2) - swderiv*d_grp(2)*mf |
1168 |
< |
f(3,atom2) = f(3,atom2) - swderiv*d_grp(3)*mf |
1166 |
> |
f(1,atom2) = f(1,atom2) + fg(1) |
1167 |
> |
f(2,atom2) = f(2,atom2) + fg(2) |
1168 |
> |
f(3,atom2) = f(3,atom2) + fg(3) |
1169 |
|
#endif |
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) |
1177 |
+ |
#else |
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 |
+ |
endif |
1184 |
|
enddo |
1185 |
|
endif |
1063 |
– |
|
1064 |
– |
if (do_stress) call add_stress_tensor(d_grp, fij) |
1186 |
|
endif |
1187 |
|
endif |
1188 |
|
endif |
1315 |
|
endif |
1316 |
|
enddo |
1317 |
|
endif |
1318 |
+ |
|
1319 |
+ |
if (do_box_dipole) then |
1320 |
+ |
#ifdef IS_MPI |
1321 |
+ |
call accumulate_box_dipole(i, eFrame, q(:,i), pChg_local, & |
1322 |
+ |
nChg_local, pChgPos_local, nChgPos_local, dipVec_local, & |
1323 |
+ |
pChgCount_local, nChgCount_local) |
1324 |
+ |
#else |
1325 |
+ |
call accumulate_box_dipole(i, eFrame, q(:,i), pChg, nChg, & |
1326 |
+ |
pChgPos, nChgPos, dipVec, pChgCount, nChgCount) |
1327 |
+ |
#endif |
1328 |
+ |
endif |
1329 |
|
enddo |
1330 |
|
endif |
1331 |
< |
|
1331 |
> |
|
1332 |
|
#ifdef IS_MPI |
1201 |
– |
|
1333 |
|
if (do_pot) then |
1334 |
< |
call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_double_precision,mpi_sum, & |
1334 |
> |
#ifdef SINGLE_PRECISION |
1335 |
> |
call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_real,mpi_sum, & |
1336 |
|
mpi_comm_world,mpi_err) |
1337 |
+ |
#else |
1338 |
+ |
call mpi_allreduce(pot_local, pot, LR_POT_TYPES,mpi_double_precision, & |
1339 |
+ |
mpi_sum, mpi_comm_world,mpi_err) |
1340 |
+ |
#endif |
1341 |
|
endif |
1342 |
< |
|
1343 |
< |
if (do_stress) then |
1344 |
< |
call mpi_allreduce(tau_Temp, tau, 9,mpi_double_precision,mpi_sum, & |
1345 |
< |
mpi_comm_world,mpi_err) |
1346 |
< |
call mpi_allreduce(virial_Temp, virial,1,mpi_double_precision,mpi_sum, & |
1347 |
< |
mpi_comm_world,mpi_err) |
1348 |
< |
endif |
1349 |
< |
|
1342 |
> |
|
1343 |
> |
if (do_box_dipole) then |
1344 |
> |
|
1345 |
> |
#ifdef SINGLE_PRECISION |
1346 |
> |
call mpi_allreduce(pChg_local, pChg, 1, mpi_real, mpi_sum, & |
1347 |
> |
mpi_comm_world, mpi_err) |
1348 |
> |
call mpi_allreduce(nChg_local, nChg, 1, mpi_real, mpi_sum, & |
1349 |
> |
mpi_comm_world, mpi_err) |
1350 |
> |
call mpi_allreduce(pChgCount_local, pChgCount, 1, mpi_integer, mpi_sum,& |
1351 |
> |
mpi_comm_world, mpi_err) |
1352 |
> |
call mpi_allreduce(nChgCount_local, nChgCount, 1, mpi_integer, mpi_sum,& |
1353 |
> |
mpi_comm_world, mpi_err) |
1354 |
> |
call mpi_allreduce(pChgPos_local, pChgPos, 3, mpi_real, mpi_sum, & |
1355 |
> |
mpi_comm_world, mpi_err) |
1356 |
> |
call mpi_allreduce(nChgPos_local, nChgPos, 3, mpi_real, mpi_sum, & |
1357 |
> |
mpi_comm_world, mpi_err) |
1358 |
> |
call mpi_allreduce(dipVec_local, dipVec, 3, mpi_real, mpi_sum, & |
1359 |
> |
mpi_comm_world, mpi_err) |
1360 |
|
#else |
1361 |
< |
|
1362 |
< |
if (do_stress) then |
1363 |
< |
tau = tau_Temp |
1364 |
< |
virial = virial_Temp |
1361 |
> |
call mpi_allreduce(pChg_local, pChg, 1, mpi_double_precision, mpi_sum, & |
1362 |
> |
mpi_comm_world, mpi_err) |
1363 |
> |
call mpi_allreduce(nChg_local, nChg, 1, mpi_double_precision, mpi_sum, & |
1364 |
> |
mpi_comm_world, mpi_err) |
1365 |
> |
call mpi_allreduce(pChgCount_local, pChgCount, 1, mpi_integer,& |
1366 |
> |
mpi_sum, mpi_comm_world, mpi_err) |
1367 |
> |
call mpi_allreduce(nChgCount_local, nChgCount, 1, mpi_integer,& |
1368 |
> |
mpi_sum, mpi_comm_world, mpi_err) |
1369 |
> |
call mpi_allreduce(pChgPos_local, pChgPos, 3, mpi_double_precision, & |
1370 |
> |
mpi_sum, mpi_comm_world, mpi_err) |
1371 |
> |
call mpi_allreduce(nChgPos_local, nChgPos, 3, mpi_double_precision, & |
1372 |
> |
mpi_sum, mpi_comm_world, mpi_err) |
1373 |
> |
call mpi_allreduce(dipVec_local, dipVec, 3, mpi_double_precision, & |
1374 |
> |
mpi_sum, mpi_comm_world, mpi_err) |
1375 |
> |
#endif |
1376 |
> |
|
1377 |
|
endif |
1378 |
|
|
1379 |
|
#endif |
1380 |
< |
|
1380 |
> |
|
1381 |
> |
if (do_box_dipole) then |
1382 |
> |
! first load the accumulated dipole moment (if dipoles were present) |
1383 |
> |
boxDipole(1) = dipVec(1) |
1384 |
> |
boxDipole(2) = dipVec(2) |
1385 |
> |
boxDipole(3) = dipVec(3) |
1386 |
> |
|
1387 |
> |
! now include the dipole moment due to charges |
1388 |
> |
! use the lesser of the positive and negative charge totals |
1389 |
> |
if (nChg .le. pChg) then |
1390 |
> |
chg_value = nChg |
1391 |
> |
else |
1392 |
> |
chg_value = pChg |
1393 |
> |
endif |
1394 |
> |
|
1395 |
> |
! find the average positions |
1396 |
> |
if (pChgCount .gt. 0 .and. nChgCount .gt. 0) then |
1397 |
> |
pChgPos = pChgPos / pChgCount |
1398 |
> |
nChgPos = nChgPos / nChgCount |
1399 |
> |
endif |
1400 |
> |
|
1401 |
> |
! dipole is from the negative to the positive (physics notation) |
1402 |
> |
chgVec(1) = pChgPos(1) - nChgPos(1) |
1403 |
> |
chgVec(2) = pChgPos(2) - nChgPos(2) |
1404 |
> |
chgVec(3) = pChgPos(3) - nChgPos(3) |
1405 |
> |
|
1406 |
> |
boxDipole(1) = boxDipole(1) + chgVec(1) * chg_value |
1407 |
> |
boxDipole(2) = boxDipole(2) + chgVec(2) * chg_value |
1408 |
> |
boxDipole(3) = boxDipole(3) + chgVec(3) * chg_value |
1409 |
> |
|
1410 |
> |
endif |
1411 |
> |
|
1412 |
|
end subroutine do_force_loop |
1413 |
|
|
1414 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
1478 |
|
endif |
1479 |
|
|
1480 |
|
if ( iand(iHash, GAYBERNE_LJ).ne.0 ) then |
1481 |
< |
call do_gb_lj_pair(i, j, d, r, rijsq, rcut, sw, vpair, fpair, & |
1481 |
> |
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
1482 |
|
pot(VDW_POT), A, f, t, do_pot) |
1483 |
|
endif |
1484 |
|
|
1656 |
|
call clean_EAM() |
1657 |
|
endif |
1658 |
|
|
1470 |
– |
tau_Temp = 0.0_dp |
1471 |
– |
virial_Temp = 0.0_dp |
1659 |
|
end subroutine zero_work_arrays |
1660 |
|
|
1661 |
|
function skipThisPair(atom1, atom2) result(skip_it) |
1760 |
|
|
1761 |
|
!! This cleans componets of force arrays belonging only to fortran |
1762 |
|
|
1763 |
< |
subroutine add_stress_tensor(dpair, fpair) |
1763 |
> |
subroutine add_stress_tensor(dpair, fpair, tau) |
1764 |
|
|
1765 |
|
real( kind = dp ), dimension(3), intent(in) :: dpair, fpair |
1766 |
+ |
real( kind = dp ), dimension(9), intent(inout) :: tau |
1767 |
|
|
1768 |
|
! because the d vector is the rj - ri vector, and |
1769 |
|
! because fx, fy, fz are the force on atom i, we need a |
1770 |
|
! negative sign here: |
1771 |
|
|
1772 |
< |
tau_Temp(1) = tau_Temp(1) - dpair(1) * fpair(1) |
1773 |
< |
tau_Temp(2) = tau_Temp(2) - dpair(1) * fpair(2) |
1774 |
< |
tau_Temp(3) = tau_Temp(3) - dpair(1) * fpair(3) |
1775 |
< |
tau_Temp(4) = tau_Temp(4) - dpair(2) * fpair(1) |
1776 |
< |
tau_Temp(5) = tau_Temp(5) - dpair(2) * fpair(2) |
1777 |
< |
tau_Temp(6) = tau_Temp(6) - dpair(2) * fpair(3) |
1778 |
< |
tau_Temp(7) = tau_Temp(7) - dpair(3) * fpair(1) |
1779 |
< |
tau_Temp(8) = tau_Temp(8) - dpair(3) * fpair(2) |
1780 |
< |
tau_Temp(9) = tau_Temp(9) - dpair(3) * fpair(3) |
1772 |
> |
tau(1) = tau(1) - dpair(1) * fpair(1) |
1773 |
> |
tau(2) = tau(2) - dpair(1) * fpair(2) |
1774 |
> |
tau(3) = tau(3) - dpair(1) * fpair(3) |
1775 |
> |
tau(4) = tau(4) - dpair(2) * fpair(1) |
1776 |
> |
tau(5) = tau(5) - dpair(2) * fpair(2) |
1777 |
> |
tau(6) = tau(6) - dpair(2) * fpair(3) |
1778 |
> |
tau(7) = tau(7) - dpair(3) * fpair(1) |
1779 |
> |
tau(8) = tau(8) - dpair(3) * fpair(2) |
1780 |
> |
tau(9) = tau(9) - dpair(3) * fpair(3) |
1781 |
|
|
1594 |
– |
virial_Temp = virial_Temp + & |
1595 |
– |
(tau_Temp(1) + tau_Temp(5) + tau_Temp(9)) |
1596 |
– |
|
1782 |
|
end subroutine add_stress_tensor |
1783 |
|
|
1784 |
|
end module doForces |