28 use,
intrinsic :: iso_fortran_env
77 logical,
public :: sp_parallel
78 integer,
public :: sp_np, sp_dim, sp_st1, sp_st2, sp_kp1, sp_kp2
79 integer,
public :: sp_distdot_mode
80 type(mpi_grp_t),
public :: sp_grp
118 class(mesh_t),
pointer :: mesh_aux => null()
126 class(mesh_t),
target,
intent(in) :: mesh
142 class(mesh_t),
intent(in) :: mesh
143 complex(real64),
intent(inout) :: ff(:)
145 real(real64),
allocatable :: ff_re(:), ff_im(:)
146 real(real64) :: dot_re, dot_im, dot_reim, sol1, sol2, maxv, maxvloc
147 real(real64) :: theta, ctheta, stheta
149 complex(real64) :: zval
153 safe_allocate(ff_re(1:mesh%np))
154 safe_allocate(ff_im(1:mesh%np))
156 ff_re(:) = real(ff(:), real64)
157 ff_im(:) = aimag(ff(:))
161 dot_reim =
dmf_dotp(mesh, ff_re, ff_im)
164 if(dot_re+dot_im > 1e-8_real64)
then
165 if(
m_two*dot_reim/(dot_re-dot_im) > 1e-8_real64)
then
169 sol1 =
cos(theta)**2 * dot_re +
sin(theta)**2 * dot_im +
m_two*
sin(theta)*
cos(theta)*dot_reim
179 ff(ip) = cmplx(ctheta*ff_re(ip)-stheta*ff_im(ip), stheta*ff_re(ip)+ctheta*ff_im(ip), real64)
187 maxvloc = real(ff(ip)*conjg(ff(ip)), real64)
188 if(maxvloc > maxv)
then
196 if(mesh%parallel_in_domains)
then
197 call mesh%mpi_grp%bcast(zval, 1, mpi_double_complex, 0)
200 call lalg_scal(mesh%np, abs(zval)/zval, ff)
204 message(1) =
"Internal error fixing phase: mesh function has zero norm."
208 safe_deallocate_a(ff_re)
209 safe_deallocate_a(ff_im)
216#include "mesh_function_inc.F90"
219#include "complex.F90"
220#include "mesh_function_inc.F90"
229real(real64) function distdot(n, x, ix, y, iy)
232 use,
intrinsic :: iso_fortran_env
239 integer,
intent(in) :: n
240 real(real64),
intent(in) :: x(n)
241 integer,
intent(in) :: ix
242 real(real64),
intent(in) :: y(n)
243 integer,
intent(in) :: iy
245 integer :: j, ik, ist, idim, k
301#endif /* HAVE_SPARSKIT */
scales a vector by a constant
double sin(double __x) __attribute__((__nothrow__
double atan(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
This module contains interfaces for BLAS routines You should not use these routines directly....
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_half
This module defines various routines, operating on mesh functions.
subroutine, public zmf_random(mesh, ff, pre_shift, post_shift, seed, normalized)
This subroutine fills a function with random values.
real(real64) function zmf_nrm2_2(mesh, dim, ff, reduce)
this function returns the norm of a vector of mesh functions
subroutine, public dmf_random(mesh, ff, pre_shift, post_shift, seed, normalized)
This subroutine fills a function with random values.
subroutine, public zmf_interpolate_points(ndim, npoints_in, x_in, f_in, npoints_out, x_out, f_out)
This function receives a function f_in defined in a mesh, and returns the interpolated values of the ...
complex(real64) function, public zmf_moment(mesh, ff, idir, order)
This function calculates the "order" moment of the function ff.
real(real64) function, public dmf_dotu_aux(f1, f2)
dot product between two vectors (mesh functions) without conjugation
real(real64) function dmf_line_integral_vector(mesh, ff, line)
This subroutine calculates the line integral of a vector function on a given line.
subroutine, public zmf_normalize(mesh, dim, psi, norm)
Normalize a mesh function psi.
complex(real64) function zmf_line_integral_vector(mesh, ff, line)
This subroutine calculates the line integral of a vector function on a given line.
real(real64) function, dimension(1:dim) dmf_integrate_2(mesh, dim, ff, mask, reduce)
Integrate of a vector of functins.
complex(real64) function zmf_dotp_2(mesh, dim, f1, f2, reduce, dotu, np)
dot product for vector valued mesh functions
real(real64) function dmf_integrate_1(mesh, ff, mask, reduce)
Integrate a function on the mesh.
class(mesh_t), pointer, public mesh_aux
Globally-scoped pointer to the mesh instance.
complex(real64) function, dimension(1:dim) zmf_integrate_2(mesh, dim, ff, mask, reduce)
Integrate of a vector of functins.
complex(real64) function, public zmf_dotu_aux(f1, f2)
dot product between two vectors (mesh functions) without conjugation
logical, public sp_parallel
integer, public sp_distdot_mode
real(real64) function dmf_nrm2_2(mesh, dim, ff, reduce)
this function returns the norm of a vector of mesh functions
real(real64) function dmf_surface_integral_scalar(mesh, ff, plane)
This subroutine calculates the surface integral of a scalar function on a given plane.
complex(real64) function zmf_line_integral_scalar(mesh, ff, line)
This subroutine calculates the line integral of a scalar function on a given line.
subroutine, public dmf_interpolate_points(ndim, npoints_in, x_in, f_in, npoints_out, x_out, f_out)
This function receives a function f_in defined in a mesh, and returns the interpolated values of the ...
real(real64) function dmf_dotp_2(mesh, dim, f1, f2, reduce, dotu, np)
dot product for vector valued mesh functions
real(real64) function, public dmf_dotp_aux(f1, f2)
dot product between two vectors (mesh functions)
real(real64) function zmf_nrm2_1(mesh, ff, reduce)
this function returns the norm of a mesh function
real(real64) function dmf_line_integral_scalar(mesh, ff, line)
This subroutine calculates the line integral of a scalar function on a given line.
real(real64) function, public zmf_nrm2_aux(ff)
calculate norm2 of a vector (mesh function)
subroutine, public dmf_multipoles(mesh, ff, lmax, multipole, mask)
This routine calculates the multipoles of a function ff.
subroutine, public zmf_multipoles(mesh, ff, lmax, multipole, mask)
This routine calculates the multipoles of a function ff.
complex(real64) function zmf_surface_integral_scalar(mesh, ff, plane)
This subroutine calculates the surface integral of a scalar function on a given plane.
subroutine, public dmf_normalize(mesh, dim, psi, norm)
Normalize a mesh function psi.
type(mpi_grp_t), public sp_grp
real(real64) function dmf_dotp_1(mesh, f1, f2, reduce, dotu, np)
this function returns the dot product between two mesh functions
real(real64) function dmf_surface_integral_vector(mesh, ff, plane)
This subroutine calculates the surface integral of a vector function on a given plane.
subroutine, public zmf_fix_phase(mesh, ff)
Fix the phase of complex function.
real(real64) function dmf_nrm2_1(mesh, ff, reduce)
this function returns the norm of a mesh function
complex(real64) function zmf_surface_integral_vector(mesh, ff, plane)
This subroutine calculates the surface integral of a vector function on a given plane.
subroutine, public dmf_dipole(mesh, ff, dipole, mask)
This routine calculates the dipole of a function ff, for arbitrary dimensions.
subroutine, public mesh_init_mesh_aux(mesh)
Initialise a pointer to the grid/mesh, that is globally exposed, such that low level mesh operations ...
real(real64) function, public dmf_moment(mesh, ff, idir, order)
This function calculates the "order" moment of the function ff.
real(real64) function, public dmf_nrm2_aux(ff)
calculate norm2 of a vector (mesh function)
subroutine, public zmf_dipole(mesh, ff, dipole, mask)
This routine calculates the dipole of a function ff, for arbitrary dimensions.
complex(real64) function zmf_integrate_1(mesh, ff, mask, reduce)
Integrate a function on the mesh.
complex(real64) function zmf_dotp_1(mesh, f1, f2, reduce, dotu, np)
this function returns the dot product between two mesh functions
complex(real64) function, public zmf_dotp_aux(f1, f2)
dot product between two vectors (mesh functions)
This module defines the meshes, which are used in Octopus.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Some general things and nomenclature: