Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
991ebc0
LR-TDDFT analytical gradients: port onto refactored develop
maki49 Aug 13, 2026
a51848b
fix(lr-grad): replace LibRI RI::LR with a local two-density-matrix EX…
maki49 Aug 13, 2026
531542e
fix(lr-grad): correct nspin in the LR grid-force ModuleGint calls, cl…
maki49 Aug 13, 2026
3bbb90d
fix(lr-grad): gather the RHS before the LAPACK Z-vector solve
maki49 Aug 13, 2026
d5d5d10
fix: singlet gate for gxc
maki49 Aug 18, 2026
495b7c0
fix: Hxc dm-trans term (symmetrization and factor)
maki49 Aug 18, 2026
72970b7
Fix some factor bugs in ceZc, K_ii terms (visible in DZP)
maki49 Aug 19, 2026
cd937ea
Fix: transpose dm_trans in Z-vector eq. RHS
maki49 Aug 19, 2026
5e1bb03
Fix pot_hxc_gs: correct TDRPA@LDA (linear vxc=fxc[gs](T+Z) instead of…
maki49 Aug 19, 2026
2bdaa6a
Feature: implement gxc
maki49 Aug 20, 2026
2a4f778
Perf: share gxc kernels to save memory
maki49 Aug 24, 2026
a54e18b
Perf: put drho out to cal_v_eff for gxc, to save memory
maki49 Aug 24, 2026
51df46b
fix nspin=1
maki49 Aug 27, 2026
e6dbb01
small fixes
maki49 Aug 28, 2026
68199dc
Perf: speed up the LR kernel-to-potential integrands by ~45%
maki49 Sep 1, 2026
ca76c00
feat: lr-grad openshell implementation
maki49 Sep 2, 2026
a5c73b0
Feat: enable LRC kernel
maki49 Sep 3, 2026
d91a131
Remove the LR-Grad EXX debug scaffolding
maki49 Sep 3, 2026
135c52d
fix(lr): make the KS-orbital window copy and paraX_ setup re-entrant
maki49 Sep 3, 2026
35254a9
refactor(lr): keep the KS solver as a member and alias its geometry o…
maki49 Sep 3, 2026
dbd737a
feat(lr): re-run the ground state from runner(istep)
maki49 Sep 4, 2026
ae72baf
feat(lr): drive geometry relaxation from an excited-state surface
maki49 Sep 4, 2026
b2a246c
fix(lr): scope the relax-target inputs, and clear out the re-entrancy…
maki49 Sep 4, 2026
2e8c043
fix(lr): the excited-state force adds the LR part, and log the energy
maki49 Sep 4, 2026
6a3d3f3
fix(lr): build an Exx_LRI on the ks-lr path for a hybrid ground state
maki49 Sep 4, 2026
399ec7e
fix: use an spin-index mixing in close-shell grad: affect triplet gra…
maki49 Sep 8, 2026
f1b237c
fix: expand Z-window to nbands for complete orbital rotation space
maki49 Sep 9, 2026
4094aea
fix: small fixes about nupdown and degeneracy information
maki49 Sep 11, 2026
aaf4032
fix openshell bug: parallel index in HamiltULR and add-on op-lr-diag
maki49 Sep 14, 2026
31df937
fix: adapt LR-gradient code to develop interface changes after rebase
maki49 Sep 15, 2026
68e56c6
fix compile warning
maki49 Sep 16, 2026
d33af90
fix: clamp sigma for HSE06's wpbeh kernel; fix complex CXC index bug
maki49 Oct 1, 2026
157822d
chore: remove diagnostic env-var switches from the LR-Grad investigation
maki49 Oct 2, 2026
9d0c84a
feat(lr-grad): algebra for the degenerate-subspace gradient matrix
maki49 Sep 28, 2026
138b2ca
refactor(lr-grad): let the excited-state gradient take X from the caller
maki49 Sep 28, 2026
d7dc54a
feat(lr-grad): compute the gradient matrix of a degenerate multiplet
maki49 Sep 28, 2026
82d2640
feat(lr-grad): store the degenerate gradient matrix, print its eigenv…
maki49 Sep 29, 2026
818dc96
feat: state following by max overlap
maki49 Sep 29, 2026
fa31179
feat(lr-grad): find the Jahn-Teller direction from the degenerate gra…
maki49 Sep 29, 2026
b14820c
feat(lr-grad): lr_relax_degen_mode = jt, descending the Jahn-Teller b…
maki49 Sep 29, 2026
c1183ba
fix: adapt LR-gradient code to develop interface changes after rebase…
maki49 Oct 2, 2026
b4ef783
test(lr): add cal_force to the gamma-only LR-TDDFT integrate tests
maki49 Oct 2, 2026
e4cf077
fix: guard MPI-only and EXX-only symbols for the no-ELPA/no-EXX CI bu…
maki49 Oct 2, 2026
12776d4
fix: more MPI-only guards, and wire the Grad sources into Makefile.Ob…
maki49 Oct 2, 2026
9a47836
fix: make the gradient path build again under -DENABLE_MPI=OFF/Intel …
maki49 Oct 3, 2026
d144b9b
fix: reduce global dependency budget flagged by agent governance check
maki49 Oct 3, 2026
58cd935
feat(lr-grad): distributed ScaLAPACK and ELPA solvers for the Z-vecto…
maki49 Oct 4, 2026
d41fbf8
feat(lr-grad): add INPUT parameter lr_grad_solver to choose the Z-vec…
maki49 Oct 4, 2026
a981272
docs(lr): move hand-written input-main.md text into the C++ descripti…
maki49 Oct 4, 2026
4791751
feat(lr-grad): add lr_grad_solver = scalapack_chol, a ScaLAPACK Chole…
maki49 Oct 4, 2026
dffff57
fix(lr): clamp sigma in xc_gga_vxc for HSE06, matching fxc/kxc
maki49 Oct 4, 2026
fdd43e7
fix(lr-grad): build the LR unit tests against the 6-argument gather_2…
maki49 Oct 4, 2026
c04ee92
refactor(lr-grad): flatten Grad/ into module_lr, cap filenames at 15 …
maki49 Oct 5, 2026
af63607
chore(lr-grad): drop unused includes left over from removed diagnostics
maki49 Oct 5, 2026
ea71a3d
fix: match Makefile.Objects' LR-Grad object name to zeqlin_solv.cpp
maki49 Oct 5, 2026
739cfd5
fix para: ks-lr nb sync with groudstate; nrxx=0 guard
maki49 Oct 5, 2026
1912461
fix(lr-grad): replace #pragma once with include guards
maki49 Oct 5, 2026
fb90da4
fix para: dav_subspace bcast type and spectra spin index
maki49 Oct 5, 2026
c79ffec
fix(lr): derive occupied windows from charged spin populations
maki49 Oct 5, 2026
9a2b75e
fix(lr): update two nocc tests left stale by the post-SCF resolution …
maki49 Oct 5, 2026
a0700ca
fix(lr): balance force timers in degenerate gradient paths
maki49 Oct 6, 2026
27cadf1
fix(lr): handle empty grid ranks and align gamma CI coverage
maki49 Oct 6, 2026
b571f36
fix CI precision
maki49 Oct 6, 2026
7f2ee94
perf(lr): reuse transition density across output spins
maki49 Oct 6, 2026
bf1387c
fix: CI test lr force thr 1e-6
maki49 Oct 6, 2026
4fdd372
perf: vectorize Gamma and multi-k LR exchange projection
maki49 Oct 6, 2026
4607c35
refactor(dm): make internal real-space density updates non-const
maki49 Oct 7, 2026
ea6e740
refactor(lr): pass orbital layout explicitly to density transposition
maki49 Oct 7, 2026
463a022
refactor(lr): move gradient evaluation out of ESolver
maki49 Oct 7, 2026
36e9095
refactor(lr): lowercase new filenames and split gradient controllers
maki49 Oct 7, 2026
7659d84
refactor(lr): remove mutable operator work buffers
maki49 Oct 7, 2026
1f2d4b2
refactor(lr): keep new filename stems within fifteen characters
maki49 Oct 7, 2026
5f0765d
refactor(input): shorten LR degeneracy parameter names
maki49 Oct 7, 2026
d6f3b3b
fix(lr): restore CI builds after gradient refactor
maki49 Oct 7, 2026
9e8ae7f
fix(lr): address blocking PR review findings
maki49 Oct 8, 2026
6c59371
fix(lr): make gradient ownership and solver failures explicit
maki49 Oct 8, 2026
232363d
refactor(lr): separate production force and validation helpers
maki49 Oct 8, 2026
6ff2094
fix(lr): apply BSE singlet weighting once and cover nspin one
maki49 Oct 8, 2026
e28cff8
refactor(lr): reuse gradient inputs in EDM W and Z interfaces
maki49 Oct 8, 2026
1012d7f
fix(lr): correct amplitude offsets and stationary JT tracking
maki49 Oct 9, 2026
73ee3d0
fix(lr): use response XC kernel for quadratic gradient terms
maki49 Oct 9, 2026
8bec3f7
fix(lr): isolate electronic EXX state while sharing geometry tensors
maki49 Oct 9, 2026
58cafa6
fix(lr): reject unsupported NLCC forces and relaxation
maki49 Oct 9, 2026
ca201a4
fix(lr): preserve signed sigma for non-HSE kernels
maki49 Oct 9, 2026
413b786
fix(lr): track roots with distributed cross-geometry overlaps
maki49 Oct 9, 2026
a055dd8
fix(lr): track degenerate subspaces and preserve the actual JT branch
maki49 Oct 9, 2026
40bcc10
test(lr): cover degenerate relaxation and enable CI XC gradients
maki49 Oct 9, 2026
b143939
Merge origin/develop into LR-Grad-relax
maki49 Oct 9, 2026
aaf7da8
Merge origin/develop into LR-Grad-relax
maki49 Oct 10, 2026
cc578ff
fix(lr): report resolved KS band counts in initialization log
maki49 Oct 10, 2026
a70cc80
Merge branch 'develop' into LR-Grad-relax
maki49 Oct 10, 2026
c62bc3a
fix(lr): check runtime LibXC KXC availability for gradients
maki49 Oct 10, 2026
9f39177
Merge remote-tracking branch 'my/LR-Grad-relax' into LR-Grad-relax
maki49 Oct 10, 2026
a546107
Merge origin/develop and adapt LR cube output API
maki49 Oct 10, 2026
ae1f3f2
refactor(lr): clarify state tracking names and orthonormality warning
maki49 Oct 10, 2026
8a2c449
refactor(lr): split ESolver initialization and orbital setup
maki49 Oct 10, 2026
8b86aa7
Merge origin/develop and adapt relocated LR initialization
maki49 Oct 10, 2026
fd32f16
fix(test): adapt overlap fixtures to UnitCell vector maps
maki49 Oct 10, 2026
c0f7c5b
fix(lr): align distributed root projection for arbitrary block sizes
maki49 Oct 11, 2026
9485c68
refactor(lr): construct only occupied and virtual MO overlap blocks
maki49 Oct 11, 2026
09691ff
Merge origin/develop and refresh LR references after AO spline fix
maki49 Oct 11, 2026
0e53a65
Merge branch 'develop' into LR-Grad-relax
mohanchen Oct 13, 2026
61f310e
Refactor LR integration collectors and rename state tracking references
maki49 Oct 13, 2026
02f96c1
Merge remote-tracking branch 'my/LR-Grad-relax' into LR-Grad-relax
maki49 Oct 13, 2026
1878539
Merge remote-tracking branch 'origin/develop' into LR-Grad-relax
maki49 Oct 13, 2026
ab811c9
Merge remote-tracking branch 'origin/develop' into LR-Grad-relax
maki49 Oct 14, 2026
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
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,41 @@ jobs:
./scripts/stage4/install_stage4.sh
cd ..

# Keep the image's LibXC version: only enable the KXC needed by LR gradients.
- name: Identify LibXC version
id: libxc
run: echo "version=$(pkg-config --modversion libxc)" >> "${GITHUB_OUTPUT}"

- name: Cache LibXC with KXC
id: libxc-cache
uses: actions/cache@v6
with:
path: toolchain/install/libxc-kxc
key: libxc-kxc-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.compiler.outputs.fingerprint }}-${{ steps.libxc.outputs.version }}

- name: Build LibXC with KXC
if: steps.libxc-cache.outputs.cache-hit != 'true'
env:
LIBXC_VERSION: ${{ steps.libxc.outputs.version }}
run: |
wget -q "https://gitlab.com/libxc/libxc/-/archive/${LIBXC_VERSION}/libxc-${LIBXC_VERSION}.tar.gz" -O /tmp/libxc-kxc.tar.gz
mkdir -p /tmp/libxc-kxc-source
tar -xzf /tmp/libxc-kxc.tar.gz --strip-components=1 -C /tmp/libxc-kxc-source
cmake -S /tmp/libxc-kxc-source -B /tmp/libxc-kxc-build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/toolchain/install/libxc-kxc" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON -DENABLE_FORTRAN=OFF -DBUILD_TESTING=OFF \
-DDISABLE_KXC=OFF -DDISABLE_LXC=ON
cmake --build /tmp/libxc-kxc-build -j8
cmake --install /tmp/libxc-kxc-build

- name: Use KXC-enabled LibXC at runtime
run: echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/toolchain/install/libxc-kxc/lib:${LD_LIBRARY_PATH:-}" >> "${GITHUB_ENV}"

- name: Test LR excited-state tracking checker
run: python3 tests/integrate/validation_tools/test_es_check.py

- name: Configure
run: |
source toolchain/install/setup
Expand All @@ -91,6 +126,7 @@ jobs:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DENABLE_MLALGO=ON \
-DENABLE_LIBXC=ON \
-DLibxc_DIR="${GITHUB_WORKSPACE}/toolchain/install/libxc-kxc/share/cmake/Libxc" \
-DENABLE_LIBRI=ON \
-DENABLE_GOOGLEBENCH=OFF \
-DENABLE_JSON=ON \
Expand Down
27 changes: 26 additions & 1 deletion source/Makefile.Objects
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ ${OBJS_DELTASPIN}\
${OBJS_TENSOR}\
${OBJS_HSOLVER_PEXSI}\
${OBJS_LR}\
${OBJS_LR_GRAD}\
${OBJS_RDMFT}

OBJS_MAIN=main.o\
Expand Down Expand Up @@ -445,6 +446,7 @@ OBJS_HAMILT_LCAO=hamilt_lcao.o\
nonlocal_dh.o\
nonlocal_fs.o\
overlap.o\
ovlp_block.o\
overlap_fs.o\
td_ekinetic_lcao.o\
td_nonlocal_lcao.o\
Expand Down Expand Up @@ -857,6 +859,7 @@ OBJS_MODULE_RI=conv_coulomb_pot_k.o\
symm_rot_out.o\
gaussian_abfs.o\
exx_lri_detail.o\
exx_lr_ws.o\
ri_util.o\
rpa_lri.o\
rpa_lri_detail.o\
Expand Down Expand Up @@ -1063,7 +1066,6 @@ OBJS_TENSOR=tensor.o\
refcount.o

OBJS_LR=lr_util.o\
lr_util_hcontainer.o\
utils/lr_io.o\
utils/exciton_plotter.o\
ao_to_mo_parallel.o\
Expand All @@ -1077,8 +1079,31 @@ OBJS_TENSOR=tensor.o\
lr_spectrum.o\
lr_spectrum_velocity.o\
hamilt_casida.o\
esolver_lr_orb.o\
esolver_lr_init.o\
esolver_lr_cfg.o\
esolver_lr_lcao_tddft.o\

OBJS_LR_GRAD=lr_force.o\
xc_kxc.o\
lr_force_aux.o\
grad_degen.o\
state_group.o\
state_track.o\
state_ovlp.o\
grad_jt.o\
gradient_output.o\
lr_grad_cs.o\
lr_grad_os.o\
exx_proj.o\
cvcx_serial.o\
cvcx_par.o\
cal_edm.o\
zeqlin_solv.o\
pot_grad_xc.o\
esolver_lr_grad.o\
esolver_lr_rlx.o\

OBJS_RDMFT=rdmft.o\
rdmft_tools.o\
rdmft_pot.o\
Expand Down
17 changes: 16 additions & 1 deletion source/source_base/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ matrix::matrix( matrix && m_in )
matrix& matrix::operator=( const matrix & m_in )
{
this->create( m_in.nr, m_in.nc, false );
memcpy( c, m_in.c, nr*nc*sizeof(double) );
// `create` leaves `c` null for an empty matrix, and memcpy's arguments are declared
// non-null even for a zero count -- so assigning an empty matrix is undefined behaviour.
if( nr && nc )
{
memcpy( c, m_in.c, nr*nc*sizeof(double) );
}
return *this;
}

Expand Down Expand Up @@ -157,6 +162,16 @@ void matrix::create( const int nrow, const int ncol, const bool flag_zero )
}
}

/* Unary minus*/
matrix operator-(const matrix& m1)
{
matrix tm(m1);
const int size = m1.nr * m1.nc;
for (int i = 0; i < size; i++)
tm.c[i] = -tm.c[i];
return tm;
}

/* Adding matrices, as a friend */
matrix operator+(const matrix &m1, const matrix &m2)
{
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class matrix
using type=double; // Peize Lin add 2022.08.08 for template
};


matrix operator-(const matrix& m1); // unary minus
matrix operator+(const matrix &m1, const matrix &m2);
matrix operator-(const matrix &m1, const matrix &m2);
matrix operator*(const matrix &m1, const matrix &m2);
Expand Down
3 changes: 3 additions & 0 deletions source/source_base/module_external/blacs_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ extern "C"

void Czgebs2d(int ConTxt, char *scope, char *top, int m, int n, std::complex<double> *A, int lda);
void Czgebr2d(int ConTxt, char *scope, char *top, int m, int n, std::complex<double> *A, int lda, int rsrc, int csrc);

// element-wise sum over `scope`; rdest = -1 leaves the result on every process
void Cigsum2d(int ConTxt, char *scope, char *top, int m, int n, int *A, int lda, int rdest, int cdest);
}

// unified interface for broadcast
Expand Down
41 changes: 41 additions & 0 deletions source/source_base/module_external/scalapack_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ extern "C"
int *ipiv, std::complex<double>* B, const int* ib, const int* jb, const int*descb, const int *info
);

void pdgesv_(
const int *n, const int *nrhs,
double *A, const int *ia, const int *ja, const int *desca,
int *ipiv, double* B, const int* ib, const int* jb, const int*descb, int *info
);

void pdpotrs_(const char* uplo, const int* n, const int* nrhs,
const double* A, const int* ia, const int* ja, const int* desca,
double* B, const int* ib, const int* jb, const int* descb, int* info);

void pzpotrs_(const char* uplo, const int* n, const int* nrhs,
const std::complex<double>* A, const int* ia, const int* ja, const int* desca,
std::complex<double>* B, const int* ib, const int* jb, const int* descb, int* info);

void pdsygvx_(const int* itype, const char* jobz, const char* range, const char* uplo,
const int* n, double* A, const int* ia, const int* ja, const int*desca, double* B, const int* ib, const int* jb, const int*descb,
const double* vl, const double* vu, const int* il, const int* iu,
Expand Down Expand Up @@ -396,6 +410,33 @@ class ScalapackConnector
pzgesv_(&n, &nrhs, A, &ia, &ja, desca, ipiv, B, &ib, &jb, descb, info);
}

static inline
void gesv(
const int n, const int nrhs,
double *A, const int ia, const int ja, const int *desca,
int *ipiv, double* B, const int ib, const int jb, const int*descb, int *info)
{
pdgesv_(&n, &nrhs, A, &ia, &ja, desca, ipiv, B, &ib, &jb, descb, info);
}

static inline
void potrs(
const char uplo, const int n, const int nrhs,
const double* A, const int ia, const int ja, const int* desca,
double* B, const int ib, const int jb, const int* descb, int* info)
{
pdpotrs_(&uplo, &n, &nrhs, A, &ia, &ja, desca, B, &ib, &jb, descb, info);
}

static inline
void potrs(
const char uplo, const int n, const int nrhs,
const std::complex<double>* A, const int ia, const int ja, const int* desca,
std::complex<double>* B, const int ib, const int jb, const int* descb, int* info)
{
pzpotrs_(&uplo, &n, &nrhs, A, &ia, &ja, desca, B, &ib, &jb, descb, info);
}

static inline
void tranu(
const int m, const int n,
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/parallel_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Parallel_Grid
int get_nz() const { return ncz; }
int get_nrxx() const { return nrxx; }

private:
private:

void z_distribution(const int kpar);

Expand Down
5 changes: 5 additions & 0 deletions source/source_esolver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ if(ENABLE_LCAO)
list(APPEND objects
esolver_ks_lcao.cpp
esolver_ks_lcao_tddft.cpp
esolver_lr_orb.cpp
esolver_lr_init.cpp
esolver_lr_cfg.cpp
esolver_lr_lcao_tddft.cpp
esolver_lr_grad.cpp
esolver_lr_rlx.cpp
esolver_gets.cpp
lcao_others.cpp
esolver_dm2rho.cpp
Expand Down
Loading
Loading