[a0bcf1] | 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 |
|
---|
| 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 NewRStep; //!< holds count of how often the ions were moved (position R has changed)
|
---|
| 87 | int MaxMinStepFactor; //!< Additional factor for setting RunStruct::ActualMaxMinStep, see InitRun()
|
---|
| 88 | double XCEnergyFactor; //!< part of discrete integration width factor in exchange correlation energy calculation, equal to volume of lattice cell
|
---|
| 89 | double HGcFactor; //!< ..., equal to one over volume of lattice cell
|
---|
| 90 |
|
---|
| 91 | double RelEpsTotalEnergy; //!< minimal relative change in total energy
|
---|
| 92 | double InitRelEpsTotalEnergy; //!< initial relative change in total energy
|
---|
| 93 | double ActualRelEpsTotalEnergy; //!< actual relative change in total energy
|
---|
| 94 | double ActualRelTE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in total energy up to RUNMAXOLD-1
|
---|
| 95 | double *ActualRelTotalEnergy; //!< points to \a ActualRelTE with respect to current RunStruct#CurrentMin
|
---|
| 96 | double RelEpsKineticEnergy; //!< minimal relative change in kinetic energy
|
---|
| 97 | double InitRelEpsKineticEnergy; //!< initial minimal relative change in kinetic energy
|
---|
| 98 | double ActualRelEpsKineticEnergy; //!< actual minimal relative change in kinetic energy
|
---|
| 99 | double ActualRelKE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in kinetic energy up to RUNMAXOLD-1
|
---|
| 100 | double *ActualRelKineticEnergy; //!< points to \a ActualRelKE with respect to current RunStruct#CurrentMin
|
---|
| 101 |
|
---|
| 102 | double TE[Extra][RUNMAXOLD]; //!< current [0] and archived total energy up to RUNMAXOLD
|
---|
| 103 | double KE[Extra][RUNMAXOLD]; //!< current [0] and archived kinetic energy up to RUNMAXOLD-1
|
---|
| 104 | double *TotalEnergy; //!< points to \a TE with respect to current RunStruct#CurrentMin
|
---|
| 105 | double *KineticEnergy; //!< points to \a KE with respect to current RunStruct#CurrentMin
|
---|
| 106 |
|
---|
| 107 | double MeanForce[MAXOLD]; //!< stores old mean force values (see GetOuterStop), [0] is recent one
|
---|
| 108 | double delta_t; //!< time per MD step
|
---|
| 109 | double t; //!< Current time
|
---|
| 110 | int OutVisStep; //!< Output data for OpenDX every ..th step
|
---|
| 111 | int OutSrcStep; //!< Output data for measurements every ..th step
|
---|
| 112 | int OuterStep; //!< Current MD/CG/Simplex step in structure optimization
|
---|
| 113 | double TargetTemp; //!< Target temperature
|
---|
| 114 | int ScaleTempStep; //!< MD temperature is scaled every ..step
|
---|
| 115 | double EpsWannier; //!< tolerance value for spread minimisation of orbitals, \sa ComputeMLWF()
|
---|
| 116 |
|
---|
| 117 | char **MinimisationName;
|
---|
| 118 | /*[8]={"Occ",
|
---|
| 119 | "UnOcc",
|
---|
| 120 | "P0",
|
---|
| 121 | "P1",
|
---|
| 122 | "P2",
|
---|
| 123 | "RxP0",
|
---|
| 124 | "RxP1",
|
---|
| 125 | "RxP2"}; //!< suffixes for SrcPsiFiles
|
---|
| 126 | */
|
---|
| 127 | };
|
---|
| 128 |
|
---|
| 129 | void InitRunLevel(struct Problem *P);
|
---|
| 130 | void InitRun(struct Problem *P);
|
---|
| 131 | void CalculateMD(struct Problem *P);
|
---|
| 132 | void UpdateActualPsiNo(struct Problem *P, enum PsiTypeTag SkipType);
|
---|
| 133 | void SetCurrentMinState(struct Problem *P, enum PsiTypeTag state);
|
---|
| 134 | int CalculateMinimumStop(struct Problem *P, int SuperStop);
|
---|
| 135 | #endif
|
---|