Skip to content

Commit

Permalink
Upadte branch with recent development branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
msoroush committed Mar 12, 2021
2 parents 1443bac + d133533 commit 8972e50
Show file tree
Hide file tree
Showing 43 changed files with 222 additions and 260 deletions.
4 changes: 2 additions & 2 deletions lib/CircuitFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void CircuitFinder::run()

bool CircuitFinder::haveCommonElements(std::vector<int> first, std::vector<int> second)
{
for (int i = 0; i < first.size(); i++) {
for (int i = 0; i < (int) first.size(); i++) {
if (std::find(second.begin(), second.end(), first[i]) != second.end()) {
return true;
}
Expand All @@ -97,7 +97,7 @@ bool CircuitFinder::haveCommonElements(std::vector<int> first, std::vector<int>
std::vector<int> CircuitFinder::returnCombinedSet(std::vector<int> first, std::vector<int> second)
{
std::vector<int> ret(first);
for (int i = 0; i < second.size(); i++) {
for (int i = 0; i < (int) second.size(); i++) {
if (std::find(ret.begin(), ret.end(), second[i]) == ret.end()) {
ret.push_back(second[i]);
}
Expand Down
28 changes: 14 additions & 14 deletions lib/FloydWarshallCycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FloydWarshallCycle::FloydWarshallCycle(int numNodes)
next[i].resize(numberOfNodes);

// double check
assert(graph.size() == numberOfNodes);
assert((int) graph.size() == numberOfNodes);
}


Expand Down Expand Up @@ -53,7 +53,7 @@ std::vector<int> FloydWarshallCycle::GetShortestCycle(int src)

std::vector< std::vector<int> > paths;
std::vector<int> allEdgesIncludingSrc = getConnectionsFor(src);
for (int i = 0; i < allEdgesIncludingSrc.size(); i++) {
for (int i = 0; i < (int) allEdgesIncludingSrc.size(); i++) {
setDefaults();
setValues(allEdgesIncludingSrc[i]);
floydWarshall();
Expand Down Expand Up @@ -157,7 +157,7 @@ void FloydWarshallCycle::setDefaults()

void FloydWarshallCycle::setValues(int exceptThisOne)
{
for (int j = 0; j < connections.size(); j++) {
for (int j = 0; j < (int) connections.size(); j++) {
if (exceptThisOne != j) {
int zero = connections[j][0];
int one = connections[j][1];
Expand All @@ -172,7 +172,7 @@ void FloydWarshallCycle::setValues(int exceptThisOne)
std::vector<int> FloydWarshallCycle::getConnectionsFor(int index)
{
std::vector<int> conn;
for (int i = 0; i < connections.size(); i++) {
for (int i = 0; i < (int) connections.size(); i++) {
if (connections[i][0] == index || connections[i][1] == index)
conn.push_back(i);
}
Expand All @@ -184,8 +184,8 @@ std::vector<int> FloydWarshallCycle::findMinimumPath(const std::vector< std::vec
//The path shouldn't be more than numberOfNodes without negative cycles
int min = 2 * numberOfNodes;
std::vector<int> shortest;
for (int i = 0; i < paths.size(); i++) {
if (paths[i].size() != 0 && paths[i].size() < min) {
for (int i = 0; i < (int) paths.size(); i++) {
if (paths[i].size() != 0 && (int) paths[i].size() < min) {
min = paths[i].size();
shortest = paths[i];
}
Expand All @@ -197,17 +197,17 @@ std::vector< std::vector<int> > FloydWarshallCycle::getUniqueVectors(std::vector
{
int j;
std::vector< std::vector<int> > uniqueCycles;
for (int i = 0; i < allCycles.size(); i++) {
for (int i = 0; i < (int) allCycles.size(); i++) {
std::sort(allCycles[i].begin(), allCycles[i].end());
}
for (int i = 0; i < allCycles.size(); i++) {
for (int i = 0; i < (int) allCycles.size(); i++) {
if (uniqueCycles.size() == 0) {
uniqueCycles.push_back(allCycles[i]);
} else {
for (j = 0; j < uniqueCycles.size(); j++)
for (j = 0; j < (int) uniqueCycles.size(); j++)
if (isVectorsEqual(uniqueCycles[j], allCycles[i]))
break;
if (j == uniqueCycles.size()) {
if (j == (int) uniqueCycles.size()) {
uniqueCycles.push_back(allCycles[i]);
}
}
Expand All @@ -219,7 +219,7 @@ bool FloydWarshallCycle::isVectorsEqual(const std::vector<int> &first, const std
{
if (first.size() != second.size())
return false;
for (int i = 0; i < first.size(); i++) {
for (int i = 0; i < (int) first.size(); i++) {
if (first[i] != second[i]) {
return false;
}
Expand All @@ -229,7 +229,7 @@ bool FloydWarshallCycle::isVectorsEqual(const std::vector<int> &first, const std

bool FloydWarshallCycle::haveCommonElements(const std::vector<int> &first, const std::vector<int> &second)
{
for (int i = 0; i < first.size(); i++) {
for (int i = 0; i < (int) first.size(); i++) {
if (std::find(second.begin(), second.end(), first[i]) != second.end()) {
return true;
}
Expand All @@ -240,7 +240,7 @@ bool FloydWarshallCycle::haveCommonElements(const std::vector<int> &first, const
std::vector<int> FloydWarshallCycle::returnCombinedSet(const std::vector<int> &first, const std::vector<int> &second)
{
std::vector<int> ret(first);
for (int i = 0; i < second.size(); i++) {
for (int i = 0; i < (int) second.size(); i++) {
if (std::find(ret.begin(), ret.end(), second[i]) == ret.end()) {
ret.push_back(second[i]);
}
Expand All @@ -258,7 +258,7 @@ int FloydWarshallCycle::GetCentricNode()
int i, j, raduse;
setDefaults();

for (j = 0; j < connections.size(); j++) {
for (j = 0; j < (int) connections.size(); j++) {
int zero = connections[j][0];
int one = connections[j][1];
graph[zero][one] = 1;
Expand Down
2 changes: 1 addition & 1 deletion src/CheckpointSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void CheckpointSetup::readMoleculesData()

// read the kIndex array
molecules_kIndexVec.resize(read_uint32_binary());
for(int i = 0; i < molecules_kIndexVec.size(); i++) {
for(int i = 0; i < (int) molecules_kIndexVec.size(); i++) {
molecules_kIndexVec[i] = read_uint32_binary();
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/ConfigSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
uint b = stringtoi(line[2]);
sys.targetedSwapCollection.AddsubVolumeBox(idx, b);
} else {
printf("%-40s %-d !\n", "Error: Expected 2 values for SubVolumeBox, but received",
printf("%-40s %-lu !\n", "Error: Expected 2 values for SubVolumeBox, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -368,7 +368,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
temp.z = stringtod(line[4]);
sys.targetedSwapCollection.AddsubVolumeCenter(idx, temp);
} else {
printf("%-40s %-d !\n", "Error: Expected 4 values for SubVolumeCenter, but received",
printf("%-40s %-lu !\n", "Error: Expected 4 values for SubVolumeCenter, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -377,20 +377,20 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
int idx = stringtoi(line[1]);
sys.targetedSwapCollection.AddsubVolumePBC(idx, line[2]);
} else {
printf("%-40s %-d !\n", "Error: Expected 2 values for SubVolumePBC, but received",
printf("%-40s %-lu !\n", "Error: Expected 2 values for SubVolumePBC, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
} else if(CheckString(line[0], "SubVolumeCenterList")) {
if(line.size() >= 3) {
int idx = stringtoi(line[1]);
std::vector<std::string> temp;
for(int k = 2; k < line.size(); k++) {
for(int k = 2; k < (int) line.size(); k++) {
temp.push_back(line[k]);
}
sys.targetedSwapCollection.AddsubVolumeAtomList(idx, temp);
} else {
printf("%-40s %-d !\n", "Error: Expected atleast 3 values for SubVolumeCenterList, but received",
printf("%-40s %-lu !\n", "Error: Expected atleast 3 values for SubVolumeCenterList, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -403,7 +403,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
temp.z = stringtod(line[4]);
sys.targetedSwapCollection.AddsubVolumeDimension(idx, temp);
} else {
printf("%-40s %-d !\n", "Error: Expected 4 values for SubVolumeDim, but received",
printf("%-40s %-lu !\n", "Error: Expected 4 values for SubVolumeDim, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -412,13 +412,13 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
int idx = stringtoi(line[1]);
std::vector<std::string> temp;

for(int k = 2; k < line.size(); k++) {
for(int k = 2; k < (int) line.size(); k++) {
temp.push_back(line[k]);
}

sys.targetedSwapCollection.AddsubVolumeResKind(idx, temp);
} else {
printf("%-40s %-d !\n", "Error: Expected atleast 2 values for SubVolumeResidueKind, but received",
printf("%-40s %-lu !\n", "Error: Expected atleast 2 values for SubVolumeResidueKind, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -428,7 +428,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
bool isRigid = checkBool(line[2]);
sys.targetedSwapCollection.AddsubVolumeSwapType(idx, isRigid);
} else {
printf("%-40s %-d !\n", "Error: Expected 2 values for SubVolumeRigidSwap, but received",
printf("%-40s %-lu !\n", "Error: Expected 2 values for SubVolumeRigidSwap, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -442,7 +442,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
bool isFugacity = false;
sys.targetedSwapCollection.AddsubVolumeChemPot(idx, resName, value, isFugacity);
} else {
printf("%-40s %-d !\n", "Error: Expected 3 values for SubVolumeChemPot, but received",
printf("%-40s %-lu !\n", "Error: Expected 3 values for SubVolumeChemPot, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand All @@ -454,7 +454,7 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim)
bool isFugacity = true;
sys.targetedSwapCollection.AddsubVolumeChemPot(idx, resName, value, isFugacity);
} else {
printf("%-40s %-d !\n", "Error: Expected 3 values for SubVolumeFugacity, but received",
printf("%-40s %-lu !\n", "Error: Expected 3 values for SubVolumeFugacity, but received",
line.size() -1);
exit(EXIT_FAILURE);
}
Expand Down Expand Up @@ -1516,7 +1516,7 @@ void ConfigSetup::verifyInputs(void)

#ifdef VARIABLE_PARTICLE_NUMBER
if(sys.targetedSwapCollection.enable) {
for (i = 0; i < sys.targetedSwapCollection.targetedSwap.size(); i++) {
for (i = 0; i < (int) sys.targetedSwapCollection.targetedSwap.size(); i++) {
// make sure all required parameter has been set
sys.targetedSwapCollection.targetedSwap[i].VerifyParm();
}
Expand Down
13 changes: 6 additions & 7 deletions src/ConfigSetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ struct TargetSwapCollection {
// Search for cavIdx in the targetSwap. If it exists,
// returns true + the index to targetSwap vector
bool SearchExisting(const int &subVIdx, int &idx) {
for (int i = 0; i < targetedSwap.size(); i++) {
for (int i = 0; i < (int) targetedSwap.size(); i++) {
if (targetedSwap[i].subVolumeIdx == subVIdx) {
idx = i;
return true;
Expand Down Expand Up @@ -551,18 +551,17 @@ struct TargetSwapCollection {
return i;
}

// Pars the list of atom. If user use a range of atom (e.g. 5-10)
// Parse the list of atoms. If user uses a range of atom (e.g. 5-10)
// This function would handle it properly
std::vector<int> ParsAtomList(const int &subVIdx, std::vector<std::string> &atoms)
{
const char dash = '-';
size_t pos = 0;
int start = 0, end = 0;
std::vector<int> list;
for(int i = 0; i < atoms.size(); ++i) {
for(int i = 0; i < (int) atoms.size(); ++i) {
if(atoms[i] == "-") {
printf("Error: If you are trying to use a range of atom indicies, use '-' without any space!\n");
printf(" For example: 1-15!\n");
printf("Error: In subVolume Index %d, if you are trying to use a range of atom indices, use '-' without any space!\n", subVIdx);
exit(EXIT_FAILURE);
}
// check if string has dash in it
Expand Down Expand Up @@ -634,9 +633,9 @@ struct TargetSwapCollection {
selectedAll |= (std::find(newKind.begin(), newKind.end(), "All") != newKind.end());
if(selectedAll) {
if(newKind.size() > 1) {
printf("Warning: %d additional residue kind was defined for subVolume index %d, while using all residues!\n",
printf("Warning: %lu additional residue kinds were defined for subVolume index %d, while using all residues!\n",
newKind.size() - 1, subVIdx);
printf("Warning: Proceed with all residue kind for subVolume index %d!\n",
printf("Warning: Proceed with all residue kinds for subVolume index %d!\n",
subVIdx);
}
newKind.clear();
Expand Down
2 changes: 1 addition & 1 deletion src/ExtendedSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void ExtendedSystem::UpdateCoordinate(PDBSetup &pdb, const char *filename, const
read_binary_file(filename, binaryCoor, numAtoms);
//find the starting index

for(; cmIndex < molLookup.molLookupCount; cmIndex++) {
for(; cmIndex < (int) molLookup.molLookupCount; cmIndex++) {
if(moleculeOffset >= numAtoms) break;
int currentMolecule = molLookup.molLookup[cmIndex];
int numberOfAtoms = mols.start[currentMolecule + 1] - mols.start[currentMolecule];
Expand Down
Loading

0 comments on commit 8972e50

Please sign in to comment.