1 |
+ |
!! |
2 |
+ |
!! Copyright (c) 2005 The University of Notre Dame. All Rights Reserved. |
3 |
+ |
!! |
4 |
+ |
!! The University of Notre Dame grants you ("Licensee") a |
5 |
+ |
!! non-exclusive, royalty free, license to use, modify and |
6 |
+ |
!! redistribute this software in source and binary code form, provided |
7 |
+ |
!! that the following conditions are met: |
8 |
+ |
!! |
9 |
+ |
!! 1. Acknowledgement of the program authors must be made in any |
10 |
+ |
!! publication of scientific results based in part on use of the |
11 |
+ |
!! program. An acceptable form of acknowledgement is citation of |
12 |
+ |
!! the article in which the program was described (Matthew |
13 |
+ |
!! A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher |
14 |
+ |
!! J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented |
15 |
+ |
!! Parallel Simulation Engine for Molecular Dynamics," |
16 |
+ |
!! J. Comput. Chem. 26, pp. 252-271 (2005)) |
17 |
+ |
!! |
18 |
+ |
!! 2. Redistributions of source code must retain the above copyright |
19 |
+ |
!! notice, this list of conditions and the following disclaimer. |
20 |
+ |
!! |
21 |
+ |
!! 3. Redistributions in binary form must reproduce the above copyright |
22 |
+ |
!! notice, this list of conditions and the following disclaimer in the |
23 |
+ |
!! documentation and/or other materials provided with the |
24 |
+ |
!! distribution. |
25 |
+ |
!! |
26 |
+ |
!! This software is provided "AS IS," without a warranty of any |
27 |
+ |
!! kind. All express or implied conditions, representations and |
28 |
+ |
!! warranties, including any implied warranty of merchantability, |
29 |
+ |
!! fitness for a particular purpose or non-infringement, are hereby |
30 |
+ |
!! excluded. The University of Notre Dame and its licensors shall not |
31 |
+ |
!! be liable for any damages suffered by licensee as a result of |
32 |
+ |
!! using, modifying or distributing the software or its |
33 |
+ |
!! derivatives. In no event will the University of Notre Dame or its |
34 |
+ |
!! licensors be liable for any lost revenue, profit or data, or for |
35 |
+ |
!! direct, indirect, special, consequential, incidental or punitive |
36 |
+ |
!! damages, however caused and regardless of the theory of liability, |
37 |
+ |
!! arising out of the use of or inability to use software, even if the |
38 |
+ |
!! University of Notre Dame has been advised of the possibility of |
39 |
+ |
!! such damages. |
40 |
+ |
!! |
41 |
+ |
|
42 |
|
!! doForces.F90 |
43 |
|
!! module doForces |
44 |
|
!! Calculates Long Range forces. |
45 |
|
|
46 |
|
!! @author Charles F. Vardeman II |
47 |
|
!! @author Matthew Meineke |
48 |
< |
!! @version $Id: doForces.F90,v 1.4 2004-10-22 22:53:57 chrisfen Exp $, $Date: 2004-10-22 22:53:57 $, $Name: not supported by cvs2svn $, $Revision: 1.4 $ |
48 |
> |
!! @version $Id: doForces.F90,v 1.10 2005-01-14 20:31:12 gezelter Exp $, $Date: 2005-01-14 20:31:12 $, $Name: not supported by cvs2svn $, $Revision: 1.10 $ |
49 |
|
|
50 |
+ |
|
51 |
|
module doForces |
52 |
|
use force_globals |
53 |
|
use simulation |
56 |
|
use switcheroo |
57 |
|
use neighborLists |
58 |
|
use lj |
59 |
< |
use sticky_pair |
59 |
> |
use sticky |
60 |
|
use dipole_dipole |
61 |
|
use charge_charge |
62 |
|
use reaction_field |
391 |
|
endif |
392 |
|
endif |
393 |
|
|
394 |
< |
if (FF_uses_sticky) then |
395 |
< |
call check_sticky_FF(my_status) |
396 |
< |
if (my_status /= 0) then |
397 |
< |
thisStat = -1 |
398 |
< |
haveSaneForceField = .false. |
399 |
< |
return |
400 |
< |
end if |
401 |
< |
endif |
394 |
> |
!sticky module does not contain check_sticky_FF anymore |
395 |
> |
!if (FF_uses_sticky) then |
396 |
> |
! call check_sticky_FF(my_status) |
397 |
> |
! if (my_status /= 0) then |
398 |
> |
! thisStat = -1 |
399 |
> |
! haveSaneForceField = .false. |
400 |
> |
! return |
401 |
> |
! end if |
402 |
> |
!endif |
403 |
|
|
404 |
|
if (FF_uses_EAM) then |
405 |
|
call init_EAM_FF(my_status) |
439 |
|
|
440 |
|
!! Does force loop over i,j pairs. Calls do_pair to calculates forces. |
441 |
|
!-------------------------------------------------------------> |
442 |
< |
subroutine do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
442 |
> |
subroutine do_force_loop(q, q_group, A, eFrame, f, t, tau, pot, & |
443 |
|
do_pot_c, do_stress_c, error) |
444 |
|
!! Position array provided by C, dimensioned by getNlocal |
445 |
|
real ( kind = dp ), dimension(3, nLocal) :: q |
448 |
|
!! Rotation Matrix for each long range particle in simulation. |
449 |
|
real( kind = dp), dimension(9, nLocal) :: A |
450 |
|
!! Unit vectors for dipoles (lab frame) |
451 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
451 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
452 |
|
!! Force array provided by C, dimensioned by getNlocal |
453 |
|
real ( kind = dp ), dimension(3,nLocal) :: f |
454 |
|
!! Torsion array provided by C, dimensioned by getNlocal |
523 |
|
call gather(q_group, q_group_Col, plan_group_col_3d) |
524 |
|
|
525 |
|
if (FF_UsesDirectionalAtoms() .and. SIM_uses_DirectionalAtoms) then |
526 |
< |
call gather(u_l, u_l_Row, plan_atom_row_3d) |
527 |
< |
call gather(u_l, u_l_Col, plan_atom_col_3d) |
526 |
> |
call gather(eFrame, eFrame_Row, plan_atom_row_rotation) |
527 |
> |
call gather(eFrame, eFrame_Col, plan_atom_col_rotation) |
528 |
|
|
529 |
|
call gather(A, A_Row, plan_atom_row_rotation) |
530 |
|
call gather(A, A_Col, plan_atom_col_rotation) |
670 |
|
#ifdef IS_MPI |
671 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
672 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
673 |
< |
u_l, A, f, t, pot_local) |
673 |
> |
eFrame, A, f, t, pot_local) |
674 |
|
#else |
675 |
|
call do_prepair(atom1, atom2, ratmsq, d_atm, sw, & |
676 |
|
rgrpsq, d_grp, do_pot, do_stress, & |
677 |
< |
u_l, A, f, t, pot) |
677 |
> |
eFrame, A, f, t, pot) |
678 |
|
#endif |
679 |
|
else |
680 |
|
#ifdef IS_MPI |
681 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
682 |
|
do_pot, & |
683 |
< |
u_l, A, f, t, pot_local, vpair, fpair) |
683 |
> |
eFrame, A, f, t, pot_local, vpair, fpair) |
684 |
|
#else |
685 |
|
call do_pair(atom1, atom2, ratmsq, d_atm, sw, & |
686 |
|
do_pot, & |
687 |
< |
u_l, A, f, t, pot, vpair, fpair) |
687 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
688 |
|
#endif |
689 |
|
|
690 |
|
vij = vij + vpair |
837 |
|
|
838 |
|
!! The reaction field needs to include a self contribution |
839 |
|
!! to the field: |
840 |
< |
call accumulate_self_rf(i, mu_i, u_l) |
840 |
> |
call accumulate_self_rf(i, mu_i, eFrame) |
841 |
|
!! Get the reaction field contribution to the |
842 |
|
!! potential and torques: |
843 |
< |
call reaction_field_final(i, mu_i, u_l, rfpot, t, do_pot) |
843 |
> |
call reaction_field_final(i, mu_i, eFrame, rfpot, t, do_pot) |
844 |
|
#ifdef IS_MPI |
845 |
|
pot_local = pot_local + rfpot |
846 |
|
#else |
880 |
|
end subroutine do_force_loop |
881 |
|
|
882 |
|
subroutine do_pair(i, j, rijsq, d, sw, do_pot, & |
883 |
< |
u_l, A, f, t, pot, vpair, fpair) |
883 |
> |
eFrame, A, f, t, pot, vpair, fpair) |
884 |
|
|
885 |
|
real( kind = dp ) :: pot, vpair, sw |
886 |
|
real( kind = dp ), dimension(3) :: fpair |
887 |
|
real( kind = dp ), dimension(nLocal) :: mfact |
888 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
888 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
889 |
|
real( kind = dp ), dimension(9,nLocal) :: A |
890 |
|
real( kind = dp ), dimension(3,nLocal) :: f |
891 |
|
real( kind = dp ), dimension(3,nLocal) :: t |
908 |
|
me_i = atid(i) |
909 |
|
me_j = atid(j) |
910 |
|
#endif |
911 |
+ |
|
912 |
+ |
! write(*,*) i, j, me_i, me_j |
913 |
|
|
914 |
|
if (FF_uses_LennardJones .and. SIM_uses_LennardJones) then |
915 |
|
|
933 |
|
|
934 |
|
if ( PropertyMap(me_i)%is_Dipole .and. PropertyMap(me_j)%is_Dipole) then |
935 |
|
call do_dipole_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
936 |
< |
pot, u_l, f, t, do_pot) |
936 |
> |
pot, eFrame, f, t, do_pot) |
937 |
|
if (FF_uses_RF .and. SIM_uses_RF) then |
938 |
< |
call accumulate_rf(i, j, r, u_l, sw) |
939 |
< |
call rf_correct_forces(i, j, d, r, u_l, sw, f, fpair) |
938 |
> |
call accumulate_rf(i, j, r, eFrame, sw) |
939 |
> |
call rf_correct_forces(i, j, d, r, eFrame, sw, f, fpair) |
940 |
|
endif |
941 |
|
endif |
942 |
|
|
957 |
|
if ( PropertyMap(me_i)%is_GayBerne .and. & |
958 |
|
PropertyMap(me_j)%is_GayBerne) then |
959 |
|
call do_gb_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
960 |
< |
pot, u_l, f, t, do_pot) |
960 |
> |
pot, A, f, t, do_pot) |
961 |
|
endif |
962 |
|
|
963 |
|
endif |
971 |
|
|
972 |
|
endif |
973 |
|
|
974 |
+ |
|
975 |
+ |
! write(*,*) PropertyMap(me_i)%is_Shape,PropertyMap(me_j)%is_Shape |
976 |
+ |
|
977 |
|
if (FF_uses_Shapes .and. SIM_uses_Shapes) then |
930 |
– |
|
978 |
|
if ( PropertyMap(me_i)%is_Shape .and. & |
979 |
|
PropertyMap(me_j)%is_Shape ) then |
980 |
|
call do_shape_pair(i, j, d, r, rijsq, sw, vpair, fpair, & |
981 |
< |
pot, u_l, f, t, do_pot) |
981 |
> |
pot, A, f, t, do_pot) |
982 |
|
endif |
983 |
|
|
984 |
|
endif |
986 |
|
end subroutine do_pair |
987 |
|
|
988 |
|
subroutine do_prepair(i, j, rijsq, d, sw, rcijsq, dc, & |
989 |
< |
do_pot, do_stress, u_l, A, f, t, pot) |
989 |
> |
do_pot, do_stress, eFrame, A, f, t, pot) |
990 |
|
|
991 |
|
real( kind = dp ) :: pot, sw |
992 |
< |
real( kind = dp ), dimension(3,nLocal) :: u_l |
992 |
> |
real( kind = dp ), dimension(9,nLocal) :: eFrame |
993 |
|
real (kind=dp), dimension(9,nLocal) :: A |
994 |
|
real (kind=dp), dimension(3,nLocal) :: f |
995 |
|
real (kind=dp), dimension(3,nLocal) :: t |
1104 |
|
q_group_Row = 0.0_dp |
1105 |
|
q_group_Col = 0.0_dp |
1106 |
|
|
1107 |
< |
u_l_Row = 0.0_dp |
1108 |
< |
u_l_Col = 0.0_dp |
1107 |
> |
eFrame_Row = 0.0_dp |
1108 |
> |
eFrame_Col = 0.0_dp |
1109 |
|
|
1110 |
|
A_Row = 0.0_dp |
1111 |
|
A_Col = 0.0_dp |
1268 |
|
end subroutine add_stress_tensor |
1269 |
|
|
1270 |
|
end module doForces |
1224 |
– |
|
1225 |
– |
!! Interfaces for C programs to module.... |
1226 |
– |
|
1227 |
– |
subroutine initFortranFF(use_RF_c, thisStat) |
1228 |
– |
use doForces, ONLY: init_FF |
1229 |
– |
logical, intent(in) :: use_RF_c |
1230 |
– |
|
1231 |
– |
integer, intent(out) :: thisStat |
1232 |
– |
call init_FF(use_RF_c, thisStat) |
1233 |
– |
|
1234 |
– |
end subroutine initFortranFF |
1235 |
– |
|
1236 |
– |
subroutine doForceloop(q, q_group, A, u_l, f, t, tau, pot, & |
1237 |
– |
do_pot_c, do_stress_c, error) |
1238 |
– |
|
1239 |
– |
use definitions, ONLY: dp |
1240 |
– |
use simulation |
1241 |
– |
use doForces, ONLY: do_force_loop |
1242 |
– |
!! Position array provided by C, dimensioned by getNlocal |
1243 |
– |
real ( kind = dp ), dimension(3, nLocal) :: q |
1244 |
– |
!! molecular center-of-mass position array |
1245 |
– |
real ( kind = dp ), dimension(3, nGroups) :: q_group |
1246 |
– |
!! Rotation Matrix for each long range particle in simulation. |
1247 |
– |
real( kind = dp), dimension(9, nLocal) :: A |
1248 |
– |
!! Unit vectors for dipoles (lab frame) |
1249 |
– |
real( kind = dp ), dimension(3,nLocal) :: u_l |
1250 |
– |
!! Force array provided by C, dimensioned by getNlocal |
1251 |
– |
real ( kind = dp ), dimension(3,nLocal) :: f |
1252 |
– |
!! Torsion array provided by C, dimensioned by getNlocal |
1253 |
– |
real( kind = dp ), dimension(3,nLocal) :: t |
1254 |
– |
|
1255 |
– |
!! Stress Tensor |
1256 |
– |
real( kind = dp), dimension(9) :: tau |
1257 |
– |
real ( kind = dp ) :: pot |
1258 |
– |
logical ( kind = 2) :: do_pot_c, do_stress_c |
1259 |
– |
integer :: error |
1260 |
– |
|
1261 |
– |
call do_force_loop(q, q_group, A, u_l, f, t, tau, pot, & |
1262 |
– |
do_pot_c, do_stress_c, error) |
1263 |
– |
|
1264 |
– |
end subroutine doForceloop |