33#if defined(HAVE_NETCDF)
54 integer,
parameter :: &
55 INTEGRATE_NONE = -1, &
68 subroutine pes_out_velocity_map(pesK, file, namespace, space, Lk, ll, how, spacing, coord_system, pmesh)
69 real(real64),
intent(in) :: pesK(:,:,:)
70 character(len=*),
intent(in) :: file
71 type(namespace_t),
intent(in) :: namespace
72 class(space_t),
intent(in) :: space
73 real(real64),
contiguous,
optional,
intent(in) :: Lk(:,:)
74 integer,
contiguous,
intent(in) :: ll(:)
76 integer(int64),
intent(in) :: how
77 real(real64),
intent(in) :: spacing(3)
78 class(coordinate_system_t),
intent(in) :: coord_system
79 real(real64),
contiguous,
optional,
intent(in) :: pmesh(:,:,:,:)
82 character(len=512) :: filename
84 type(cube_function_t) :: cf
89 call cube_init(cube, ll, namespace, space, spacing, coord_system)
91 assert(cf%batch_size == 1)
92 cf%dRS(:,:,:,1) = pesk
94 if (.not.
present(pmesh))
then
98 dk(1:space%dim) = abs(lk(2, 1:space%dim) - lk(1,1:space%dim))
101#if defined(HAVE_NETCDF)
103 if (
bitand(how, option__outputformat__netcdf) /= 0)
then
104 filename = trim(file)//
".ncdf"
105 write(
message(1),
'(a)')
'Writing netcdf format file: '
108 call dout_cf_netcdf(filename, ierr, cf, cube, space, dk(:), .false.,
unit_one/
units_out%length, namespace)
114 if (
bitand(how, option__outputformat__vtk) /= 0)
then
115 filename = trim(file)//
".vtk"
116 write(
message(1),
'(a)')
'Writing vtk format file: '
119 if (
present(pmesh))
then
123 call dvtk_out_cf(filename, namespace,
'PES_vel_map', ierr, cf, cube, dk(:),&
139 real(real64),
intent(in) :: arpes(:,:,:)
140 character(len=*),
intent(in) :: file
141 integer,
intent(in) :: dim
142 integer,
contiguous,
intent(in) :: ll(:)
143 real(real64),
contiguous,
intent(in) :: pmesh(:,:,:,:)
144 real(real64),
contiguous,
intent(in) :: ekin(:,:,:)
146 integer :: iunit, ip, ie
147 real(real64) :: dp, length, pp(1:2), pdiff(1:2)
151 iunit =
io_open(file, namespace, action=
'write')
152 write(iunit,
'(a)')
'##################################################'
153 write(iunit,
'(a1,a18,2x,a18,2x,a18,2x,a18,2x, a18,2x,a18)')
'#', &
158 write(iunit,
'(a1,a18,2x,a18,2x,a18,2x,a18,2x, a18,2x,a18)')
'#', &
164 write(iunit,
'(a)')
'##################################################'
171 pp(1:2) = pmesh(ip,1,1,1:2)
172 if (ip > 1) pdiff = pp(1:2) - pmesh(ip-1,1,1,1:2)
173 dp = norm2(pdiff(1:2))
179 write(iunit,
'(es19.12,2x,es19.12,2x,es19.12,2x,es19.12,2x,es19.12,2x,es19.12)') &
189 write(iunit,
'(es19.12,2x,es19.12,2x,es19.12,2x,es19.12,2x,es19.12,2x,es19.12)') &
213 subroutine pes_out_velocity_map_cut(namespace, pesK, file, ll, dim, pol, dir, integrate, pos, Lk, pmesh)
215 real(real64),
intent(in) :: pesk(:,:,:)
216 character(len=*),
intent(in) :: file
217 integer,
contiguous,
intent(in) :: ll(:)
218 integer,
intent(in) :: dim
219 real(real64),
intent(in) :: pol(3)
220 integer,
intent(in) :: dir
221 integer,
intent(in) :: integrate
222 integer,
optional,
intent(in) :: pos(3)
223 real(real64),
contiguous,
optional,
intent(in) :: lk(:,:)
224 real(real64),
contiguous,
optional,
intent(in) :: pmesh(:,:,:,:)
226 integer :: ii, ix, iy, iunit,ldir(2), icut(3)
227 real(real64) :: kk(3),temp
228 integer,
allocatable :: idx(:,:)
229 real(real64),
allocatable :: lk_(:,:)
230 real(real64) :: rotation(1:dim,1:dim)
231 logical :: aligned_axis
233 real(real64) :: k, kkk(3), theta, phi, dphi, dk(3)
236 integer :: idone, ntodo
238 real(real64),
allocatable :: cube_f(:)
243 iunit =
io_open(file, namespace, action=
'write')
247 assert(
size(pesk, 1) == ll(1))
249 if (.not.
present(pmesh))
then
252 safe_allocate(idx(1:maxval(ll(:)), 1:3))
253 safe_allocate(lk_(1:maxval(ll(:)), 1:3))
256 dk(1:dim) = abs(lk(2,1:dim)-lk(1,1:dim))
260 call sort(lk_(1:ll(ii), ii), idx(1:ll(ii), ii))
264 aligned_axis = sum((pol-(/0 ,0 ,1/))**2) <=
m_epsilon .or. &
265 sum((pol-(/0 ,1 ,0/))**2) <=
m_epsilon .or. &
268 if (
present(pos))
then
271 icut(1:3) = ll(1:3)/2 + 1
274 if (aligned_axis .and. integrate == integrate_none)
then
287 if (
present(pmesh))
then
288 do ix = 1, ll(ldir(1))
289 do iy = 1, ll(ldir(2))
293 temp = pesk(icut(dir), ix, iy)
294 kk(1) = pmesh(icut(dir), ix, iy, ldir(1))
295 kk(2) = pmesh(icut(dir), ix, iy, ldir(2))
297 temp = pesk(ix, icut(dir), iy)
298 kk(1) = pmesh(ix, icut(dir), iy, ldir(1))
299 kk(2) = pmesh(ix, icut(dir), iy, ldir(2))
301 temp = pesk(ix, iy, icut(dir))
302 kk(1) = pmesh(ix, iy, icut(dir), ldir(1))
303 kk(2) = pmesh(ix, iy, icut(dir), ldir(2))
306 write(iunit,
'(es19.12,2x,es19.12,2x,es19.12)') &
315 do ix = 1, ll(ldir(1))
316 kk(1) = lk_(ix, ldir(1))
317 do iy = 1, ll(ldir(2))
318 kk(2) = lk_(iy, ldir(2))
322 temp = pesk(idx(icut(dir), 1), idx(ix, 2), idx(iy, 3))
324 temp = pesk(idx(ix, 1), idx(icut(dir), 2), idx(iy, 3))
326 temp = pesk(idx(ix, 1), idx(iy, 2), idx(icut(dir), 3))
329 write(iunit,
'(es19.12,2x,es19.12,2x,es19.12)') &
343 print *,
"Rotate z-axis over the zenith axis"
344 print *,rotation(1,:)
345 print *,rotation(2,:)
346 print *,rotation(3,:)
351 ntodo = product(ll(1:2))
362 if (
present(pmesh))
then
363 kk(2) = pmesh(ix, 1, 1, 1)
364 kk(3) = pmesh(1, iy, 1, 2)
371 if (
present(pmesh))
then
372 kk(1) = pmesh(ix, 1, 1, 1)
373 kk(3) = pmesh(1, iy, 1, 2)
381 if (
present(pmesh))
then
382 kk(1) = pmesh(ix, 1, 1, 1)
383 kk(2) = pmesh(1, iy, 1, 2)
393 select case (integrate)
403 theta =
atan2(norm2(kk(1:2)), kk(3))
405 kkk(1) = k *
sin(theta) *
cos(phi)
406 kkk(2) = k *
sin(theta) *
sin(phi)
407 kkk(3) = k *
cos(theta)
443 write(iunit,
'(es19.12,2x,es19.12,2x,es19.12)') &
456 write(stdout,
'(1x)')
465 safe_deallocate_a(idx)
466 safe_deallocate_a(lk_)
480 real(real64),
intent(in) :: pesk(:,:,:)
481 real(real64),
contiguous,
intent(in) :: lk(:,:)
482 integer,
contiguous,
intent(in) :: ll(:)
483 integer,
intent(in) :: dim
484 real(real64),
allocatable,
intent(out) :: cube_f(:)
485 type(
qshep_t),
intent(out) :: interp
486 real(real64),
contiguous,
optional,
intent(in) :: pmesh(:,:,:,:)
488 integer :: np, ii, ix, iy, iz
489 real(real64) :: kk(3)
490 real(real64),
allocatable :: kx(:),ky(:),kz(:)
495 call messages_write(
"Initializing Qshep interpolator. Be patient it may take a while... ")
498 np = ll(1)*ll(2)*ll(3)
501 if (dim < 2 .or. dim > 3)
then
502 message(1) =
"This interpolator works only for 2 <= dim <= 3."
506 safe_allocate(cube_f(1:np))
508 safe_allocate(kx(1:np))
509 safe_allocate(ky(1:np))
510 safe_allocate(kz(1:np))
519 if (
present(pmesh))
then
524 cube_f(ii) = pesk(ix,iy,iz)
526 kx(ii) = pmesh(ix,iy,iz,1)
527 ky(ii) = pmesh(ix,iy,iz,2)
528 kz(ii) = pmesh(ix,iy,iz,3)
544 cube_f(ii) = pesk(ix,iy,iz)
564 safe_deallocate_a(kx)
565 safe_deallocate_a(ky)
566 safe_deallocate_a(kz)
580 real(real64),
allocatable,
intent(inout) :: cube_f(:)
581 type(
qshep_t),
intent(inout) :: interp
587 safe_deallocate_a(cube_f)
This is the common interface to a sorting routine. It performs the shell algorithm,...
double sin(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
double atan2(double __y, double __x) __attribute__((__nothrow__
subroutine, public dcube_function_alloc_rs(cube, cf, in_device, force_alloc)
Allocates locally the real space grid, if PFFT library is not used. Otherwise, it assigns the PFFT re...
subroutine, public dcube_function_free_rs(cube, cf)
Deallocates the real space grid.
subroutine, public cube_end(cube)
subroutine, public cube_init(cube, nn, namespace, space, spacing, coord_system, fft_type, fft_library, dont_optimize, nn_out, mpi_grp, need_partition, tp_enlarge, blocksize, batch_size, nthreads, single)
type(debug_t), save, public debug
real(real64), parameter, public m_two
real(real64), parameter, public m_zero
real(real64), parameter, public m_pi
some mathematical constants
real(real64), parameter, public m_epsilon
real(real64), parameter, public m_one
subroutine, public io_close(iunit, grp)
integer function, public io_open(file, namespace, action, status, form, position, die, recl, grp)
System information (time, memory, sysname)
subroutine, public loct_progress_bar(a, maxcount)
A wrapper around the progress bar, such that it can be silenced without needing to dress the call wit...
This module is intended to contain "only mathematical" functions and procedures.
subroutine, public generate_rotation_matrix(R, ff, tt)
Generates a rotation matrix R to rotate a vector f to t.
subroutine, public messages_new_line()
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
subroutine, public pes_out_velocity_map_cut(namespace, pesK, file, ll, dim, pol, dir, integrate, pos, Lk, pmesh)
subroutine pes_out_interpolator_init(namespace, pesK, Lk, ll, dim, cube_f, interp, pmesh)
Qshep interpolation helper function initialization. Generates the linearized version of pesK (cube_f)...
integer, parameter integrate_ky
subroutine, public pes_out_velocity_map(pesK, file, namespace, space, Lk, ll, how, spacing, coord_system, pmesh)
integer, parameter integrate_r
integer, parameter integrate_phi
integer, parameter integrate_theta
subroutine pes_out_interpolator_end(cube_f, interp)
Destroy the interpolation objects.
integer, parameter integrate_kx
subroutine, public pes_out_arpes_cut(namespace, arpes, file, dim, ll, pmesh, Ekin)
integer, parameter integrate_kz
/* To use the profiling module, call profiling_in and profiling_out with the label of the region as a...
subroutine, public qshep_end(interp)
This module is intended to contain "only mathematical" functions and procedures.
character(len=80) function, public str_center(s_in, l_in)
puts space around string, so that it is centered
brief This module defines the class unit_t which is used by the unit_systems_oct_m module.
character(len=20) pure function, public units_abbrev(this)
This module defines the unit system, used for input and output.
type(unit_system_t), public units_out
type(unit_t), public unit_one
some special units required for particular quantities
subroutine, public dvtk_out_cf_structured(filename, namespace, fieldname, ierr, cf_in, cube, unit, points, ascii)
Writes a mesh_function in VTK legacy format for structured grid data (i.e. curvilinear coordinates)....
subroutine, public dvtk_out_cf(filename, namespace, fieldname, ierr, cf_in, cube, spacing, unit)
Writes a cube_function in VTK legacy format see http://www.vtk.org/VTK/img/file-formats....