1 |
module forceGlobals |
2 |
|
3 |
use definitions |
4 |
use simulation |
5 |
use atype_typedefs |
6 |
use vector_class |
7 |
#ifdef IS_MPI |
8 |
use mpiSimulation |
9 |
#endif |
10 |
|
11 |
logical, save :: atype_vector_initialized = .false. |
12 |
logical, save :: ff_initialized = .false. |
13 |
|
14 |
real(kind = dp) :: pot = 0.0_dp |
15 |
real(kind = dp), dimension(9) :: tau_Temp = 0.0_dp |
16 |
real(kind = dp) :: virial_Temp = 0.0_dp |
17 |
|
18 |
public :: new_atype |
19 |
public :: init_FF |
20 |
|
21 |
contains |
22 |
|
23 |
subroutine new_atype(c_ident, is_LJ, is_Sticky, is_DP, is_GB, & |
24 |
lj_epsilon, lj_sigma, & |
25 |
dipole_moment, & |
26 |
sticky_w0, sticky_v0, & |
27 |
GB_sigma, GB_l2b_ratio, GB_eps, GB_eps_ratio, GB_mu, GB_nu, & |
28 |
status) |
29 |
|
30 |
real( kind = dp ), intent(in) :: lj_epsilon |
31 |
real( kind = dp ), intent(in) :: lj_sigma |
32 |
real( kind = dp ), intent(in) :: sticky_w0 |
33 |
real( kind = dp ), intent(in) :: sticky_v0 |
34 |
real( kind = dp ), intent(in) :: dipole_moment |
35 |
real( kind = dp ), intent(in) :: GB_sigma, GB_l2b_ratio, GB_eps |
36 |
real( kind = dp ), intent(in) :: GB_eps_ratio, GB_mu, GB_nu |
37 |
|
38 |
integer, intent(in) :: c_ident |
39 |
integer, intent(out) :: status |
40 |
integer, intent(in) :: is_Sticky |
41 |
integer, intent(in) :: is_DP |
42 |
integer, intent(in) :: is_GB |
43 |
integer, intent(in) :: is_LJ |
44 |
integer :: me |
45 |
logical :: l_is_LJ, l_is_DP, l_is_Sticky, l_is_GB |
46 |
|
47 |
status = 0 |
48 |
|
49 |
if (.not.atype_vector_initialized) then |
50 |
!! There are 16 properties to worry about for now. |
51 |
!! Fix this if needed for more atomic properties |
52 |
atypes = initialize(16) |
53 |
if (.not.associated(atypes)) then |
54 |
status = -1 |
55 |
return |
56 |
endif |
57 |
endif |
58 |
|
59 |
me = addElement(atypes) |
60 |
|
61 |
call setElementProperty(atypes, me, "c_ident", c_ident) |
62 |
|
63 |
l_is_LJ = (is_LJ .ne. 0) |
64 |
l_is_DP = (is_DP .ne. 0) |
65 |
l_is_Sticky = (is_Sticky .ne. 0) |
66 |
l_is_GB = (is_GB .ne. 0) |
67 |
|
68 |
call setElementProperty(atypes, me, "is_LJ", l_is_LJ) |
69 |
call setElementProperty(atypes, me, "is_DP", l_is_DP) |
70 |
call setElementProperty(atypes, me, "is_Sticky", l_is_Sticky) |
71 |
call setElementProperty(atypes, me, "is_GB", l_is_GB) |
72 |
|
73 |
if (l_is_LJ) then |
74 |
call setElementProperty(atypes, me, "lj_sigma", lj_sigma) |
75 |
call setElementProperty(atypes, me, "lj_epsilon", lj_epsilon) |
76 |
endif |
77 |
if (l_is_DP) then |
78 |
call setElementProperty(atypes, me, "dipole_moment", dipole_moment) |
79 |
endif |
80 |
if (l_is_Sticky) then |
81 |
call setElementProperty(atypes, me, "sticky_w0", sticky_w0) |
82 |
call setElementProperty(atypes, me, "sticky_v0", sticky_v0) |
83 |
endif |
84 |
if (l_is_GB) then |
85 |
call setElementProperty(atypes, me, "GB_sigma", GB_sigma) |
86 |
call setElementProperty(atypes, me, "GB_l2b_ratio", GB_l2b_ratio) |
87 |
call setElementProperty(atypes, me, "GB_eps", GB_eps) |
88 |
call setElementProperty(atypes, me, "GB_eps_ratio", GB_eps_ratio) |
89 |
call setElementProperty(atypes, me, "GB_mu", GB_mu) |
90 |
call setElementProperty(atypes, me, "GB_nu", GB_nu) |
91 |
endif |
92 |
|
93 |
end subroutine new_atype |
94 |
|
95 |
|
96 |
subroutine init_FF(status) |
97 |
|
98 |
!! Result status, success = 0, error = -1 |
99 |
integer, intent(out) :: status |
100 |
integer :: thisStat = 0 |
101 |
|
102 |
|
103 |
call initForce_Modules(thisStat) |
104 |
if (thisStat /= 0) then |
105 |
status = -1 |
106 |
return |
107 |
endif |
108 |
|
109 |
|
110 |
ff_initialized = .true. |
111 |
|
112 |
|
113 |
end subroutine init_FF |
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
subroutine initForce_Modules(thisStat) |
121 |
integer, intent(out) :: thisStat |
122 |
integer :: my_status |
123 |
|
124 |
thisStat = 0 |
125 |
call init_lj_FF(my_status) |
126 |
if (my_status /= 0) then |
127 |
thisStat = -1 |
128 |
return |
129 |
end if |
130 |
|
131 |
call check_sticky_FF(my_status) |
132 |
if (my_status /= 0) then |
133 |
thisStat = -1 |
134 |
return |
135 |
end if |
136 |
|
137 |
|
138 |
end subroutine initForce_Modules |
139 |
|
140 |
end module forceGlobals |