Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code clean up, remove warnings and un-used variables #50

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ PATCH_LCLIN_DELETION
}

PATCH_LCLIN_SINGLE
bool Do_New = true; bool Do_Old = true;
if(MoveType == SINGLE_INSERTION) Do_Old = false;
if(MoveType == SINGLE_DELETION) Do_New = false;
if(SystemComponents.UseLCLin)
{
if(Do_New) DNN_New = Predict_From_FeatureMatrix_Move(Sims, SystemComponents, NEW);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ PATCH_ALLEGRO_DELETION
}

PATCH_ALLEGRO_SINGLE
bool Do_New = true; bool Do_Old = true;
if(MoveType == SINGLE_INSERTION) Do_Old = false;
if(MoveType == SINGLE_DELETION) Do_New = false;
if(SystemComponents.UseAllegro)
{
bool Initialize = false;
Expand Down
4 changes: 1 addition & 3 deletions src_clean/DNN_HostGuest_Energy_Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,13 @@ double DNN_Prediction_Move(Components& SystemComponents, Simulations& Sims, size
}
case TRANSLATION: case ROTATION: case SINGLE_INSERTION: case SINGLE_DELETION:
{
bool Do_New = true; bool Do_Old = true;
if(MoveType == SINGLE_INSERTION) Do_Old = false;
if(MoveType == SINGLE_DELETION) Do_New = false;
double DNN_New = 0.0; double DNN_Old = 0.0;
//###PATCH_ALLEGRO_SINGLE###//
//###PATCH_LCLIN_SINGLE###//
return DNN_New - DNN_Old;
}
}
return 0.0;
}

double DNN_Prediction_Reinsertion(Components& SystemComponents, Simulations& Sims, size_t SelectedComponent, double3* temp)
Expand Down
1 change: 0 additions & 1 deletion src_clean/axpy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ inline void RunMoves(int Cycle, Components& SystemComponents, Simulations& Sims,
throw std::runtime_error("There is negative number of adsorbates. Break program!");

size_t comp = 0; // When selecting components, skip the component 0 (because it is the framework)
size_t SelectedMolecule = 0;
size_t SelectedMolInComponent = 0;

size_t NumberOfImmobileFrameworkMolecules = 0; size_t ImmobileFrameworkSpecies = 0;
Expand Down
3 changes: 1 addition & 2 deletions src_clean/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "fxn_main.h"

#include <unistd.h>
// // // // // // // #include <limits.h>
// // // // // // // // // // #include <limits.h>

void printMemoryUsage()
{
Expand Down Expand Up @@ -327,7 +327,6 @@ int main(void)
////////////////
// RUN CYCLES //
////////////////
bool RunSerialSimulations = true;
double start = omp_get_wtime();

///////////////////////////
Expand Down
3 changes: 1 addition & 2 deletions src_clean/mc_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ void NVTGibbsMove(std::vector<Components>& SystemComponents, Simulations*& Sims,
//////////////////////
// TOTAL VDW + REAL //
//////////////////////
size_t Host_threads = 0; //In this move, there should be NO Framework Atom (Framework (component 0) should be an empty box)//
bool UseOffset = true;
bool UseOffset = true;
NewE[sim] = Total_VDW_Coulomb_Energy(Sims[sim], SystemComponents[sim], FF, UseOffset);
//Check for Overlaps//
cudaMemcpy(SystemComponents[sim].flag, Sims[sim].device_flag, sizeof(bool), cudaMemcpyDeviceToHost);
Expand Down
5 changes: 0 additions & 5 deletions src_clean/mc_cbcfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ static inline MoveEnergy CBCFMove(Components& SystemComponents, Simulations& Sim
double NMol = SystemComponents.NumberOfMolecule_for_Component[SelectedComponent];
if(SystemComponents.hasfractionalMolecule[SelectedComponent]) NMol--;

int MoveType;
double TMMCPacc = 0.0;

SystemComponents.Moves[SelectedComponent].CBCFTotal ++;
Expand Down Expand Up @@ -262,8 +261,6 @@ static inline MoveEnergy CBCFMove(Components& SystemComponents, Simulations& Sim
//////////////////
if(SelectednewBin > static_cast<int>(nbin))
{
MoveType = CBCF_INSERTION;

//return 0.0;
SystemComponents.Moves[SelectedComponent].CBCFInsertionTotal ++;
int newBin = SelectednewBin - static_cast<int>(nbin); //printf("INSERTION, newBin: %zu\n", newBin);
Expand Down Expand Up @@ -338,7 +335,6 @@ static inline MoveEnergy CBCFMove(Components& SystemComponents, Simulations& Sim
}
else if(SelectednewBin < 0) //Deletion Move//
{
MoveType = CBCF_DELETION;
//return 0.0; //for debugging
SystemComponents.Moves[SelectedComponent].CBCFDeletionTotal ++;
int newBin = SelectednewBin + nbin; //printf("DELETION, newBin: %zu\n", newBin);
Expand Down Expand Up @@ -424,7 +420,6 @@ static inline MoveEnergy CBCFMove(Components& SystemComponents, Simulations& Sim
}
else //Lambda Move//
{
MoveType = CBCF_LAMBDACHANGE;
SystemComponents.Moves[SelectedComponent].CBCFLambdaTotal ++;
int newBin = static_cast<size_t>(SelectednewBin); //printf("LAMBDACHANGE, newBin: %zu\n", newBin);
double newLambda = delta * static_cast<double>(newBin);
Expand Down
1 change: 0 additions & 1 deletion src_clean/mc_swap_moves.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ static inline MoveEnergy Deletion(Components& SystemComponents, Simulations& Sim
MoveEnergy energy;
double Rosenbluth = 0.0;
size_t UpdateLocation = 0;
int CBMCType = CBMC_DELETION; //Deletion//
double2 Scale = SystemComponents.Lambda[SelectedComponent].SET_SCALE(1.0); //Set scale for full molecule (lambda = 1.0), Zhao's note: This is not used in deletion, just set to 1//
//Wrapper for the deletion move//
energy = Deletion_Body(SystemComponents, Sims, FF, Random, Widom, SelectedMolInComponent, SelectedComponent, UpdateLocation, Rosenbluth, SuccessConstruction, preFactor, Scale);
Expand Down
1 change: 0 additions & 1 deletion src_clean/print_statistics.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,6 @@ static inline void Print_HeatOfAdsorption(Components& SystemComponents, int Cycl
static inline void Print_Averages(Components& SystemComponents, int Cycles, int Blocksize, Simulations& Sims, Units& Constants)
{
printf("============= BLOCK AVERAGES (HEAT OF ADSORPTION: kJ/mol) =========\n");
size_t NumberOfAdsorbateComponent = SystemComponents.NComponents.x - SystemComponents.NComponents.y;
Print_HeatOfAdsorption(SystemComponents, Cycles, Blocksize, SystemComponents.Nblock, Constants);
printf("==============================================================\n");

Expand Down
6 changes: 3 additions & 3 deletions src_clean/read_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,14 +2657,14 @@ void RestartFileParser(Boxsize& Box, Components& SystemComponents)
size_t PreviousCompNMol = 0;
for(size_t i = SystemComponents.NComponents.y; i < SystemComponents.NComponents.x; i++)
{
size_t start = 0; size_t end = 0;
size_t start = 0;
while (std::getline(file, str))
{
//find range of the part we need to read//
if (str.find("Components " + std::to_string(i - SystemComponents.NComponents.y), 0) != std::string::npos)
start = counter;
if (str.find("Maximum-rotation-change component " + std::to_string(i - SystemComponents.NComponents.y), 0) != std::string::npos)
{ end = counter; break; }
{ break; }
}
file.clear();
file.seekg(0);
Expand Down Expand Up @@ -2727,7 +2727,7 @@ void RestartFileParser(Boxsize& Box, Components& SystemComponents)
file.clear();
file.seekg(0);
//Start reading atom positions and other information//
start = 0; end = 0; counter = 0;
start = 0; counter = 0;
while (std::getline(file, str))
{
if (str.find("Component: " + std::to_string(i - SystemComponents.NComponents.y), 0) != std::string::npos)
Expand Down
Loading