Skip to content

Commit

Permalink
Fix typos in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ssahoo41 committed Sep 1, 2023
1 parent 70b4e33 commit ae0e5e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
5 changes: 0 additions & 5 deletions src/convolutional_gga/ConvolutionalGGAexchangeCorrelation.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,6 @@ void Calculate_Vc_GGA_CONV_PBE(SPARC_OBJ *pSPARC, XCCST_OBJ *xc_cst, double *rho
rhotmo6 = sqrt(rhom1_3);
rhoto6 = rho[i] * rhom1_3 * rhom1_3 * rhotmo6;

// First take care of the exchange part of the functional
rhomot = rho_updnm1_3;
// Perdew-Burke-Ernzerhof GGA, exchange part
rho_inv = rhomot * rhomot * rhomot;

// Then takes care of the LSD correlation part of the functional
rs = xc_cst->rsfac * rhom1_3;
sqr_rs = xc_cst->sq_rsfac * rhotmo6;
Expand Down
8 changes: 2 additions & 6 deletions src/convolutional_gga/convolutionalGGAMultipoleXC.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void Calculate_Vxc_GGA_CONV_PBE_MULTIPOLE(SPARC_OBJ *pSPARC, XCCST_OBJ *xc_cst,

// Next steps:
// 1. Dxdgrho transformation part- for non-orthogonal cells (is it required for features)
// 2. Forces, stress and pressure calculation using multipole features
// 2. Stress and pressure calculation using multipole features

/**
* @brief function to calculate exchange potential for PBEq where the additional terms for potential
Expand Down Expand Up @@ -136,7 +136,6 @@ void Calculate_Vx_GGA_CONV_PBE_MULTIPOLE(SPARC_OBJ *pSPARC, XCCST_OBJ *xc_cst, d
// memory allocation for global variables
int gridsizes[3] = {pSPARC->Nx, pSPARC->Ny, pSPARC->Nz};
global_rho = (double *) malloc(pSPARC->Nd * sizeof(double));
global_sigma = (double *) malloc(pSPARC->Nd * sizeof(double));
global_Df_featmp = (double *) malloc(pSPARC->Nd * sizeof(double));

// gathering distributed rho vector into global vector and broadcast to all processors
Expand Down Expand Up @@ -491,7 +490,7 @@ void Calculate_Vx_GSGA_CONV_PBE_MULTIPOLE(SPARC_OBJ *pSPARC, XCCST_OBJ *xc_cst,
Dxdgrho[spn_i*DMnd + i] = ex_lsd * rho_updn * dfxdg; // spin up and spin down for second part of the derivative
ex += ex_gga * rho_updn;
// Df_alpha = -xc_cst->kappa * pow(divss, alpha[spn_i*DMnd + i])*(-log(1/divss) + (divss/alpha[spn_i*DMnd + i]));
// Dalpha_qp = - (4.0 * m)/(2.0 + exp(-m * (feat_qp_monopole[spn_i*DMnd + i]-n)) + exp(m*(feat_qp_monopole[spn_i*DMnd + i]-n)));
// Dalpha_qp = - ((4.0 - 0.75) * m)/(2.0 + exp(-m * (feat_qp_monopole[spn_i*DMnd + i]-n)) + exp(m*(feat_qp_monopole[spn_i*DMnd + i]-n)));
// Dfeat_qp_mp[spn_i*DMnd+i] = ex_lsd * rho_updn * Df_alpha * Dalpha_qp;
}
e_x[i] = ex * rhotot_inv;
Expand Down Expand Up @@ -577,10 +576,7 @@ void Construct_alpha(SPARC_OBJ *pSPARC, const double *featureVector, const doubl
double *global_alpha;
int Nd = pSPARC->Nd;
global_alpha = (double *) malloc(Nd * sizeof(double));
int rank;
int gridsizes[3] = {pSPARC->Nx, pSPARC->Ny, pSPARC->Nz};

MPI_Comm_rank(MPI_COMM_WORLD, &rank);
for (int i = 0; i < DMnd; i++){
alpha[i] = 0.75 + ((4.0-0.75)/(1.0+exp(m*(featureVector[i] - n))));
// alpha[i] = 0.52; //// comment out this line for constant alpha calculations
Expand Down
36 changes: 18 additions & 18 deletions src/multipole_features/MCSHDescriptorMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ void taskPartition_RadialLegendre(const int length, const double rCutoff, const
if (rank == 0) printf("after calc total score, total score: %f\n", totalScore);
#endif

double currentTotal = 0, currentRemaindingScore = totalScore;
int currentRemaindingComm = numParallelComm, currentComm = 0;
double currentTargetScore = currentRemaindingScore/currentRemaindingComm;
double currentTotal = 0, currentRemainingScore = totalScore;
int currentRemainingComm = numParallelComm, currentComm = 0;
double currentTargetScore = currentRemainingScore/currentRemainingComm;

#ifdef DEBUG
if (rank == 0) printf("step -1, currentTotal: %f, currentRemaindingScore: %f, currentRemaindingComm: %d, currentComm: %d, currentTargetScore: %f \n", currentTotal, currentRemaindingScore, currentRemaindingComm, currentComm, currentTargetScore);
if (rank == 0) printf("step -1, currentTotal: %f, currentRemainingScore: %f, currentRemainingComm: %d, currentComm: %d, currentTargetScore: %f \n", currentTotal, currentRemainingScore, currentRemainingComm, currentComm, currentTargetScore);
#endif

for (i = 0; i < length; i++){
Expand All @@ -59,15 +59,15 @@ void taskPartition_RadialLegendre(const int length, const double rCutoff, const
#endif
if (currentTotal >= currentTargetScore ){
currentComm++;
currentRemaindingScore -= currentTotal;
currentRemaindingComm--;
currentRemainingScore -= currentTotal;
currentRemainingComm--;
currentTotal = 0;
if (currentRemaindingScore != 0){
currentTargetScore = currentRemaindingScore/currentRemaindingComm;
if (currentRemainingScore != 0){
currentTargetScore = currentRemainingScore/currentRemainingComm;
}
}
#ifdef DEBUG
if (rank == 0) printf("step %d, currentTotal: %f, currentRemaindingScore: %f, currentRemaindingComm: %d, currentComm: %d, currentTargetScore: %f \n", i, currentTotal, currentRemaindingScore, currentRemaindingComm, currentComm, currentTargetScore);
if (rank == 0) printf("step %d, currentTotal: %f, currentRemainingScore: %f, currentRemainingComm: %d, currentComm: %d, currentTargetScore: %f \n", i, currentTotal, currentRemainingScore, currentRemainingComm, currentComm, currentTargetScore);
#endif
}
#ifdef DEBUG
Expand All @@ -93,12 +93,12 @@ void taskPartition_RadialRStep(const int length, const double *rCutoffList, cons
if (rank == 0) printf("after calc total score, total score: %f\n", totalScore);
#endif

double currentTotal = 0, currentRemaindingScore = totalScore;
int currentRemaindingComm = numParallelComm, currentComm = 0;
double currentTargetScore = currentRemaindingScore/currentRemaindingComm;
double currentTotal = 0, currentRemainingScore = totalScore;
int currentRemainingComm = numParallelComm, currentComm = 0;
double currentTargetScore = currentRemainingScore/currentRemainingComm;

#ifdef DEBUG
if (rank == 0) printf("step -1, currentTotal: %f, currentRemaindingScore: %f, currentRemaindingComm: %d, currentComm: %d, currentTargetScore: %f \n", currentTotal, currentRemaindingScore, currentRemaindingComm, currentComm, currentTargetScore);
if (rank == 0) printf("step -1, currentTotal: %f, currentRemainingScore: %f, currentRemainingComm: %d, currentComm: %d, currentTargetScore: %f \n", currentTotal, currentRemainingScore, currentRemainingComm, currentComm, currentTargetScore);
#endif

for (i = 0; i < length; i++){
Expand All @@ -109,16 +109,16 @@ void taskPartition_RadialRStep(const int length, const double *rCutoffList, cons
#endif
if (currentTotal >= currentTargetScore ){
currentComm++;
currentRemaindingScore -= currentTotal;
currentRemaindingComm--;
currentRemainingScore -= currentTotal;
currentRemainingComm--;
currentTotal = 0;
if (currentRemaindingScore != 0){
currentTargetScore = currentRemaindingScore/currentRemaindingComm;
if (currentRemainingScore != 0){
currentTargetScore = currentRemainingScore/currentRemainingComm;
}

}
#ifdef DEBUG
if (rank == 0) printf("step %d, currentTotal: %f, currentRemaindingScore: %f, currentRemaindingComm: %d, currentComm: %d, currentTargetScore: %f \n", i, currentTotal, currentRemaindingScore, currentRemaindingComm, currentComm, currentTargetScore);
if (rank == 0) printf("step %d, currentTotal: %f, currentRemainingScore: %f, currentRemainingComm: %d, currentComm: %d, currentTargetScore: %f \n", i, currentTotal, currentRemainingScore, currentRemainingComm, currentComm, currentTargetScore);
#endif
}
#ifdef DEBUG
Expand Down

0 comments on commit ae0e5e5

Please sign in to comment.