Skip to content

Commit cce45b9

Browse files
siuwuncheungjeanlucf22dreamer2368
authored
Merge release (#354)
* Fix EnergyAndForces tests (#277) * have them work in debug mode too * Move factor 4pi out og linear solvers (#278) * Move some code into PoissonSolverFactory (#279) * Clean up class Potentials (#280) * Clean up class Ions, add test for it (#281) * Add test MD_MVP (#290) * Clean up code related to DM restart data (#292) * Write dm (#291) * Update use of DM in restart * Remove unused function in Control (#294) * Change symlink to restart in tests (#295) * enable tests when old link present * Extract number empty orbitals from restart file (#296) * Clean up MD_IonicStepper restart data write (#297) * Clean up code based on compiler warnings (#299) * Add getForces for evaluateDMandEnergyAndForces (#300) * Add check for compatibility MVP/Mehrstellen (#301) * Add support for Br atom (#302) * Clean up some HDFrestart functions (#303) * Fix and test restart single hdf5 file (#305) * Save Hartree potential for write in restart file (#306) * Speed-up recently added tests (#309) * simply use a smaller domain/mesh * Encapsulate some functions in Potentials (#310) * some functions were called at random places and confusing * Remove confusing 0 in naming restart files (#308) * use added integer only in case of fail/retry * Add functionalities for extra info in restart file (#312) * MPI abort (#313) * Fix error code used by MPI_Abort * Rho and VH restart (#311) * enable restart with consistent rho and VHartree --------- Co-authored-by: Seung Whan Chung <seung.chung@austin.utexas.edu> * Strenghten testIons (#315) * More clean up in class Potentials (#316) * remove some unused functions * make use of class MGmol_MPI * change some function names for clarity * fix some minor bug in iterative indexes * Misc code fixes (#317) * exposed by porting on new environment * Use unique restart filenames in test HDF5single (#318) * Swap ions in existing test (#319) * strengthen testing by swapping ions in testRestartEnergyAndForces * Code clean up (#320) * use more const * use initNuc() instead of moveVnuc() * remove incorrect assert * use MGmol_MPI in more cases * setup g_kbpsi_ inside initNuc() * rename initNuc() into setupPotentials() * Added functionalities to set local forces (#321) * Update mixed precision code (#322) * enable cmake build with mixed precision * enable use of BLIS * isolate blas3 loop rewrite in separate files * fix misc issues with mixed precision code * Clean up and fixes Ions (#326) * reset static index counter ion Ion when needed * simplify some loops * make Ions copy constructor private * Fixes for build without HDF5P (#324) * Fix testRhoVhRestart (#325) * Fix a few more issues with class Ions (#328) * Introduce new constructor for class Ions (#330) * modify various functions to use argument of type Ions instead of MGmol::ions_ * Add cleanup and MGmolInterface (#331) * Add function to set local forces (#333) * based on matching coordinates to local ions * Fix setLocalForces (#335) * Fix test WFEnergyAndForces (#336) * writing restart twice in same directory was failing * Add mixing option in MVP (#337) * Update MVP with mixing (#339) * use tolerance to terminate iterations * tune verbosity * Update DensityMatrix class (#342) * add extrapolation function * remove unused function * simplify use of iterative index * Fixing DM tolerance (#341) * Fix Density Matrix tolerance read --------- Co-authored-by: Jean-Luc Fattebert <fattebertj@ornl.gov> * Rm oversubscribe from CMakeLists.txt (#346) * already set in build script * Adapt to new environment on condo @ ORNL (#348) * Remove unused function * Clean up use of coords file when restarting * use coordinates file to override atomic coordinates when using restart wavefunctions * Add test restart with override atomic coordinates * Add some missing include files * required for gcc12 * Print MVP timers --------- Co-authored-by: Jean-Luc Fattebert <fattebertj@ornl.gov> Co-authored-by: Seung Whan Chung <seung.chung@austin.utexas.edu>
1 parent 81ab133 commit cce45b9

23 files changed

Lines changed: 234 additions & 128 deletions

src/Control.cc

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Control::Control()
112112
out_restart_file_type = -1;
113113
spread_radius = -1.;
114114
iprint_residual = -1;
115-
override_restart = -1;
116115
dot_product_type = -1;
117116
spread_penalty_damping_ = -1;
118117
spread_penalty_alpha_ = -1;
@@ -386,7 +385,7 @@ void Control::sync(void)
386385
short_buffer[47] = out_restart_file_naming_strategy;
387386
short_buffer[48] = enforceVmass0;
388387
short_buffer[49] = dm_inner_steps;
389-
short_buffer[50] = override_restart;
388+
short_buffer[50] = -1;
390389
short_buffer[51] = fgmres_kim;
391390
short_buffer[52] = fgmres_maxits;
392391
short_buffer[53] = ilu_type;
@@ -599,41 +598,41 @@ void Control::sync(void)
599598
out_restart_file_naming_strategy = short_buffer[47];
600599
enforceVmass0 = short_buffer[48];
601600
dm_inner_steps = short_buffer[49];
602-
override_restart = short_buffer[50];
603-
fgmres_kim = short_buffer[51];
604-
fgmres_maxits = short_buffer[52];
605-
ilu_type = short_buffer[53];
606-
ilu_lof = short_buffer[54];
607-
ilu_maxfil = short_buffer[55];
608-
coloring_algo_ = short_buffer[56];
609-
diel_flag_ = short_buffer[57];
610-
poisson_pc_nu1 = short_buffer[58];
611-
poisson_pc_nu2 = short_buffer[59];
612-
poisson_pc_nlev = short_buffer[60];
613-
system_charge_ = short_buffer[61];
614-
md_print_freq = short_buffer[62];
615-
use_kernel_functions = short_buffer[63];
616-
ngpts_[0] = short_buffer[64];
617-
ngpts_[1] = short_buffer[65];
618-
ngpts_[2] = short_buffer[66];
619-
computeCondGram_ = short_buffer[67];
620-
lrs_extrapolation = short_buffer[68];
621-
parallel_transport = (bool)short_buffer[69];
622-
with_spin_ = (bool)short_buffer[70];
623-
conv_criterion_ = short_buffer[71];
624-
load_balancing_max_iterations = short_buffer[72];
625-
load_balancing_modulo = short_buffer[73];
626-
write_clusters = short_buffer[74];
627-
DM_solver_ = short_buffer[75];
628-
dm_algo_ = short_buffer[80];
629-
dm_approx_order = short_buffer[81];
630-
dm_approx_ndigits = short_buffer[82];
631-
dm_approx_power_maxits = short_buffer[83];
632-
spread_penalty_type_ = short_buffer[84];
633-
dm_use_old_ = short_buffer[85];
634-
max_electronic_steps_tight_ = short_buffer[86];
635-
hartree_reset_ = short_buffer[88];
636-
MD_last_step_ = short_buffer[89];
601+
//... = short_buffer[50];
602+
fgmres_kim = short_buffer[51];
603+
fgmres_maxits = short_buffer[52];
604+
ilu_type = short_buffer[53];
605+
ilu_lof = short_buffer[54];
606+
ilu_maxfil = short_buffer[55];
607+
coloring_algo_ = short_buffer[56];
608+
diel_flag_ = short_buffer[57];
609+
poisson_pc_nu1 = short_buffer[58];
610+
poisson_pc_nu2 = short_buffer[59];
611+
poisson_pc_nlev = short_buffer[60];
612+
system_charge_ = short_buffer[61];
613+
md_print_freq = short_buffer[62];
614+
use_kernel_functions = short_buffer[63];
615+
ngpts_[0] = short_buffer[64];
616+
ngpts_[1] = short_buffer[65];
617+
ngpts_[2] = short_buffer[66];
618+
computeCondGram_ = short_buffer[67];
619+
lrs_extrapolation = short_buffer[68];
620+
parallel_transport = (bool)short_buffer[69];
621+
with_spin_ = (bool)short_buffer[70];
622+
conv_criterion_ = short_buffer[71];
623+
load_balancing_max_iterations = short_buffer[72];
624+
load_balancing_modulo = short_buffer[73];
625+
write_clusters = short_buffer[74];
626+
DM_solver_ = short_buffer[75];
627+
dm_algo_ = short_buffer[80];
628+
dm_approx_order = short_buffer[81];
629+
dm_approx_ndigits = short_buffer[82];
630+
dm_approx_power_maxits = short_buffer[83];
631+
spread_penalty_type_ = short_buffer[84];
632+
dm_use_old_ = short_buffer[85];
633+
max_electronic_steps_tight_ = short_buffer[86];
634+
hartree_reset_ = short_buffer[88];
635+
MD_last_step_ = short_buffer[89];
637636
poisson_lap_type_ = static_cast<PoissonFDtype>(short_buffer[90]);
638637

639638
numst = int_buffer[0];
@@ -1787,7 +1786,6 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
17871786
// options not available in configure file
17881787
lr_updates_type = 0;
17891788
precond_factor_computed = false;
1790-
override_restart = 0;
17911789
mix_pot = 1.;
17921790
project_out_psd = 0;
17931791
multipole_order = 1;

src/Control.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,6 @@ class Control
562562
short out_restart_file_naming_strategy;
563563
short restart_file_type;
564564
short out_restart_file_type;
565-
short override_restart;
566565

567566
short verbose;
568567

src/DensityMatrix.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@
2222

2323
const double factor_kernel4dot = 10.;
2424

25-
#define MGMOL_DENSITYMATRIX_FAIL(X) \
26-
{ \
27-
std::cerr << "DensityMatrix failure:" << std::endl; \
28-
std::cerr << "Error Message: " << X << std::endl; \
29-
}
30-
3125
#define MGMOL_DENSITYMATRIX_FAIL(X) \
3226
{ \
3327
std::cerr << "DensityMatrix failure:" << std::endl; \

src/MGmol.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "MGmol.h"
4646
#include "MLWFTransform.h"
4747
#include "MPIdata.h"
48+
#include "MVPSolver.h"
4849
#include "MasksSet.h"
4950
#include "Mesh.h"
5051
#include "OrbitalsPreconditioning.h"
@@ -901,6 +902,9 @@ void MGmol<OrbitalsType>::printTimers()
901902
AndersonMix<OrbitalsType>::update_tm().print(os_);
902903
proj_matrices_->printTimers(os_);
903904
ShortSightedInverse::printTimers(os_);
905+
if (std::is_same<OrbitalsType, ExtendedGridOrbitals>::value)
906+
MVPSolver<ExtendedGridOrbitals,
907+
dist_matrix::DistMatrix<DISTMATDTYPE>>::printTimers(os_);
904908
VariableSizeMatrixInterface::printTimers(os_);
905909
DataDistribution::printTimers(os_);
906910
PackedCommunicationBuffer::printTimers(os_);

src/MGmol.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ class MGmol : public MGmolInterface
229229

230230
void printEigAndOcc();
231231

232-
int readCoordinates(std::ifstream* tfile, const bool cell_relative);
233232
int readCoordinates(const std::string& filename, const bool cell_relative);
234233
double computeConstraintResidual(OrbitalsType& orbitals,
235234
const OrbitalsType& hphi, OrbitalsType& res, const bool print_residual,

src/MVPSolver.cc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,8 @@ int MVPSolver<OrbitalsType, MatrixType>::solve(OrbitalsType& orbitals)
398398
template <class OrbitalsType, class MatrixType>
399399
void MVPSolver<OrbitalsType, MatrixType>::printTimers(std::ostream& os)
400400
{
401-
if (onpe0)
402-
{
403-
os << std::setprecision(2) << std::fixed << std::endl;
404-
solve_tm_.print(os);
405-
target_tm_.print(os);
406-
}
401+
solve_tm_.print(os);
402+
target_tm_.print(os);
407403
}
408404

409405
template class MVPSolver<LocGridOrbitals,

src/MVPSolver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
class Ions;
1818
class Electrostatic;
19-
class ProjectedMatrices2N;
2019
template <class OrbitalsType>
2120
class ProjectedMatrices;
2221

@@ -67,7 +66,7 @@ class MVPSolver
6766
~MVPSolver();
6867

6968
int solve(OrbitalsType& orbitals);
70-
void printTimers(std::ostream& os);
69+
static void printTimers(std::ostream& os);
7170
};
7271

7372
#endif

src/main.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char** argv)
5858
/*
5959
* read runtime parameters
6060
*/
61-
std::string input_filename("");
61+
std::string coords_filename("");
6262
std::string lrs_filename;
6363
std::string constraints_filename("");
6464

@@ -70,7 +70,7 @@ int main(int argc, char** argv)
7070
// read from PE0 only
7171
if (MPIdata::onpe0)
7272
{
73-
read_config(argc, argv, vm, input_filename, lrs_filename,
73+
read_config(argc, argv, vm, coords_filename, lrs_filename,
7474
constraints_filename, total_spin, with_spin);
7575
}
7676

@@ -89,18 +89,18 @@ int main(int argc, char** argv)
8989
int ret = ct.checkOptions();
9090
if (ret < 0) return ret;
9191

92-
mmpi.bcastGlobal(input_filename);
92+
mmpi.bcastGlobal(coords_filename);
9393
mmpi.bcastGlobal(lrs_filename);
9494

9595
// Enter main scope
9696
{
9797
MGmolInterface* mgmol;
9898
if (ct.isLocMode())
9999
mgmol = new MGmol<LocGridOrbitals>(global_comm, *MPIdata::sout,
100-
input_filename, lrs_filename, constraints_filename);
100+
coords_filename, lrs_filename, constraints_filename);
101101
else
102102
mgmol = new MGmol<ExtendedGridOrbitals>(global_comm, *MPIdata::sout,
103-
input_filename, lrs_filename, constraints_filename);
103+
coords_filename, lrs_filename, constraints_filename);
104104

105105
mgmol->setup();
106106

src/md.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ void MGmol<OrbitalsType>::md(OrbitalsType** orbitals, Ions& ions)
340340

341341
constraints_->printConstraints(os_);
342342

343-
if (ct.restart_info > 0 && !ct.override_restart)
343+
if (ct.restart_info > 0)
344344
{
345345
if (onpe0) os_ << "Use restart file to initialize MD..." << std::endl;
346346
stepper->init(*h5f_file_);

src/readInput.cc

Lines changed: 9 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ int MGmol<OrbitalsType>::readLRsFromInput(std::ifstream* tfile)
164164

165165
template <class OrbitalsType>
166166
int MGmol<OrbitalsType>::readCoordinates(
167-
std::ifstream* tfile, const bool cell_relative)
167+
const std::string& coords_filename, const bool cell_relative)
168168
{
169169
Control& ct = *(Control::instance());
170170
if (ct.verbose > 0) printWithTimeStamp("Read atomic coordinates...", os_);
@@ -177,71 +177,26 @@ int MGmol<OrbitalsType>::readCoordinates(
177177
const std::vector<Species>& sp(ct.getSpecies());
178178
ions_.reset(new Ions(lattice, sp));
179179

180-
if (ct.restart_info > 0
181-
&& ct.override_restart == 0) // read restart ionic positions
180+
if (ct.restart_info > 0 && coords_filename.empty())
182181
{
183-
if (ct.restart_info > 0)
184-
{
185-
if (onpe0 && ct.verbose > 0)
186-
{
187-
os_ << "Initialize ionic positions from restart file "
188-
<< ct.restart_file << std::endl;
189-
}
190-
ions_->initFromRestartFile(*h5f_file_);
191-
}
192-
}
193-
else
194-
{
195-
// Coordinates and species type for each ion.
196-
int info = ions_->readAtoms(tfile, cell_relative);
197-
198-
return info;
199-
}
200-
201-
const int num_ions = ions_->getNumIons();
202-
if (onpe0) os_ << num_ions << " ions in simulation" << std::endl;
203-
204-
return 0;
205-
}
206-
207-
template <class OrbitalsType>
208-
int MGmol<OrbitalsType>::readCoordinates(
209-
const std::string& filename, const bool cell_relative)
210-
{
211-
Control& ct = *(Control::instance());
212-
if (ct.verbose > 0) printWithTimeStamp("Read atomic coordinates...", os_);
213-
Mesh* mymesh = Mesh::instance();
214-
const pb::Grid& mygrid = mymesh->grid();
215-
216-
const double lattice[3] = { mygrid.ll(0), mygrid.ll(1), mygrid.ll(2) };
217-
218-
// setup ions
219-
const std::vector<Species>& sp(ct.getSpecies());
220-
ions_.reset(new Ions(lattice, sp));
221-
222-
if (ct.restart_info > 0
223-
&& ct.override_restart == 0) // read restart ionic positions
224-
{
225-
if (ct.restart_info > 0)
182+
// read restart atomic positions
183+
if (onpe0 && ct.verbose > 0)
226184
{
227-
if (onpe0 && ct.verbose > 0)
228-
{
229-
os_ << "Initialize ionic positions from restart file "
230-
<< ct.restart_file << std::endl;
231-
}
232-
ions_->initFromRestartFile(*h5f_file_);
185+
os_ << "Initialize atomic positions from restart file "
186+
<< ct.restart_file << std::endl;
233187
}
188+
ions_->initFromRestartFile(*h5f_file_);
234189
}
235190
else
236191
{
237192
// Coordinates and species type for each ion.
238-
int info = ions_->readAtoms(filename, cell_relative);
193+
int info = ions_->readAtoms(coords_filename, cell_relative);
239194

240195
return info;
241196
}
242197

243198
const int num_ions = ions_->getNumIons();
244-
if (onpe0) os_ << num_ions << " ions in simulation" << std::endl;
199+
if (onpe0) os_ << num_ions << " atoms in simulation" << std::endl;
245200

246201
return 0;
247202
}

0 commit comments

Comments
 (0)