26 |
|
real( kind = dp ), allocatable,dimension(:,:),save :: q0 |
27 |
|
|
28 |
|
|
29 |
– |
public :: check |
30 |
– |
public :: save_nlist |
29 |
|
public :: wrap |
30 |
|
public :: getBox |
31 |
|
public :: getRcut |
114 |
|
|
115 |
|
thisBox = thisSim%box(dim) |
116 |
|
end function getBox_dim |
119 |
– |
|
120 |
– |
subroutine check(q,update_nlist) |
121 |
– |
real( kind = dp ), dimension(:,:) :: q |
122 |
– |
integer :: i |
123 |
– |
real( kind = DP ) :: dispmx |
124 |
– |
logical, intent(out) :: update_nlist |
125 |
– |
real( kind = DP ) :: dispmx_tmp |
126 |
– |
real( kind = dp ) :: skin_thickness |
127 |
– |
integer :: natoms |
128 |
– |
|
129 |
– |
natoms = thisSim%nLRparticles |
130 |
– |
skin_thickness = thisSim%rlist - thisSim%rcut |
131 |
– |
dispmx = 0.0E0_DP |
132 |
– |
!! calculate the largest displacement of any atom in any direction |
133 |
– |
|
134 |
– |
#ifdef MPI |
135 |
– |
dispmx_tmp = 0.0E0_DP |
136 |
– |
do i = 1, thisSim%nLRparticles |
137 |
– |
dispmx_tmp = max( abs ( q(1,i) - q0(1,i) ), dispmx ) |
138 |
– |
dispmx_tmp = max( abs ( q(2,i) - q0(2,i) ), dispmx ) |
139 |
– |
dispmx_tmp = max( abs ( q(3,i) - q0(3,i) ), dispmx ) |
140 |
– |
end do |
141 |
– |
call mpi_allreduce(dispmx_tmp,dispmx,1,mpi_double_precision, & |
142 |
– |
mpi_max,mpi_comm_world,mpi_err) |
143 |
– |
#else |
144 |
– |
|
145 |
– |
do i = 1, thisSim%nLRparticles |
146 |
– |
dispmx = max( abs ( q(1,i) - q0(1,i) ), dispmx ) |
147 |
– |
dispmx = max( abs ( q(2,i) - q0(2,i) ), dispmx ) |
148 |
– |
dispmx = max( abs ( q(3,i) - q0(3,i) ), dispmx ) |
149 |
– |
end do |
150 |
– |
#endif |
117 |
|
|
152 |
– |
!! a conservative test of list skin crossings |
153 |
– |
dispmx = 2.0E0_DP * sqrt (3.0E0_DP * dispmx * dispmx) |
154 |
– |
|
155 |
– |
update_nlist = (dispmx.gt.(skin_thickness)) |
156 |
– |
|
157 |
– |
end subroutine check |
158 |
– |
|
159 |
– |
subroutine save_nlist(q) |
160 |
– |
real(kind = dp ), dimension(:,:), intent(in) :: q |
161 |
– |
integer :: list_size |
162 |
– |
|
118 |
|
|
164 |
– |
list_size = size(q) |
165 |
– |
|
166 |
– |
if (.not. allocated(q0)) then |
167 |
– |
allocate(q0(3,list_size)) |
168 |
– |
else if( list_size > size(q0)) then |
169 |
– |
deallocate(q0) |
170 |
– |
allocate(q0(3,list_size)) |
171 |
– |
endif |
172 |
– |
|
173 |
– |
q0 = q |
174 |
– |
|
175 |
– |
end subroutine save_nlist |
176 |
– |
|
177 |
– |
|
119 |
|
function wrap_1d(r,dim) result(this_wrap) |
120 |
|
|
121 |
|
|