Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 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
c61b48d
Update mixed precision code (#322)
jeanlucf22 Mar 24, 2025
e37983b
Clean up and fixes Ions (#326)
jeanlucf22 Mar 26, 2025
89630b3
Fixes for build without HDF5P (#324)
jeanlucf22 Mar 26, 2025
e80193b
Fix testRhoVhRestart (#325)
jeanlucf22 Mar 26, 2025
bcad112
Fix a few more issues with class Ions (#328)
jeanlucf22 Mar 26, 2025
a78e260
Introduce new constructor for class Ions (#330)
jeanlucf22 Mar 27, 2025
1af25da
Merge branch 'release' into merge_release_20250327
siuwuncheung Mar 28, 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
6 changes: 3 additions & 3 deletions src/ABPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void ABPG<T>::setup(T& orbitals)
//
// orthof=true: wants orthonormalized updated wave functions
template <class T>
int ABPG<T>::updateWF(T& orbitals, Ions& /*ions*/, const double precond_factor,
int ABPG<T>::updateWF(T& orbitals, Ions& ions, const double precond_factor,
const bool /*orthof*/, T& work_orbitals, const bool accelerate,
const bool print_res, const double atol)
{
Expand All @@ -51,8 +51,8 @@ int ABPG<T>::updateWF(T& orbitals, Ions& /*ions*/, const double precond_factor,
T res("Residual", orbitals, false);

const bool check_res = (atol > 0.);
double normRes = mgmol_strategy_->computeResidual(
orbitals, work_orbitals, res, (print_res || check_res), check_res);
double normRes = mgmol_strategy_->computeResidual(orbitals, work_orbitals,
ions, res, (print_res || check_res), check_res);
if (normRes < atol && check_res)
{
abpg_nl_update_tm_.stop();
Expand Down
4 changes: 2 additions & 2 deletions src/DFTsolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ double DFTsolver<OrbitalsType>::evaluateEnergy(

// Get the new total energy
const double ts = 0.5 * proj_matrices_->computeEntropy(); // in [Ha]
eks_history_[0]
= energy_->evaluateTotal(ts, proj_matrices_, orbitals, print_flag, os_);
eks_history_[0] = energy_->evaluateTotal(
ts, proj_matrices_, ions_, orbitals, print_flag, os_);

sum_eig_[1] = sum_eig_[0];
sum_eig_[0] = 2. * proj_matrices_->getEigSum(); // 2.*sum in [Ry]
Expand Down
8 changes: 4 additions & 4 deletions src/DavidsonSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(

ts0 = evalEntropy(projmatrices, (ct.verbose > 1), os_);
e0 = energy_->evaluateTotal(
ts0, projmatrices, orbitals, printE, os_);
ts0, projmatrices, ions_, orbitals, printE, os_);

retval = checkConvergence(e0, outer_it, ct.conv_tol);
if (retval == 0 || (outer_it == ct.max_electronic_steps))
Expand Down Expand Up @@ -549,7 +549,7 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(

ts0 = evalEntropy(proj_mat2N_.get(), (ct.verbose > 1), os_);
e0 = energy_->evaluateTotal(
ts0, proj_mat2N_.get(), orbitals, printE, os_);
ts0, proj_mat2N_.get(), ions_, orbitals, printE, os_);
}

// 2N x 2N target...
Expand Down Expand Up @@ -621,8 +621,8 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(

const double ts1
= evalEntropy(proj_mat2N_.get(), (ct.verbose > 2), os_);
const double e1 = energy_->evaluateTotal(
ts1, proj_mat2N_.get(), orbitals, ct.verbose - 1, os_);
const double e1 = energy_->evaluateTotal(ts1, proj_mat2N_.get(),
ions_, orbitals, ct.verbose - 1, os_);

// line minimization
beta = minQuadPolynomial(e0, e1, de0, (ct.verbose > 2), os_);
Expand Down
29 changes: 14 additions & 15 deletions src/Energy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@
#define RY2HA 0.5

template <class T>
Energy<T>::Energy(const pb::Grid& mygrid, const Ions& ions,
const Potentials& pot, const Electrostatic& es, const Rho<T>& rho,
const XConGrid& xc, SpreadPenaltyInterface<T>* spread_penalty)
Energy<T>::Energy(const pb::Grid& mygrid, const Potentials& pot,
const Electrostatic& es, const Rho<T>& rho, const XConGrid& xc,
SpreadPenaltyInterface<T>* spread_penalty)
: mygrid_(mygrid),
ions_(ions),
pot_(pot),
es_(es),
rho_(rho),
Expand Down Expand Up @@ -59,7 +58,7 @@ double Energy<T>::getEVrhoRho() const
}

template <class T>
double Energy<T>::evaluateEnergyIonsInVext()
double Energy<T>::evaluateEnergyIonsInVext(Ions& ions)
{
double energy = 0.;

Expand All @@ -69,12 +68,12 @@ double Energy<T>::evaluateEnergyIonsInVext()
//(*MPIdata::sout)<<"Energy<T>::evaluateEnergyIonsInVext()"<<std::endl;
double position[3];
std::vector<double> positions;
positions.reserve(3 * ions_.local_ions().size());
positions.reserve(3 * ions.local_ions().size());

// loop over ions
int nions = 0;
std::vector<Ion*>::const_iterator ion = ions_.local_ions().begin();
while (ion != ions_.local_ions().end())
std::vector<Ion*>::const_iterator ion = ions.local_ions().begin();
while (ion != ions.local_ions().end())
{
(*ion)->getPosition(position);
positions.push_back(position[0]);
Expand All @@ -88,9 +87,9 @@ double Energy<T>::evaluateEnergyIonsInVext()
pot_.getValVext(positions, val);

// loop over ions again
ion = ions_.local_ions().begin();
ion = ions.local_ions().begin();
int ion_index = 0;
while (ion != ions_.local_ions().end())
while (ion != ions.local_ions().end())
{
const double z = (*ion)->getZion();
// int ion_index=(*ion)->index();
Expand All @@ -112,16 +111,16 @@ double Energy<T>::evaluateEnergyIonsInVext()

template <class T>
double Energy<T>::evaluateTotal(const double ts, // in [Ha]
ProjectedMatricesInterface* projmatrices, const T& phi, const int verbosity,
std::ostream& os)
ProjectedMatricesInterface* projmatrices, Ions& ions, const T& phi,
const int verbosity, std::ostream& os)
{
eval_te_tm_.start();

Control& ct = *(Control::instance());

const double eself = ions_.energySelf();
const double ediff = ions_.energyDiff(ct.bcPoisson);
const double eipot = evaluateEnergyIonsInVext();
const double eself = ions.energySelf();
const double ediff = ions.energyDiff(ct.bcPoisson);
const double eipot = evaluateEnergyIonsInVext(ions);

const double eigsum = 0.5 * projmatrices->getExpectationH();

Expand Down
12 changes: 5 additions & 7 deletions src/Energy.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#define MGMOL_ENERGY_H

#include "Grid.h"
#include "Ions.h"
#include "Rho.h"
#include "SpreadPenaltyInterface.h"
#include "Timer.h"
Expand All @@ -20,7 +21,6 @@
#include <vector>

class Potentials;
class Ions;
class Electrostatic;
class ProjectedMatricesInterface;
class XConGrid;
Expand All @@ -29,7 +29,6 @@ template <class T>
class Energy
{
const pb::Grid& mygrid_;
const Ions& ions_;
const Potentials& pot_;
const Electrostatic& es_;
const Rho<T>& rho_;
Expand All @@ -45,16 +44,15 @@ class Energy
double getEVrhoRho() const;

public:
Energy(const pb::Grid&, const Ions&, const Potentials&,
const Electrostatic&, const Rho<T>&, const XConGrid&,
SpreadPenaltyInterface<T>*);
Energy(const pb::Grid&, const Potentials&, const Electrostatic&,
const Rho<T>&, const XConGrid&, SpreadPenaltyInterface<T>*);

static Timer eval_te_tm() { return eval_te_tm_; }

double evaluateTotal(const double ts, ProjectedMatricesInterface*,
double evaluateTotal(const double ts, ProjectedMatricesInterface*, Ions&,
const T& phi, const int, std::ostream&);

double evaluateEnergyIonsInVext();
double evaluateEnergyIonsInVext(Ions&);

void saveVofRho();
};
Expand Down
4 changes: 2 additions & 2 deletions src/GrassmanLineMinimization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Timer GrassmanLineMinimization<T>::update_states_tm_("Grassman_update_states");
//
// orthof=true: wants orthonormalized updated wave functions
template <class T>
int GrassmanLineMinimization<T>::updateWF(T& orbitals, Ions& /*ions*/,
int GrassmanLineMinimization<T>::updateWF(T& orbitals, Ions& ions,
const double precond_factor, const bool orthof, T& work_orbitals,
const bool accelerate, const bool print_res, const double atol)
{
Expand Down Expand Up @@ -61,7 +61,7 @@ int GrassmanLineMinimization<T>::updateWF(T& orbitals, Ions& /*ions*/,
// Update wavefunctions
const bool check_res = (atol > 0.);
double normRes = mgmol_strategy_->computeResidual(orbitals, work_orbitals,
*new_grad_, (print_res || check_res), check_res);
ions, *new_grad_, (print_res || check_res), check_res);
if (normRes < atol && check_res)
{
nl_update_tm_.stop();
Expand Down
14 changes: 7 additions & 7 deletions src/HamiltonianMVPSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ int HamiltonianMVPSolver<MatrixType, ProjMatrixType, OrbitalsType>::solve(

// compute energy at origin
const int printE = (ct.verbose > 1) ? 1 : 0;
double e0
= energy_->evaluateTotal(ts0, projmatrices, orbitals, printE, os_);
double e0 = energy_->evaluateTotal(
ts0, projmatrices, ions_, orbitals, printE, os_);

//
// compute energy at end for new H
Expand Down Expand Up @@ -189,8 +189,8 @@ int HamiltonianMVPSolver<MatrixType, ProjMatrixType, OrbitalsType>::solve(
projmatrices->setHB2H();

// compute energy at end (beta=1.)
double e1
= energy_->evaluateTotal(ts1, projmatrices, orbitals, printE, os_);
double e1 = energy_->evaluateTotal(
ts1, projmatrices, ions_, orbitals, printE, os_);

//
// evaluate energy at mid-point
Expand Down Expand Up @@ -226,8 +226,8 @@ int HamiltonianMVPSolver<MatrixType, ProjMatrixType, OrbitalsType>::solve(
projmatrices->setHB2H();

// compute energy at midpoint
double ei
= energy_->evaluateTotal(tsi, projmatrices, orbitals, printE, os_);
double ei = energy_->evaluateTotal(
tsi, projmatrices, ions_, orbitals, printE, os_);

// line minimization
double beta
Expand Down Expand Up @@ -285,7 +285,7 @@ int HamiltonianMVPSolver<MatrixType, ProjMatrixType, OrbitalsType>::solve(

// compute energy at end (beta=1.)
ei = energy_->evaluateTotal(
tsi, projmatrices, orbitals, printE, os_);
tsi, projmatrices, ions_, orbitals, printE, os_);

// line minimization
beta = minQuadPolynomialFrom3values(
Expand Down
Loading