QMCPACK
NLPPClass.h
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2016 Jeongnim Kim and QMCPACK developers.
6 //
7 // File developed by: Paul R. C. Kent, kentpr@ornl.gov, Oak Ridge National Laboratory
8 // Ye Luo, yeluo@anl.gov, Argonne National Laboratory
9 // Mark A. Berrill, berrillma@ornl.gov, Oak Ridge National Laboratory
10 //
11 // File created by: Paul R. C. Kent, kentpr@ornl.gov, Oak Ridge National Laboratory
12 //////////////////////////////////////////////////////////////////////////////////////
13 
14 
15 #ifndef PSEUDO_CLASS_H
16 #define PSEUDO_CLASS_H
17 
18 #include <map>
19 #include <string>
20 #include <vector>
21 #include "CubicSpline.h"
22 #include "XMLWriterClass2.h"
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26 #include "common/PotentialBase.h"
27 
28 struct State
29 {
30  int n, l;
31  double occ;
32  State(int n_, int l_, double occ_) : n(n_), l(l_), occ(occ_) {}
33  State(std::string s);
34 };
35 
36 class Config
37 {
38  std::vector<State> States;
39  std::map<char, int> ChannelRevMap;
40 
41 public:
42  inline const State& operator[](int i) { return States[i]; }
43 
44  size_t size() { return States.size(); }
45 
46  Config() {}
47  Config(std::string s);
48 };
49 
50 
52 {
53 public:
54  int l, n_principal;
55  // Vl is stored in hartrees
60  double FindCutoff();
61  void WriteChannelLog(XMLWriterClass& writer, bool writeVl);
62  void WriteChannelLinear(XMLWriterClass& writer, double dr, double rmax, bool writeVl);
64  {
65  HasProjector = false;
66  Occupation = 0.0;
67  Eigenvalue = 0.0;
68  }
69 };
70 
71 typedef enum
72 {
78 } XCType;
79 
81 {
82 private:
83  std::map<std::string, double> UnitToHartreeMap;
84  std::map<std::string, double> UnitToBohrMap;
85  std::map<XCType, std::string> XCMap;
86  std::map<std::string, XCType> XCRevMap;
87  std::map<int, std::string> ChannelMap;
88  std::map<std::string, int> ChannelRevMap;
89  std::map<int, std::string> ZToSymbolMap;
90  std::map<int, double> ZToMassMap;
91  std::map<std::string, int> SymbolToZMap;
92  void SetupMaps();
93 
94  std::vector<ChannelPotentialClass> ChannelPotentials;
98  std::string EnergyUnit, LengthUnit;
99  // The grid is stored in bohr
104  void Write4Block(FILE* fout, std::vector<double>& data, int indent = 2);
105  bool GetNextState(std::string& state, int& n, int& l, double& occ);
106  //
107  const double grid_delta;
108  double DensityMix;
109 
110 public:
112 
113  int GetNumChannels();
114  bool HaveProjectors();
115  bool ReadBFD_PP(std::string fileName);
116  bool ReadCASINO_PP(std::string fileName);
117  bool ReadCASINO_WF(std::string fileName, int l);
118  bool ReadFHI_PP(std::string fileName);
119  bool ReadGAMESS_PP(std::string fileName);
120  bool ReadUPF_PP(std::string fileName);
121  void WriteXML(std::string fileName);
122  void WriteABINIT(std::string fileName = "");
123  void WriteUPF(std::string fileName);
124  void WriteASCII();
125  void WriteFHI(std::string filename);
126  void WriteFPMD(std::string filename);
127  void WriteCASINO(std::string filename);
128  void WriteHDF5(std::string filename);
129  void CalcProjector(std::string refstate, int lchannel);
130  double V(double r) override;
131  double V(int l, double r) override;
132  double dVdr(double r) override;
133  double dVdr(int l, double r) override;
134  double d2Vdr2(double r) override;
135  double d2Vdr2(int l, double r) override;
136  void Write(IOSectionClass& out) override;
137  void Read(IOSectionClass& in) override;
138 
139  void SetDensityMix(double mix) { DensityMix = mix; }
140 
141  void SetLocalChannel(int local) { LocalChannel = local; }
142 
144  : XC(XC_NONE), Relativistic(false), LocalChannel(-1), grid_delta(0.001), DensityMix(0.75), WriteLogGrid(false)
145  {
146  SetupMaps();
147  }
148 };
149 
150 #endif
SimpleGrid PotentialGrid
Definition: NLPPClass.h:100
void SetupMaps()
bool ReadUPF_PP(std::string fileName)
std::map< int, std::string > ChannelMap
Definition: NLPPClass.h:87
State(int n_, int l_, double occ_)
Definition: NLPPClass.h:32
The CubSpline class is a third-order spline representation of a function.
Definition: CubicSpline.h:26
void WriteFHI(std::string filename)
bool ReadGAMESS_PP(std::string fileName)
bool ReadFHI_PP(std::string fileName)
double dVdr(double r) override
Config()
Definition: NLPPClass.h:46
void Read(IOSectionClass &in) override
void WriteXML(std::string fileName)
double TotalEnergy
Definition: NLPPClass.h:97
bool WriteLogGrid
Definition: NLPPClass.h:111
bool ReadBFD_PP(std::string fileName)
bool HaveProjectors()
void SetLocalChannel(int local)
Definition: NLPPClass.h:141
size_t size()
Definition: NLPPClass.h:44
std::map< std::string, double > UnitToHartreeMap
Definition: NLPPClass.h:83
std::map< std::string, XCType > XCRevMap
Definition: NLPPClass.h:86
void WriteFPMD(std::string filename)
void Write4Block(FILE *fout, std::vector< double > &data, int indent=2)
std::vector< State > States
Definition: NLPPClass.h:38
double occ
Definition: NLPPClass.h:31
std::string EnergyUnit
Definition: NLPPClass.h:98
void WriteABINIT(std::string fileName="")
void CalcProjector(std::string refstate, int lchannel)
std::string LengthUnit
Definition: NLPPClass.h:98
std::map< char, int > ChannelRevMap
Definition: NLPPClass.h:39
double V(double r) override
void SetDensityMix(double mix)
Definition: NLPPClass.h:139
const double grid_delta
Definition: NLPPClass.h:107
void WriteChannelLinear(XMLWriterClass &writer, double dr, double rmax, bool writeVl)
std::map< std::string, double > UnitToBohrMap
Definition: NLPPClass.h:84
void Write(IOSectionClass &out) override
std::map< int, std::string > ZToSymbolMap
Definition: NLPPClass.h:89
int GetNumChannels()
std::vector< ChannelPotentialClass > ChannelPotentials
Definition: NLPPClass.h:94
bool Relativistic
Definition: NLPPClass.h:102
CubSpline RhoAtom
Definition: NLPPClass.h:95
std::map< int, double > ZToMassMap
Definition: NLPPClass.h:90
const State & operator[](int i)
Definition: NLPPClass.h:42
bool GetNextState(std::string &state, int &n, int &l, double &occ)
int l
Definition: NLPPClass.h:30
void WriteUPF(std::string fileName)
Wrapper class for IOTreeClass that gives a nearly identical interface as the OutputSectionClass.
Definition: IO.h:110
int LocalChannel
Definition: NLPPClass.h:103
bool ReadCASINO_WF(std::string fileName, int l)
std::map< XCType, std::string > XCMap
Definition: NLPPClass.h:85
double d2Vdr2(double r) override
std::map< std::string, int > SymbolToZMap
Definition: NLPPClass.h:91
XCType XC
Definition: NLPPClass.h:101
std::map< std::string, int > ChannelRevMap
Definition: NLPPClass.h:88
void WriteChannelLog(XMLWriterClass &writer, bool writeVl)
void WriteASCII()
double PseudoCharge
Definition: NLPPClass.h:97
void WriteHDF5(std::string filename)
double DensityMix
Definition: NLPPClass.h:108
void WriteCASINO(std::string filename)
int n
Definition: NLPPClass.h:30
int AtomicNumber
Definition: NLPPClass.h:96
XCType
Definition: NLPPClass.h:71
bool ReadCASINO_PP(std::string fileName)