[a0bcf1] | 1 | #ifndef grad_h
|
---|
| 2 | #define grad_h
|
---|
| 3 | /** \file grad.h
|
---|
| 4 | * Header file for \ref grad.c
|
---|
| 5 | *
|
---|
| 6 | * Contains declarations of the functions implemented in \ref grad.c and
|
---|
| 7 | * enumeration of the various GradientTypes which is used in the Gradient
|
---|
| 8 | * structure herein discerning the various stages of finding the conjugate
|
---|
| 9 | * gradient direction.
|
---|
| 10 | *
|
---|
| 11 | *
|
---|
| 12 | Project: ParallelCarParrinello
|
---|
| 13 | Jan Hamaekers
|
---|
| 14 | 2000
|
---|
| 15 |
|
---|
| 16 | File: grad.h
|
---|
| 17 | $Id: grad.h,v 1.21 2007/02/09 09:22:05 foo Exp $
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | // use double precision fft when we have it
|
---|
| 22 | #ifdef HAVE_CONFIG_H
|
---|
| 23 | #include <config.h>
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #ifdef HAVE_DFFTW_H
|
---|
| 27 | #include "dfftw.h"
|
---|
| 28 | #else
|
---|
| 29 | #include "fftw.h"
|
---|
| 30 | #endif
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | #define MaxGradientArrayTypes 9 //!< number of different stages in the conjugate direction
|
---|
| 34 | /// Enumerating the different Gradient types during the construction of the conjugate gradient
|
---|
| 35 | enum GradientTypes { GraSchGradient, //!< set onto extra local Psi in order to orthonormalise CG by GramSch() (working array)
|
---|
| 36 | ActualGradient, //!< contains orthonormalized direction of steepest descent of step m \f$\zeta^{(m)}_i = - (H-\lambda_i)\psi^{(m)}_i\f$
|
---|
| 37 | OldActualGradient, //!< contains orthonormalized direction of steepest descent of step m-1 \f$\zeta^{(m-1)}_i = - (H-\lambda_i)\psi^{(m-1)}_i\f$
|
---|
| 38 | HcGradient, //!< contains gradient of wave function \f$\langle \chi_G| -\frac{1}{2}\nabla^2 + \underbrace{V^H + V^{ps,loc} + V^{XC}}_{V^{loc}} + V^{ps,nl} | \psi_i \rangle\f$
|
---|
| 39 | H1cGradient, //!< contains gradient of wave function \f$\langle {\cal H}^{(1)} | \psi_i^{(0)} \rangle\f$
|
---|
| 40 | PreConGradient, //!< contains preconditioned, orthonormalized direction of steepest descent \f$M \tilde{\zeta}_i\f$
|
---|
| 41 | ConDirGradient, //!< conjugate gradient direction of current step m, \f$\tilde{\tilde{\zeta}}_i^{(m)}\f$
|
---|
| 42 | OldConDirGradient, //!< old conjugate gradient direction of last step m-1, \f$\tilde{\tilde{\zeta}}_i^{(m-1)}\f$
|
---|
| 43 | TempGradient //!< temporary working gradient array
|
---|
| 44 | };
|
---|
| 45 |
|
---|
| 46 | /** Structure containing calculated conjugate gradient at its various stages.
|
---|
| 47 | */
|
---|
| 48 | struct Gradient {
|
---|
| 49 | fftw_complex *GradientArray[MaxGradientArrayTypes]; //!< Array containing the conjugate direction: initial, steepest descent, preconditioned, conjugate, ...
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | void InitGradients(struct Problem *P, struct Gradient *Grad);
|
---|
| 53 | void RemoveGradients(struct Problem *P, struct Gradient *Grad);
|
---|
| 54 | void CalculateGradientNoRT(struct Problem *P, fftw_complex *source, const double PsiFactor, double *Lambda, fftw_complex ***fnl, fftw_complex *grad, fftw_complex *oldgrad, fftw_complex *Hc_grad);
|
---|
| 55 | void CalculateNewWave(struct Problem *P, double *x);
|
---|
| 56 | void CalculateConDirHConDir(struct Problem *P, fftw_complex *ConDir, const double PsiFactor, double *ConDirHConDir, double *HartreeddEddt0, double *XCddEddt0);
|
---|
| 57 | double CalculateDeltaI(double E0, double dEdt0, double ddEddt0, double *E, double *dE, double *ddE, double *dcos, double *dsin);
|
---|
| 58 | void CalculateHamiltonian(struct Problem *P);
|
---|
| 59 | void CalculateUnOccupied(struct Problem *P);
|
---|
| 60 | double GradSP(struct Problem *P, struct LatticeLevel *Lev, const fftw_complex *LPsiDatA, const fftw_complex *LPsiDatB);
|
---|
| 61 | double GradImSP(struct Problem *P, struct LatticeLevel *Lev, fftw_complex *LPsiDatA, fftw_complex *LPsiDatB);
|
---|
| 62 | double UpdateWaveAfterIonMove(struct Problem *P);
|
---|
| 63 | #endif
|
---|