JDFTx  1.2.0
IonDynamics.h
1 /*-------------------------------------------------------------------
2 Copyright 2011 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_ELECTRONIC_IONDYNAMICS_H
21 #define JDFTX_ELECTRONIC_IONDYNAMICS_H
22 
23 #include <electronic/common.h>
24 #include <electronic/Dump.h>
25 #include <electronic/IonicMinimizer.h>
26 #include <core/vector3.h>
27 #include <core/matrix3.h>
28 #include <vector>
29 
31 {
32 public:
33  void run();
34  IonDynamics(Everything& e) : e(e), totalMass(0.0), numberOfAtoms(0), imin(IonicMinimizer(e)){};
35 private:
36  Everything& e;
37  double initialPotentialEnergy;
38  double kineticEnergy, potentialEnergy;
39  double pressure, totalMomentumNorm;
40  double totalMass; int numberOfAtoms;
41  vector3<double> totalMomentum;
42 
43  IonicMinimizer imin; //Just to be able to call IonicMinimizer::step(). Doesn't minimize anything.
44 
45  // similar to the virtual functions of Minimizable:
46  void step(const IonicGradient&, const double&);
47  double computeAcceleration(IonicGradient& accel);
48  bool report(double t);
49 
50  //Utility functions
51  void velocitiesInit();
52  void computeMomentum();
53  void computePressure();
54  void computeKineticEnergy();
55  void removeNetDrift();
56  void centerOfMassToOrigin();
57 };
58 
59 #endif //JDFTX_ELECTRONIC_IONDYNAMICS_H
Definition: IonDynamics.h:30
void run()
Run the simulation.
Definition: IonicMinimizer.h:52
Definition: Everything.h:41
Object to hold all the forces.
Definition: IonicMinimizer.h:31