50 real(real64),
allocatable,
public :: v_old(:, :, :)
51 real(real64),
allocatable,
public :: vtau_old(:, :, :)
52 logical :: mgga_with_exc
55 integer :: interpolation_steps
61 type(potential_interpolation_t),
intent(inout) :: vkso
62 type(potential_interpolation_t),
intent(in) :: vksi
66 safe_allocate_source_a(vkso%v_old, vksi%v_old)
67 safe_allocate_source_a(vkso%vtau_old, vksi%vtau_old)
68 vkso%mgga_with_exc = vksi%mgga_with_exc
76 type(potential_interpolation_t),
intent(inout) :: potential_interpolation
77 integer,
intent(in) :: np, nspin
78 logical,
intent(in) :: mgga_with_exc
79 integer,
optional,
intent(in) :: order
85 safe_allocate(potential_interpolation%v_old(1:np, 1:nspin, 0:interpolation_steps))
86 potential_interpolation%v_old(:, :, :) =
m_zero
88 potential_interpolation%mgga_with_exc = mgga_with_exc
90 if (potential_interpolation%mgga_with_exc)
then
92 safe_allocate(potential_interpolation%vtau_old(1:np, 1:nspin, 0:interpolation_steps))
93 potential_interpolation%vtau_old(:, :, :) =
m_zero
103 type(potential_interpolation_t),
intent(inout) :: potential_interpolation
107 assert(
allocated(potential_interpolation%v_old))
108 safe_deallocate_a(potential_interpolation%v_old)
109 safe_deallocate_a(potential_interpolation%vtau_old)
117 type(potential_interpolation_t),
intent(inout) :: potential_interpolation
118 integer,
intent(in) :: np, nspin
119 real(real64),
intent(in) :: vhxc(:, :)
120 real(real64),
optional,
intent(in) :: vtau(:, :)
122 integer :: i, ispin, ip
126 do i = 1, interpolation_steps
129 potential_interpolation%v_old(ip, ispin, i) = vhxc(ip, ispin)
134 if (potential_interpolation%mgga_with_exc)
then
135 assert(
present(vtau))
136 do i = 1, interpolation_steps
139 potential_interpolation%vtau_old(ip, ispin, i) = vtau(ip, ispin)
152 integer,
intent(in) :: np, nspin
153 real(real64),
intent(in) :: time, dt
154 real(real64),
contiguous,
intent(in) :: vhxc(:, :)
155 real(real64),
contiguous,
optional,
intent(in) :: vtau(:, :)
157 real(real64),
allocatable :: times(:)
162 safe_allocate(times(1:interpolation_steps))
163 do j = 1, interpolation_steps
164 times(j) = time - j*dt
167 do j = interpolation_steps, 2, -1
168 call lalg_copy(np, nspin, potential_interpolation%v_old(:, :, j-1), potential_interpolation%v_old(:, :, j))
170 call lalg_copy(np, nspin, vhxc(:, :), potential_interpolation%v_old(:, :, 1))
171 call interpolate( times, potential_interpolation%v_old(:, :, 1:interpolation_steps), &
172 time, potential_interpolation%v_old(:, :, 0))
174 if (potential_interpolation%mgga_with_exc)
then
175 assert(
present(vtau))
176 do j = interpolation_steps, 2, -1
177 call lalg_copy(np, nspin, potential_interpolation%vtau_old(:, :, j-1), potential_interpolation%vtau_old(:, :, j))
179 call lalg_copy(np, nspin, vtau(:, :), potential_interpolation%vtau_old(:, :, 1))
180 call interpolate( times, potential_interpolation%vtau_old(:, :, 1:interpolation_steps), &
181 time, potential_interpolation%vtau_old(:, :, 0))
184 safe_deallocate_a(times)
192 integer,
intent(in) :: np, nspin
193 integer,
intent(in) :: i
194 real(real64),
contiguous,
intent(in) :: vhxc(:, :)
195 real(real64),
contiguous,
optional,
intent(in) :: vtau(:, :)
199 call lalg_copy(np, nspin, vhxc, potential_interpolation%v_old(:, :, i))
201 if (potential_interpolation%mgga_with_exc)
then
202 assert(
present(vtau))
203 call lalg_copy(np, nspin, vtau, potential_interpolation%vtau_old(:, :, i))
213 integer,
intent(in) :: np, nspin
214 integer,
intent(in) :: i
215 real(real64),
contiguous,
intent(inout) :: vhxc(:, :)
216 real(real64),
optional,
contiguous,
intent(inout) :: vtau(:, :)
220 call lalg_copy(np, nspin, potential_interpolation%v_old(:, :, i), vhxc)
222 if (potential_interpolation%mgga_with_exc)
then
223 assert(
present(vtau))
224 call lalg_copy(np, nspin, potential_interpolation%vtau_old(:, :, i), vtau)
235 integer,
intent(in) :: order
236 real(real64),
intent(in) :: time, dt, t
237 real(real64),
contiguous,
intent(inout) :: vhxc(:, :)
238 real(real64),
contiguous,
optional,
intent(inout) :: vtau(:, :)
241 real(real64),
allocatable :: times(:)
245 safe_allocate(times(1:interpolation_steps))
246 do j = 1, interpolation_steps
247 times(j) = time - (j-1)*dt
250 call interpolate( times(1:order), potential_interpolation%v_old(:, :, 0:order-1), t, vhxc(:, :))
252 if (potential_interpolation%mgga_with_exc)
then
253 assert(
present(vtau))
254 call interpolate( times(1:order), potential_interpolation%vtau_old(:, :, 0:order-1), t, vtau(:, :))
257 safe_deallocate_a(times)
266 class(
mesh_t),
intent(in) :: mesh
267 integer,
intent(in) :: nspin
268 integer,
intent(out) :: err2
270 integer :: ii, is, err
271 character(len=256) :: filename
277 do ii = 1, interpolation_steps - 1
279 write(filename,
'(a6,i2.2,i3.3)')
'vprev_', ii, is
280 call restart%write_mesh_function(filename, mesh, &
281 potential_interpolation%v_old(1:mesh%np, is, ii), err)
284 if (err /= 0) err2 = err2 + 1
289 if (potential_interpolation%mgga_with_exc)
then
291 do ii = 1, interpolation_steps - 1
293 write(filename,
'(a9,i2.2,i3.3)')
'vtauprev_', ii, is
294 call restart%write_mesh_function(filename, mesh, &
295 potential_interpolation%vtau_old(1:mesh%np, is, ii), err)
298 if (err /= 0) err2 = err2 + 1
312 class(
mesh_t),
intent(in) :: mesh
313 integer,
intent(in) :: nspin
314 integer,
intent(out) :: err2
316 integer :: ii, is, err
317 character(len=256) :: filename
322 do ii = 1, interpolation_steps - 1
324 write(filename,
'(a,i2.2,i3.3)')
'vprev_', ii, is
325 call restart%read_mesh_function(filename, mesh, &
326 potential_interpolation%v_old(1:mesh%np, is, ii), err)
329 message(1) =
"Unable to read VKS restart file '" // trim(filename) //
"'"
335 if (potential_interpolation%mgga_with_exc)
then
337 do ii = 1, interpolation_steps - 1
339 write(filename,
'(a,i2.2,i3.3)')
'vtauprev_', ii, is
340 call restart%read_mesh_function(filename, mesh, &
341 potential_interpolation%vtau_old(1:mesh%np, is, ii), err)
344 message(1) =
"Unable to read VKS restart file '" // trim(filename) //
"'"
Copies a vector x, to a vector y.
This is the common interface to a simple-minded polynomical interpolation procedure (simple use of th...
real(real64), parameter, public m_zero
This module is intended to contain "only mathematical" functions and procedures.
This module defines the meshes, which are used in Octopus.
subroutine, public messages_warning(no_lines, all_nodes, namespace)
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public potential_interpolation_copy(vkso, vksi)
subroutine, public potential_interpolation_end(potential_interpolation)
subroutine, public potential_interpolation_interpolate(potential_interpolation, order, time, dt, t, vhxc, vtau)
subroutine, public potential_interpolation_set(potential_interpolation, np, nspin, i, vhxc, vtau)
subroutine, public potential_interpolation_new(potential_interpolation, np, nspin, time, dt, vhxc, vtau)
subroutine, public potential_interpolation_run_zero_iter(potential_interpolation, np, nspin, vhxc, vtau)
subroutine, public potential_interpolation_load(potential_interpolation, namespace, restart, mesh, nspin, err2)
subroutine, public potential_interpolation_get(potential_interpolation, np, nspin, i, vhxc, vtau)
subroutine, public potential_interpolation_dump(potential_interpolation, restart, mesh, nspin, err2)
subroutine, public potential_interpolation_init(potential_interpolation, np, nspin, mgga_with_exc, order)
Describes mesh distribution to nodes.