1 |
gezelter |
1608 |
!! 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 |
|
|
|
11 |
|
|
|
12 |
|
|
public :: new_atype |
13 |
|
|
|
14 |
|
|
contains |
15 |
|
|
|
16 |
|
|
subroutine new_atype(c_ident, is_LJ, is_Sticky, is_DP, is_GB, & |
17 |
|
|
is_EAM, is_Charge, lj_epsilon, lj_sigma, charge, dipole_moment, & |
18 |
|
|
status) |
19 |
|
|
|
20 |
|
|
real( kind = dp ), intent(in) :: lj_epsilon |
21 |
|
|
real( kind = dp ), intent(in) :: lj_sigma |
22 |
|
|
real( kind = dp ), intent(in) :: dipole_moment |
23 |
|
|
real( kind = dp ), intent(in) :: charge |
24 |
|
|
|
25 |
|
|
integer, intent(in) :: c_ident |
26 |
|
|
integer, intent(out) :: status |
27 |
|
|
integer, intent(in) :: is_Sticky |
28 |
|
|
integer, intent(in) :: is_DP |
29 |
|
|
integer, intent(in) :: is_GB |
30 |
|
|
integer, intent(in) :: is_EAM |
31 |
|
|
integer, intent(in) :: is_LJ |
32 |
|
|
integer, intent(in) :: is_Charge |
33 |
|
|
integer :: me |
34 |
|
|
logical :: l_is_LJ, l_is_DP, l_is_Sticky, l_is_GB |
35 |
|
|
logical :: l_is_EAM, l_is_Charge |
36 |
|
|
integer :: FFcheckStatus |
37 |
|
|
status = 0 |
38 |
|
|
|
39 |
|
|
if (.not. associated(atypes)) then |
40 |
|
|
!! There are 16 properties to worry about for now. |
41 |
|
|
!! Fix this if needed for more atomic properties |
42 |
|
|
atypes => initialize(17) |
43 |
|
|
if (.not.associated(atypes)) then |
44 |
|
|
status = -1 |
45 |
|
|
return |
46 |
|
|
endif |
47 |
|
|
endif |
48 |
|
|
|
49 |
|
|
me = addElement(atypes) |
50 |
|
|
call setElementProperty(atypes, me, "c_ident", c_ident) |
51 |
|
|
|
52 |
|
|
l_is_LJ = (is_LJ .ne. 0) |
53 |
|
|
l_is_DP = (is_DP .ne. 0) |
54 |
|
|
l_is_Sticky = (is_Sticky .ne. 0) |
55 |
|
|
l_is_GB = (is_GB .ne. 0) |
56 |
|
|
l_is_EAM = (is_EAM .ne. 0) |
57 |
|
|
l_is_Charge = (is_Charge .ne. 0) |
58 |
|
|
|
59 |
|
|
call setElementProperty(atypes, me, "is_LJ", l_is_LJ) |
60 |
|
|
call setElementProperty(atypes, me, "is_DP", l_is_DP) |
61 |
|
|
call setElementProperty(atypes, me, "is_Sticky", l_is_Sticky) |
62 |
|
|
call setElementProperty(atypes, me, "is_GB", l_is_GB) |
63 |
|
|
call setElementProperty(atypes, me, "is_EAM", l_is_EAM) |
64 |
|
|
call setElementProperty(atypes, me, "is_Charge", l_is_Charge) |
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_Charge) then |
74 |
|
|
call setElementProperty(atypes, me, "charge", charge) |
75 |
|
|
endif |
76 |
|
|
|
77 |
|
|
end subroutine new_atype |
78 |
|
|
|
79 |
|
|
end module atype_module |
80 |
|
|
! provide interface for c calls.... |
81 |
|
|
subroutine makeatype(c_ident, is_LJ, is_Sticky, is_DP, is_GB, & |
82 |
|
|
is_EAM, is_Charge, lj_epsilon, lj_sigma, charge, dipole_moment, & |
83 |
|
|
status) |
84 |
|
|
use definitions, only: dp |
85 |
|
|
use atype_module, ONLY: new_atype |
86 |
|
|
|
87 |
|
|
real( kind = dp ), intent(in) :: lj_epsilon |
88 |
|
|
real( kind = dp ), intent(in) :: lj_sigma |
89 |
|
|
real( kind = dp ), intent(in) :: dipole_moment |
90 |
|
|
real( kind = dp ), intent(in) :: charge |
91 |
|
|
|
92 |
|
|
integer, intent(in) :: c_ident |
93 |
|
|
integer, intent(out) :: status |
94 |
|
|
integer, intent(in) :: is_Sticky |
95 |
|
|
integer, intent(in) :: is_DP |
96 |
|
|
integer, intent(in) :: is_GB |
97 |
|
|
integer, intent(in) :: is_EAM |
98 |
|
|
integer, intent(in) :: is_LJ |
99 |
|
|
integer, intent(in) :: is_Charge |
100 |
|
|
|
101 |
|
|
call module_new_atype(c_ident, is_LJ, is_Sticky, is_DP, is_GB, & |
102 |
|
|
is_EAM, is_Charge, lj_epsilon, lj_sigma, charge, dipole_moment, & |
103 |
|
|
status) |
104 |
|
|
|
105 |
|
|
end subroutine |