Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 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
c4817b8
Add cleanup and MGmolInterface (#331)
siuwuncheung Mar 27, 2025
a5f6f3a
Add function to set local forces (#333)
jeanlucf22 Mar 28, 2025
4e82239
Fix setLocalForces (#335)
siuwuncheung Mar 30, 2025
f715dd9
Fix test WFEnergyAndForces (#336)
jeanlucf22 Apr 4, 2025
89d502e
Add mixing option in MVP (#337)
jeanlucf22 Apr 4, 2025
f198397
Update MVP with mixing (#339)
jeanlucf22 Apr 9, 2025
781d7e5
Update DensityMatrix class (#342)
jeanlucf22 Apr 11, 2025
47cba98
Fixing DM tolerance (#341)
siuwuncheung Apr 14, 2025
ffc087c
Rm oversubscribe from CMakeLists.txt (#346)
jeanlucf22 Jul 11, 2025
0897876
Adapt to new environment on condo @ ORNL (#348)
jeanlucf22 Jul 14, 2025
89fc0c3
Merge branch 'release' into merge_release_20250713
siuwuncheung Jul 15, 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
8 changes: 3 additions & 5 deletions scripts/build_condo-mod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
#Before compiling, load the following modules:
source scripts/modules.condo-mod

# We need to define the cmake blas vendor option here to find the right one.
BLAS_VENDOR=OpenBLAS

MGMOL_ROOT=`pwd`

INSTALL_DIR=${MGMOL_ROOT}/install
Expand All @@ -15,16 +12,17 @@ BUILD_DIR=${MGMOL_ROOT}/build
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}

SCALAPACK_DIR=/home/q8j/Software/ScaLapack/scalapack-2.2.2

# call cmake
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=mpiCC \
-DCMAKE_Fortran_COMPILER=mpif77 \
-DBLA_VENDOR=${BLAS_VENDOR} \
-DMGMOL_USE_HDF5P=OFF \
-DMGMOL_WITH_CLANG_FORMAT=ON \
-DCMAKE_PREFIX_PATH=${HOME}/bin \
-DSCALAPACK_LIBRARY="${SCALAPACK_DIR}/lib/libscalapack.a;/lib64/libgfortran.so.3" \
-DSCALAPACK_LIBRARY="${SCALAPACK_DIR}/lib/libscalapack.a;/lib64/libgfortran.so.5" \
-DMPIEXEC_EXECUTABLE=${OPENMPI_DIR}/bin/mpiexec \
..

Expand Down
21 changes: 5 additions & 16 deletions scripts/build_condo.sh
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
#/bin/bash
## An example script to build on ONRL condo systems (CADES).
## This script assumes intel/ mkl libraries are being used.

#Before compiling, load the following modules:
source scripts/modules.condo

# set some environment variables using loaded module path
export SCALAPACK_ROOT=${MKLROOT}

# We need to define the cmake blas vendor option here to find the right one.
BLAS_VENDOR=Intel10_64lp

# manually set the location of BLACS libraries for scalapack
BLACS_LIB=${MKLROOT}/lib/intel64

MGMOL_ROOT=`pwd`

INSTALL_DIR=${MGMOL_ROOT}/mgmol_install
INSTALL_DIR=${MGMOL_ROOT}/install
mkdir -p ${INSTALL_DIR}

BUILD_DIR=${MGMOL_ROOT}/build
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}

SCALAPACK_DIR=/home/q8j/Software/ScaLapack/scalapack-2.2.2

# call cmake
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=mpiCC \
-DCMAKE_Fortran_COMPILER=mpif77 \
-DHDF5_LIBRARIES=${HDF5_DIR}/lib/libhdf5.so \
-DHDF5_HL_LIBRARIES=${HDF5_DIR}/lib/libhdf5_hl.so \
-DHDF5_INCLUDE_DIRS=${HDF5_DIR}/include \
-DBLA_VENDOR=${BLAS_VENDOR} \
-DMGMOL_USE_HDF5P=OFF \
-DMGMOL_WITH_CLANG_FORMAT=ON \
-DCMAKE_PREFIX_PATH=${HOME}/bin \
-DSCALAPACK_LIBRARY="${SCALAPACK_DIR}/lib/libscalapack.a;/lib64/libgfortran.so.5" \
-DMPIEXEC_EXECUTABLE=${OPENMPI_DIR}/bin/mpiexec \
-DSCALAPACK_BLACS_LIBRARY=${BLACS_LIB}/libmkl_blacs_openmpi_lp64.so \
..

# call make install
Expand Down
9 changes: 4 additions & 5 deletions scripts/modules.condo
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module load PE-intel/3.0
module load boost/1.67.0-pe3
module load mkl
module load hdf5_parallel/1.10.3
module load cmake/3.18.4
module load hdf5
module load boost
module load cmake
module load python
module load openblas
10 changes: 4 additions & 6 deletions scripts/modules.condo-mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module load PE-gnu/3.0
module load hdf5-parallel/1.8.20
module load hdf5
module load boost
module load cmake/3.20.3
module load python/3.6.6
module load openBLAS/0.2.19
module load scalapack/2.0.2
module load cmake
module load python
module load openblas
3 changes: 2 additions & 1 deletion src/Control.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ void Control::print(std::ostream& os)
<< conv_tol << std::endl;
os << std::fixed;
os << " Density matrix mixing = " << dm_mix << std::endl;
os << std::setprecision(4) << std::scientific << " Density matrix tol = " << dm_tol << std::endl;
os << std::setprecision(4) << std::scientific
<< " Density matrix tol = " << dm_tol << std::endl;
if (DMEigensolver() == DMEigensolverType::Eigensolver)
{
os << " Density matrix computation algorithm = "
Expand Down
12 changes: 6 additions & 6 deletions src/DavidsonSolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ double DavidsonSolver<OrbitalsType, MatrixType>::evaluateDerivative(
const double dbeta = 0.0001;
*work2N_ = dm2Ninit;
work2N_->axpy(dbeta, delta_dm);
// proj_mat2N_->setDM(*work2N_,orbitals.getIterativeIndex());
proj_mat2N_->setDM(*work2N_, -1);

proj_mat2N_->setDM(*work2N_);
proj_mat2N_->computeOccupationsFromDM();

const double tsd0e = evalEntropy(proj_mat2N_.get(), false, os_);
Expand Down Expand Up @@ -250,7 +250,7 @@ void DavidsonSolver<OrbitalsType, MatrixType>::buildTarget2N_MVP(
// if( onpe0 )os_<<"Compute X2N..."<<endl;
proj_mat2N_->setHB2H();

proj_mat2N_->updateDM(orbitals_index);
proj_mat2N_->updateDM();

target = proj_mat2N_->dm();

Expand Down Expand Up @@ -584,7 +584,7 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(
//
if (mmpi.PE0() && ct.verbose > 2)
os_ << "Target energy..." << std::endl;
proj_mat2N_->setDM(target, orbitals.getIterativeIndex());
proj_mat2N_->setDM(target);
proj_mat2N_->computeOccupationsFromDM();
double nel = proj_mat2N_->getNel();
if (mmpi.PE0() && ct.verbose > 2)
Expand Down Expand Up @@ -643,7 +643,7 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(
// update DM
*work2N_ = dm2Ninit;
work2N_->axpy(beta, delta_dm);
proj_mat2N_->setDM(*work2N_, orbitals.getIterativeIndex());
proj_mat2N_->setDM(*work2N_);

if (inner_it < ct.dm_inner_steps - 1)
{
Expand Down Expand Up @@ -809,7 +809,7 @@ int DavidsonSolver<OrbitalsType, MatrixType>::solve(
= dynamic_cast<ProjectedMatrices<MatrixType>*>(
orbitals.getProjMatrices());
assert(pmat);
pmat->buildDM(new_occ, orbitals.getIterativeIndex());
pmat->buildDM(new_occ);

if (retval == 0) break;

Expand Down
85 changes: 44 additions & 41 deletions src/DensityMatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@

const double factor_kernel4dot = 10.;

#define PROCRUSTES 0
#define MGMOL_DENSITYMATRIX_FAIL(X) \
{ \
std::cerr << "DensityMatrix failure:" << std::endl; \
std::cerr << "Error Message: " << X << std::endl; \
}

#define MGMOL_DENSITYMATRIX_FAIL(X) \
{ \
Expand All @@ -36,7 +40,7 @@ const double factor_kernel4dot = 10.;
template <class MatrixType>
DensityMatrix<MatrixType>::DensityMatrix(const int ndim)
: dim_(ndim),
orbitals_index_(-1),
update_index_(-1),
occ_uptodate_(false),
uniform_occ_(false),
stripped_(false)
Expand Down Expand Up @@ -66,8 +70,8 @@ DensityMatrix<MatrixType>::~DensityMatrix()
}

template <class MatrixType>
void DensityMatrix<MatrixType>::build(const MatrixType& zmat,
const std::vector<double>& occ, const int new_orbitals_index)
void DensityMatrix<MatrixType>::build(
const MatrixType& zmat, const std::vector<double>& occ)
{
#ifdef PRINT_OPERATIONS
MGmol_MPI& mmpi = *(MGmol_MPI::instance());
Expand Down Expand Up @@ -98,32 +102,30 @@ void DensityMatrix<MatrixType>::build(const MatrixType& zmat,
work_->symm('r', 'l', 1., gamma, zmat, 0.);
kernel4dot_->gemm('n', 't', 1., *work_, zmat, 0.);

stripped_ = false;
orbitals_index_ = new_orbitals_index;
stripped_ = false;
update_index_++;
}

template <class MatrixType>
void DensityMatrix<MatrixType>::build(
const MatrixType& zmat, const int new_orbitals_index)
void DensityMatrix<MatrixType>::build(const MatrixType& zmat)
{
build(zmat, occupation_, new_orbitals_index);
build(zmat, occupation_);
}

// build diagonal matrix
template <class MatrixType>
void DensityMatrix<MatrixType>::build(
const std::vector<double>& occ, const int new_orbitals_index)
void DensityMatrix<MatrixType>::build(const std::vector<double>& occ)
{
assert(dm_ != nullptr);
assert(!occ.empty());

setOccupations(occ);

build(new_orbitals_index);
build();
}

template <class MatrixType>
void DensityMatrix<MatrixType>::build(const int new_orbitals_index)
void DensityMatrix<MatrixType>::build()
{
MGmol_MPI& mmpi = *(MGmol_MPI::instance());
#ifdef PRINT_OPERATIONS
Expand All @@ -148,13 +150,12 @@ void DensityMatrix<MatrixType>::build(const int new_orbitals_index)
* std::min(1., factor_kernel4dot * occupation_[i]));
kernel4dot_->setDiagonal(w);

stripped_ = false;
orbitals_index_ = new_orbitals_index;
stripped_ = false;
update_index_++;
}

template <class MatrixType>
void DensityMatrix<MatrixType>::setUniform(
const double nel, const int new_orbitals_index)
void DensityMatrix<MatrixType>::setUniform(const double nel)
{
assert(!occupation_.empty());

Expand All @@ -171,22 +172,13 @@ void DensityMatrix<MatrixType>::setUniform(

uniform_occ_ = true;

build(occupation_, new_orbitals_index);
}

template <class MatrixType>
void DensityMatrix<MatrixType>::buildFromBlock(const MatrixType& block00)
{
dm_->clear();
dm_->assign(block00, 0, 0);
dm_->print(std::cout, 0, 0, 25, 25);
build(occupation_);
}

template <class MatrixType>
void DensityMatrix<MatrixType>::rotate(
const MatrixType& rotation_matrix, const bool flag_eigen)
{

if (!flag_eigen)
{
MatrixType invU(rotation_matrix);
Expand All @@ -204,6 +196,8 @@ void DensityMatrix<MatrixType>::rotate(
invU.getrs('n', tmp, ipiv);

*dm_ = tmp;

update_index_++;
}
}

Expand Down Expand Up @@ -370,8 +364,7 @@ double DensityMatrix<MatrixType>::computeEntropy() const
}

template <class MatrixType>
void DensityMatrix<MatrixType>::setto2InvS(
const MatrixType& invS, const int orbitals_index)
void DensityMatrix<MatrixType>::setto2InvS(const MatrixType& invS)
{
*dm_ = invS;
dm_->scal(orbital_occupation_);
Expand All @@ -382,8 +375,8 @@ void DensityMatrix<MatrixType>::setto2InvS(
occupation_[st] = 1.;
occ_uptodate_ = true;
}
uniform_occ_ = false;
orbitals_index_ = orbitals_index;
uniform_occ_ = false;
update_index_++;
}

template <class MatrixType>
Expand All @@ -400,8 +393,7 @@ void DensityMatrix<MatrixType>::stripS(const MatrixType& ls)
}

template <class MatrixType>
void DensityMatrix<MatrixType>::dressUpS(
const MatrixType& ls, const int new_orbitals_index)
void DensityMatrix<MatrixType>::dressUpS(const MatrixType& ls)
{
assert(stripped_);

Expand All @@ -410,10 +402,11 @@ void DensityMatrix<MatrixType>::dressUpS(
*dm_ = *work_;
ls.trtrs('l', 't', 'n', *dm_);

orbitals_index_ = new_orbitals_index;
occ_uptodate_ = false;
uniform_occ_ = false;
stripped_ = false;
update_index_++;

occ_uptodate_ = false;
uniform_occ_ = false;
stripped_ = false;
}

// dm_ -> u*dm_*u^T
Expand All @@ -424,6 +417,8 @@ void DensityMatrix<MatrixType>::transform(const MatrixType& u)
{
work_->gemm('n', 't', 1., *dm_, u, 0.);
dm_->gemm('n', 'n', 1., u, *work_, 0.);

update_index_++;
}

template <class MatrixType>
Expand All @@ -434,13 +429,21 @@ double DensityMatrix<MatrixType>::getExpectation(const MatrixType& A)
}

template <class MatrixType>
void DensityMatrix<MatrixType>::mix(
const double mix, const MatrixType& matA, const int new_orbitals_index)
void DensityMatrix<MatrixType>::mix(const double mix, const MatrixType& matA)
{
dm_->scal(1. - mix);

dm_->axpy(mix, matA);
orbitals_index_ = new_orbitals_index;

update_index_++;
}

template <class MatrixType>
void DensityMatrix<MatrixType>::linearExtrapolate(const MatrixType& previous_dm)
{
dm_->scal(2.);
dm_->axpy(-1., previous_dm);

update_index_++;
}

template <class MatrixType>
Expand Down
Loading