CP2K 2.4 (Revision 12889)
Classes | Functions | Variables

pw_spline_utils Namespace Reference

different utils that are useful to manipulate splines on the regular grid of a pw More...

Classes

struct  pw_spline_precond_type
 stores information for the preconditioner used to calculate the coeffs of splines More...

Functions

subroutine, public pw_spline2_interpolate_values_g (spline_g, error)
 calculates the FFT of the coefficents of the quadratic spline that interpolates the given values
subroutine, public pw_spline3_interpolate_values_g (spline_g, error)
 calculates the FFT of the coefficents of the2 cubic spline that interpolates the given values
subroutine, public pw_spline2_evaluate_values_g (spline_g, error)
 calculates the FFT of the values of the quadratic spline given by the FFT of the coefficents of the spline (inverse of pw_spline_interpolate_values_g)
subroutine, public pw_nn_smear_g (spline_g, coeffs, error)
 calculates the FFT of the values of a nearest neighbor smearing
subroutine, public pw_spline3_evaluate_values_g (spline_g, error)
 calculates the FFT of the values of the cubic spline given by the FFT of the coefficents of the spline (inverse of pw_spline_interpolate_values_g)
subroutine, public pw_spline_scale_deriv (deriv_vals_r, cell, transpose, scale, error)
 rescales the derivatives from gridspacing=1 to the real derivatives
subroutine, public pw_spline3_deriv_g (spline_g, idir, error)
 calculates the FFT of the values of the x,y,z (idir=1,2,3) derivative of the cubic spline
subroutine, public pw_spline2_deriv_g (spline_g, idir, error)
 calculates the FFT of the values of the x,y,z (idir=1,2,3) derivative of the quadratic spline
subroutine pw_compose_stripe (weights, in_val, in_val_first, in_val_last, out_val, n_el)
 applies a nearest neighbor linear operator to a stripe in x direction: out_val(i)=sum(weight(j)*in_val(i+j-1),j=0..2)
subroutine pw_compose_stripe2 (weights, in_val, in_val_first, in_val_last, out_val, first_val, last_val, myj, myk, j, k)
subroutine pw_nn_compose_r_work (weights, in_val, out_val, pw_in, bo, error)
 private routine that computes pw_nn_compose_r (it seems that without passing arrays in this way either some compiler do a copyin/out (xlf) or by inlining suboptimal code is produced (nag))
subroutine, public pw_nn_compose_r (weights, pw_in, pw_out, error)
 applies a nearest neighbor linear operator to a pw in real space
subroutine, public pw_nn_smear_r (pw_in, pw_out, coeffs, error)
 calculates the values of a nearest neighbor smearing
subroutine, public pw_nn_deriv_r (pw_in, pw_out, coeffs, idir, error)
 calculates a nearest neighbor central derivative. for the x dir: pw_outcr3d(i,j,k)=( pw_in(i+1,j,k)-pw_in(i-1,j,k) )*coeff(1)+ ( pw_in(i+1,j(+-)1,k)-pw_in(i-1,j(+-)1,k)+ pw_in(i+1,j,k(+-)1)-pw_in(i-1,j,k(+-)1) )*coeff(2)+ ( pw_in(i+1,j(+-)1,k(+-)1)-pw_in(i-1,j(+-)1,k(+-)1)+ pw_in(i+1,j(+-)1,k(-+)1)-pw_in(i-1,j(+-)1,k(-+)1) )*coeff(3) periodic boundary conditions are applied
subroutine add_coarse2fine (coarse_coeffs_pw, fine_values_pw, weights_1d, w_border0, w_border1, pbc, safe_computation, error)
 low level function that adds a coarse grid to a fine grid. If pbc is true periodic boundary conditions are applied
subroutine, public add_fine2coarse (fine_values_pw, coarse_coeffs_pw, weights_1d, w_border0, w_border1, pbc, safe_computation, error)
 low level function that adds a coarse grid (without boundary) to a fine grid.
subroutine, public pw_spline_precond_create (preconditioner, precond_kind, pool, pbc, transpose, error)
subroutine, public pw_spline_precond_set_kind (preconditioner, precond_kind, pbc, transpose, error)
 switches the types of precoditioner to use
subroutine pw_spline_precond_retain (preconditioner, error)
 retains the preconditioner
subroutine, public pw_spline_precond_release (preconditioner, error)
 releases the preconditioner
subroutine, public pw_spline_do_precond (preconditioner, in_v, out_v, error)
 applies the preconditioner to the system of equations to find the coefficents of the spline
LOGICAL, public find_coeffs (values, coeffs, linOp, preconditioner, pool, eps_r, eps_x, max_iter, error)
 solves iteratively (CG) a systmes of linear equations linOp(coeffs)=values (for example those needed to find the coefficents of a spline) Returns true if the it succeded to acheive the requested accuracy
subroutine, public pw_restrict_s3 (pw_fine_in, pw_coarse_out, coarse_pool, param_section, error)
 restricts the function from a fine grid to a coarse one
subroutine, public pw_prolongate_s3 (pw_coarse_in, pw_fine_out, coarse_pool, param_section, error)
 prolongates a function from a coarse grid into a fine one
subroutine, public pw_nn_compose_r_no_pbc (weights_1d, pw_in, pw_out, sharpen, normalize, transpose, smooth_boundary, error)
 adds to pw_out pw_in composed with the weights pw_outcr3d(i,j,k)=pw_outcr3d(i,j,k)+sum(pw_incr3d(i+l,j+m,k+n)* weights_1d(abs(l)+1)*weights_1d(abs(m)+1)*weights_1d(abs(n)+1), l=-1..1,m=-1..1,n=-1..1)
subroutine, public spl3_nopbc (pw_in, pw_out, error)
subroutine, public spl3_nopbct (pw_in, pw_out, error)
subroutine, public spl3_pbc (pw_in, pw_out, error)
REAL(KIND=dp), public Eval_Interp_Spl3_pbc (vec, pw, error)
 Evaluates the PBC interpolated Spline (pw) function on the generic input vector (vec)
REAL(KIND=dp), dimension(3), public Eval_d_Interp_Spl3_pbc (vec, pw, error)
 Evaluates the derivatives of the PBC interpolated Spline (pw) function on the generic input vector (vec)

Variables

LOGICAL, parameter, private debug_this_module = .TRUE.
CHARACTER(len=*), parameter,
private 
moduleN = 'pw_spline_utils'
REAL(KIND=dp), dimension(4),
parameter, public 
nn10_coeffs = (/ 125._dp/216._dp, 25._dp/432._dp, 5._dp/864._dp, 1._dp/1728._dp /)
REAL(KIND=dp), dimension(4),
parameter, public 
spline3_coeffs = (/ 8._dp/(27._dp),2._dp/(27._dp),1._dp/(27._dp*2._dp), 1._dp/(27._dp*8._dp) /)
REAL(KIND=dp), dimension(4),
parameter, public 
spline2_coeffs = (/ 27._dp/(64._dp),9._dp/(64._dp*2_dp),3._dp/(64._dp*4._dp), 1._dp/(64._dp*8._dp) /)
REAL(KIND=dp), dimension(4),
parameter, public 
nn50_coeffs = (/ 15625._dp/17576._dp, 625._dp/35152._dp, 25._dp/70304._dp, 1._dp/140608._dp /)
REAL(KIND=dp), dimension(4),
parameter, public 
spl3_aint_coeff = (/ 46._dp/27._dp,-2._dp/(27._dp),-1._dp/(27._dp*2._dp), -1._dp/(27._dp*8._dp) /)
REAL(KIND=dp), dimension(4),
parameter, public 
spl3_precond1_coeff = (/ 64._dp/3._dp,-8._dp/3._dp,-1._dp/3._dp, -1._dp/24._dp /)
REAL(KIND=dp), dimension(4),
parameter, public 
spl3_1d_transf_coeffs = (/ 2._dp/3._dp,23._dp/48._dp,1._dp/6._dp,1._dp/48._dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
spline3_deriv_coeffs = (/ 2.0_dp/9.0_dp, 1.0_dp/18.0_dp, 1.0_dp/72.0_dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
spline2_deriv_coeffs = (/ 9.0_dp/32.0_dp, 3.0_dp/64.0_dp, 1.0_dp/128.0_dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
nn10_deriv_coeffs = (/ 25._dp/72._dp, 5._dp/144, 1._dp/288._dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
nn50_deriv_coeffs = (/ 625._dp/1352._dp, 25._dp/2704._dp,1._dp/5408._dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
spl3_1d_coeffs0 = (/ 1._dp/6_dp,2._dp/3._dp,1._dp/6._dp /)
REAL(KIND=dp), dimension(3),
parameter, public 
spl3_1d_transf_border1 = (/ 0.517977704_dp, 0.464044595_dp, 0.17977701e-1_dp /)
INTEGER, save, private last_precond_id = 0

Detailed Description

different utils that are useful to manipulate splines on the regular grid of a pw

History
05.2003 created [fawzi] 08.2004 removed spline evaluation method using more than 2 read streams (pw_compose_stripe_rs3), added linear solver based spline inversion [fawzi]
Author:
Fawzi Mohamed

Function Documentation

subroutine pw_spline_utils::add_coarse2fine ( TYPE(pw_type),pointer  coarse_coeffs_pw,
TYPE(pw_type),pointer  fine_values_pw,
REAL(kind=dp),dimension(4),intent(in)  weights_1d,
REAL(kind=dp),intent(in)  w_border0,
REAL(kind=dp),dimension(3),intent(in)  w_border1,
LOGICAL,intent(in)  pbc,
LOGICAL,intent(in),optional  safe_computation,
TYPE(cp_error_type),intent(inout)  error 
) [private]

low level function that adds a coarse grid to a fine grid. If pbc is true periodic boundary conditions are applied

It will add to

fine_values(2*coarse_bounds(1,1):2*coarse_bounds(2,1), 2*coarse_bounds(1,2):2*coarse_bounds(2,2), 2*coarse_bounds(1,3):2*coarse_bounds(2,3))

using

coarse_coeffs(coarse_bounds(1,1):coarse_bounds(2,1), coarse_bounds(1,2):coarse_bounds(2,2), coarse_bounds(1,3):coarse_bounds(2,3))

composed with the weights obtained by the direct product of the 1d coefficents weights:

for i,j,k in -3..3 w(i,j,k)=weights_1d(abs(i)+1)*weights_1d(abs(j)+1)* weights_1d(abs(k)+1)

Parameters:
coarse_coeffs_pwthe values of the coefficients
fine_values_pwwhere to add the values due to the coarse coeffs
weights_1d: the weights of the 1d smearing
w_border0: the 1d weight at the border (when pbc is false)
w_border1: the 1d weights for a point one off the border (w_border1(1) is the weight of the coefficent at the border) (used if pbc is false)
pbcif periodic boundary conditions should be applied
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
coarse looping is continuos, I did not check if keeping the fine looping contiguos is better. And I ask myself yet again why, why we use x-slice distribution, z-slice distribution would be much better performancewise (and would semplify this code enormously). fine2coarse has much more understandable parallel part (build up of send/rcv sizes,... but worse if you have really a lot of processors, probabily irrelevant because it is not critical) [fawzi].
Author:
fawzi

Definition at line 1482 of file pw_spline_utils.f90.

References CPAssert, CPPostcondition, CPPostconditionNoFail, error, and timings::timeset().

Referenced by pw_prolongate_s3().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::add_fine2coarse ( TYPE(pw_type),pointer  fine_values_pw,
TYPE(pw_type),pointer  coarse_coeffs_pw,
REAL(kind=dp),dimension(4),intent(in)  weights_1d,
REAL(kind=dp),intent(in)  w_border0,
REAL(kind=dp),dimension(3),intent(in)  w_border1,
LOGICAL,intent(in)  pbc,
LOGICAL,intent(in),optional  safe_computation,
TYPE(cp_error_type),intent(inout)  error 
)

low level function that adds a coarse grid (without boundary) to a fine grid.

It will add to

coarse_coeffs(coarse_bounds(1,1):coarse_bounds(2,1), coarse_bounds(1,2):coarse_bounds(2,2), coarse_bounds(1,3):coarse_bounds(2,3))

using

fine_values(2*coarse_bounds(1,1):2*coarse_bounds(2,1), 2*coarse_bounds(1,2):2*coarse_bounds(2,2), 2*coarse_bounds(1,3):2*coarse_bounds(2,3))

composed with the weights obtained by the direct product of the 1d coefficents weights:

for i,j,k in -3..3 w(i,j,k)=weights_1d(abs(i)+1)*weights_1d(abs(j)+1)* weights_1d(abs(k)+1)

Parameters:
coarse_coeffs3d array with boundary of size 1 with the values of the coefficients
fine_values3d array where to add the values due to the coarse coeffs
coarse_boundsbounds of the coarse coefficents
weights_1d: the weights of the 1d smearing
w_border0: the 1d weight at the border
w_border1: the 1d weights for a point one off the border (w_border1(1) is the weight of the coefficent at the border)
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
see coarse2fine for some relevant notes
Author:
fawzi

Definition at line 2303 of file pw_spline_utils.f90.

References CPAssert, CPPostcondition, CPPostconditionNoFail, error, and timings::timeset().

Referenced by pw_restrict_s3().

Here is the call graph for this function:

Here is the caller graph for this function:

REAL(KIND=dp),dimension(3),public pw_spline_utils::Eval_d_Interp_Spl3_pbc ( REAL(KIND=dp),dimension(3),intent(in)  vec,
TYPE(pw_type),pointer  pw,
TYPE(cp_error_type),intent(inout)  error 
)

Evaluates the derivatives of the PBC interpolated Spline (pw) function on the generic input vector (vec)

Parameters:
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
Requires the Spline coefficients to be computed with PBC
History
12.2007 Adapted for use with distributed grids [rdeclerck]
Author:
Teodoro Laino 12/2005 [tlaino]

Definition at line 4174 of file pw_spline_utils.f90.

Referenced by ewald_spline_util::check_spline_interp_TabLR(), cp_ddapc_forces::ewald_ddapc_force(), and qs_electric_field_gradient::qs_efg_calc().

Here is the caller graph for this function:

REAL(KIND=dp),public pw_spline_utils::Eval_Interp_Spl3_pbc ( REAL(KIND=dp),dimension(3),intent(in)  vec,
TYPE(pw_type),pointer  pw,
TYPE(cp_error_type),intent(inout)  error 
)

Evaluates the PBC interpolated Spline (pw) function on the generic input vector (vec)

Parameters:
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
Requires the Spline coefficients to be computed with PBC
History
12.2007 Adapted for use with distributed grids [rdeclerck]
Author:
Teodoro Laino 12/2005 [tlaino]

Definition at line 4017 of file pw_spline_utils.f90.

Referenced by ewald_spline_util::check_spline_interp_TabLR(), qs_linres_epr_ownutils::epr_g_so(), qs_linres_epr_ownutils::epr_g_soo(), cp_ddapc_methods::ewald_ddapc_pot(), qs_linres_nmr_shift::interpolate_shift_pwgrid(), and qs_electric_field_gradient::qs_efg_calc().

Here is the caller graph for this function:

LOGICAL,public pw_spline_utils::find_coeffs ( TYPE(pw_type),pointer  values,
TYPE(pw_type),pointer  coeffs,
linOp  linOp,
TYPE(pw_spline_precond_type),pointer  preconditioner,
TYPE(pw_pool_type),pointer  pool,
REAL(kind=dp),intent(in)  eps_r,
REAL(kind=dp),intent(in)  eps_x,
INTEGER,intent(in)  max_iter,
TYPE(cp_error_type),intent(inout)  error 
)

solves iteratively (CG) a systmes of linear equations linOp(coeffs)=values (for example those needed to find the coefficents of a spline) Returns true if the it succeded to acheive the requested accuracy

Parameters:
valuesthe right hand side of the system
coeffwill contain the solution of the system (and on entry it contains the starting point)
linOpthe linear operator to be inverted
preconditionerthe preconditioner to apply
poola pool of grids (for the temporary objects)
eps_rthe requested precision on the residual
eps_xthe requested precision on the solution
max_itermaximum number of iteration allowed
print_sectioninformation about when to print information
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3305 of file pw_spline_utils.f90.

Referenced by ewald_spline_util::eval_pw_TabLR(), pw_prolongate_s3(), pw_restrict_s3(), and qs_electric_field_gradient::qs_efg_calc().

Here is the caller graph for this function:

subroutine pw_spline_utils::pw_compose_stripe ( REAL(kind=dp),dimension(0:2),intent(in)  weights,
REAL(kind=dp),dimension(*),intent(in)  in_val,
REAL(kind=dp),intent(in)  in_val_first,
REAL(kind=dp),intent(in)  in_val_last,
REAL(kind=dp),dimension(*),intent(inout)  out_val,
INTEGER  n_el 
) [private]

applies a nearest neighbor linear operator to a stripe in x direction: out_val(i)=sum(weight(j)*in_val(i+j-1),j=0..2)

Parameters:
weightsthe weights of the linear operator
in_valthe argument to the operator
in_val_firstthe first argument (needed to calculate out_val(1))
in_val_lastthe last argument (needed to calculate out_val(n_el))
out_valthe place where the result is accumulated
n_elthe number of elements in in_v and out_v
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
uses 2 read streams and 1 write stream
History
04.2004 created [fawzi]
Author:
fawzi

Definition at line 981 of file pw_spline_utils.f90.

Referenced by pw_nn_compose_r_no_pbc(), and pw_nn_compose_r_work().

Here is the caller graph for this function:

subroutine pw_spline_utils::pw_compose_stripe2 ( REAL(kind=dp),dimension(0:2),intent(in)  weights,
REAL(kind=dp),dimension(:, :, :),pointer  in_val,
REAL(kind=dp),intent(in)  in_val_first,
REAL(kind=dp),intent(in)  in_val_last,
REAL(kind=dp),dimension(:, :, :),pointer  out_val,
INTEGER,intent(in)  first_val,
INTEGER,intent(in)  last_val,
INTEGER,intent(in)  myj,
INTEGER,intent(in)  myk,
INTEGER,intent(in)  j,
INTEGER,intent(in)  k 
) [private]

Definition at line 1079 of file pw_spline_utils.f90.

subroutine,public pw_spline_utils::pw_nn_compose_r ( REAL(kind=dp),dimension(0:2, 0:2, 0:2)  weights,
TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
TYPE(cp_error_type),intent(inout)  error 
)

applies a nearest neighbor linear operator to a pw in real space

Parameters:
weightsa 3x3x3 array with the linear operator
pw_inthe argument for the linear operator
pw_outplace where the value of the linear oprator should be added
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
has specialized versions for derivative operator (with central values==0)
Author:
fawzi

Definition at line 1290 of file pw_spline_utils.f90.

References pw_nn_compose_r_work(), and timings::timeset().

Referenced by pw_nn_deriv_r(), and pw_nn_smear_r().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_nn_compose_r_no_pbc ( REAL(kind=dp),dimension(-1:1)  weights_1d,
TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
LOGICAL,intent(in),optional  sharpen,
LOGICAL,intent(in),optional  normalize,
LOGICAL,intent(in),optional  transpose,
LOGICAL,intent(in),optional  smooth_boundary,
TYPE(cp_error_type),intent(inout)  error 
)

adds to pw_out pw_in composed with the weights pw_outcr3d(i,j,k)=pw_outcr3d(i,j,k)+sum(pw_incr3d(i+l,j+m,k+n)* weights_1d(abs(l)+1)*weights_1d(abs(m)+1)*weights_1d(abs(n)+1), l=-1..1,m=-1..1,n=-1..1)

Parameters:
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3629 of file pw_spline_utils.f90.

References CPAssert, CPPostcondition, CPPostconditionNoFail, and pw_compose_stripe().

Referenced by pw_spline_do_precond(), spl3_nopbc(), and spl3_nopbct().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine pw_spline_utils::pw_nn_compose_r_work ( REAL(kind=dp),dimension(0:2, 0:2, 0:2)  weights,
REAL(kind=dp),dimension(bo(1, 1):bo(2, 1), bo(1, 2):bo(2, 2), bo(1, 3):bo(2, 3)),intent(in)  in_val,
REAL(kind=dp),dimension(bo(1, 1):bo(2, 1), bo(1, 2):bo(2, 2), bo(1, 3):bo(2, 3)),intent(inout)  out_val,
TYPE(pw_type),pointer  pw_in,
INTEGER,dimension(2, 3)  bo,
TYPE(cp_error_type),intent(inout)  error 
) [private]

private routine that computes pw_nn_compose_r (it seems that without passing arrays in this way either some compiler do a copyin/out (xlf) or by inlining suboptimal code is produced (nag))

Parameters:
weightsa 3x3x3 array with the linear operator
in_valthe argument for the linear operator
out_valplace where the value of the linear oprator should be added
pw_inpw to be able to get the needed meta data about in_val and out_val
boboundaries of in_val and out_val
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 1192 of file pw_spline_utils.f90.

References CPPostcondition, CPPostconditionNoFail, and pw_compose_stripe().

Referenced by pw_nn_compose_r().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_nn_deriv_r ( TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
REAL(KIND=dp),dimension(3),intent(in)  coeffs,
INTEGER  idir,
TYPE(cp_error_type),intent(inout)  error 
)

calculates a nearest neighbor central derivative. for the x dir: pw_outcr3d(i,j,k)=( pw_in(i+1,j,k)-pw_in(i-1,j,k) )*coeff(1)+ ( pw_in(i+1,j(+-)1,k)-pw_in(i-1,j(+-)1,k)+ pw_in(i+1,j,k(+-)1)-pw_in(i-1,j,k(+-)1) )*coeff(2)+ ( pw_in(i+1,j(+-)1,k(+-)1)-pw_in(i-1,j(+-)1,k(+-)1)+ pw_in(i+1,j(+-)1,k(-+)1)-pw_in(i-1,j(+-)1,k(-+)1) )*coeff(3) periodic boundary conditions are applied

Parameters:
pw_inthe argument for the linear operator
pw_outplace where the smeared values should be added
spline_gon entry the FFT of the values to interpolate as cc3d, will contain the FFT of the smeared values
coeffsarray with the coefficent of the front (positive) plane of the central derivative, ordered with the distance from the center: coeffs(1) the coeff of the central element, coeffs(2) the coeff of the 4 element with distance 1, coeff(3) the coeff of the 4 elements at distance sqrt(2)
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
with coeff=(/ 2.0_dp/9.0_dp, 1.0_dp/18.0_dp, 1.0_dp/72.0_dp /) is equivalent to pw_spline3_deriv_r, with coeff=(/ 9.0_dp/32.0_dp, 3.0_dp/64.0_dp, 1.0_dp/128.0_dp /) to pw_spline2_deriv_r coeff=(/ 25._dp/72._dp, 5._dp/144, 1._dp/288._dp /)
Author:
Fawzi Mohamed

Definition at line 1392 of file pw_spline_utils.f90.

References error, and pw_nn_compose_r().

Referenced by xc::xc_calc_2nd_deriv(), xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_nn_smear_g ( TYPE(pw_type),pointer  spline_g,
REAL(KIND=dp),dimension(4),intent(in)  coeffs,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the values of a nearest neighbor smearing

Parameters:
spline_gon entry the FFT of the values to interpolate as cc3d, will contain the FFT of the smeared values
coeffsarray with the coefficent of the smearing, ordered with the distance from the center: coeffs(1) the coeff of the central element, coeffs(2) the coeff of the 6 element with distance 1, coeff(3) the coeff of the 12 elements at distance sqrt(2), coeff(4) the coeff of the 8 elements at distance sqrt(3).
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
does not normalize the smear to 1. with coeff=(/ 8._dp/27._dp, 2._dp/27._dp, 1._dp/54._dp, 1._dp/216._dp /) is equivalent to pw_spline3_evaluate_values_g, with coeff=(/ 27._dp/64._dp, 9._dp/128._dp, 3._dp/256._dp, 1._dp/512._dp /)
History
07.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 404 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Here is the call graph for this function:

subroutine,public pw_spline_utils::pw_nn_smear_r ( TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
REAL(KIND=dp),dimension(4),intent(in)  coeffs,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the values of a nearest neighbor smearing

Parameters:
pw_inthe argument for the linear operator
pw_outplace where the smeared values should be added
coeffsarray with the coefficent of the smearing, ordered with the distance from the center: coeffs(1) the coeff of the central element, coeffs(2) the coeff of the 6 element with distance 1, coeff(3) the coeff of the 12 elements at distance sqrt(2), coeff(4) the coeff of the 8 elements at distance sqrt(3).
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
does not normalize the smear to 1. with coeff=(/ 8._dp/27._dp, 2._dp/27._dp, 1._dp/54._dp, 1._dp/216._dp /) is equivalent to pw_spline3_evaluate_values_g, with coeff=(/ 27._dp/64._dp, 9._dp/128._dp, 3._dp/256._dp, 1._dp/512._dp /)
Author:
Fawzi Mohamed

Definition at line 1340 of file pw_spline_utils.f90.

References pw_nn_compose_r().

Referenced by pw_spline_do_precond(), spl3_pbc(), xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_prolongate_s3 ( TYPE(pw_type),pointer  pw_coarse_in,
TYPE(pw_type),pointer  pw_fine_out,
TYPE(pw_pool_type),pointer  coarse_pool,
TYPE(section_vals_type),pointer  param_section,
TYPE(cp_error_type),intent(inout)  error 
)

prolongates a function from a coarse grid into a fine one

Parameters:
pw_fine_inthe fine grid
pw_coarse_outthe coarse grid
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
extremely slow (but correct) version
Author:
fawzi

Definition at line 3524 of file pw_spline_utils.f90.

References add_coarse2fine(), CPPostconditionNoFail, error, find_coeffs(), pw_pool_types::pw_pool_create_pw(), pw_spline_do_precond(), pw_spline_precond_create(), pw_spline_precond_release(), pw_spline_precond_set_kind(), spl3_1d_transf_border1, spl3_1d_transf_coeffs, spl3_nopbc(), spl3_pbc(), and timings::timeset().

Referenced by qs_collocate_density::density_rs2pw(), qs_collocate_density::density_rs2pw_basic(), and qmmm_gpw_energy::qmmm_elec_with_gaussian().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_restrict_s3 ( TYPE(pw_type),pointer  pw_fine_in,
TYPE(pw_type),pointer  pw_coarse_out,
TYPE(pw_pool_type),pointer  coarse_pool,
TYPE(section_vals_type),pointer  param_section,
TYPE(cp_error_type),intent(inout)  error 
)

restricts the function from a fine grid to a coarse one

Parameters:
pw_fine_inthe fine grid
pw_coarse_outthe coarse grid
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
extremely slow (but correct) version
Author:
fawzi

Definition at line 3419 of file pw_spline_utils.f90.

References add_fine2coarse(), error, find_coeffs(), pw_methods::pw_axpy(), pw_pool_types::pw_pool_create_pw(), pw_spline_do_precond(), pw_spline_precond_create(), pw_spline_precond_release(), pw_spline_precond_set_kind(), spl3_1d_transf_border1, spl3_1d_transf_coeffs, spl3_nopbct(), spl3_pbc(), and timings::timeset().

Referenced by qs_integrate_potential::potential_pw2rs(), and qmmm_gpw_forces::qmmm_forces_with_gaussian().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline2_deriv_g ( TYPE(pw_type),pointer  spline_g,
INTEGER,intent(in)  idir,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the values of the x,y,z (idir=1,2,3) derivative of the quadratic spline

Parameters:
spline_gon entry the FFT of the coefficents of the spline will contain the FFT of the derivative
idirdirection of the derivative
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
the distance between gridpoints is assumed to be 1
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 834 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Referenced by xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline2_evaluate_values_g ( TYPE(pw_type),pointer  spline_g,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the values of the quadratic spline given by the FFT of the coefficents of the spline (inverse of pw_spline_interpolate_values_g)

Parameters:
spline_gon entry the FFT of the coefficents of the spline as cr3d, will contain the FFT of the values of the spline
errorvariable to control error logging, stopping,... see module cp_error_handling
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 316 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Here is the call graph for this function:

subroutine,public pw_spline_utils::pw_spline2_interpolate_values_g ( TYPE(pw_type),pointer  spline_g,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the coefficents of the quadratic spline that interpolates the given values

Parameters:
spline_gon entry the FFT of the values to interpolate as cc, will contain the FFT of the coefficents of the spline
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
does not work with spherical cutoff
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 146 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Referenced by xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline3_deriv_g ( TYPE(pw_type),pointer  spline_g,
INTEGER,intent(in)  idir,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the values of the x,y,z (idir=1,2,3) derivative of the cubic spline

Parameters:
spline_gon entry the FFT of the coefficents of the spline will contain the FFT of the derivative
idirdirection of the derivative
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
the distance between gridpoints is assumed to be 1
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 688 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Referenced by xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline3_evaluate_values_g ( TYPE(pw_type),pointer  spline_g,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the values of the cubic spline given by the FFT of the coefficents of the spline (inverse of pw_spline_interpolate_values_g)

Parameters:
spline_gon entry the FFT of the values to interpolate as cc3d, will contain the FFT of the coefficents of the spline
errorvariable to control error logging, stopping,... see module cp_error_handling
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 490 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Here is the call graph for this function:

subroutine,public pw_spline_utils::pw_spline3_interpolate_values_g ( TYPE(pw_type),pointer  spline_g,
TYPE(cp_error_type),intent(inout)  error 
)

calculates the FFT of the coefficents of the2 cubic spline that interpolates the given values

Parameters:
spline_gon entry the FFT of the values to interpolate as cc, will contain the FFT of the coefficents of the spline
errorvariable to control error logging, stopping,... see module cp_error_handling
Note:
does not work with spherical cutoff stupid distribution for cos calculation, it should calculate only the needed cos, and avoid the mp_sum
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 229 of file pw_spline_utils.f90.

References pw_types::COMPLEXDATA1D, CPPostcondition, CPPostconditionNoFail, pw_grid_types::FULLSPACE, timings::timeset(), and mathconstants::twopi.

Referenced by xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline_do_precond ( TYPE(pw_spline_precond_type),pointer  preconditioner,
TYPE(pw_type),pointer  in_v,
TYPE(pw_type),pointer  out_v,
TYPE(cp_error_type),intent(inout)  error 
)

applies the preconditioner to the system of equations to find the coefficents of the spline

Parameters:
preconditionerthe preconditioner to apply
v_inthe grid on which the preconditioner should be applied
v_outplace to store the preconditioner applied on v_out
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3240 of file pw_spline_utils.f90.

References CPAssert, error, input_constants::no_precond, pw_nn_compose_r_no_pbc(), and pw_nn_smear_r().

Referenced by ewald_spline_util::eval_pw_TabLR(), linOp::linOp(), pw_prolongate_s3(), pw_restrict_s3(), and qs_electric_field_gradient::qs_efg_calc().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline_precond_create ( TYPE(pw_spline_precond_type),pointer  preconditioner,
INTEGER,intent(in)  precond_kind,
TYPE(pw_pool_type),pointer  pool,
LOGICAL,intent(in)  pbc,
LOGICAL,intent(in)  transpose,
TYPE(cp_error_type),intent(inout)  error 
)
Parameters:
preconditionerthe preconditioner to create
precond_kindthe kind of preconditioner to use
poola pool with grids of the same type as the elements to precondition
pbcif periodic boundary conditions should be applied
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3047 of file pw_spline_utils.f90.

References CPPostcondition, error, last_precond_id, input_constants::no_precond, and pw_spline_precond_set_kind().

Referenced by ewald_spline_util::eval_pw_TabLR(), pw_prolongate_s3(), pw_restrict_s3(), and qs_electric_field_gradient::qs_efg_calc().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline_precond_release ( TYPE(pw_spline_precond_type),pointer  preconditioner,
TYPE(cp_error_type),intent(inout)  error 
)

releases the preconditioner

Parameters:
preconditionerthe preconditioner to release
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3207 of file pw_spline_utils.f90.

References CPPostconditionNoFail, and CPPreconditionNoFail.

Referenced by ewald_spline_util::eval_pw_TabLR(), pw_prolongate_s3(), pw_restrict_s3(), and qs_electric_field_gradient::qs_efg_calc().

Here is the caller graph for this function:

subroutine pw_spline_utils::pw_spline_precond_retain ( TYPE(pw_spline_precond_type),pointer  preconditioner,
TYPE(cp_error_type),intent(inout)  error 
) [private]

retains the preconditioner

Parameters:
preconditionerthe preconditioner to retain
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3182 of file pw_spline_utils.f90.

References CPPreconditionNoFail.

subroutine,public pw_spline_utils::pw_spline_precond_set_kind ( TYPE(pw_spline_precond_type),pointer  preconditioner,
INTEGER,intent(in)  precond_kind,
LOGICAL,intent(in),optional  pbc,
LOGICAL,intent(in),optional  transpose,
TYPE(cp_error_type),intent(inout)  error 
)

switches the types of precoditioner to use

Parameters:
precoditionerthe preconditioner to be changed
precond_kindthe new kind of preconditioner to use
errorvariable to control error logging, stopping,... see module cp_error_handling
Author:
fawzi

Definition at line 3086 of file pw_spline_utils.f90.

References CPAssert, input_constants::no_precond, and spl3_1d_coeffs0.

Referenced by ewald_spline_util::eval_pw_TabLR(), pw_prolongate_s3(), pw_restrict_s3(), pw_spline_precond_create(), and qs_electric_field_gradient::qs_efg_calc().

Here is the caller graph for this function:

subroutine,public pw_spline_utils::pw_spline_scale_deriv ( TYPE(pw_p_type),dimension(3)  deriv_vals_r,
TYPE(cell_type),pointer  cell,
LOGICAL,intent(in),optional  transpose,
REAL(KIND=dp),intent(in),optional  scale,
TYPE(cp_error_type),intent(inout)  error 
)

rescales the derivatives from gridspacing=1 to the real derivatives

Parameters:
deriv_vals_ran array of x,y,z derivatives
cellthe mapping to the real cell
transposeif true applies the transpose of the map (defaults to false)
scalea scaling factor (defaults to 1.0)
errorvariable to control error logging, stopping,... see module cp_error_handling
History
06.2003 created [fawzi]
Author:
Fawzi Mohamed

Definition at line 578 of file pw_spline_utils.f90.

References timings::timeset().

Referenced by xc_rho_set_types::xc_rho_set_update(), and xc::xc_vxc_pw_create().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::spl3_nopbc ( TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
TYPE(cp_error_type),intent(inout)  error 
)

Definition at line 3976 of file pw_spline_utils.f90.

References pw_nn_compose_r_no_pbc(), and spl3_1d_coeffs0.

Referenced by pw_prolongate_s3().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::spl3_nopbct ( TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
TYPE(cp_error_type),intent(inout)  error 
)

Definition at line 3986 of file pw_spline_utils.f90.

References pw_nn_compose_r_no_pbc(), and spl3_1d_coeffs0.

Referenced by pw_restrict_s3().

Here is the call graph for this function:

Here is the caller graph for this function:

subroutine,public pw_spline_utils::spl3_pbc ( TYPE(pw_type),pointer  pw_in,
TYPE(pw_type),pointer  pw_out,
TYPE(cp_error_type),intent(inout)  error 
)

Definition at line 3997 of file pw_spline_utils.f90.

References pw_nn_smear_r(), and spline3_coeffs.

Referenced by ewald_spline_util::eval_pw_TabLR(), pw_prolongate_s3(), pw_restrict_s3(), and qs_electric_field_gradient::qs_efg_calc().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

LOGICAL,parameter,private pw_spline_utils::debug_this_module = .TRUE.

Definition at line 63 of file pw_spline_utils.f90.

Definition at line 98 of file pw_spline_utils.f90.

Referenced by pw_spline_precond_create().

CHARACTER(len=*),parameter,private pw_spline_utils::moduleN = 'pw_spline_utils'

Definition at line 64 of file pw_spline_utils.f90.

REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::nn10_coeffs = (/ 125._dp/216._dp, 25._dp/432._dp, 5._dp/864._dp, 1._dp/1728._dp /)
REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::nn10_deriv_coeffs = (/ 25._dp/72._dp, 5._dp/144, 1._dp/288._dp /)
REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::nn50_coeffs = (/ 15625._dp/17576._dp, 625._dp/35152._dp, 25._dp/70304._dp, 1._dp/140608._dp /)
REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::nn50_deriv_coeffs = (/ 625._dp/1352._dp, 25._dp/2704._dp,1._dp/5408._dp /)
REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::spl3_1d_coeffs0 = (/ 1._dp/6_dp,2._dp/3._dp,1._dp/6._dp /)

Definition at line 85 of file pw_spline_utils.f90.

Referenced by pw_spline_precond_set_kind(), spl3_nopbc(), and spl3_nopbct().

REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::spl3_1d_transf_border1 = (/ 0.517977704_dp, 0.464044595_dp, 0.17977701e-1_dp /)

Definition at line 85 of file pw_spline_utils.f90.

Referenced by pw_prolongate_s3(), and pw_restrict_s3().

REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::spl3_1d_transf_coeffs = (/ 2._dp/3._dp,23._dp/48._dp,1._dp/6._dp,1._dp/48._dp /)

Definition at line 66 of file pw_spline_utils.f90.

Referenced by pw_prolongate_s3(), and pw_restrict_s3().

REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::spl3_aint_coeff = (/ 46._dp/27._dp,-2._dp/(27._dp),-1._dp/(27._dp*2._dp), -1._dp/(27._dp*8._dp) /)

Definition at line 66 of file pw_spline_utils.f90.

REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::spl3_precond1_coeff = (/ 64._dp/3._dp,-8._dp/3._dp,-1._dp/3._dp, -1._dp/24._dp /)

Definition at line 66 of file pw_spline_utils.f90.

REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::spline2_coeffs = (/ 27._dp/(64._dp),9._dp/(64._dp*2_dp),3._dp/(64._dp*4._dp), 1._dp/(64._dp*8._dp) /)
REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::spline2_deriv_coeffs = (/ 9.0_dp/32.0_dp, 3.0_dp/64.0_dp, 1.0_dp/128.0_dp /)
REAL ( KIND = dp ),dimension(4),parameter,public pw_spline_utils::spline3_coeffs = (/ 8._dp/(27._dp),2._dp/(27._dp),1._dp/(27._dp*2._dp), 1._dp/(27._dp*8._dp) /)
REAL ( KIND = dp ),dimension(3),parameter,public pw_spline_utils::spline3_deriv_coeffs = (/ 2.0_dp/9.0_dp, 1.0_dp/18.0_dp, 1.0_dp/72.0_dp /)