|
CP2K 2.4 (Revision 12889)
|
Routines to efficently collocate and integrate gaussians on a grid These use most of Joost's tricks and a couple more... result is *speed* and genericity. More...
Functions | |
| REAL(dp), public | calc_max_r2 (poly, poly_shift, alpha, epsilon, error, scale) |
| finds square radius of a gaussian time a polynomial with a gaussian in poly_shift (wrt. the reference system of the polynomial) | |
| REAL(dp), public | calcRadius2 (poly, alpha, epsilon) |
| calculates the radius of polynomial times a gaussian in 0,0,0 | |
| REAL(dp), public | sphRad2 (coeff, l, alpha, epsilon) |
| finds the largest real solution for r^2 of the equation coeff*r^l*exp(-alpha*r^2) | |
| INTEGER, dimension(2, 0:2), public | calcBox (h, h_inv, posi, max_r2, periodic, gdim, error, guarantee_nearest) |
| finds a box on the grid that contains a sphere of the given radius. If guarantee_nearest is true at least the nearest points on the grid are included by enlarging the radius | |
| subroutine, public | collocGauss (h, h_inv, grid, poly, alphai, posi, max_r2, periodic, gdim, local_bounds, local_shift, poly_shift, scale, lgrid, error) |
| collocate a periodically repeated gaussian on a non orthormbic grid | |
| subroutine, public | collocGaussFlat (h, h_inv, grid, ngpts, ldim, poly, alphai, posi, max_r2, periodic, gdim, local_bounds, local_shift, poly_shift, scale, error) |
| collocate a periodically repeated gaussian on a non orthormbic grid | |
| subroutine, public | integrateGauss (h, h_inv, grid, poly, alphai, posi, max_r2, periodic, npoly, res, gdim, local_bounds, local_shift, poly_shift, scale, error) |
| integrates a gaussian times a polynomial. | |
| subroutine, public | integrateGaussFull (h, h_inv, grid, poly, alphai, posi, max_r2, periodic, gdim, local_bounds, local_shift, poly_shift, scale, error) |
| integrates a gaussian times any polynomial up to a give order. | |
| subroutine, public | integrateGaussFullFlat (h, h_inv, grid, ngpts, ldim, poly, alphai, posi, max_r2, periodic, gdim, local_bounds, local_shift, poly_shift, scale, error) |
| integrates a gaussian times any polynomial up to a give order. | |
| subroutine, public | collocGauss_safe (h, h_inv, grid, poly, alphai, posi, max_r2, periodic, gdim, local_bounds, local_shift, error) |
| collocate a periodically repeated gaussian on a non orthormbic grid (reference function) | |
Variables | |
| CHARACTER(len=*), parameter, private | moduleN = 'gauss_colloc' |
| REAL(dp), parameter | small = TINY(1.0_dp) |
| INTEGER(KIND=int_8), parameter | unused_import_of_int_8 = 1 |
Routines to efficently collocate and integrate gaussians on a grid These use most of Joost's tricks and a couple more... result is *speed* and genericity.
| REAL(dp),public gauss_colloc::calc_max_r2 | ( | REAL(dp),dimension(0:),intent(in) | poly, |
| REAL(dp),dimension(3) | poly_shift, | ||
| REAL(dp),intent(in) | alpha, | ||
| REAL(dp),intent(in) | epsilon, | ||
| TYPE(cp_error_type),intent(inout) | error, | ||
| REAL(dp),intent(in),optional | scale | ||
| ) |
finds square radius of a gaussian time a polynomial with a gaussian in poly_shift (wrt. the reference system of the polynomial)
utility method
Definition at line 55 of file gauss_colloc.f90.
References calcRadius2(), CPPostconditionNoFail, d3_poly::grad_size3(), d3_poly::poly_affine_t3(), and d3_poly::poly_size3().
Here is the call graph for this function:| INTEGER,dimension(2,0:2),public gauss_colloc::calcBox | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in) | gdim, | ||
| TYPE(cp_error_type),intent(inout) | error, | ||
| LOGICAL,intent(in),optional | guarantee_nearest | ||
| ) |
finds a box on the grid that contains a sphere of the given radius. If guarantee_nearest is true at least the nearest points on the grid are included by enlarging the radius
Definition at line 198 of file gauss_colloc.f90.
References error.
Referenced by collocGauss_safe().
Here is the caller graph for this function:| REAL(dp),public gauss_colloc::calcRadius2 | ( | REAL(dp),dimension(0:),intent(in) | poly, |
| REAL(dp),intent(in) | alpha, | ||
| REAL(dp),intent(in) | epsilon | ||
| ) |
calculates the radius of polynomial times a gaussian in 0,0,0
performace of bounding random poly (grad 0-6), random h (det(h)/(a*b*c)>0.2) at least 1 grid point per unit, alpha (0.5-2.5)
actual choice: igrad-norm, pade(1,2), 1 step iterative solver Nr values: 15996 InnerBound too Low: 96 0.600150037509 % min value: 9.25569425556e-12 mean 0.000749140381379 OuterBound too High: 0 0.0 % max value: 9.99925035941e-11 mean 3.18900144269e-11
runner up: 2-norm, pade(1,2), 1 step iterative solver Nr values: 15996 InnerBound too Low: 197 1.23155788947 % min value: 7.29606466146e-12 mean 0.000749166756885 OuterBound too High: 0 0.0 % max value: 9.99925035941e-11 mean 2.72429081183e-11
can bound either the value or the (absolute) surface integral
Definition at line 107 of file gauss_colloc.f90.
References d3_poly::grad_size3(), and sphRad2().
Referenced by calc_max_r2().
Here is the call graph for this function:
Here is the caller graph for this function:| subroutine,public gauss_colloc::collocGauss | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(0:, 0:, 0:),intent(inout) | grid, | ||
| REAL(dp),dimension(:),intent(in) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| REAL(dp),dimension(0:2),intent(in),optional | poly_shift, | ||
| REAL(dp),intent(in),optional | scale, | ||
| TYPE(lgrid_type),intent(inout),optional | lgrid, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
collocate a periodically repeated gaussian on a non orthormbic grid
this routine has been tested and works well with cells with det(h)/sqrt(tr(dot(h^T,h)))>0.2 (2 angles bigger than 24 deg or one angle bigger than 11 deg). Because of its numerics it might fail badly (infinity or NaN) with with more deformed cells. Avoiding this would be bossible only using IEEE numerics controls, which would also make everything slower and less supported. Still the actual numeric has been carefully tuned, and in normal cases and most anormal it should work. With det(h)/sqrt(tr(dot(h^T,h)))>0.2 I could not find any failure.
| h | cell matrix |
| h_inv | inverse of the cell matrix |
| grid | the grid |
| poly | polynomial (d3_poly format) |
| alphai | exponential coeff |
| posi | position of the gaussian |
| max_r2 | maximum radius of collocation squared |
| periodic | array of 0 or 1 that says which dimensions have pbc (1=pbc) |
| gdim | dimension of the grid (grid might be a subset) |
| local_bounds | local bounds of the grid piece that is kept locally (i.e. of grid) the global grid is assumed to atart at 0,0,0 |
| local_shift | start indexes of the local slice (i.e. of grid) |
| poly_shift | position of posi in the polynomial reference system. Set it to posi to use the global reference system. |
| scale | a global scale factor |
| error | type to control the error handling |
Definition at line 388 of file gauss_colloc.f90.
References error.
Referenced by collocate_general_subpatch(), and collocate_general_wings().
Here is the caller graph for this function:| subroutine,public gauss_colloc::collocGauss_safe | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(0:, 0:, 0:),intent(inout) | grid, | ||
| REAL(dp),dimension(:),intent(in) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
collocate a periodically repeated gaussian on a non orthormbic grid (reference function)
Definition at line 576 of file gauss_colloc.f90.
References calcBox(), error, and d3_poly::poly_eval3().
Here is the call graph for this function:| subroutine,public gauss_colloc::collocGaussFlat | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(if_check(ngpts,*)),intent(inout) | grid, | ||
| INTEGER,intent(in) | ngpts, | ||
| INTEGER,dimension(0:2),intent(in) | ldim, | ||
| REAL(dp),dimension(:),intent(in) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| REAL(dp),dimension(0:2),intent(in),optional | poly_shift, | ||
| REAL(dp),intent(in),optional | scale, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
collocate a periodically repeated gaussian on a non orthormbic grid
like collocGauss, but takes a flattened grid as input. A little bit less optimized, mostly to connect to other languages.
Definition at line 426 of file gauss_colloc.f90.
References error.
| subroutine,public gauss_colloc::integrateGauss | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(0:, 0:, 0:),intent(inout) | grid, | ||
| REAL(dp),dimension(:),intent(in) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,intent(in) | npoly, | ||
| REAL(dp),dimension(npoly),intent(out) | res, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| REAL(dp),dimension(0:2),intent(in),optional | poly_shift, | ||
| REAL(dp),intent(in),optional | scale, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
integrates a gaussian times a polynomial.
Most things are the same as for collocGauss (see its comments). Unlike collocGauss this function can receive more than one polynomial to integrate at once. How many polynomial are passed is controlled with npoly. The polynomials must be in the d3_poly format. res will then contain the corresponding integrals
Definition at line 466 of file gauss_colloc.f90.
References error.
| subroutine,public gauss_colloc::integrateGaussFull | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(0:, 0:, 0:),intent(inout) | grid, | ||
| REAL(dp),dimension(:),intent(out) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| REAL(dp),dimension(0:2),intent(in),optional | poly_shift, | ||
| REAL(dp),intent(in),optional | scale, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
integrates a gaussian times any polynomial up to a give order.
Most things are the same as for collocGauss (see its comments). Returns the integrals of all the monomials in d3 format into poly
Definition at line 504 of file gauss_colloc.f90.
References error.
Referenced by integrate_general_subpatch(), and integrate_general_wings().
Here is the caller graph for this function:| subroutine,public gauss_colloc::integrateGaussFullFlat | ( | REAL(dp),dimension(0:2, 0:2),intent(in) | h, |
| REAL(dp),dimension(0:2, 0:2),intent(in) | h_inv, | ||
| REAL(dp),dimension(if_check(ngpts,*)),intent(inout) | grid, | ||
| INTEGER,intent(in) | ngpts, | ||
| INTEGER,dimension(0:2),intent(in) | ldim, | ||
| REAL(dp),dimension(:),intent(out) | poly, | ||
| REAL(dp),intent(in) | alphai, | ||
| REAL(dp),dimension(0:2),intent(in) | posi, | ||
| REAL(dp),intent(in) | max_r2, | ||
| INTEGER,dimension(0:2),intent(in) | periodic, | ||
| INTEGER,dimension(0:2),intent(in),optional | gdim, | ||
| INTEGER,dimension(2, 0:2),intent(in),optional | local_bounds, | ||
| INTEGER,dimension(0:2),intent(in),optional | local_shift, | ||
| REAL(dp),dimension(0:2),intent(in),optional | poly_shift, | ||
| REAL(dp),intent(in),optional | scale, | ||
| TYPE(cp_error_type),intent(inout) | error | ||
| ) |
integrates a gaussian times any polynomial up to a give order.
like integrateGaussFull, but with a flat grid. a little bit less optimized, mostly to connect to other languages
Definition at line 540 of file gauss_colloc.f90.
References error.
| REAL(dp),public gauss_colloc::sphRad2 | ( | REAL(dp),intent(in) | coeff, |
| INTEGER,intent(in) | l, | ||
| REAL(dp),intent(in) | alpha, | ||
| REAL(dp),intent(in) | epsilon | ||
| ) |
finds the largest real solution for r^2 of the equation coeff*r^l*exp(-alpha*r^2)
Definition at line 159 of file gauss_colloc.f90.
References small.
Referenced by calcRadius2().
Here is the caller graph for this function:| CHARACTER(len=*),parameter,private gauss_colloc::moduleN = 'gauss_colloc' |
Definition at line 37 of file gauss_colloc.f90.
| REAL(dp),parameter gauss_colloc::small = TINY(1.0_dp) |
Definition at line 39 of file gauss_colloc.f90.
Referenced by sphRad2().
| INTEGER(KIND=int_8),parameter gauss_colloc::unused_import_of_int_8 = 1 |
Definition at line 42 of file gauss_colloc.f90.
1.7.3