Skip to content

Commit 4077abe

Browse files
author
Shubhang Krishnakant Trivedi
committed
Fixed_SPARC_Warnings
1 parent 65e3ca7 commit 4077abe

41 files changed

Lines changed: 582 additions & 410 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
-changes
55

66
--------------
7-
April 06, 2026
7+
April 08, 2026
88
Name: Shubhang Krishnakant Trivedi
99
Changes: (src/md.c, src/initialization.c, src/readfiles.c, src/include/md.h, src/include/isddft.h)
1010
1. Extended the functionality of NPT_NP QMD for doing full cell flexibility (including changing of cell angles).
1111
2. Added the NPH (isobaric-isoenthalpic) ensemble in QMD with allowing full cell flexibility.
12-
3. Updated the manual regarding the same.
13-
4. Added extra tests corresponding to the same.
12+
3. Updated the manual and added extra tests corresponding to the same.
13+
4. Fixed warnings in the SPARC compilation occuring when using first 3 compile options.
1414

1515
--------------
1616
December 03, 2025

src/atom/electronicGroundStateAtom.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void electronicGroundState_atom(SPARC_ATOM_OBJ *pSPARC_ATOM){
9999
if (pSPARC_ATOM->usefock) pSPARC_ATOM->usefock++;
100100

101101
if (pSPARC_ATOM->usefock > 0) {
102-
int countExx = 0; double exx_error;
102+
int countExx = 0; double exx_error = 1;
103103
double *denMatPrev = (double *)malloc((Nd-1)*(Nd-1)*sizeof(double));
104104
double *denMat = (double *)malloc((Nd-1)*(Nd-1)*sizeof(double));
105105

@@ -407,7 +407,7 @@ void Calculate_Vxc_atom(SPARC_ATOM_OBJ *pSPARC_ATOM){
407407
int Nd = pSPARC_ATOM->Nd;
408408
int sz = ncol * (Nd - 1); // first and last points are not needed
409409
double *rho = (double *)malloc(sz * sizeof(double));
410-
double *r_rho, *sigma, *Drho, *tau;
410+
double *r_rho, *sigma, *Drho, *tau = NULL;
411411
r_rho = sigma = Drho = NULL;
412412
double *D = NULL;
413413

@@ -843,7 +843,7 @@ void scfLoopAtom(SPARC_ATOM_OBJ *pSPARC_ATOM) {
843843
int val_len = pSPARC_ATOM->val_len;
844844
int min_l = pSPARC_ATOM->min_l;
845845
int max_l = pSPARC_ATOM->max_l;
846-
int no_orb_per_l;
846+
int no_orb_per_l = 0;
847847

848848
// Allocate memory for eigenvectors/eigenvalues
849849
double *eigvecs = (double *)malloc(col*(Nd - 1)*(Nd - 1)*sizeof(double));

src/atom/exx_atom/exxPotentialEnergyAtom.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void evaluateExxPotentialAtom(SPARC_ATOM_OBJ *pSPARC_ATOM, int l, double spin, d
5959
double *int_scale = pSPARC_ATOM->int_scale;
6060
int val_len = pSPARC_ATOM->val_len;
6161
int *occ = pSPARC_ATOM->occ;
62-
int *orbital_l = pSPARC_ATOM->orbital_l;
62+
//int *orbital_l = pSPARC_ATOM->orbital_l;
6363

6464
// Copy \tilde{R}_{nl} = r*R_{nl} into orbitals
6565
double *orbitals = (double *)malloc(nspinor*val_len*(Nd-1)*sizeof(double));
@@ -208,11 +208,11 @@ void evaluateExxEnergyAtom(SPARC_ATOM_OBJ *pSPARC_ATOM, double *Exx) {
208208
int Nd = pSPARC_ATOM->Nd;
209209
int nspinor = pSPARC_ATOM->nspinor;
210210
double *w = pSPARC_ATOM->w;
211-
double *r = pSPARC_ATOM->r;
211+
// double *r = pSPARC_ATOM->r;
212212
double *int_scale = pSPARC_ATOM->int_scale;
213213
int val_len = pSPARC_ATOM->val_len;
214214
int *occ = pSPARC_ATOM->occ;
215-
int *orbital_l = pSPARC_ATOM->orbital_l;
215+
// int *orbital_l = pSPARC_ATOM->orbital_l;
216216

217217
// Copy \tilde{R}_{nl} = r*R_{nl} into orbitals
218218
double *orbitals = (double *)malloc(nspinor*val_len*(Nd-1)*sizeof(double));
@@ -230,7 +230,7 @@ void evaluateExxEnergyAtom(SPARC_ATOM_OBJ *pSPARC_ATOM, double *Exx) {
230230

231231
int jstart, jstop;
232232
double *orbital;
233-
double wigner_const;
233+
// double wigner_const;
234234
double *wt_orbital = (double *)malloc(sizeof(double)*(Nd - 1));
235235
for (int i = lmin; i <= lmax; i++) {
236236
// store the start and stop indices

src/atom/exx_atom/exxToolsAtom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void densityMatrix(SPARC_ATOM_OBJ *pSPARC_ATOM, double *denMat) {
5151
int Nd = pSPARC_ATOM->Nd;
5252
int nspinor = pSPARC_ATOM->nspinor;
5353
double *w = pSPARC_ATOM->w;
54-
double *r = pSPARC_ATOM->r;
54+
//double *r = pSPARC_ATOM->r;
5555
double *int_scale = pSPARC_ATOM->int_scale;
5656
int val_len = pSPARC_ATOM->val_len;
5757
int *occ = pSPARC_ATOM->occ;

src/atom/finalizeAtom.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
* @brief Print eigenvalues and energy.
1515
*/
1616
void printResultsAtom(SPARC_ATOM_OBJ *pSPARC_ATOM) {
17-
char filename[64];
18-
int Z = *pSPARC_ATOM->Zatom;
17+
// char filename[64];
18+
//int Z = *pSPARC_ATOM->Zatom;
1919
int Nd = pSPARC_ATOM->Nd;
2020

2121
int lcount0 = pSPARC_ATOM->lcount0;
@@ -361,12 +361,12 @@ void copyAtomSolution(SPARC_ATOM_OBJ *pSPARC_ATOM, SPARC_OBJ *pSPARC, int ityp)
361361

362362
int Nd = pSPARC_ATOM->Nd;
363363
double *r = pSPARC_ATOM->r;
364-
double *orb = pSPARC_ATOM->orbitals;
364+
//double *orb = pSPARC_ATOM->orbitals;
365365
int val_len = pSPARC_ATOM->val_len;
366366
int nspinor = pSPARC_ATOM->nspinor;
367367
int orb_size = (Nd)*val_len*nspinor;
368368
int max_l = pSPARC_ATOM->max_l;
369-
int min_l = pSPARC_ATOM->min_l;
369+
//int min_l = pSPARC_ATOM->min_l;
370370
// allocate memory
371371
pSPARC->AtmU[ityp].orbitals = (double *)malloc(orb_size*sizeof(double));
372372
pSPARC->AtmU[ityp].RadialGrid = (double *)calloc((Nd),sizeof(double));

src/atom/initializationAtom.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ void xc_decomposition_atom(SPARC_ATOM_OBJ *pSPARC_ATOM) {
474474
}
475475

476476
void Calculate_SplineDerivRadFun_atom(SPARC_ATOM_OBJ *pSPARC_ATOM){
477-
int ityp, l, lcount, lcount2, np, ppl_sum, psd_len;
477+
//int ityp;
478+
int l, lcount, lcount2, np, ppl_sum, psd_len;
478479
int lloc = *pSPARC_ATOM->localPsd;
479480
psd_len = pSPARC_ATOM->psd->size;
480481
pSPARC_ATOM->psd->SplinerVlocD = (double *)malloc(sizeof(double)*psd_len);

src/atom/mgga_atom/mGGApotentialAtom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
void mGGA_hamiltonian_term(SPARC_ATOM_OBJ *pSPARC_ATOM, int l, double spin, double *VmGGA) {
1919
int Nd = pSPARC_ATOM->Nd;
20-
int nspinor = pSPARC_ATOM->nspinor;
20+
//int nspinor = pSPARC_ATOM->nspinor;
2121
double *r = pSPARC_ATOM->r;
2222
double *V3;
2323

src/gradVecRoutines.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void Gradient_vec_dir(const SPARC_OBJ *pSPARC, const int DMnd, const int *DMVert
105105
int nbrcount, nbr_i;
106106

107107
MPI_Request request;
108-
double *x_in, *x_out;
108+
double *x_in = NULL, *x_out = NULL;
109109

110110
if(nproc > 1){
111111
int nd_in = ncol * pSPARC->order * (isDir[0] * DMny * DMnz + DMnx * isDir[1] * DMnz + DMnxny * isDir[2]);

src/highT/sqHighT.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void GaussQuadrature_highT(SPARC_OBJ *pSPARC, int SCFCount) {
5555
int nd, rank;
5656
int *nloc, DMnx, DMny, DMnz, DMnd;
5757
int Nx_loc, Ny_loc;
58-
double lambda_min, lambda_max, lambda_min_MIN, lambda_max_MAX, x1, x2, *t0;
58+
double lambda_min, lambda_max, *t0;
5959
double time1, time2;
6060
SQ_OBJ *pSQ = pSPARC->pSQ;
6161

@@ -64,6 +64,11 @@ void GaussQuadrature_highT(SPARC_OBJ *pSPARC, int SCFCount) {
6464
DMny = pSQ->DMny_SQ;
6565
DMnz = pSQ->DMnz_SQ;
6666
DMnd = pSQ->DMnd_SQ;
67+
68+
(void)DMnx;
69+
(void)DMny;
70+
(void)DMnz;
71+
6772
Nx_loc = pSQ->Nx_loc;
6873
Ny_loc = pSQ->Ny_loc;
6974
MPI_Comm_rank(pSQ->dmcomm_SQ, & rank);

src/highT/sqHighTDensity.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ void calculate_density_matrix_SQ_highT(SPARC_OBJ *pSPARC)
6666
if (pSQ->dmcomm_SQ == MPI_COMM_NULL) return;
6767

6868
int DMnd = pSQ->DMnd_SQ;
69-
int *nloc = pSQ->nloc;
70-
int Nx_loc = pSQ->Nx_loc;
71-
int Ny_loc = pSQ->Ny_loc;
72-
int Nd_loc = pSQ->Nd_loc;
73-
int NxNy_loc = Nx_loc*Ny_loc;
74-
int center = nloc[0] + nloc[1]*Nx_loc + nloc[2]*NxNy_loc;
75-
int flag_exxPot = (pSPARC->usefock > 0) && (pSPARC->usefock % 2 == 0)
76-
&& (pSPARC->ExxAcc == 1) && (pSPARC->SQ_highT_hybrid_gauss_mem == 0);
69+
//int *nloc = pSQ->nloc;
70+
//int Nx_loc = pSQ->Nx_loc;
71+
//int Ny_loc = pSQ->Ny_loc;
72+
//int Nd_loc = pSQ->Nd_loc;
73+
//int NxNy_loc = Nx_loc*Ny_loc;
74+
//int center = nloc[0] + nloc[1]*Nx_loc + nloc[2]*NxNy_loc;
75+
//int flag_exxPot = (pSPARC->usefock > 0) && (pSPARC->usefock % 2 == 0) && (pSPARC->ExxAcc == 1) && (pSPARC->SQ_highT_hybrid_gauss_mem == 0);
7776

7877
for (int nd = 0; nd < DMnd; nd++) {
7978
// Already saved

0 commit comments

Comments
 (0)