# sc_BatchElectronDensity - Man Page

This a more highly optimized than ElectronDensity since everything is precomputed.

## Synopsis

`#include <density.h>`

Inherits **sc::Volume**.

### Public Types

enum { **X** =0, **Y** =1, **Z** =2 }

This gives the elements of gradient arrays.

enum { **XX** =0, **YX** =1, **YY** =2, **ZX** =3, **ZY** =4, **ZZ** =5 }

This gives the elements of hessian arrays.

### Public Member Functions

**BatchElectronDensity** (const **Ref**< **KeyVal** > &)**BatchElectronDensity** (const **Ref**< **Wavefunction** > &, double accuracy=DBL_EPSILON)**BatchElectronDensity** (const **Ref**< **BatchElectronDensity** > &d, bool reference_parent_data=false)

This will construct copies of this.

virtual void **boundingbox** (double valuemin, double valuemax, **SCVector3** &p1, **SCVector3** &p2)

Returns the bounding box.

void **clear** ()

This will cause all stratch storage to be released.

void **compute_density** (const **SCVector3** &r, double *alpha_density, double *alpha_density_grad, double *alpha_density_hessian, double *beta_density, double *beta_density_grad, double *beta_density_hessian)

This is a alternate to the **Volume** interface that avoids some of the overhead of that interface.

virtual void **init** (bool initialize_density_matrices=true)

This is called to finish initialization of the object.

virtual void **set_densities** (const **RefSymmSCMatrix** &aden, const **RefSymmSCMatrix** &bden)

This will fill in the internel copies of the density matrices with new values.

void **set_linear_scaling** (bool b)

Turn linear scaling algorithm on/off.

void **set_accuracy** (double a)

Sets the accuracy.

void **set_use_dmat_bound** (bool b)

Turn use of density matrix bounds on/off.

**DFT Support Members.**

These return some of the internal data, some of which is only value after a density has been computed.

This data is needed by the density functional theory code.

double * **alpha_density_matrix** ()

Return the alpha density matrix.

double * **beta_density_matrix** ()

Return the beta density matrix.

int **ncontrib** ()

int * **contrib** ()

int **ncontrib_bf** ()

int * **contrib_bf** ()

double * **bs_values** ()

double * **bsg_values** ()

double * **bsh_values** ()

void **set_need_basis_gradient** (bool b)

To ensure that that the basis functions gradients are computed, use this.

void **set_need_basis_hessian** (bool b)

### Protected Member Functions

virtual void **init_common_data** (bool initialize_density_matrices)

virtual void **init_scratch_data** ()

void **compute_basis_values** (const **SCVector3** &r)

void **compute_spin_density** (const double *dmat, double *rho, double *grad, double *hess)

virtual void **compute** ()

Recompute at least the results that have compute true and are not already computed.

### Protected Attributes

**Ref**< **Wavefunction** > **wfn_****Ref**< **GaussianBasisSet** > **basis_**

double * **alpha_dmat_**

double * **beta_dmat_**

double * **dmat_bound_****ShellExtent** * **extent_****GaussianBasisSet::ValueData** * **valdat_**

int **ncontrib_**

int * **contrib_**

int **ncontrib_bf_**

int * **contrib_bf_**

double * **bs_values_**

double * **bsg_values_**

double * **bsh_values_**

int **nshell_**

int **nbasis_**

int **spin_polarized_**

int **linear_scaling_**

int **use_dmat_bound_**

bool **need_hessian_**

bool **need_gradient_**

bool **need_basis_hessian_**

bool **need_basis_gradient_**

bool **using_shared_data_**

double **accuracy_**

### Additional Inherited Members

## Detailed Description

This a more highly optimized than **ElectronDensity** since everything is precomputed.

However, it cannot be used if the density and/or geometry might change between computations of the density or bounding box, unless the obsolete member is called.

## Constructor & Destructor Documentation

### sc::BatchElectronDensity::BatchElectronDensity (const Ref< BatchElectronDensity > & d, bool reference_parent_data = false)

This will construct copies of this. If reference_parent_data is true, then data that do not change, such as the density matrices and shell extent, are referenced rather than copied. In this case, the original object that allocated this items must be valid while copied objects are used to compute densities. Also d must have already been intialized and the resulting copy is already initialized (and cannot be reinitialized).

If reference_parent_data is false, then init must be called on this object before it is used.

## Member Function Documentation

### virtual void sc::BatchElectronDensity::boundingbox (double valuemin, double valuemax, SCVector3 & p1, SCVector3 & p2) [virtual]

Returns the bounding box.

Implements **sc::Volume**.

### virtual void sc::BatchElectronDensity::compute () [protected], [virtual]

Recompute at least the results that have compute true and are not already computed. This should only be called by **Result**'s members.

Implements **sc::Volume**.

### virtual void sc::BatchElectronDensity::init (bool initialize_density_matrices = true) [virtual]

This is called to finish initialization of the object. It must not be called with objects that created in a way that they share parent data, those objects are initialized when they are constructed. This member is usually called automatically, however, if it will be used to initial other objects that share parent data, then it must be initialized first and this return is the way to do that. If initialize_density_matrices is false, then the density matrices will be allocated, but not filled in. They must be later filled in with set_densities.

### void sc::BatchElectronDensity::set_accuracy (double a) [inline]

Sets the accuracy.

### virtual void sc::BatchElectronDensity::set_densities (const RefSymmSCMatrix & aden, const RefSymmSCMatrix & bden) [virtual]

This will fill in the internel copies of the density matrices with new values. aden is the alpha density matrix and bden is the beta density matrix. bden is ignored if the wavefunction is not spin polarized.

### void sc::BatchElectronDensity::set_linear_scaling (bool b) [inline]

Turn linear scaling algorithm on/off. The effect of this will be delayed until the next time **init()** is called.

## Author

Generated automatically by Doxygen for MPQC from the source code.