---
name: "sc_Wavefunction"
section: "3"
platform: "linux"
package: "libsc-doc"
version: "2.3.1-22"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/sc_Wavefunction"
---

# sc\_Wavefunction(3)

A Wavefunction is a MolecularEnergy that utilizies a GaussianBasisSet.

## NAME

sc::Wavefunction - A **Wavefunction** is a **MolecularEnergy** that utilizies a **GaussianBasisSet**.

## SYNOPSIS

`#include <wfn.h>`

Inherits **sc::MolecularEnergy**.

Inherited by **sc::MBPT2**, **sc::OneBodyWavefunction**, and **sc::PsiWavefunction**.

### Public Member Functions

**Wavefunction** (**StateIn** &)\
 **Wavefunction** (const **Ref**\< **KeyVal** \> &)\
 The **KeyVal** constructor.  void **save\_data\_state** (**StateOut** &)\
 Save the base classes (with save\_data\_state) and the members in the same order that the **StateIn** CTOR initializes them.  double **density** (const **SCVector3** &)\
 double **density\_gradient** (const **SCVector3** &, double \*)\
 double **natural\_orbital** (const **SCVector3** &r, int iorb)\
 double **natural\_orbital\_density** (const **SCVector3** &r, int orb, double \*orbval=0)\
 double **orbital** (const **SCVector3** &r, int iorb, const **RefSCMatrix** &orbs)\
 double **orbital\_density** (const **SCVector3** &r, int iorb, const **RefSCMatrix** &orbs, double \*orbval=0)\
 double **charge** ()\
 Returns the charge.  virtual int **nelectron** ()=0\
 Returns the number of electrons.  virtual **RefSymmSCMatrix** **density** ()=0\
 Returns the **SO** density.  virtual **RefSymmSCMatrix** **ao\_density** ()\
 Returns the AO density.  virtual **RefSCMatrix** **natural\_orbitals** ()\
 Returns the natural orbitals.  virtual **RefDiagSCMatrix** **natural\_density** ()\
 Returns the natural density (a diagonal matrix).  virtual int **spin\_polarized** ()=0\
 Return 1 if the alpha density is not equal to the beta density.  virtual **RefSymmSCMatrix** **alpha\_density** ()\
 Return alpha electron densities in the **SO** basis.  virtual **RefSymmSCMatrix** **beta\_density** ()\
 Return beta electron densities in the **SO** basis.  virtual **RefSymmSCMatrix** **alpha\_ao\_density** ()\
 Return alpha electron densities in the AO basis.  virtual **RefSymmSCMatrix** **beta\_ao\_density** ()\
 Return beta electron densities in the AO basis.  virtual **RefSCMatrix** **nao** (double \*atom\_charges=0)\
 returns the ao to nao transformation matrix  virtual **RefSymmSCMatrix** **overlap** ()\
 Returns the **SO** overlap matrix.  virtual **RefSymmSCMatrix** **core\_hamiltonian** ()\
 Returns the **SO** core Hamiltonian.  virtual double **nuclear\_repulsion\_energy** ()\
 Returns the nuclear repulsion energy.  void **nuclear\_repulsion\_energy\_gradient** (double \*g)\
 Computes the nuclear repulsion gradient.  virtual void **nuclear\_repulsion\_energy\_gradient** (double \*\*g)\
 Computes the nuclear repulsion gradient.  **RefSCDimension** **ao\_dimension** ()\
 Atomic orbital dimension.  **RefSCDimension** **so\_dimension** ()\
 Symmetry adapted orbital dimension.  **RefSCDimension** **oso\_dimension** ()\
 Orthogonalized symmetry adapted orbital dimension.  **Ref**\< **SCMatrixKit** \> **basis\_matrixkit** ()\
 Matrix kit for AO, **SO**, orthogonalized **SO**, and MO dimensioned matrices.  **Ref**\< **Molecule** \> **molecule** () const\
 Returns the **Molecule**.  **Ref**\< **GaussianBasisSet** \> **basis** () const\
 Returns the basis set.  **Ref**\< **GaussianBasisSet** \> **atom\_basis** () const\
 Returns the basis set describing the nuclear charge distributions.  const double \* **atom\_basis\_coef** () const\
 Returns the coefficients of the nuclear charge distribution basis functions.  **Ref**\< **Integral** \> **integral** ()\
 Returns the integral evaluator.  void **symmetry\_changed** ()\
 Call this if you have changed the molecular symmetry of the molecule contained by this **MolecularEnergy**.  **RefSCMatrix** **so\_to\_orthog\_so** ()\
 Returns a matrix which does the default transform from **SO**'s to orthogonal **SO**'s.  **RefSCMatrix** **so\_to\_orthog\_so\_inverse** ()\
 Returns the inverse of the transformation returned by so\_to\_orthog\_so.  **OverlapOrthog::OrthogMethod** **orthog\_method** () const\
 Returns the orthogonalization method.  void **set\_orthog\_method** (const **OverlapOrthog::OrthogMethod** &)\
 (Re)Sets the orthogonalization method and makes this obsolete  double **lindep\_tol** () const\
 Returns the tolerance for linear dependencies.  void **set\_lindep\_tol** (double)\
 Re(Sets) the tolerance for linear dependencies.  void **obsolete** ()\
 Marks all results as being out of date.  void **print** (std::ostream &=**ExEnv::out0**()) const\
 Print information about the object.

### Protected Member Functions

double **min\_orthog\_res** ()\
 double **max\_orthog\_res** ()\
 void **copy\_orthog\_info** (const **Ref**\< **Wavefunction** \> &)\

### Protected Attributes

int **debug\_**\

### Additional Inherited Members

## Detailed Description

A **Wavefunction** is a **MolecularEnergy** that utilizies a **GaussianBasisSet**.

## Constructor & Destructor Documentation

### sc::Wavefunction::Wavefunction (const Ref\< KeyVal \> &)

The **KeyVal** constructor.

- `basis`

  Specifies a **GaussianBasisSet** object. There is no default.

- `integral`

  Specifies an **Integral** object that computes the two electron integrals. The default is a **IntegralV3** object.

- `orthog_method`

  This is a string that specifies the orthogonalization method to be used. It can be one one canonical, gramschmidt, or symmetric. The default is symmetric.

- `lindep_tol`

  The tolerance used to detect linearly dependent basis functions. The precise meaning depends on the orthogonalization method. The default value is 1e-8.

- `print_nao`

  This specifies a boolean value. If true the natural atomic orbitals will be printed. Not all wavefunction will be able to do this. The default is false.

- `print_npa`

  This specifies a boolean value. If true the natural population analysis will be printed. Not all wavefunction will be able to do this. The default is true if print\_nao is true, otherwise it is false.

- `debug`

  This integer can be used to produce output for debugging. The default is 0.

## Member Function Documentation

### virtual RefSymmSCMatrix sc::Wavefunction::alpha\_density ()` [virtual]`

Return alpha electron densities in the **SO** basis.

Reimplemented in **sc::HSOSSCF**, **sc::OSSSCF**, **sc::TCSCF**, and **sc::UnrestrictedSCF**.

### virtual RefSymmSCMatrix sc::Wavefunction::beta\_density ()` [virtual]`

Return beta electron densities in the **SO** basis.

Reimplemented in **sc::HSOSSCF**, **sc::OSSSCF**, **sc::TCSCF**, and **sc::UnrestrictedSCF**.

### virtual RefSymmSCMatrix sc::Wavefunction::density ()` [pure virtual]`

Returns the **SO** density.

Implemented in **sc::CLKS**, **sc::MBPT2**, **sc::MBPT2\_R12**, **sc::PsiWavefunction**, **sc::CLSCF**, **sc::HSOSSCF**, **sc::OSSSCF**, **sc::TCSCF**, **sc::UnrestrictedSCF**, **sc::ExtendedHuckelWfn**, and **sc::HCoreWfn**.

### Ref\< Molecule \> sc::Wavefunction::molecule () const` [virtual]`

Returns the **Molecule**.

Reimplemented from **sc::MolecularEnergy**.

### virtual int sc::Wavefunction::nelectron ()` [pure virtual]`

Returns the number of electrons.

Implemented in **sc::MBPT2**, **sc::PsiWavefunction**, and **sc::OneBodyWavefunction**.

### virtual double sc::Wavefunction::nuclear\_repulsion\_energy ()` [virtual]`

Returns the nuclear repulsion energy. This must be used instead of **Molecule::nuclear\_repulsion\_energy()** since there may be diffuse atomic charges.

### virtual void sc::Wavefunction::nuclear\_repulsion\_energy\_gradient (double \*\* g)` [virtual]`

Computes the nuclear repulsion gradient. This must be used instead of **Molecule::nuclear\_repulsion\_1der()** since there may be diffuse atomic charges. The gradient, g, is first zeroed. Its dimensions are g\[natom\]\[3\].

### void sc::Wavefunction::nuclear\_repulsion\_energy\_gradient (double \* g)

Computes the nuclear repulsion gradient. This must be used instead of **Molecule::nuclear\_repulsion\_1der()** since there may be diffuse atomic charges. The gradient, g, is zeroed and set to x\_0, y\_0, z\_0, x\_1, ... .

### void sc::Wavefunction::obsolete ()` [virtual]`

Marks all results as being out of date. Any subsequent access to results will cause **Compute::compute()** to be called.

Reimplemented from **sc::Compute**.

### void sc::Wavefunction::print (std::ostream & = ExEnv::out0`()`) const` [virtual]`

Print information about the object.

Reimplemented from **sc::MolecularEnergy**.

### void sc::Wavefunction::save\_data\_state (StateOut &)` [virtual]`

Save the base classes (with save\_data\_state) and the members in the same order that the **StateIn** CTOR initializes them. This must be implemented by the derived class if the class has data.

Reimplemented from **sc::MolecularEnergy**.

### RefSCMatrix sc::Wavefunction::so\_to\_orthog\_so ()

Returns a matrix which does the default transform from **SO**'s to orthogonal **SO**'s. This could be either the symmetric or canonical orthogonalization matrix. The row dimension is **SO** and the column dimension is ortho **SO**. An operator $O$ in the ortho **SO** basis is given by $X O X^T$ where $X$ is the return value of this function.

### virtual int sc::Wavefunction::spin\_polarized ()` [pure virtual]`

Return 1 if the alpha density is not equal to the beta density.

Implemented in **sc::MBPT2**, **sc::PsiCLHF**, **sc::PsiHSOSHF**, **sc::PsiUHF**, **sc::PsiCCSD**, **sc::PsiCCSD\_T**, **sc::CLSCF**, **sc::HSOSSCF**, **sc::OSSSCF**, **sc::TCSCF**, **sc::UnrestrictedSCF**, **sc::ExtendedHuckelWfn**, and **sc::HCoreWfn**.

### void sc::Wavefunction::symmetry\_changed ()` [virtual]`

Call this if you have changed the molecular symmetry of the molecule contained by this **MolecularEnergy**.

Reimplemented from **sc::MolecularEnergy**.

## Author

Generated automatically by Doxygen for MPQC from the source code.
