source: pcp/src/ions.h@ b74e5e

Last change on this file since b74e5e was b74e5e, checked in by Frederik Heber <heber@…>, 17 years ago

InitThermostats() added and included in IonsInitRead()

  • Property mode set to 100644
File size: 6.7 KB
Line 
1#ifndef ions_h
2#define ions_h
3
4/** \file ions.h
5 * Header file for \ref ions.c
6 *
7 * Contains declarations of the functions implemented in \ref ions.c,
8 * enumerations such CoreCorrType - whether the config file has values for the
9 * core electron density - or IonMoveType - is the ion allowed to move or not -
10 * and structures for IonType, containg all Ions of a atomic type, which are all
11 * attached to Ions.
12 *
13 Project: ParallelCarParrinello
14 Jan Hamaekers
15 2000
16
17 File: ions.h
18 $Id: ions.h,v 1.19 2007/02/09 09:13:48 foo Exp $
19*/
20
21
22// use double precision fft when available
23#ifdef HAVE_CONFIG_H
24#include <config.h>
25#endif
26
27#ifdef HAVE_DFFTW_H
28#include "dfftw.h"
29#else
30#include "fftw.h"
31#endif
32
33enum CoreCorrType { NotCoreCorrected, CoreCorrected}; //!< Pseudopotential: Whether there is a correction factor for the potential ansatz or not
34#define MaxIonMoveType 2 //!< Number of different IonMoveType
35enum IonMoveType { MoveIon, FixedIon}; //!< Whether the Ion is movable or not (influences kinetic energy among others)
36
37#define MaxThermostats 6 //!< maximum number of thermostat entries in Ions#ThermostatNames and Ions#ThermostatImplemented
38enum thermostats { None, Woodcock, Gaussian, Langevin, Berendsen, NoseHoover }; //!< Thermostat names for output
39
40/** Structure containing coordinate and velocity of one ion for a single MD step.
41 * This is an item in a forward-referenced list, such that at each step the current
42 * constrained can be extracted and the item subsequently removed from the list.
43 */
44struct IonConstrained {
45 int step; //!< constrained motion for MD step ...
46 double *R; //!< ion coordinates (null if not specified)
47 double *U; //!< ion velocity (null if not specified)
48 enum IonMoveType IMT; //!< Ion MoveType for this step
49 struct IonConstrained *next; //!< pointer to next item in forward-referenced list
50};
51
52/** Structure containing data for a single ion type.
53 * Contains Mass, atomic number, number of types, coordinates (current and the
54 * last two old positions), forces (and last one), velocity, some Pseudopotential
55 * values
56 */
57struct IonType { /* A single Ion */
58 int Z; //!< Atomic number of ion
59 double IonMass; //!< Mass of ion
60 int Max_IonsOfType; //!< Maximum number of ions of this type (needed for memory allocation)
61 double *R; //!< coordinate (x,y,z) array for all ions of this type R[i][j] (i=x,y,z;j=1,..)
62 double *R_old; //!< Remembers last position (two-dim array, see IonType::R)
63 double *R_old_old; //!< Remembers position before the last one (two-dim array, see IonType::R)
64 struct IonConstrained **Constraints; //!< pointer to each Ion of this IonType with a pointer to the current start item of a list of constrained values
65 double *FIon; //!< Overall force acting on the ion (two-dim array, see IonType::R)
66 double *FIonL; //!< Linear force acting on the ion (two-dim array, see IonType::R)
67 double *FIonNL; //!< Nonlinear force acting on the ion (two-dim array, see IonType::R)
68 double *FEwald; //!< Ewald force (two-dim array, see IonType::R)
69 double *FMagnetic; //!< Magnetic force acting on the ion (two-dim array, see IonType::R)
70 double *FConstraint;//!< Constraint force acting on the ion, needed for Thermostat() (two-dim array, see IonType::R)
71 double *U; //!< Velocity of the ion (two-dim array, see IonType::R)
72 double *FIon_old; //!< Remembers prior force acting on the ion (two-dim array, see IonType::R)
73 double IonFac; //!< mass-like factor in CG structure optimization to determinte step width
74 double *GammaA; //!<
75 double *SearchDir; //!<
76 double rgauss; //!< Gauss radius
77 double *alpha; //!< parameter for CSDGT gauge, see ShiftGaugeOrigin()
78 int l_max; //!< (?) Pseudopotential specific value
79 int l_loc; //!< (?) Pseudopotential specific value
80 double ZFactor; //!< (?) CalcVIFactor
81 fftw_complex *SFactor; //!< structure factor, \f$S_{I_s} (G) \f$, thereby the centre of a potential is shifted away from the origin
82 enum CoreCorrType corecorr; //!< (?) Core correction due to pseudo potential ansatz
83 enum IonMoveType *IMT; //!< Ion is moving or fixed
84 char *Name; //!< name of ion's element
85 char *Symbol; //!< short form of ion's element
86 double **moment; //!< magnetic moment
87 double **sigma; //!< shielding tensor
88 double **sigma_rezi; //!< shielding tensor for reciprocal calculation
89 double **sigma_PAS; //!< Principal Axis System shielding tensor
90 double **sigma_rezi_PAS; //!< Principal Axis System shielding tensor for reciprocal calculation
91 double chi[NDIM*NDIM]; //!< magnetic susceptibility
92 double chi_PAS[NDIM]; //!< Principal Axis System magnetic susceptibility
93};
94
95/** Containing structure for all ion data.
96 * Contains max types, counts, cut values, temperature and total mass among others
97 */
98struct Ions { /* All Ions */
99 int Max_Types; //!< Number of types overall (needed for memory allocation)
100 int Max_TotalIons; //!< Maximum of of total ions (needed for memory allocation)
101 int Max_Max_IonsOfType; //!< Maximum of ions per type (needed for memory allocation)
102 int TotalZval;
103 struct IonType *I; //!< Structure containing data for each type
104 /* Ewald */
105 double R_cut; //!< Radial cut value
106 int MaxVec;
107 int MaxLocalVec;
108 double *RLatticeVec;
109 double *FTemp; //!< Array for temporary force
110 double EKin; //!< Kinetic energy of electrons
111 double ActualTemp; //!< Actual temperature
112 double TotalMass; //!< Total mass of all ions in the structure
113 int StructOpt; //!< whether structure optimization (1) (with CG) or MD (0) shall be done
114 int IsAngstroem; //!< 1 - lengths in config file in angstroem, 0 - lengths in atomic units
115 enum thermostats Thermostat; //!< 0 - none, 1 - Woodcock, 2 - Gaussian, 3 - Langevin, 4 - Berendsen, 5 - Nose-Hoover
116 char **ThermostatNames;
117 int *ThermostatImplemented;
118};
119
120
121/* Functions */
122void IonsInitRead(struct Problem *P, FILE *source);
123void InitThermostats(struct Problem *P, FILE *source);
124void CalculateEwald(struct Problem *P, int first);
125void RemoveIonsRead(struct Ions *I);
126/*void CalculateIonLocalForce(struct Problem *P);*/
127void CalculateIonForce(struct Problem *P);
128void OutputIonForce(struct Problem *P);
129void ParseIonForce(struct Problem *P);
130void OutputIonCoordinates(struct Problem *P);
131void UpdateIons(struct Problem *P);
132void UpdateIonsR(struct Problem *P);
133void UpdateIonsU(struct Problem *P);
134void CalculateEnergyIonsU(struct Problem *P);
135void ScaleTemp(struct Problem *P);
136void GetOuterStop(struct Problem *P);
137void CorrectForces(struct Problem *P);
138void ResetForces(struct Problem *P);
139void CorrectVelocity(struct Problem *P);
140struct IonConstrained * AddConstraintItem(struct IonType *I, int ion);
141int RemoveConstraintItem(struct IonType *I, int ion);
142#endif
Note: See TracBrowser for help on using the repository browser.