1 |
chuckv |
215 |
module lj_ff |
2 |
|
|
use simulation |
3 |
|
|
use definitions, ONLY : dp, ndim |
4 |
|
|
implicit none |
5 |
|
|
|
6 |
|
|
integer, save :: n_lj_atypes = 0 |
7 |
|
|
|
8 |
|
|
type, public :: lj_atype |
9 |
|
|
private |
10 |
|
|
sequence |
11 |
|
|
integer :: atype_ident = 0 |
12 |
|
|
character(len = 15) :: name = "NULL" |
13 |
|
|
real ( kind = dp ) :: mass = 0.0_dp |
14 |
|
|
real ( kind = dp ) :: epslon = 0.0_dp |
15 |
|
|
real ( kind = dp ) :: sigma = 0.0_dp |
16 |
|
|
type (lj_atype), pointer :: next => null() |
17 |
|
|
end type lj_atype |
18 |
|
|
|
19 |
|
|
type (lj_atype), pointer :: lj_atype_list => null() |
20 |
|
|
|
21 |
|
|
public :: new_lj_atype |
22 |
|
|
|
23 |
|
|
contains |
24 |
|
|
|
25 |
|
|
subroutine new_lj_atype(name,mass,epslon,sigma,status) |
26 |
|
|
character( len = 15 ) :: name |
27 |
|
|
real( kind = dp ), intent(in) :: mass |
28 |
|
|
real( kind = dp ), intent(in) :: epslon |
29 |
|
|
real( kind = dp ), intent(in) :: sigam |
30 |
|
|
integer, intent(out) :: status |
31 |
|
|
|
32 |
chuckv |
216 |
type (lj_atype), pointer :: this_lj_atype |
33 |
|
|
type (lj_atype), pointer :: lj_atype_ptr |
34 |
|
|
|
35 |
|
|
integer :: alloc_error |
36 |
|
|
integer :: atype_counter = 0 |
37 |
|
|
|
38 |
chuckv |
215 |
status = 0 |
39 |
|
|
|
40 |
chuckv |
216 |
allocate(this_lj_atype,stat=alloc_error) |
41 |
|
|
if (alloc_error /= 0 ) then |
42 |
|
|
status = -1 |
43 |
|
|
return |
44 |
|
|
end if |
45 |
|
|
|
46 |
|
|
! assign our new lj_atype information |
47 |
|
|
this_lj_atype%name = name |
48 |
|
|
this_lj_atype%mass = mass |
49 |
|
|
this_lj_atype%epslon = epslon |
50 |
|
|
this_lj_atype%sigma = sigma |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
! if lj_atype_list is null then we are at the top of the list. |
54 |
|
|
if (.not. associated(lj_atype_list)) then |
55 |
|
|
lj_atype_ptr => this_lj_atype |
56 |
|
|
atype_counter = 1 |
57 |
|
|
else ! we need to find the bottom of the list |
58 |
|
|
lj_atype_ptr => lj_atype_list%next |
59 |
|
|
find_end: do |
60 |
|
|
if (.not. associated(lj_atype_ptr%next)) then |
61 |
|
|
exit find_end |
62 |
|
|
end if |
63 |
|
|
lj_atype_ptr => lj_atype_ptr%next |
64 |
|
|
end do find_end |
65 |
|
|
end if |
66 |
|
|
|
67 |
|
|
lj_atype_ptr => this_lj_atype |
68 |
|
|
|
69 |
chuckv |
215 |
end subroutine new_lj_atype |
70 |
|
|
|
71 |
chuckv |
216 |
subroutine add_lj_atype() |
72 |
chuckv |
215 |
|
73 |
|
|
|
74 |
|
|
|
75 |
chuckv |
216 |
end subroutine add_lj_atype |
76 |
chuckv |
215 |
|
77 |
|
|
|
78 |
chuckv |
222 |
subroutine do_lj_ff(q,f,potE) |
79 |
|
|
real ( kind = dp ), dimension(ndim,) :: q |
80 |
|
|
real ( kind = dp ), dimension(ndim,nLRparticles) :: f |
81 |
|
|
real ( kind = dp ) :: potE |
82 |
chuckv |
216 |
|
83 |
|
|
|
84 |
chuckv |
222 |
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
end subroutine do_lj_ff |
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
chuckv |
215 |
end module lj_ff |