-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm_uplist.f90
210 lines (174 loc) · 4.51 KB
/
m_uplist.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
!---------------------------------------------------------------------
! MELQUIADES: Metropolis Monte Carlos Program
!---------------------------------------------------------------------
!bop
!
! !Module: m_uplist
!
! !Description: This module contains the routines needed for updating
!list of neighbors in box simulation.
!\\
!\\
! !Interface:
!
module m_uplist
!
! !Uses:
!
use m_kind
use m_simtype
use m_boxtype
use m_precells
!
! !Public member functions:
!
private
public :: r_update
public :: r_up2date
public :: r_up3date
!
! !Revision history:
! 08Aug 2015 Asdrubal Lozada
!
!eop
!----------------------------------------------------------------------
contains
!
!bop
!
! !Iroutine: r_update
!
! !Description: This routine updates the list of neighbors if cell index
!was changed.
!\\
!\\
! !Interface:
subroutine r_update( com_new, i_d, a, y, x )
!
implicit none
!
! !Input parameters:
type(simulation), intent(inout) :: y
type(box), pointer :: x
integer,intent(in) :: a
integer,intent(in) :: i_d
real(rkind), dimension(:),intent(in) :: com_new
!
! !Revision history:
! 08Aug 2015 Asdrubal Lozada
!
!eop
!----------------------------------------------------------------------
! Local variables
real(rkind), dimension(3) :: com_old
integer :: jold, jnew, i
if( a == 1 ) then
com_old(1) = x%m_cmass(1,i_d)
com_old(2) = x%m_cmass(2,i_d)
com_old(3) = x%m_cmass(3,i_d)
x%m_cmass(1,i_d) = com_new(1)
x%m_cmass(2,i_d) = com_new(2)
x%m_cmass(3,i_d) = com_new(3)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rot(1,i)
x%m_site(2,i,i_d) = x%m_rot(2,i)
x%m_site(3,i,i_d) = x%m_rot(3,i)
end do
jold = f_idcell(com_old,y,x)
jnew = f_idcell(com_new,y,x)
if( jnew /= jold ) then
call r_headinit(y,x)
call r_linkscell(y,x)
end if ! index cell
else
x%m_cmass(1,i_d) = x%m_rcom(1,i_d)
x%m_cmass(2,i_d) = x%m_rcom(2,i_d)
x%m_cmass(3,i_d) = x%m_rcom(3,i_d)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rsite(1,i)
x%m_site(2,i,i_d) = x%m_rsite(2,i)
x%m_site(3,i,i_d) = x%m_rsite(3,i)
end do
end if ! a
end subroutine r_update
subroutine r_up2date( com_new, i_d, a, y, x )
implicit none
type(simulation), intent(inout) :: y
type(box), pointer :: x
integer,intent(in) :: a
integer,intent(in) :: i_d
real(rkind), dimension(:),intent(in) :: com_new
! Local variables
real(rkind), dimension(3) :: com_old
integer :: jold, jnew, i
if( a == 1 ) then
com_old(1) = x%m_cmass(1,i_d)
com_old(2) = x%m_cmass(2,i_d)
com_old(3) = x%m_cmass(3,i_d)
x%m_cmass(1,i_d) = com_new(1)
x%m_cmass(2,i_d) = com_new(2)
x%m_cmass(3,i_d) = com_new(3)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rot(1,i)
x%m_site(2,i,i_d) = x%m_rot(2,i)
x%m_site(3,i,i_d) = x%m_rot(3,i)
end do
jold = f_idcell(com_old,y,x)
jnew = f_idcell(com_new,y,x)
if( jnew /= jold ) then
call r_headinit2(y,x)
call r_linkscell2(y,x)
end if
else
x%m_cmass(1,i_d) = x%m_rcom(1,i_d)
x%m_cmass(2,i_d) = x%m_rcom(2,i_d)
x%m_cmass(3,i_d) = x%m_rcom(3,i_d)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rsite(1,i)
x%m_site(2,i,i_d) = x%m_rsite(2,i)
x%m_site(3,i,i_d) = x%m_rsite(3,i)
end do
end if ! a
y%m_solute = .true.
end subroutine r_up2date
subroutine r_up3date( com_new, i_d, a, y, x )
implicit none
type(simulation), intent(inout) :: y
type(box), pointer :: x
integer,intent(in) :: a
integer,intent(in) :: i_d
real(rkind), dimension(:),intent(in) :: com_new
! Local variable
real(rkind), dimension(3) :: com_old
integer :: jold, jnew, i
if( a == 1 ) then
com_old(1) = x%m_cmass(1,i_d)
com_old(2) = x%m_cmass(2,i_d)
com_old(3) = x%m_cmass(3,i_d)
x%m_cmass(1,i_d) = com_new(1)
x%m_cmass(2,i_d) = com_new(2)
x%m_cmass(3,i_d) = com_new(3)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rot(1,i)
x%m_site(2,i,i_d) = x%m_rot(2,i)
x%m_site(3,i,i_d) = x%m_rot(3,i)
end do
jold = f_idcell(com_old,y,x)
jnew = f_idcell(com_new,y,x)
if( jnew /= jold ) then
call r_headinit3(y,x)
call r_linkscell3(y,x)
end if
else
x%m_cmass(1,i_d) = x%m_rcom(1,i_d)
x%m_cmass(2,i_d) = x%m_rcom(2,i_d)
x%m_cmass(3,i_d) = x%m_rcom(3,i_d)
do i=1,x%m_ns(i_d)
x%m_site(1,i,i_d) = x%m_rsite(1,i)
x%m_site(2,i,i_d) = x%m_rsite(2,i)
x%m_site(3,i,i_d) = x%m_rsite(3,i)
end do
end if
y%m_solute = .true.
end subroutine r_up3date
end module m_uplist