Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
1ad1292
Fix EnergyAndForces tests (#277)
jeanlucf22 Sep 26, 2024
8ac6cd6
Move factor 4pi out og linear solvers (#278)
jeanlucf22 Sep 30, 2024
a2ece1a
Move some code into PoissonSolverFactory (#279)
jeanlucf22 Sep 30, 2024
8b577ea
Clean up class Potentials (#280)
jeanlucf22 Oct 3, 2024
7ac691c
Clean up class Ions, add test for it (#281)
jeanlucf22 Oct 12, 2024
c05ba7f
Add test MD_MVP (#290)
jeanlucf22 Nov 25, 2024
bb8051d
Clean up code related to DM restart data (#292)
jeanlucf22 Dec 2, 2024
a227c04
Write dm (#291)
jeanlucf22 Dec 2, 2024
b263532
Remove unused function in Control (#294)
jeanlucf22 Dec 23, 2024
3eb52d6
Change symlink to restart in tests (#295)
jeanlucf22 Jan 3, 2025
c1d46bc
Extract number empty orbitals from restart file (#296)
jeanlucf22 Jan 7, 2025
eb53963
Clean up MD_IonicStepper restart data write (#297)
jeanlucf22 Jan 16, 2025
857673f
Clean up code based on compiler warnings (#299)
jeanlucf22 Jan 17, 2025
f294d3c
Add getForces for evaluateDMandEnergyAndForces (#300)
siuwuncheung Jan 23, 2025
98a79de
Add check for compatibility MVP/Mehrstellen (#301)
jeanlucf22 Jan 24, 2025
8eda83e
Add support for Br atom (#302)
jeanlucf22 Feb 3, 2025
f298d43
Clean up some HDFrestart functions (#303)
jeanlucf22 Feb 11, 2025
c690bc5
Fix and test restart single hdf5 file (#305)
jeanlucf22 Feb 17, 2025
9f1fc20
Save Hartree potential for write in restart file (#306)
jeanlucf22 Feb 17, 2025
8a1cf05
Speed-up recently added tests (#309)
jeanlucf22 Feb 19, 2025
8a26879
Encapsulate some functions in Potentials (#310)
jeanlucf22 Feb 20, 2025
59b79e7
Remove confusing 0 in naming restart files (#308)
jeanlucf22 Feb 20, 2025
16a818a
Add functionalities for extra info in restart file (#312)
jeanlucf22 Feb 20, 2025
77bd87e
MPI abort (#313)
jeanlucf22 Feb 21, 2025
8b84de4
Rho and VH restart (#311)
jeanlucf22 Feb 24, 2025
8003d70
Strenghten testIons (#315)
jeanlucf22 Mar 4, 2025
4efb34c
More clean up in class Potentials (#316)
jeanlucf22 Mar 4, 2025
2f511b7
Misc code fixes (#317)
jeanlucf22 Mar 14, 2025
45a2c80
Use unique restart filenames in test HDF5single (#318)
jeanlucf22 Mar 14, 2025
b6cf162
Swap ions in existing test (#319)
jeanlucf22 Mar 15, 2025
7fbfe13
Code clean up (#320)
jeanlucf22 Mar 17, 2025
14eb43f
Added functionalities to set local forces (#321)
jeanlucf22 Mar 21, 2025
cd796dd
Merge branch 'release' into merge_release_20250324
siuwuncheung Mar 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BlockVector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void BlockVector<ScalarType, MemorySpaceType>::allocate_storage()
std::cerr << "ERROR BlockVector: trying to use allocation "
<< size_storage_ << " bigger than initialy preallocated "
<< allocated_size_storage_ << "!!!" << std::endl;
ct.global_exit(0);
ct.global_exit();
}
storage_ = class_storage_[my_allocation_];
assert(class_storage_.size() > 0);
Expand Down
18 changes: 9 additions & 9 deletions src/Control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ void Control::sync(void)
if (mpirc != MPI_SUCCESS)
{
(*MPIdata::sout) << "MPI Bcast of Control failed!!!" << std::endl;
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
};

Expand Down Expand Up @@ -1152,7 +1152,7 @@ void Control::setTolEigenvalueGram(const float tol)
<< threshold_eigenvalue_gram_ << std::endl;
}

void Control::global_exit(int i) { MPI_Abort(comm_global_, i); }
void Control::global_exit() { MPI_Abort(comm_global_, EXIT_FAILURE); }

void Control::setSpecies(Potentials& pot)
{
Expand Down Expand Up @@ -1342,7 +1342,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::serr)
<< "ERROR in Control::setOptions: Invalid restart dump type"
<< std::endl;
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

(*MPIdata::sout) << "Output restart file: " << out_restart_file
Expand Down Expand Up @@ -1549,14 +1549,14 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
else
{
std::cerr << "ERROR: Spread Penalty needs a type" << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

if (spread_penalty_target_ <= 0.)
{
(*MPIdata::sout) << "Invalid value for Spread Penalty target: "
<< spread_penalty_target_ << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
}

Expand Down Expand Up @@ -1599,7 +1599,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
{
(*MPIdata::sout) << "Invalid value for Thermostat.type: "
<< thermostat_type << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

tkel = vm["Thermostat.temperature"].as<float>();
Expand All @@ -1608,15 +1608,15 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::sout)
<< "Invalid value for Thermostat.temperature: " << tkel
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
thtime = vm["Thermostat.relax_time"].as<float>();
if (thtime < 0.)
{
(*MPIdata::sout)
<< "Invalid value for Thermostat.relax_time: " << thtime
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

if (str.compare("SCALING") == 0)
Expand All @@ -1627,7 +1627,7 @@ void Control::setOptions(const boost::program_options::variables_map& vm)
(*MPIdata::sout)
<< "Invalid value for Thermostat.width: " << thwidth
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class Control
return pair_mlwf_distance_threshold_;
}

void global_exit(int i);
void global_exit();

bool Mehrstellen() const { return (lap_type == 0 || lap_type == 10); }

Expand Down
10 changes: 5 additions & 5 deletions src/DistMatrix/BlacsContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " BlacsContext::BlacsContext: type = " << type
<< " is an incorrect parameter" << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}

size_ = nprow_ * npcol_;
Expand Down Expand Up @@ -222,7 +222,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " nprocs_=" << nprocs_ << std::endl;
std::cerr << " BlacsContext nprow*npcol > nprocs_" << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}

ictxt_ = Csys2blacs_handle(comm_global_);
Expand Down Expand Up @@ -252,7 +252,7 @@ BlacsContext::BlacsContext(
{
std::cerr << " BlacsContext::BlacsContext: invalid parameters"
<< " in " << __FILE__ << ":" << __LINE__ << std::endl;
MPI_Abort(comm_global, 0);
MPI_Abort(comm_global, EXIT_FAILURE);
}
int* pmap = new int[nprow * npcol];
// build pmap
Expand Down Expand Up @@ -296,7 +296,7 @@ BlacsContext::BlacsContext(BlacsContext& bc, const int irow, const int icol,
{
std::cerr << " BlacsContext::BlacsContext: invalid parameters"
<< std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}
int* pmap = new int[nprow * npcol];
// build pmap
Expand Down Expand Up @@ -350,7 +350,7 @@ BlacsContext::BlacsContext(const BlacsContext& bc, const char type)
std::cerr
<< " BlacsContext::BlacsContext: row/col incorrect parameter: "
<< type << std::endl;
MPI_Abort(comm_global_, 0);
MPI_Abort(comm_global_, EXIT_FAILURE);
}

ictxt_ = Csys2blacs_handle(comm_global_);
Expand Down
2 changes: 1 addition & 1 deletion src/DistMatrix/DistMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
std::cerr << "ERROR in file " << __FILE__ << " at line " << __LINE__ \
<< std::endl; \
std::cerr << "Error Message: " << X << std::endl; \
MPI_Abort(comm_global_, 2);
MPI_Abort(comm_global_, EXIT_FAILURE);

#endif

Expand Down
2 changes: 1 addition & 1 deletion src/DistanceConstraint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ bool DistanceConstraint::enforce(void)
{
cerr << "mype=" << mype << ", tau1p_[0]=" << tau1p_[0] << endl;
cerr << "mype=" << mype << ", tau2p_[0]=" << tau2p_[0] << endl;
MPI_Abort(MPI_COMM_WORLD, 0);
MPI_Abort(MPI_COMM_WORLD, EXIT_FAILURE);
}
if (locally_owned_)
(*MPIdata::sout) << setprecision(8) << "DistanceConstraint, d=" << d
Expand Down
4 changes: 2 additions & 2 deletions src/Electrostatic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Electrostatic::~Electrostatic()
if (grhoc_ != nullptr) delete grhoc_;
}

void Electrostatic::setupInitialVh(const POTDTYPE* const vh_init)
void Electrostatic::setupInitialVh(const std::vector<POTDTYPE>& vh_init)
{
poisson_solver_->set_vh(vh_init);

Expand Down Expand Up @@ -153,7 +153,7 @@ void Electrostatic::setupPB(

// initialize vh with last trial solution
pb::GridFunc<POTDTYPE> gf_vh(*pbGrid_, bc_[0], bc_[1], bc_[2]);
gf_vh.assign(pot.vh_rho());
gf_vh.assign((pot.vh_rho()).data());
poisson_solver_->set_vh(gf_vh);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Electrostatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Electrostatic
template <class T>
void computeVh(const pb::GridFunc<POTDTYPE>& vhinit, const Ions& ions,
Rho<T>& rho, Potentials& pot);
void setupInitialVh(const POTDTYPE* const);
void setupInitialVh(const std::vector<POTDTYPE>&);
void setupInitialVh(const pb::GridFunc<POTDTYPE>&);
template <class T>
void computeVhRho(Rho<T>& rho);
Expand Down
2 changes: 1 addition & 1 deletion src/ExtendedGridOrbitals.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ double ExtendedGridOrbitals::dotProduct(
"dot product type"
<< std::endl;
Control& ct = *(Control::instance());
ct.global_exit(2);
ct.global_exit();
}

dot_product_tm_.stop();
Expand Down
3 changes: 2 additions & 1 deletion src/Forces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ void Forces<T>::get_loc_proj(RHODTYPE* rho,
const int numpt = mymesh->numpt();

Potentials& pot = hamiltonian_->potential();
const std::vector<POTDTYPE>& vh_rho(pot.vh_rho());
for (int idx = 0; idx < numpt; idx++)
{
const double vhrho = pot.vh_rho(idx);
const double vhrho = vh_rho[idx];
for (short dir = 0; dir < 3; dir++)
{
double* lproj = &(loc_proj[dir * NPTS]);
Expand Down
29 changes: 17 additions & 12 deletions src/HDFrestart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1440,8 +1440,8 @@ int HDFrestart::read_1func_hdf5(T* vv, const std::string& datasetname)
}

template <class T>
int HDFrestart::write_1func_hdf5(
T* vv, const std::string& datasetname, double* ll, double* cell_origin)
int HDFrestart::write_1func_hdf5(const T* const vv,
const std::string& datasetname, double* ll, double* cell_origin)
{
assert(ll != nullptr);
assert(cell_origin != nullptr);
Expand Down Expand Up @@ -1652,7 +1652,7 @@ int HDFrestart::readData(
}

template <class T>
int HDFrestart::writeData(T* data, hid_t space_id, hid_t memspace,
int HDFrestart::writeData(const T* const data, hid_t space_id, hid_t memspace,
hid_t dset_id, const short precision)
{
if (precision == 1)
Expand Down Expand Up @@ -1922,10 +1922,12 @@ int HDFrestart::readAtomicData(std::string datasetname, std::vector<int>& data)
// send data to inactive PEs
if (gather_data_x_) gatherDataXdir(data);

#ifdef MGMOL_USE_HDF5P
if (useHdf5p())
{
data.erase(std::remove(data.begin(), data.end(), -1), data.end());
}
#endif

return 0;
}
Expand Down Expand Up @@ -1974,10 +1976,12 @@ int HDFrestart::readAtomicData(
}
}

#ifdef MGMOL_USE_HDF5P
if (useHdf5p())
{
data.erase(std::remove(data.begin(), data.end(), 1e+32), data.end());
}
#endif
if (gather_data_x_) gatherDataXdir(data);

return 0;
Expand Down Expand Up @@ -2017,7 +2021,8 @@ int HDFrestart::readAtomicData(
{
Control& ct = *(Control::instance());
if (onpe0 && ct.verbose > 0)
(*MPIdata::sout) << "HDFrestart::readAtomicNames()..." << std::endl;
(*MPIdata::sout) << "HDFrestart::readAtomicData(), dataset = "
<< datasetname << std::endl;

std::vector<char> buffer;
short name_length = 7; // default, value used before February 2016
Expand Down Expand Up @@ -2095,19 +2100,19 @@ int HDFrestart::readAtomicData(
{
std::string t(&buffer[i], name_length);
assert(t.size() > 0);
// cout<<"name="<<t<<endl;

stripLeadingAndTrailingBlanks(t);
// cout<<"stripped name="<<t<<endl;
// std::cout<<"stripped name="<<t<<std::endl;

assert(t.size() > 0);
data.push_back(t);
}

#ifdef MGMOL_USE_HDF5P
if (useHdf5p())
{
data.erase(std::remove(data.begin(), data.end(), ""), data.end());
}
#endif

return 0;
}
Expand Down Expand Up @@ -2232,13 +2237,13 @@ template int HDFrestart::read_1func_hdf5(float*, const std::string&);
template int HDFrestart::read_1func_hdf5(double*, const std::string&);

template int HDFrestart::write_1func_hdf5(
double*, const std::string&, double* ll, double* origin);
const double* const, const std::string&, double* ll, double* origin);

template int HDFrestart::readData(
double*, hid_t memspace, hid_t dset_id, const short precision);
template int HDFrestart::readData(
float*, hid_t memspace, hid_t dset_id, const short precision);
template int HDFrestart::writeData(double* vv, hid_t filespace, hid_t memspace,
hid_t dset_id, const short precision);
template int HDFrestart::writeData(float* vv, hid_t filespace, hid_t memspace,
hid_t dset_id, const short precision);
template int HDFrestart::writeData(const double* const vv, hid_t filespace,
hid_t memspace, hid_t dset_id, const short precision);
template int HDFrestart::writeData(const float* const vv, hid_t filespace,
hid_t memspace, hid_t dset_id, const short precision);
8 changes: 4 additions & 4 deletions src/HDFrestart.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ class HDFrestart
int read_1func_hdf5(T*, const std::string&);

template <class T>
int write_1func_hdf5(
T*, const std::string&, double* ll = nullptr, double* origin = nullptr);
int write_1func_hdf5(const T* const, const std::string&,
double* ll = nullptr, double* origin = nullptr);

int read_att(const hid_t dset_id, const std::string& attname,
std::vector<double>& attr_data);

// write data in file with precision "precision"
template <class T>
int writeData(T* vv, hid_t filespace, hid_t memspace, hid_t dset_id,
const short precision);
int writeData(const T* const vv, hid_t filespace, hid_t memspace,
hid_t dset_id, const short precision);

template <class T>
int readData(T* vv, hid_t memspace, hid_t dset_id, const short precision);
Expand Down
8 changes: 7 additions & 1 deletion src/Ion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,18 @@ void Ion::getIonData(IonData& idata) const
}
}

void Ion::resetPositionsToPrevious()
{
for (int pos = 0; pos < 3; pos++)
position_[pos] = old_position_[pos];
}

void Ion::setFromIonData(const IonData& data)
{
// random state
setRandomState(data.rand_state[0], data.rand_state[1], data.rand_state[2]);
// previous position
setOldPosition(
setPreviousPosition(
data.old_position[0], data.old_position[1], data.old_position[2]);
// velocity
setVelocity(data.velocity[0], data.velocity[1], data.velocity[2]);
Expand Down
16 changes: 10 additions & 6 deletions src/Ion.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ class Ion

position_[i] += shift;
}
void setOldPosition(const double x, const double y, const double z)
{
old_position_[0] = x;
old_position_[1] = y;
old_position_[2] = z;
}

public:
Ion(const Species& species, const std::string& name, const double crds[3],
Expand All @@ -96,6 +90,13 @@ class Ion
void init(const double crds[3], const double velocity[3], const bool lock);
void setup();

void setPreviousPosition(const double x, const double y, const double z)
{
old_position_[0] = x;
old_position_[1] = y;
old_position_[2] = z;
}

std::shared_ptr<KBprojector> kbproj() { return kbproj_; }
const std::shared_ptr<KBprojector> kbproj() const { return kbproj_; }

Expand Down Expand Up @@ -189,6 +190,9 @@ class Ion

kbproj_->clear();
}

void resetPositionsToPrevious();

void shiftPositionXLBOMDTest(Vector3D shift)
{
for (short dir = 0; dir < 3; dir++)
Expand Down
2 changes: 1 addition & 1 deletion src/IonicAlgorithm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void IonicAlgorithm<OrbitalsType>::init(HDFrestart* h5f_file)
if (ct.restart_info > 0)
{
int status = stepper_->init(*h5f_file);
if (status < 0) ct.global_exit(2);
if (status < 0) ct.global_exit();

// if restart data for lbfgs found
if (status == 0)
Expand Down
Loading