1 |
!! module defines atypes available to simulation |
2 |
|
3 |
module atype_module |
4 |
use definitions, only: dp |
5 |
use vector_class |
6 |
use sticky_pair |
7 |
use gb_pair |
8 |
implicit none |
9 |
private |
10 |
|
11 |
type (Vector), pointer, public :: atypes => null() |
12 |
|
13 |
|
14 |
public :: new_atype |
15 |
|
16 |
contains |
17 |
|
18 |
subroutine new_atype(c_ident, is_LJ, is_Sticky, is_DP, is_GB, & |
19 |
lj_epsilon, lj_sigma, & |
20 |
dipole_moment, & |
21 |
sticky_w0, sticky_v0, & |
22 |
GB_sigma, GB_l2b_ratio, GB_eps, GB_eps_ratio, GB_mu, GB_nu, & |
23 |
status) |
24 |
|
25 |
real( kind = dp ), intent(in) :: lj_epsilon |
26 |
real( kind = dp ), intent(in) :: lj_sigma |
27 |
real( kind = dp ), intent(in) :: sticky_w0 |
28 |
real( kind = dp ), intent(in) :: sticky_v0 |
29 |
real( kind = dp ), intent(in) :: dipole_moment |
30 |
real( kind = dp ), intent(in) :: GB_sigma, GB_l2b_ratio, GB_eps |
31 |
real( kind = dp ), intent(in) :: GB_eps_ratio, GB_mu, GB_nu |
32 |
|
33 |
integer, intent(in) :: c_ident |
34 |
integer, intent(out) :: status |
35 |
integer, intent(in) :: is_Sticky |
36 |
integer, intent(in) :: is_DP |
37 |
integer, intent(in) :: is_GB |
38 |
integer, intent(in) :: is_LJ |
39 |
integer :: me |
40 |
logical :: l_is_LJ, l_is_DP, l_is_Sticky, l_is_GB |
41 |
|
42 |
status = 0 |
43 |
|
44 |
if (.not. associated(atypes)) then |
45 |
!! There are 16 properties to worry about for now. |
46 |
!! Fix this if needed for more atomic properties |
47 |
write(*,*) "Initializing atypes directly" |
48 |
atypes => initialize(16) |
49 |
if (.not.associated(atypes)) then |
50 |
status = -1 |
51 |
return |
52 |
endif |
53 |
endif |
54 |
|
55 |
me = addElement(atypes) |
56 |
call setElementProperty(atypes, me, "c_ident", c_ident) |
57 |
|
58 |
l_is_LJ = (is_LJ .ne. 0) |
59 |
l_is_DP = (is_DP .ne. 0) |
60 |
l_is_Sticky = (is_Sticky .ne. 0) |
61 |
l_is_GB = (is_GB .ne. 0) |
62 |
|
63 |
call setElementProperty(atypes, me, "is_LJ", l_is_LJ) |
64 |
call setElementProperty(atypes, me, "is_DP", l_is_DP) |
65 |
call setElementProperty(atypes, me, "is_Sticky", l_is_Sticky) |
66 |
call setElementProperty(atypes, me, "is_GB", l_is_GB) |
67 |
|
68 |
if (l_is_LJ) then |
69 |
call setElementProperty(atypes, me, "lj_sigma", lj_sigma) |
70 |
call setElementProperty(atypes, me, "lj_epsilon", lj_epsilon) |
71 |
endif |
72 |
if (l_is_DP) then |
73 |
call setElementProperty(atypes, me, "dipole_moment", dipole_moment) |
74 |
endif |
75 |
if (l_is_Sticky) then |
76 |
call setElementProperty(atypes, me, "sticky_w0", sticky_w0) |
77 |
call setElementProperty(atypes, me, "sticky_v0", sticky_v0) |
78 |
call check_sticky_FF(status) |
79 |
if (status .ne. 0) call set_sticky_params(sticky_w0, sticky_v0) |
80 |
endif |
81 |
if (l_is_GB) then |
82 |
call setElementProperty(atypes, me, "GB_sigma", GB_sigma) |
83 |
call setElementProperty(atypes, me, "GB_l2b_ratio", GB_l2b_ratio) |
84 |
call setElementProperty(atypes, me, "GB_eps", GB_eps) |
85 |
call setElementProperty(atypes, me, "GB_eps_ratio", GB_eps_ratio) |
86 |
call setElementProperty(atypes, me, "GB_mu", GB_mu) |
87 |
call setElementProperty(atypes, me, "GB_nu", GB_nu) |
88 |
call check_gb_pair_FF(status) |
89 |
if (status .ne. 0) call set_gb_pair_params(GB_sigma, GB_l2b_ratio, & |
90 |
GB_eps, GB_eps_ratio, GB_mu, GB_nu) |
91 |
endif |
92 |
|
93 |
end subroutine new_atype |
94 |
|
95 |
end module atype_module |