File fns.h

Parent directory (gbasis)

Evaluate functions on grids and derive Fock matrices from potentials on grids.

Definition (gbasis/fns.h)

Detailed Description

Functions on grid points are calculated in three steps, which are controlled by methods in the Class GBasis class in File gbasis.h. Also code is shared with the Fock build from potentials on grids. Class GB1GridFn functions require only a single loop to compute properties of basis functions. See following methods in File gbasis.h: GOBasis::compute_grid1_exp GOBasis::compute_grid1_dm GOBasis::compute_grid1_fock GOBasis::compute_grid_point1 (called by the previous three)

GB2GridFn functions requires double loop to compute properties of basis pairs of basis functions. See following methods in File gbasis.h: GOBasis::compute_grid2_dm GOBasis::compute_grid_point2 (called by compute_grid2_dm)

The methods reset, add, cart_to_pure and compute_point_from_* or compute_fock_from_pot, are called from functions in gbasis.cpp (Class GOBasis). For a given grid point… 1) The method reset is called with basic information of the contraction and the position of the grid point. 2) The method add is called to evaluate properties (function value and/or derivatives) of primitives on the grid point. Code in gbasis.cpp takes care of contractions and calls add with the proper prefactor coeff. The add method adds results for one primitive in work_cart. 3) cart_to_pure to transform the results for a contraction to pure functions when needed. 4) After looping over all the (pairs of) contractions (steps 1 to 3), one of the following two happens, still just for one grid point 4a) The compute_point_from_* method is called to convert the properties of the basis functions into the (density) function(s) of interest, making use of either expansion coefficients of the orbitals or first-order density matrix coefficients. 4b) The compute_fock_from_pot method is called to convert a potential on a grid into a Fock operator. The above work flow is repeated for every grid point. The Cartesian polynomials in the Gaussian primitives (and/or their derivatives) are computed only once for a given contraction when calling the reset method. This is done by calling fill_cartesian_polynomials, which computes all mononomials in alphabetical order up to a given order. It returns an offset, which is the position of the first mononomial of the highest order. This offset is used to quickly find the desired mononomial for evaluating each primitive. The offset is stored as a class attribute and used on the add method:

  • There is only only offset attribute in many cases, i.e. when only mononomials of one order are needed.
  • When mononomials of different orders are needed, their offsets are computed in the reset method: offset_l1, offset_h1, offset_l2 and offset_h2. The suffixes h and l refer to higher and lower.
  • Keep in mind that the derivative (toward x) of a primitive (with x^k) includes two terms (one with a mononomial x^{k-1} and one with x^(k+1}). So in the case of GGA and even more so for MGGA, many mononomials are needed and several relevant offsets must be stored.

Given the position of a mononomial, related mononomials (increasing or decreasing one or two powers) are “easily” found. Given a mononomial:

  • mono = x**nx * y**ny * z**nz: offset + i
  • mono * x: offset_h1 + i
  • mono / x: offset_l1 + i
  • mono * y: offset_h1 + i + 1 + ny + nz
  • mono / y: offset_l1 + i - ny - nz
  • mono * z: offset_h1 + i + 2 + ny + nz
  • mono / z: offset_l1 + i - 1 - ny - nz
  • mono * (x*x): offset_h2 + i
  • mono / (x*x): offset_l2 + i
  • mono * (x*y): offset_h2 + i + 1 + ny + nz
  • mono / (x*y): offset_l2 + i - ny - nz
  • mono * (x*z): offset_h2 + i + 2 + ny + nz
  • mono / (x*z): offset_l2 + i - 1 - ny - nz
  • mono * (y*y): offset_h2 + i + 3 + 2*ny + 2*nz
  • mono / (y*y): offset_l2 + i + 1 - 2*ny - 2*nz
  • mono * (y*z): offset_h2 + i + 4 + 2*ny + 2*nz
  • mono / (y*z): offset_l2 + i - 2*ny - 2*nz
  • mono * (z*z): offset_h2 + i + 5 + 2*ny + 2*nz
  • mono / (z*z): offset_l2 + i - 1 - 2*ny - 2*nz

These rules are used on the add methods.

Includes

Included By