| 1 | #ifndef run_h | 
|---|
| 2 | #define run_h | 
|---|
| 3 |  | 
|---|
| 4 | /** \file run.h | 
|---|
| 5 | * Header file for \ref run.c | 
|---|
| 6 | * | 
|---|
| 7 | * Contains declarations of the functions implemented in \ref run.c and declaration | 
|---|
| 8 | * of RunStruct structure, which contains LatticeLevels, do or don't variables and | 
|---|
| 9 | * all the current stop conditions. | 
|---|
| 10 | * | 
|---|
| 11 | Project: ParallelCarParrinello | 
|---|
| 12 | Jan Hamaekers | 
|---|
| 13 | 2000 | 
|---|
| 14 |  | 
|---|
| 15 | File: run.h | 
|---|
| 16 | $Id: run.h,v 1.42 2007/02/09 09:37:29 foo Exp $ | 
|---|
| 17 | */ | 
|---|
| 18 |  | 
|---|
| 19 | #define RUNMAXOLD 2   //!< store this many old values of relative kinetic and total energ in RunStruct | 
|---|
| 20 |  | 
|---|
| 21 |  | 
|---|
| 22 | /** Structure containing values needed during the simulation. | 
|---|
| 23 | * contains values such as LatticeLevel, densities, MaxMinStep, UseAddGramSch, | 
|---|
| 24 | * deltat, energies, MeanForce | 
|---|
| 25 | */ | 
|---|
| 26 | struct RunStruct { | 
|---|
| 27 | struct LatticeLevel *LevS;     //!< _S_tandard level | 
|---|
| 28 | int LevSNo;                    //!< number of standard level within Lattice::Lev array | 
|---|
| 29 | struct LatticeLevel *Lev0;     //!< topmost (zeroth) level | 
|---|
| 30 | int Lev0No;                    //!< number of topmost level within Lattice::Lev array | 
|---|
| 31 | struct LatticeLevel *LevR;     //!< _R_iemann level (only for RiemannTensor use) | 
|---|
| 32 | int LevRNo;                    //!< number of Riemann level within Lattice::Lev array | 
|---|
| 33 | struct LatticeLevel *LevRS;    //!< _R_iemann _S_tandard level (only for RiemannTensor use) | 
|---|
| 34 | int LevRSNo;                    //!< number of Riemann standard level within Lattice::Lev array | 
|---|
| 35 | struct LatticeLevel *LevR0;     //!< _R_iemann topmost level (only for RiemannTensor use) | 
|---|
| 36 | int LevR0No;                    //!< number of Riemann topmost level within Lattice::Lev array | 
|---|
| 37 | struct LatticeLevel *InitLevS;  //!< initial _S_tandard LatticeLevel | 
|---|
| 38 | int InitLevSNo;                 //!< number of initial standard level within Lattice::Lev array | 
|---|
| 39 | struct LatticeLevel *InitLev0;  //!< initial topmost (zeroth) level | 
|---|
| 40 | int InitLev0No;                 //!< number of inital topmost level within Lattice::Lev array | 
|---|
| 41 | double FactorDensityR;          //!< one over volume of lattice cell | 
|---|
| 42 | double FactorDensityC;          //!< volume of lattice cell | 
|---|
| 43 | int ActualLocalPsiNo;           //!< number among local Psis of wave function currently minimised | 
|---|
| 44 | int OldActualLocalPsiNo;        //!< number among local Psis of wave function minimised last step | 
|---|
| 45 |  | 
|---|
| 46 | int MinStep;                    //!< holds count of minimisation steps | 
|---|
| 47 | int MaxMinStep;                                                                       //!< Maximum number of minimisation steps until stop | 
|---|
| 48 | int MaxInitMinStep;                                                   //!< initial Maximum number of minimisation steps until stop | 
|---|
| 49 | int ActualMaxMinStep;           //!< actual maximum number of minimisation steps until stop: MaxMinStep times MaxPsiStep times MaxMinStepFactor | 
|---|
| 50 |  | 
|---|
| 51 | int ScanPotential;              //!< prevents CGradient from being calculated more than once (for testing the potential) | 
|---|
| 52 | int ScanAtStep;                 //!< as RunStruct#ScanPotential is steadily increased, this gives the step where CGradient is no more updated furtheron | 
|---|
| 53 | double ScanDelta;               //!< step size for delta within the 0..PI array whilst scanning the potential form | 
|---|
| 54 | int ScanFlag;                   //!< Indicates whether Scan step is to be made (1) or just for testing (0) | 
|---|
| 55 |  | 
|---|
| 56 | int DoBrent;                    //!< whether line search shall be approximative (0) or numerically exact by a brent algorithm (1) per wave function | 
|---|
| 57 | int UseForcesFile;                                                      //!< 1 - do not calculate electronic forces but parse values from file, 0 - calculate force by solving ground state problem | 
|---|
| 58 | int UseOldPsi;                  //!< 1 - old Psis are used, 0 - not | 
|---|
| 59 | int UseAddGramSch;                                                    //!< whether additional Gram-Schmidt-Orthogonalization is used | 
|---|
| 60 | int DoCalcCGGauss;              //!< whether to calculate the gaussian part in the second derivative of the hartree exchange potential or not | 
|---|
| 61 | int DoUnOccupied;               //!< whether unoccupied states shall be minimised in a separate run per level or not | 
|---|
| 62 | int DoFullCurrent;              //!< whether in current density \f$\Delta j_k(r')\f$ is always (1), never (0) or when needed (2) calculated and added | 
|---|
| 63 | int DoPerturbation;             //!< States whether an external magnetic field is applied and perturbed wave functions, energies and derivated currents shall be calculated | 
|---|
| 64 | int CommonWannier;               //!< Defines whether the same Wannier centre for all orbitals (1), individual (0) or combined ones in regard to spread (2) shall be used | 
|---|
| 65 | int VectorPlane;                //!< output current vector plane perpendicular to this axis (0,1,2, -1=don't) | 
|---|
| 66 | double VectorCut;               //!< Do the plane cut at this position along the axis defined by RunStruct#VectorPlane | 
|---|
| 67 | int PsiStep;                    //!< holds count of number of made minimisation steps per state | 
|---|
| 68 | int MaxPsiStep;                                                                       //!< maximum number of minimisation steps per state (0 - default) | 
|---|
| 69 | int AlphaStep;                  //!< holds count of how often alpha was recalculated, due to wrong jump prediction in the CG-minimisation of the wave functions | 
|---|
| 70 | enum PsiTypeTag CurrentMin;     //!< within which minimisation loop are we right now (only useful in DoSeparated-case) | 
|---|
| 71 | int Seed;                       //!< initial value for random seed on randomisation of Psi coefficients | 
|---|
| 72 | int WaveNr;                     //!< wave function number that OutputVis writes to file | 
|---|
| 73 | double Lambda;                  //!< test factor with no meaning | 
|---|
| 74 | double Diffcount;               //!< sums up difference between TE and ATE for measure | 
|---|
| 75 | double Diffsteps;               //!< start value of MinStep, when summation began | 
|---|
| 76 |  | 
|---|
| 77 | int MinStopStep;                //!< counts how often stop condition was checked | 
|---|
| 78 | int MaxMinStopStep;                                                   //!< check whether to check if to stop every ..th steps | 
|---|
| 79 | int ActualMaxMinStopStep;       //!< actual check whether to check if to stop every ..th steps | 
|---|
| 80 | int InitMaxMinStopStep;                                       //!< initial check whether to check if to stop every ..th steps | 
|---|
| 81 | int MaxMinGapStopStep;          //!< check whether to check if to stop gap calcs every ..th steps | 
|---|
| 82 | int ActualMaxMinGapStopStep;    //!< actual check whether to check if to stop gap calcs every ..th steps | 
|---|
| 83 | int InitMaxMinGapStopStep;      //!< initial check whether to check if to stop gap calcs every ..th steps | 
|---|
| 84 |  | 
|---|
| 85 | int MaxOuterStep;                                                             //!< maximum number of MolecularDynamics steps | 
|---|
| 86 | int MaxStructOptStep;               //!< maximum number of structure optimization steps | 
|---|
| 87 | int NewRStep;                   //!< holds count of how often the ions were moved (position R has changed) | 
|---|
| 88 | int MaxMinStepFactor;           //!< Additional factor for setting RunStruct::ActualMaxMinStep, see InitRun() | 
|---|
| 89 | double XCEnergyFactor;          //!< part of discrete integration width factor in exchange correlation energy calculation, equal to volume of lattice cell | 
|---|
| 90 | double HGcFactor;               //!< ..., equal to one over volume of lattice cell | 
|---|
| 91 |  | 
|---|
| 92 | double RelEpsTotalEnergy;                                                               //!< minimal relative change in total energy | 
|---|
| 93 | double InitRelEpsTotalEnergy;                                           //!< initial relative change in total energy | 
|---|
| 94 | double ActualRelEpsTotalEnergy;           //!< actual relative change in total energy | 
|---|
| 95 | double ActualRelTE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in total energy up to RUNMAXOLD-1 | 
|---|
| 96 | double *ActualRelTotalEnergy; //!< points to \a ActualRelTE with respect to current RunStruct#CurrentMin | 
|---|
| 97 | double RelEpsKineticEnergy;                                                   //!< minimal relative change in kinetic energy | 
|---|
| 98 | double InitRelEpsKineticEnergy;                                       //!< initial minimal relative change in kinetic energy | 
|---|
| 99 | double ActualRelEpsKineticEnergy;       //!< actual minimal relative change in kinetic energy | 
|---|
| 100 | double ActualRelKE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in kinetic energy up to RUNMAXOLD-1 | 
|---|
| 101 | double *ActualRelKineticEnergy; //!<  points to \a ActualRelKE with respect to current RunStruct#CurrentMin | 
|---|
| 102 |  | 
|---|
| 103 | double TE[Extra][RUNMAXOLD];                                  //!< current [0] and archived total energy up to RUNMAXOLD | 
|---|
| 104 | double KE[Extra][RUNMAXOLD];                          //!< current [0] and archived kinetic energy up to RUNMAXOLD-1 | 
|---|
| 105 | double *TotalEnergy;         //!< points to \a TE with respect to current RunStruct#CurrentMin | 
|---|
| 106 | double *KineticEnergy;       //!< points to \a KE with respect to current RunStruct#CurrentMin | 
|---|
| 107 |  | 
|---|
| 108 | double MeanForce[MAXOLD];                                     //!< stores old mean force values (see GetOuterStop), [0] is recent one | 
|---|
| 109 | double delta_t;                                                                               //!< time per MD step | 
|---|
| 110 | double t;                                               //!< Current time | 
|---|
| 111 | int OutVisStep;                                                                               //!< Output data for OpenDX every ..th step | 
|---|
| 112 | int OutSrcStep;                                                                               //!< Output data for measurements every ..th step | 
|---|
| 113 | int OuterStep;                    //!< Current MD step | 
|---|
| 114 | int StructOptStep;                //!< Current step in structure optimization | 
|---|
| 115 | double TargetTemp;                                                            //!< Target temperature | 
|---|
| 116 | int ScaleTempStep;                                                            //!< MD temperature is scaled every ..step | 
|---|
| 117 | double HooverMass;                //!< Hoover Mass for Nose-Hoover Thermostat in atom mass units (not atom_ic_ units), \sa Thermostat() | 
|---|
| 118 | double TempFrequency;             //!< collision frequency for Langevin/Stochastic Thermostat/\f$\tau_T\f$ for Berendsen Thermostat, \sa Thermostat() | 
|---|
| 119 | double alpha;                     //!< interpolation coefficent for Langevin/Stochastic Thermostat, \sa Thermostat() | 
|---|
| 120 | double EpsWannier;                //!< tolerance value for spread minimisation of orbitals, \sa ComputeMLWF() | 
|---|
| 121 |  | 
|---|
| 122 | double BField[NDIM]; | 
|---|
| 123 |  | 
|---|
| 124 | char **MinimisationName; | 
|---|
| 125 | /*[8]={"Occ", | 
|---|
| 126 | "UnOcc", | 
|---|
| 127 | "P0", | 
|---|
| 128 | "P1", | 
|---|
| 129 | "P2", | 
|---|
| 130 | "RxP0", | 
|---|
| 131 | "RxP1", | 
|---|
| 132 | "RxP2"};          //!< suffixes for SrcPsiFiles | 
|---|
| 133 | */ | 
|---|
| 134 | }; | 
|---|
| 135 |  | 
|---|
| 136 | void InitRunLevel(struct Problem *P); | 
|---|
| 137 | void InitRun(struct Problem *P); | 
|---|
| 138 | void CalculateMD(struct Problem *P); | 
|---|
| 139 | void UpdateActualPsiNo(struct Problem *P, enum PsiTypeTag SkipType); | 
|---|
| 140 | void SetCurrentMinState(struct Problem *P, enum PsiTypeTag state); | 
|---|
| 141 | int CalculateMinimumStop(struct Problem *P, int SuperStop); | 
|---|
| 142 | void Thermostats(struct Problem *P, enum thermostats i); | 
|---|
| 143 | #endif | 
|---|