Skip to content

Commit

Permalink
Merge pull request #198 from YaphetS-jx/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
phanish-suryanarayana authored Sep 23, 2023
2 parents e128382 + 0c4b626 commit aff9ef8
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 22 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
-Name
-changes

--------------
Sep 23, 2023
Name: Xin Jing
Changes: (eigenSolver.c, eigenSolverKpt.c, force.c, stress.c, pressure.c)
1. changes for GPU hooks
2. fix bug in exact exchange energy density

--------------
Sep 22, 2023
Name: Qimen Xu, Ziao Tang, Yu Zhang
Expand Down
12 changes: 6 additions & 6 deletions src/eigenSolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ void CheFSI(SPARC_OBJ *pSPARC, double lambda_cutoff, double *x0, int count, int
} else {
#endif
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->usefock <=1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->usefock <=1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_ChebyshevFiltering(pSPARC, pSPARC->DMVertices_dmcomm, pSPARC->Xorb + spn_i*size_s,
pSPARC->Yorb, pSPARC->Nband_bandcomm,
pSPARC->ChebDegree, lambda_cutoff, pSPARC->eigmax[spn_i], pSPARC->eigmin[spn_i], k, spn_i,
pSPARC->dmcomm);
ACCEL_ChebyshevFiltering(pSPARC, pSPARC->DMVertices_dmcomm, pSPARC->Xorb + spn_i*DMnd, DMndsp,
pSPARC->Yorb + spn_i*DMnd, DMndsp, pSPARC->Nband_bandcomm,
pSPARC->ChebDegree, lambda_cutoff, pSPARC->eigmax[spn_i], pSPARC->eigmin[spn_i], k, spn_i,
pSPARC->dmcomm);
}
else
#endif // SPARCX_ACCEL
Expand Down Expand Up @@ -951,7 +951,7 @@ void DP_Project_Hamiltonian(SPARC_OBJ *pSPARC, int *DMVertices, double *Y, int l
double *Veff_loc_sg = pSPARC->Veff_loc_dmcomm + sg * pSPARC->Nd_d_dmcomm;
st = MPI_Wtime();
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->usefock <=1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->usefock <=1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
}
else
Expand Down
12 changes: 6 additions & 6 deletions src/eigenSolverKpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ void CheFSI_kpt(SPARC_OBJ *pSPARC, double lambda_cutoff, double _Complex *x0, in
t1 = MPI_Wtime();

#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->usefock <=1 && pSPARC->SOC_Flag == 0 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->usefock <=1 && pSPARC->SOC_Flag == 0 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_ChebyshevFiltering_kpt(pSPARC, pSPARC->DMVertices_dmcomm, pSPARC->Xorb_kpt + kpt*size_k + spn_i*DMnd,
pSPARC->Yorb_kpt, pSPARC->Nband_bandcomm,
pSPARC->ChebDegree, lambda_cutoff, pSPARC->eigmax[spn_i*pSPARC->Nkpts_kptcomm + kpt], pSPARC->eigmin[spn_i*pSPARC->Nkpts_kptcomm + kpt], kpt, spn_i,
pSPARC->dmcomm);
ACCEL_ChebyshevFiltering_kpt(pSPARC, pSPARC->DMVertices_dmcomm, pSPARC->Xorb_kpt + kpt*size_k + spn_i*DMnd, DMndsp,
pSPARC->Yorb_kpt + spn_i*DMnd, DMndsp, pSPARC->Nband_bandcomm,
pSPARC->ChebDegree, lambda_cutoff, pSPARC->eigmax[spn_i*pSPARC->Nkpts_kptcomm + kpt], pSPARC->eigmin[spn_i*pSPARC->Nkpts_kptcomm + kpt], kpt, spn_i,
pSPARC->dmcomm);
}
else
#endif // SPARCX_ACCEL
Expand Down Expand Up @@ -690,7 +690,7 @@ void DP_Project_Hamiltonian_kpt(SPARC_OBJ *pSPARC, int *DMVertices, double _Comp
double *Veff_loc_sg = pSPARC->Veff_loc_dmcomm + sg * pSPARC->Nd_d_dmcomm;
st = MPI_Wtime();
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->usefock <=1 && pSPARC->SOC_Flag == 0 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->usefock <=1 && pSPARC->SOC_Flag == 0 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
}
else
Expand Down
4 changes: 2 additions & 2 deletions src/forces.c
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ void Calculate_nonlocal_forces(SPARC_OBJ *pSPARC)
Calculate_nonlocal_forces_SQ(pSPARC);
} else if (pSPARC->isGammaPoint) {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_forces_linear(pSPARC);
} else
Expand All @@ -737,7 +737,7 @@ void Calculate_nonlocal_forces(SPARC_OBJ *pSPARC)
}
} else {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_forces_kpt(pSPARC);
} else
Expand Down
2 changes: 1 addition & 1 deletion src/initialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -3338,7 +3338,7 @@ void write_output_init(SPARC_OBJ *pSPARC) {
}

fprintf(output_fp,"***************************************************************************\n");
fprintf(output_fp,"* SPARC (version Sept 22, 2023) *\n");
fprintf(output_fp,"* SPARC (version Sep 23, 2023) *\n");
fprintf(output_fp,"* Copyright (c) 2020 Material Physics & Mechanics Group, Georgia Tech *\n");
fprintf(output_fp,"* Distributed under GNU General Public License 3 (GPL) *\n");
fprintf(output_fp,"* Start time: %s *\n",c_time_str);
Expand Down
6 changes: 3 additions & 3 deletions src/pressure.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ void Calculate_nonlocal_pressure(SPARC_OBJ *pSPARC) {
Calculate_nonlocal_pressure_SQ(pSPARC);
} else if (pSPARC->isGammaPoint) {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_pressure_linear(pSPARC);
} else
Expand All @@ -784,9 +784,9 @@ void Calculate_nonlocal_pressure(SPARC_OBJ *pSPARC) {
}
} else {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_pressure_kpt_linear(pSPARC);
ACCEL_Calculate_nonlocal_pressure_kpt(pSPARC);
} else
#endif
{
Expand Down
4 changes: 2 additions & 2 deletions src/stress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ void Calculate_nonlocal_kinetic_stress(SPARC_OBJ *pSPARC) {
Calculate_nonlocal_kinetic_stress_SQ(pSPARC);
} else if (pSPARC->isGammaPoint) {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_kinetic_stress_linear(pSPARC);
} else
Expand All @@ -1072,7 +1072,7 @@ void Calculate_nonlocal_kinetic_stress(SPARC_OBJ *pSPARC) {
}
} else {
#ifdef SPARCX_ACCEL
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
if (pSPARC->useACCEL == 1 && pSPARC->cell_typ < 20 && pSPARC->spin_typ <= 1 && pSPARC->Nd_d_dmcomm == pSPARC->Nd)
{
ACCEL_Calculate_nonlocal_kinetic_stress_kpt(pSPARC);
} else
Expand Down
4 changes: 2 additions & 2 deletions src/xc/exx/exactExchangeEnergyDensity.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void computeExactExchangeEnergyDensity(SPARC_OBJ *pSPARC, double *Exxrho)
#endif
}

double vscal = 1.0 / pSPARC->dV * pSPARC->exx_frac;
double vscal = 1.0 / pSPARC->dV;
if (pSPARC->spin_typ == 0) {
for (i = 0; i < DMnd; i++) {
Exxrho[i] *= vscal;
Expand All @@ -170,6 +170,6 @@ void computeExactExchangeEnergyDensity(SPARC_OBJ *pSPARC, double *Exxrho)
}
Exx *= pSPARC->dV;
if (!rank) printf("\nExact exchange energy from energy density: %f\n"
"Exact exchange energy calculated directly: %f\n", Exx, pSPARC->exx_frac*pSPARC->Eexx);
"Exact exchange energy calculated directly: %f\n", Exx, pSPARC->Eexx);
#endif
}

0 comments on commit aff9ef8

Please sign in to comment.