slr.cc File Reference

contains a Simple Linear Response implementation based on the MO orbital picture. More...

#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <vector>
#include "gblas.h"
#include "slr.h"
#include "solve_lin_eq_syst.h"
#include "utilities.h"
#include "output.h"
#include "units.h"

Namespaces

namespace  LR

Functions

ergo_real LR::dot (int len, const ergo_real *a, const ergo_real *b)
 returns dot_product(a, b)
ergo_real LR::operator * (const VarVector &a, const VarVector &b)
ergo_real LR::operator * (const VarVector &a, const VarVectorProxyOp< false, false > &b)
ergo_real LR::operator * (const VarVector &a, const VarVectorProxyOp< true, false > &b)
ergo_real LR::operator * (const VarVector &a, const VarVectorProxyOp< false, true > &b)
VarVectorProxyOp< false, false > LR::operator * (ergo_real s, const VarVector &v)
template<bool MultByS, bool SwapXY>
VarVectorProxyOp< MultByS,
SwapXY > 
LR::operator * (ergo_real s, const VarVectorProxyOp< MultByS, SwapXY > &v)
VarVector & LR::operator+= (VarVector &a, const VarVectorProxyOp< false, false > &proxy)
VarVector & LR::operator+= (VarVector &a, const VarVectorProxyOp< true, false > &proxy)
VarVector & LR::operator+= (VarVector &a, const VarVectorProxyOp< false, true > &proxy)
VarVector & LR::operator+= (VarVector &a, const VarVectorProxyOp< true, true > &proxy)
const VarVectorProxyOp< false,
true > 
LR::swapXY (const VarVector &arg)
 returns a proxy object corresponding to a swapped vector.
const VarVectorProxyOp< true,
false > 
LR::sTimes (const VarVector &arg)
 returns a proxy object corresponding to a vector multiplied by S[2], i.e.
template<bool SwapXY>
VarVectorProxyOp< true, SwapXY > LR::sTimes (const VarVectorProxyOp< false, SwapXY > &arg)
static void LR::precondition (VarVector &v, const VarVector &e2diag, ergo_real shift)
 pre-condition a vector given an approximation of the E[2] operator diagonal and a shift of the S[2] operator.
static void LR::commuteWithDMO (int nbast, int nocc, ergo_real *mat)
 mat := [mat, D_MO]
static void LR::gemm (int n, const char *at, const ergo_real *a, const char *bt, const ergo_real *b, ergo_real alpha, ergo_real beta, ergo_real *c)
static void LR::commute (int nbast, const ergo_real *a, const ergo_real *b, ergo_real f, ergo_real *res)
 res := f*res + [a, b]


Detailed Description

contains a Simple Linear Response implementation based on the MO orbital picture.

Copyright(c) Pawel Salek 2006.

The solver is generic: it can handle both linear sets of equations and eigenvalue problems. The variable parts are implemented by subclasses. A subclass must implement following functions:

In case of the set of equations, residual is computed in 3 steps: Solution in the subspace: Xsub = (Asub-freq*Ssub)\Ysub; Solution expanded out fo subspace: X=v*Xsub; Residual vector: residualv= (Av-freq*Sv)*Xsub - Y;

In case of the eigenvalue problem, more steps are needed: Solution in the subspace: [ Xsub, lambda ] = eig(Asub, Ssub); Pick first positive eigenvalue l1 = lambda(step+1); Pick corresponding eigenvector: Xsub = Xsub(:,step+1); Residual Vector: residualv = (Av-l1*Sv)*Xsub;

Example usage:

  MyE2Evaluator e2;
  EigenSolver solver(nbast, nocc, fock_matrix, overlap_matrix);
  solver.solve(e2);
  printf("Lowest eigenvalue: %f\n", solver.getFreq());
  
The important stuff will get printed but also a solution should probably be returned in some convenient way.
Generated on Mon Sep 17 14:30:41 2012 for ergo by  doxygen 1.4.7