#ifndef run_h #define run_h /** \file run.h * Header file for \ref run.c * * Contains declarations of the functions implemented in \ref run.c and declaration * of RunStruct structure, which contains LatticeLevels, do or don't variables and * all the current stop conditions. * Project: ParallelCarParrinello Jan Hamaekers 2000 File: run.h $Id: run.h,v 1.42 2007/02/09 09:37:29 foo Exp $ */ #define RUNMAXOLD 2 //!< store this many old values of relative kinetic and total energ in RunStruct /** Structure containing values needed during the simulation. * contains values such as LatticeLevel, densities, MaxMinStep, UseAddGramSch, * deltat, energies, MeanForce */ struct RunStruct { struct LatticeLevel *LevS; //!< _S_tandard level int LevSNo; //!< number of standard level within Lattice::Lev array struct LatticeLevel *Lev0; //!< topmost (zeroth) level int Lev0No; //!< number of topmost level within Lattice::Lev array struct LatticeLevel *LevR; //!< _R_iemann level (only for RiemannTensor use) int LevRNo; //!< number of Riemann level within Lattice::Lev array struct LatticeLevel *LevRS; //!< _R_iemann _S_tandard level (only for RiemannTensor use) int LevRSNo; //!< number of Riemann standard level within Lattice::Lev array struct LatticeLevel *LevR0; //!< _R_iemann topmost level (only for RiemannTensor use) int LevR0No; //!< number of Riemann topmost level within Lattice::Lev array struct LatticeLevel *InitLevS; //!< initial _S_tandard LatticeLevel int InitLevSNo; //!< number of initial standard level within Lattice::Lev array struct LatticeLevel *InitLev0; //!< initial topmost (zeroth) level int InitLev0No; //!< number of inital topmost level within Lattice::Lev array double FactorDensityR; //!< one over volume of lattice cell double FactorDensityC; //!< volume of lattice cell int ActualLocalPsiNo; //!< number among local Psis of wave function currently minimised int OldActualLocalPsiNo; //!< number among local Psis of wave function minimised last step int MinStep; //!< holds count of minimisation steps int MaxMinStep; //!< Maximum number of minimisation steps until stop int MaxInitMinStep; //!< initial Maximum number of minimisation steps until stop int ActualMaxMinStep; //!< actual maximum number of minimisation steps until stop: MaxMinStep times MaxPsiStep times MaxMinStepFactor int ScanPotential; //!< prevents CGradient from being calculated more than once (for testing the potential) int ScanAtStep; //!< as RunStruct#ScanPotential is steadily increased, this gives the step where CGradient is no more updated furtheron double ScanDelta; //!< step size for delta within the 0..PI array whilst scanning the potential form int ScanFlag; //!< Indicates whether Scan step is to be made (1) or just for testing (0) int DoBrent; //!< whether line search shall be approximative (0) or numerically exact by a brent algorithm (1) per wave function int UseOldPsi; //!< 1 - old Psis are used, 0 - not int UseAddGramSch; //!< whether additional Gram-Schmidt-Orthogonalization is used int DoCalcCGGauss; //!< whether to calculate the gaussian part in the second derivative of the hartree exchange potential or not int DoUnOccupied; //!< whether unoccupied states shall be minimised in a separate run per level or not int DoFullCurrent; //!< whether in current density \f$\Delta j_k(r')\f$ is always (1), never (0) or when needed (2) calculated and added int DoPerturbation; //!< States whether an external magnetic field is applied and perturbed wave functions, energies and derivated currents shall be calculated 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 int VectorPlane; //!< output current vector plane perpendicular to this axis (0,1,2, -1=don't) double VectorCut; //!< Do the plane cut at this position along the axis defined by RunStruct#VectorPlane int PsiStep; //!< holds count of number of made minimisation steps per state int MaxPsiStep; //!< maximum number of minimisation steps per state (0 - default) int AlphaStep; //!< holds count of how often alpha was recalculated, due to wrong jump prediction in the CG-minimisation of the wave functions enum PsiTypeTag CurrentMin; //!< within which minimisation loop are we right now (only useful in DoSeparated-case) int Seed; //!< initial value for random seed on randomisation of Psi coefficients int WaveNr; //!< wave function number that OutputVis writes to file double Lambda; //!< test factor with no meaning double Diffcount; //!< sums up difference between TE and ATE for measure double Diffsteps; //!< start value of MinStep, when summation began int MinStopStep; //!< counts how often stop condition was checked int MaxMinStopStep; //!< check whether to check if to stop every ..th steps int ActualMaxMinStopStep; //!< actual check whether to check if to stop every ..th steps int InitMaxMinStopStep; //!< initial check whether to check if to stop every ..th steps int MaxMinGapStopStep; //!< check whether to check if to stop gap calcs every ..th steps int ActualMaxMinGapStopStep; //!< actual check whether to check if to stop gap calcs every ..th steps int InitMaxMinGapStopStep; //!< initial check whether to check if to stop gap calcs every ..th steps int MaxOuterStep; //!< maximum number of MolecularDynamics steps int NewRStep; //!< holds count of how often the ions were moved (position R has changed) int MaxMinStepFactor; //!< Additional factor for setting RunStruct::ActualMaxMinStep, see InitRun() double XCEnergyFactor; //!< part of discrete integration width factor in exchange correlation energy calculation, equal to volume of lattice cell double HGcFactor; //!< ..., equal to one over volume of lattice cell double RelEpsTotalEnergy; //!< minimal relative change in total energy double InitRelEpsTotalEnergy; //!< initial relative change in total energy double ActualRelEpsTotalEnergy; //!< actual relative change in total energy double ActualRelTE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in total energy up to RUNMAXOLD-1 double *ActualRelTotalEnergy; //!< points to \a ActualRelTE with respect to current RunStruct#CurrentMin double RelEpsKineticEnergy; //!< minimal relative change in kinetic energy double InitRelEpsKineticEnergy; //!< initial minimal relative change in kinetic energy double ActualRelEpsKineticEnergy; //!< actual minimal relative change in kinetic energy double ActualRelKE[Extra][RUNMAXOLD-1]; //!< current [0] and archived relative change in kinetic energy up to RUNMAXOLD-1 double *ActualRelKineticEnergy; //!< points to \a ActualRelKE with respect to current RunStruct#CurrentMin double TE[Extra][RUNMAXOLD]; //!< current [0] and archived total energy up to RUNMAXOLD double KE[Extra][RUNMAXOLD]; //!< current [0] and archived kinetic energy up to RUNMAXOLD-1 double *TotalEnergy; //!< points to \a TE with respect to current RunStruct#CurrentMin double *KineticEnergy; //!< points to \a KE with respect to current RunStruct#CurrentMin double MeanForce[MAXOLD]; //!< stores old mean force values (see GetOuterStop), [0] is recent one double delta_t; //!< time per MD step double t; //!< Current time int OutVisStep; //!< Output data for OpenDX every ..th step int OutSrcStep; //!< Output data for measurements every ..th step int OuterStep; //!< Current MD/CG/Simplex step in structure optimization double TargetTemp; //!< Target temperature int ScaleTempStep; //!< MD temperature is scaled every ..step double EpsWannier; //!< tolerance value for spread minimisation of orbitals, \sa ComputeMLWF() char **MinimisationName; /*[8]={"Occ", "UnOcc", "P0", "P1", "P2", "RxP0", "RxP1", "RxP2"}; //!< suffixes for SrcPsiFiles */ }; void InitRunLevel(struct Problem *P); void InitRun(struct Problem *P); void CalculateMD(struct Problem *P); void UpdateActualPsiNo(struct Problem *P, enum PsiTypeTag SkipType); void SetCurrentMinState(struct Problem *P, enum PsiTypeTag state); int CalculateMinimumStop(struct Problem *P, int SuperStop); #endif