Skip to content

Commit 78ddb79

Browse files
authored
Merge pull request #5785 from ye-luo/adjust-ham-factory
Rename bandinfo.dat files + Remove MPIObjectBase::myName/ClassName
2 parents 7243b23 + 5653a8c commit 78ddb79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+121
-217
lines changed

docs/lab_excited.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,12 @@ neutral DFT calculations; therefore, we need to explicitly define the
417417
band and twist indexes of the excitations in QMCPACK (e.g., to define
418418
electron promotion). In C-diamond, we can give an example by finding the
419419
band and twist indexes of :math:`\Gamma` and :math:`\Delta'`. For this
420-
end, a mock VMC calculation can be run and the ``einspline.tile_300010003`` ``.spin_0.tw_0.g0.bandinfo.dat`` file read. The Einspline
421-
file prints out the eigenstates information from DFT calculations.
420+
end, a mock VMC calculation can be run and the ``updet.tile_300010003.spin_0.tw_0.g0.bandinfo.dat`` file read. The bandinfo
421+
file includes the eigenstates information from the underlying DFT calculation.
422422
Therefore, we can obtain the band and the state index from this file,
423423
which can later be used to define the electron promotion. You can see in
424424
the following an explanation of how the band and twist indexes are
425-
defined using a portion of the ``einspline.tile_300010003.spin_0.tw_0.g0.bandinfo.dat`` file. Spin_0 in the file name suggests
425+
defined using a portion of the ``updet.tile_300010003.spin_0.tw_0.g0.bandinfo.dat`` file. Spin_0 in the file name suggests
426426
that we are reading the spin-up eigenstates. Band, state, twistindex,
427427
and bandindex numbers all start from zero. We know we have 72 electrons
428428
in the simulation cell, with 36 of them spin-up polarized. Since the
@@ -594,7 +594,7 @@ Here, the number of up electrons are increased by one (negatively charged system
594594

595595
QE uses symmetry to reduce the number of k-points required for the calculation.
596596
Therefore, all symmetry tags in QE (``nosym``, ``noinv``, and ``nosym_evc``) must be set to false.
597-
An easy way to check whether this is the case is to see that all KmK values ``einspline`` files are equal to 1.
597+
An easy way to check whether this is the case is to see that all KmK values ``bandinfo`` files are equal to 1.
598598
Previously, the input for the neutral cell is given, while the changes are denoted as comments for the positively charged cell.
599599
Note that we have used ``det_format = "old"`` in the ``vmc_+/-e.py`` files.
600600

@@ -638,7 +638,7 @@ After resubmitting the batch job, in the output, you should be able to see the f
638638
We will read 36 distinct orbitals.
639639
There are 0 core states and 36 valence states.
640640

641-
And the ``einspline.tile_300010003.spin_0.tw_0.g0.bandinfo.dat`` file must be changed in the following way:
641+
And the ``updet.tile_300010003.spin_0.tw_0.g0.bandinfo.dat`` file must be changed in the following way:
642642

643643
::
644644

nexus/docs/examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@ k-point grid density in one dimension.
15441544
format. Another option is to use an indexing of the orbitals depending
15451545
on their energetic ordering. In this example this would correspond to
15461546
"excitation = [’up’, ’-11 +12’]". Band/twist index and energy indexes
1547-
of the orbitals can be found in "einspline" files or they can be
1547+
of the orbitals can be found in "bandinfo" files or they can be
15481548
determined after parsing the "nscf.out" file using PwscfAnalyzer.
15491549
In addition to these options, "excitation = ['up','lowest']" can also
15501550
be specified which will execute a homo-lumo excitation based on the

nexus/nexus/qmcpack.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ def post_analyze(self,analyzer):
12261226
if exc_run:
12271227
exc_failure = False
12281228

1229-
edata = self.read_einspline_dat()
1229+
edata = self.read_bandinfo_dat()
12301230
exc_input = self.excitation
12311231

12321232
exc_spin,exc_type,exc_spins,exc_types,exc1,exc2 = check_excitation_type(exc_input)
@@ -1547,10 +1547,10 @@ def write_prep(self):
15471547
#end if
15481548
#end def write_prep
15491549

1550-
def read_einspline_dat(self):
1550+
def read_bandinfo_dat(self):
15511551
edata = obj()
15521552
import glob
1553-
for einpath in glob.glob(self.locdir+'/einsplin*'):
1553+
for einpath in glob.glob(self.locdir+'/*.bandinfo.dat'):
15541554
ftokens = einpath.split('.')
15551555
fspin = int(ftokens[-5][5])
15561556
if fspin==0:
@@ -1573,7 +1573,7 @@ def read_einspline_dat(self):
15731573
#end with
15741574
#end for
15751575
return edata
1576-
#end def read_einspline_dat
1576+
#end def read_bandinfo_dat
15771577
#end class Qmcpack
15781578

15791579

src/Message/Communicate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ struct CommunicatorTraits
5353
#include <vector>
5454
#include <utility>
5555
#include <unistd.h>
56-
#include <cstring>
5756

5857
#include "Message/AppAbort.h"
5958

src/Message/MPIObjectBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515

1616
namespace qmcplusplus
1717
{
18-
MPIObjectBase::MPIObjectBase(Communicate* c) : myComm(c), ClassName("MPIObjectBase") {}
18+
MPIObjectBase::MPIObjectBase(Communicate* c) : myComm(c) {}
1919

2020
} // namespace qmcplusplus

src/Message/MPIObjectBase.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#ifndef QMCPLUSPLUS_MPIOBJECTBASE_H
1919
#define QMCPLUSPLUS_MPIOBJECTBASE_H
20+
2021
#include "Message/Communicate.h"
2122

2223
namespace qmcplusplus
@@ -50,21 +51,11 @@ class MPIObjectBase
5051
*/
5152
inline bool is_manager() const { return !myComm->rank(); }
5253

53-
///return the name
54-
inline const std::string& getName() const { return myName; }
55-
56-
inline void setName(const std::string& aname) { myName = aname; }
57-
5854
protected:
5955
/** pointer to Communicate
6056
* @todo use smart pointer
6157
*/
6258
Communicate* myComm;
63-
/** class Name
64-
*/
65-
std::string ClassName;
66-
/** name of the object */
67-
std::string myName;
6859
};
6960

7061
} // namespace qmcplusplus

src/Particle/ParticleSetPool.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,11 @@ namespace qmcplusplus
3232
{
3333
ParticleSetPool::ParticleSetPool(Communicate* c, const char* aname)
3434
: MPIObjectBase(c), simulation_cell_(std::make_unique<SimulationCell>())
35-
{
36-
ClassName = "ParticleSetPool";
37-
myName = aname;
38-
}
35+
{}
3936

4037
ParticleSetPool::ParticleSetPool(ParticleSetPool&& other) noexcept
4138
: MPIObjectBase(other.myComm), simulation_cell_(std::move(other.simulation_cell_)), myPool(std::move(other.myPool))
42-
{
43-
ClassName = other.ClassName;
44-
myName = other.myName;
45-
}
39+
{}
4640

4741
ParticleSetPool::~ParticleSetPool() = default;
4842

src/QMCDrivers/QMCDriver.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,18 @@ QMCDriver::QMCDriver(const ProjectData& project_data,
5959
checkpoint_timer_(createGlobalTimer("checkpoint::recordBlock", timer_level_medium)),
6060
driver_scope_profiler_(enable_profiling)
6161
{
62-
ResetRandom = false;
63-
AppendRun = false;
64-
DumpConfig = false;
65-
IsQMCDriver = true;
66-
allow_traces = false;
62+
ResetRandom = false;
63+
AppendRun = false;
64+
DumpConfig = false;
65+
IsQMCDriver = true;
66+
allow_traces = false;
6767
allow_walker_logs = false;
6868
walker_logs_xml = NULL;
69-
MyCounter = 0;
69+
MyCounter = 0;
7070
//<parameter name=" "> value </parameter>
7171
//accept multiple names for the same value
7272
//recommend using all lower cases for a new parameter
73-
Period4CheckPoint = 0;
73+
Period4CheckPoint = 0;
7474
Period4CheckProperties = 100;
7575
m_param.add(Period4CheckProperties, "checkProperties");
7676
m_param.add(Period4CheckProperties, "checkproperties");
@@ -398,7 +398,7 @@ bool QMCDriver::putQMCInfo(xmlNodePtr cur)
398398
{
399399
if (!IsQMCDriver)
400400
{
401-
app_log() << getName() << " Skip QMCDriver::putQMCInfo " << std::endl;
401+
app_log() << " Skip QMCDriver::putQMCInfo " << std::endl;
402402
return true;
403403
}
404404

src/QMCHamiltonians/CoulombPotentialFactory.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void HamiltonianFactory::addMPCPotential(xmlNodePtr cur, bool isphysical)
4949
hAttrib.add(cutoff, "cutoff");
5050
hAttrib.add(physical, "physical");
5151
hAttrib.put(cur);
52-
renameProperty(a);
5352
isphysical = (physical == "yes" || physical == "true");
5453

5554
app_summary() << std::endl;
@@ -107,7 +106,6 @@ void HamiltonianFactory::addCoulombPotential(xmlNodePtr cur)
107106
ParticleSet* ptclA = &targetPtcl;
108107
if (sourceInp != targetPtcl.getName())
109108
{
110-
//renameProperty(sourceInp);
111109
auto pit(ptclPool.find(sourceInp));
112110
if (pit == ptclPool.end())
113111
{
@@ -173,7 +171,6 @@ void HamiltonianFactory::addForceHam(xmlNodePtr cur)
173171

174172
bool quantum = (a == targetPtcl.getName());
175173

176-
renameProperty(a);
177174
auto pit(ptclPool.find(a));
178175
if (pit == ptclPool.end())
179176
{
@@ -244,8 +241,6 @@ void HamiltonianFactory::addPseudoPotential(xmlNodePtr cur)
244241
{
245242
APP_ABORT("pseudopotential Table format is not supported.");
246243
}
247-
renameProperty(src);
248-
renameProperty(wfname);
249244
auto pit(ptclPool.find(src));
250245
if (pit == ptclPool.end())
251246
{

src/QMCHamiltonians/HamiltonianFactory.cpp

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ HamiltonianFactory::HamiltonianFactory(const std::string& hName,
6565
psiName("psi0")
6666
{
6767
//PBCType is zero or 1 but should be generalized
68-
PBCType = targetPtcl.getLattice().SuperCellEnum;
69-
ClassName = "HamiltonianFactory";
70-
myName = hName;
68+
PBCType = targetPtcl.getLattice().SuperCellEnum;
7169
targetPtcl.set_quantum();
7270
}
7371

@@ -92,7 +90,7 @@ bool HamiltonianFactory::build(xmlNodePtr cur)
9290
app_summary() << std::endl;
9391
app_summary() << " Hamiltonian and observables" << std::endl;
9492
app_summary() << " ---------------------------" << std::endl;
95-
app_summary() << " Name: " << myName << std::endl;
93+
app_summary() << " Name: " << targetH->getName() << std::endl;
9694
app_summary() << std::endl;
9795

9896
std::string htype("generic"), source("i"), defaultKE("yes");
@@ -101,7 +99,6 @@ bool HamiltonianFactory::build(xmlNodePtr cur)
10199
hAttrib.add(source, "source");
102100
hAttrib.add(defaultKE, "default");
103101
hAttrib.put(cur);
104-
renameProperty(source);
105102
auto psi_it(psiPool.find(psiName));
106103
if (psi_it == psiPool.end())
107104
APP_ABORT("Unknown psi \"" + psiName + "\" for target Psi");
@@ -136,8 +133,6 @@ bool HamiltonianFactory::build(xmlNodePtr cur)
136133
attrib.add(potUnit, "units");
137134
attrib.add(estType, "potential");
138135
attrib.put(element);
139-
renameProperty(sourceInp);
140-
renameProperty(targetInp);
141136

142137
int nham = targetH->total_size();
143138
if (cname == "pairpot")
@@ -394,18 +389,6 @@ bool HamiltonianFactory::build(xmlNodePtr cur)
394389
return true;
395390
}
396391

397-
398-
void HamiltonianFactory::renameProperty(const std::string& a, const std::string& b) { RenamedProperty[a] = b; }
399-
400-
void HamiltonianFactory::renameProperty(std::string& aname)
401-
{
402-
std::map<std::string, std::string>::iterator it(RenamedProperty.find(aname));
403-
if (it != RenamedProperty.end())
404-
{
405-
aname = (*it).second;
406-
}
407-
}
408-
409392
bool HamiltonianFactory::put(xmlNodePtr cur)
410393
{
411394
bool success = build(cur);

0 commit comments

Comments
 (0)