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