diff --git a/lib/CircuitFinder.cpp b/lib/CircuitFinder.cpp index 16d73f768..95166f81a 100644 --- a/lib/CircuitFinder.cpp +++ b/lib/CircuitFinder.cpp @@ -86,7 +86,7 @@ void CircuitFinder::run() bool CircuitFinder::haveCommonElements(std::vector first, std::vector 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; } @@ -97,7 +97,7 @@ bool CircuitFinder::haveCommonElements(std::vector first, std::vector std::vector CircuitFinder::returnCombinedSet(std::vector first, std::vector second) { std::vector 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]); } diff --git a/lib/FloydWarshallCycle.cpp b/lib/FloydWarshallCycle.cpp index b27bcf55f..c2e38eaed 100644 --- a/lib/FloydWarshallCycle.cpp +++ b/lib/FloydWarshallCycle.cpp @@ -23,7 +23,7 @@ FloydWarshallCycle::FloydWarshallCycle(int numNodes) next[i].resize(numberOfNodes); // double check - assert(graph.size() == numberOfNodes); + assert((int) graph.size() == numberOfNodes); } @@ -53,7 +53,7 @@ std::vector FloydWarshallCycle::GetShortestCycle(int src) std::vector< std::vector > paths; std::vector 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(); @@ -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]; @@ -172,7 +172,7 @@ void FloydWarshallCycle::setValues(int exceptThisOne) std::vector FloydWarshallCycle::getConnectionsFor(int index) { std::vector 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); } @@ -184,8 +184,8 @@ std::vector FloydWarshallCycle::findMinimumPath(const std::vector< std::vec //The path shouldn't be more than numberOfNodes without negative cycles int min = 2 * numberOfNodes; std::vector 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]; } @@ -197,17 +197,17 @@ std::vector< std::vector > FloydWarshallCycle::getUniqueVectors(std::vector { int j; std::vector< std::vector > 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]); } } @@ -219,7 +219,7 @@ bool FloydWarshallCycle::isVectorsEqual(const std::vector &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; } @@ -229,7 +229,7 @@ bool FloydWarshallCycle::isVectorsEqual(const std::vector &first, const std bool FloydWarshallCycle::haveCommonElements(const std::vector &first, const std::vector &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; } @@ -240,7 +240,7 @@ bool FloydWarshallCycle::haveCommonElements(const std::vector &first, const std::vector FloydWarshallCycle::returnCombinedSet(const std::vector &first, const std::vector &second) { std::vector 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]); } @@ -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; diff --git a/src/CheckpointSetup.cpp b/src/CheckpointSetup.cpp index 3b58e0431..e26ac98d2 100644 --- a/src/CheckpointSetup.cpp +++ b/src/CheckpointSetup.cpp @@ -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(); } } diff --git a/src/ConfigSetup.cpp b/src/ConfigSetup.cpp index 9fa1c0c9f..c3550ac3e 100644 --- a/src/ConfigSetup.cpp +++ b/src/ConfigSetup.cpp @@ -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); } @@ -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); } @@ -377,7 +377,7 @@ 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); } @@ -385,12 +385,12 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim) if(line.size() >= 3) { int idx = stringtoi(line[1]); std::vector 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); } @@ -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); } @@ -412,13 +412,13 @@ void ConfigSetup::Init(const char *fileName, MultiSim const*const& multisim) int idx = stringtoi(line[1]); std::vector 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); } @@ -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); } @@ -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); } @@ -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); } @@ -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(); } diff --git a/src/ConfigSetup.h b/src/ConfigSetup.h index a156b1e0a..fd1280a53 100644 --- a/src/ConfigSetup.h +++ b/src/ConfigSetup.h @@ -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; @@ -551,7 +551,7 @@ 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 ParsAtomList(const int &subVIdx, std::vector &atoms) { @@ -559,10 +559,9 @@ struct TargetSwapCollection { size_t pos = 0; int start = 0, end = 0; std::vector 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 @@ -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(); diff --git a/src/ExtendedSystem.cpp b/src/ExtendedSystem.cpp index 8c45eb8f9..89afd48e6 100644 --- a/src/ExtendedSystem.cpp +++ b/src/ExtendedSystem.cpp @@ -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]; diff --git a/src/MolSetup.cpp b/src/MolSetup.cpp index c45b7600b..fbf43be6b 100644 --- a/src/MolSetup.cpp +++ b/src/MolSetup.cpp @@ -59,16 +59,16 @@ void BriefDihKinds(MolKind& kind, const FFSetup& ffData); //Builds kindMap from PSF file (does not include coordinates) kindMap // should be empty returns number of atoms in the file, or errors::READ_ERROR if // the read failed somehow -int ReadPSF(const char* psfFilename, MoleculeVariables & molVars, MolMap& kindMap, SizeMap& sizeMap, pdb_setup::Atoms& pdbData, MolMap * kindMapFromBox1 = NULL, SizeMap * sizeMapFromBox1 = NULL); +int ReadPSF(const char* psfFilename, MoleculeVariables & molVars, MolMap& kindMap, SizeMap& sizeMap, MolMap * kindMapFromBox1 = NULL, SizeMap * sizeMapFromBox1 = NULL); //adds atoms and molecule data in psf to kindMap //pre: stream is at !NATOMS post: stream is at end of atom section int ReadPSFAtoms(FILE *, unsigned int nAtoms, std::vector & allAtoms); //adds bonds in psf to kindMap //pre: stream is before !BONDS post: stream is in bond section just after //the first appearance of the last molecule -int ReadPSFBonds(FILE* psf, MolMap& kindMap, - std::vector >& firstAtom, - const uint nbonds); +// int ReadPSFBonds(FILE* psf, MolMap& kindMap, + // std::vector >& firstAtom, + // const uint nbonds); //adds angles in psf to kindMap //pre: stream is before !NTHETA post: stream is in angle section just //after the first appearance of the last molecule @@ -216,22 +216,22 @@ int mol_setup::ReadCombinePSF(MoleculeVariables & molVars, const bool* psfDefined, pdb_setup::Atoms& pdbAtoms) { - int errorcode = ReadPSF(psfFilename[0].c_str(), molVars, kindMap, sizeMap, pdbAtoms); + int errorcode = ReadPSF(psfFilename[0].c_str(), molVars, kindMap, sizeMap); int nAtoms = errorcode; if (errorcode < 0) return errorcode; MolMap map2; SizeMap sizeMap2; - if (pdbAtoms.count != nAtoms && BOX_TOTAL == 2 && psfDefined[1]) { + if ((int) pdbAtoms.count != nAtoms && BOX_TOTAL == 2 && psfDefined[1]) { map2.clear(); - errorcode = ReadPSF(psfFilename[1].c_str(), molVars, map2, sizeMap2, pdbAtoms, &kindMap, &sizeMap); + errorcode = ReadPSF(psfFilename[1].c_str(), molVars, map2, sizeMap2, &kindMap, &sizeMap); nAtoms += errorcode; if (errorcode < 0) return errorcode; kindMap.insert(map2.begin(), map2.end()); } - if (pdbAtoms.count != nAtoms){ + if ((int) pdbAtoms.count != nAtoms){ std::cout << "Error: This number of atoms in coordinate file(s) (PDB) " << pdbAtoms.count << " does not match the number of atoms in structure file(s) (PSF) " << nAtoms << "!" << std::endl; exit(EXIT_FAILURE); @@ -323,9 +323,6 @@ void createKindMap (mol_setup::MoleculeVariables & molVars, it != moleculeXAtomIDY.cend(); it++){ std::string fragName; - bool multiResidue = false; - bool newSize = false; - bool newMapEntry = true; bool foundEntryInOldMap = false; if (sizeMapFromBox1 != NULL && kindMapFromBox1 != NULL){ @@ -359,7 +356,6 @@ void createKindMap (mol_setup::MoleculeVariables & molVars, molVars.startIdxMolecules.push_back(startIdxMolBoxOffset + it->front()); molVars.moleculeKinds.push_back((*kindMapFromBox1)[fragName].kindIndex); molVars.moleculeNames.push_back(fragName); - newMapEntry = false; /* Boilerplate PDB Data modifications for matches */ /* Search current KindMap for this entry. @@ -542,11 +538,11 @@ void createKindMap (mol_setup::MoleculeVariables & molVars, typedef std::map MolMap; void MolSetup::copyBondInfoIntoMapEntry(const BondAdjacencyList & bondAdjList, mol_setup::MolMap & kindMap, std::string fragName){ - unsigned int molBegin = kindMap[fragName].firstAtomID - 1; + int molBegin = static_cast(kindMap[fragName].firstAtomID) - 1; //index AFTER last atom in molecule - unsigned int molEnd = molBegin + kindMap[fragName].atoms.size(); + int molEnd = molBegin + static_cast(kindMap[fragName].atoms.size()); //assign the bond - for (uint i = molBegin; i < molEnd; i++){ + for (int i = molBegin; i < molEnd; i++){ adjNode* ptr = bondAdjList.head[i]; while (ptr != nullptr) { if (i < ptr->val) { @@ -821,7 +817,7 @@ namespace { //Initializes system from PSF file (does not include coordinates) //returns number of atoms in the file, or errors::READ_ERROR if the read failed somehow -int ReadPSF(const char* psfFilename, MoleculeVariables & molVars, MolMap& kindMap, SizeMap & sizeMap, pdb_setup::Atoms& pdbData, MolMap * kindMapFromBox1, SizeMap * sizeMapFromBox1) +int ReadPSF(const char* psfFilename, MoleculeVariables & molVars, MolMap& kindMap, SizeMap & sizeMap, MolMap * kindMapFromBox1, SizeMap * sizeMapFromBox1) { FILE* psf = fopen(psfFilename, "r"); char* check; //return value of fgets @@ -990,49 +986,49 @@ int ReadPSFAtoms(FILE *psf, unsigned int nAtoms, std::vector & //adds bonds in psf to kindMap //pre: stream is before !BONDS post: stream is in bond section just after //the first appearance of the last molecule -int ReadPSFBonds(FILE* psf, MolMap& kindMap, - std::vector >& firstAtom, - const uint nbonds) -{ - unsigned int atom0, atom1; - int dummy; - std::vector defined(firstAtom.size(), false); - for (uint n = 0; n < nbonds; n++) { - dummy = fscanf(psf, "%u %u", &atom0, &atom1); - if(dummy != 2) { - fprintf(stderr, "ERROR: Incorrect Number of bonds in PSF file "); - return errors::READ_ERROR; - } else if (feof(psf) || ferror(psf)) { - fprintf(stderr, "ERROR: Could not find all bonds in PSF file "); - return errors::READ_ERROR; - } - - //loop to find the molecule kind with this bond - for (unsigned int i = 0; i < firstAtom.size(); ++i) { - MolKind& currentMol = kindMap[firstAtom[i].second]; - //index of first atom in molecule - unsigned int molBegin = firstAtom[i].first; - //index AFTER last atom in molecule - unsigned int molEnd = molBegin + currentMol.atoms.size(); - //assign the bond - if (atom0 >= molBegin && atom0 < molEnd) { - currentMol.bonds.push_back(Bond(atom0 - molBegin, atom1 - molBegin)); - //once we found the molecule kind, break from the loop - defined[i] = true; - break; - } - } - } - //Check if we defined all bonds - for (unsigned int i = 0; i < firstAtom.size(); ++i) { - MolKind& currentMol = kindMap[firstAtom[i].second]; - if(currentMol.atoms.size() > 1 && !defined[i]) { - std::cout << "Warning: Bond is missing for " << firstAtom[i].second - << " !\n"; - } - } - return 0; -} +// int ReadPSFBonds(FILE* psf, MolMap& kindMap, + // std::vector >& firstAtom, + // const uint nbonds) +// { + // unsigned int atom0, atom1; + // int dummy; + // std::vector defined(firstAtom.size(), false); + // for (uint n = 0; n < nbonds; n++) { + // dummy = fscanf(psf, "%u %u", &atom0, &atom1); + // if(dummy != 2) { + // fprintf(stderr, "ERROR: Incorrect Number of bonds in PSF file "); + // return errors::READ_ERROR; + // } else if (feof(psf) || ferror(psf)) { + // fprintf(stderr, "ERROR: Could not find all bonds in PSF file "); + // return errors::READ_ERROR; + // } + + // //loop to find the molecule kind with this bond + // for (unsigned int i = 0; i < firstAtom.size(); ++i) { + // MolKind& currentMol = kindMap[firstAtom[i].second]; + // //index of first atom in molecule + // unsigned int molBegin = firstAtom[i].first; + // //index AFTER last atom in molecule + // unsigned int molEnd = molBegin + currentMol.atoms.size(); + // //assign the bond + // if (atom0 >= molBegin && atom0 < molEnd) { + // currentMol.bonds.push_back(Bond(atom0 - molBegin, atom1 - molBegin)); + // //once we found the molecule kind, break from the loop + // defined[i] = true; + // break; + // } + // } + // } + // //Check if we defined all bonds + // for (unsigned int i = 0; i < firstAtom.size(); ++i) { + // MolKind& currentMol = kindMap[firstAtom[i].second]; + // if(currentMol.atoms.size() > 1 && !defined[i]) { + // std::cout << "Warning: Bond is missing for " << firstAtom[i].second + // << " !\n"; + // } + // } + // return 0; +// } //adds angles in psf to kindMap //pre: stream is before !NTHETA post: stream is in angle section just after @@ -1084,18 +1080,18 @@ int ReadPSFAngles(FILE* psf, MolMap& kindMap, -bool ContainsDihedral(const std::vector& vec, const int dih[]) -{ - for (uint i = 0; i < vec.size(); i += 4) { - bool match = true; - for (uint j = 0; j < 4; ++j) - if (vec[i + j] != dih[j]) - match = false; - if (match) - return true; - } - return false; -} +// bool ContainsDihedral(const std::vector& vec, const int dih[]) +// { + // for (uint i = 0; i < vec.size(); i += 4) { + // bool match = true; + // for (uint j = 0; j < 4; ++j) + // if ((int) vec[i + j] != dih[j]) + // match = false; + // if (match) + // return true; + // } + // return false; +// } //adds dihedrals in psf to kindMap diff --git a/src/MoleculeLookup.cpp b/src/MoleculeLookup.cpp index 021271430..c7764e2bf 100644 --- a/src/MoleculeLookup.cpp +++ b/src/MoleculeLookup.cpp @@ -45,7 +45,7 @@ void MoleculeLookup::Init(const Molecules& mols, indexVector.resize(BOX_TOTAL); fixedMolecule.resize(mols.count); - for (int i = 0; i < numKinds * BOX_TOTAL; i++){ + for (int i = 0; i < (int) numKinds * BOX_TOTAL; i++){ boxAndKindSwappableCounts[i] = 0; } diff --git a/src/PDBOutput.cpp b/src/PDBOutput.cpp index 542e985b1..9e3fd0c7f 100644 --- a/src/PDBOutput.cpp +++ b/src/PDBOutput.cpp @@ -17,9 +17,8 @@ along with this program, also can be found at . PDBOutput::PDBOutput(System & sys, StaticVals const& statV) : moveSetRef(sys.moveSettings), molLookupRef(sys.molLookupRef), - coordCurrRef(sys.coordinates), comCurrRef(sys.com), - pStr(coordCurrRef.Count(), GetDefaultAtomStr()), - boxDimRef(sys.boxDimRef), molRef(statV.mol) + boxDimRef(sys.boxDimRef), molRef(statV.mol), coordCurrRef(sys.coordinates), + comCurrRef(sys.com), pStr(coordCurrRef.Count(), GetDefaultAtomStr()) { for(int i = 0; i < BOX_TOTAL; i++) frameNumber[i] = 0; @@ -69,7 +68,7 @@ void PDBOutput::Init(pdb_setup::Atoms const& atoms, outF[b].Init(output.state.files.pdb.name[b], aliasStr, true, notify); outF[b].open(); } - InitPartVec(atoms); + InitPartVec(); DoOutput(0); } @@ -94,7 +93,7 @@ void PDBOutput::Init(pdb_setup::Atoms const& atoms, } } -void PDBOutput::InitPartVec(pdb_setup::Atoms const& atoms) +void PDBOutput::InitPartVec() { uint pStart = 0, pEnd = 0, molecule = 0; //Start particle numbering @ 1 @@ -254,7 +253,6 @@ void PDBOutput::PrintCrystRest(const uint b, const uint step, Writer & out) #endif sstrm::Converter toStr; std::string outStr(pdb_entry::LINE_WIDTH, ' '); - XYZ axis = boxDimRef.axis.Get(b); //Tag for remark outStr.replace(label::POS.START, label::POS.LENGTH, label::REMARK); //Tag GOMC diff --git a/src/PDBOutput.h b/src/PDBOutput.h index f9a8b1926..5d559c569 100644 --- a/src/PDBOutput.h +++ b/src/PDBOutput.h @@ -49,7 +49,7 @@ struct PDBOutput : OutputableBase { private: std::string GetDefaultAtomStr(); - void InitPartVec(pdb_setup::Atoms const& atoms); + void InitPartVec(); void SetMolBoxVec(std::vector & mBox); diff --git a/src/PDBSetup.cpp b/src/PDBSetup.cpp index a71c15bf6..cf7cc9fd8 100644 --- a/src/PDBSetup.cpp +++ b/src/PDBSetup.cpp @@ -105,12 +105,9 @@ void Atoms::SetRestart(config_setup::RestartSettings const& r ) recalcTrajectory = r.recalcTrajectory; } -void Atoms::Assign(std::string const& atomName, - std::string const& resName, - const uint resNum, +void Atoms::Assign(std::string const& resName, const char l_chain, const double l_x, const double l_y, const double l_z, - const double l_occ, const double l_beta) { //box.push_back((bool)(restart?(uint)(l_occ):currBox)); @@ -145,8 +142,7 @@ void Atoms::Read(FixedWidthReader & file) if(recalcTrajectory && (uint)l_occ != currBox) { return; } - Assign(atomName, resName, resNum, l_chain, l_x, l_y, l_z, - l_occ, l_beta); + Assign(resName, l_chain, l_x, l_y, l_z, l_beta); } void Atoms::Clear() diff --git a/src/PDBSetup.h b/src/PDBSetup.h index 380e6d40c..ffdf91467 100644 --- a/src/PDBSetup.h +++ b/src/PDBSetup.h @@ -99,14 +99,11 @@ class Atoms : public FWReadableBase { currBox = b; } - void Assign(std::string const& atomName, - std::string const& resName, - const uint resNum, + void Assign(std::string const& resName, const char l_chain, const double l_x, const double l_y, const double l_z, - const double l_occ, const double l_beta); void Read(FixedWidthReader & file); diff --git a/src/PSFOutput.cpp b/src/PSFOutput.cpp index 9bdc9d295..85353945e 100644 --- a/src/PSFOutput.cpp +++ b/src/PSFOutput.cpp @@ -13,7 +13,6 @@ using namespace mol_setup; namespace { const char* remarkHeader = "!NTITLE"; -const char* remarkTag = " REMARKS "; const char* atomHeader = "!NATOM"; const char* bondHeader = "!NBOND: bonds"; const char* angleHeader = "!NTHETA: angles"; @@ -37,8 +36,8 @@ const int dihPerLine = 2; PSFOutput::PSFOutput(const Molecules& molecules, const System &sys, Setup & set) : - molecules(&molecules), molNames(set.mol.molVars.moleculeKindNames), - molLookRef(sys.molLookup) + molecules(&molecules), molLookRef(sys.molLookup), + molNames(set.mol.molVars.moleculeKindNames) { molKinds.resize(set.mol.kindMap.size()); for(uint i = 0; i < set.mol.molVars.moleculeKindNames.size(); ++i) { @@ -68,12 +67,6 @@ void PSFOutput::Init(pdb_setup::Atoms const& atoms, toStr >> numStr; aliasStr = "Output PSF file for Box "; aliasStr += numStr; - bool notify; -#ifndef NDEBUG - notify = true; -#else - notify = false; -#endif //NEW_RESTART_COD outRebuildRestartFName[b] = output.state.files.splitPSF.name[b]; std::string newStrAddOn = "_restart.psf"; @@ -101,7 +94,7 @@ void PSFOutput::DoOutput(const ulong step) PrintBondsInBox(outfile, b); PrintAnglesInBox(outfile, b); PrintDihedralsInBox(outfile, b); - PrintNAMDCompliantSuffixInBox(outfile, b); + PrintNAMDCompliantSuffixInBox(outfile); fclose(outfile); } GOMC_EVENT_STOP(1, GomcProfileEvent::PSF_RESTART_OUTPUT); @@ -212,7 +205,6 @@ void PSFOutput::PrintAtoms(FILE* outfile) const //silly psfs index from 1 uint atomID = 1; uint resID = 1; - uint currKind = molecules->kIndex[0]; for(uint mol = 0; mol < molecules->count; ++mol) { uint thisKind = molecules->kIndex[mol]; uint nAtoms = molKinds[thisKind].atoms.size(); @@ -432,7 +424,7 @@ void PSFOutput::PrintDihedrals(FILE* outfile) const fputs("\n\n", outfile); } - void PSFOutput::PrintNAMDCompliantSuffixInBox(FILE* outfile, uint b) const { + void PSFOutput::PrintNAMDCompliantSuffixInBox(FILE* outfile) const { fprintf(outfile, headerFormat, 0, improperHeader); fputs("\n\n", outfile); fprintf(outfile, headerFormat, 0, donorHeader); diff --git a/src/PSFOutput.h b/src/PSFOutput.h index 9a91dc48c..34ebb772e 100644 --- a/src/PSFOutput.h +++ b/src/PSFOutput.h @@ -68,7 +68,7 @@ class PSFOutput : public OutputableBase { void PrintDihedralsInBox(FILE* outfile, uint b) const; void PrintNAMDCompliantSuffix(FILE* outfile) const; - void PrintNAMDCompliantSuffixInBox(FILE* outfile, uint b) const; + void PrintNAMDCompliantSuffixInBox(FILE* outfile) const; void CountMolecules(); void CountMoleculesInBoxes(); diff --git a/src/System.cpp b/src/System.cpp index c8610a02d..e9b1dbc6c 100644 --- a/src/System.cpp +++ b/src/System.cpp @@ -130,7 +130,7 @@ void System::Init(Setup & set, ulong & startStep) // Allocate space for atom forces atomForceRef.Init(set.pdb.atoms.beta.size()); molForceRef.Init(com.Count()); - // Allocate space for reciprocate force + // Allocate space for reciprocal force atomForceRecRef.Init(set.pdb.atoms.beta.size()); molForceRecRef.Init(com.Count()); cellList.SetCutoff(); @@ -138,7 +138,6 @@ void System::Init(Setup & set, ulong & startStep) //check if we have to use cached version of Ewald or not. bool ewald = set.config.sys.elect.ewald; - bool cached = set.config.sys.elect.cache; #ifdef GOMC_CUDA if(ewald) @@ -146,6 +145,7 @@ void System::Init(Setup & set, ulong & startStep) else calcEwald = new NoEwald(statV, *this); #else + bool cached = set.config.sys.elect.cache; if (ewald && cached) calcEwald = new EwaldCached(statV, *this); else if (ewald && !cached) @@ -154,7 +154,7 @@ void System::Init(Setup & set, ulong & startStep) calcEwald = new NoEwald(statV, *this); #endif - //Initial the lambda before calling SystemTotal + //Initialize lambda before calling SystemTotal InitLambda(); calcEnergy.Init(*this); calcEwald->Init(); diff --git a/src/System.h b/src/System.h index cf5a90967..52f7a34ab 100644 --- a/src/System.h +++ b/src/System.h @@ -99,6 +99,7 @@ class System #endif MoveSettings moveSettings; + CellList cellList; SystemPotential potential; Coordinates coordinates; XYZArray atomForceRef; @@ -111,7 +112,6 @@ class System CalculateEnergy calcEnergy; Ewald *calcEwald; - CellList cellList; CheckpointSetup checkpointSet; diff --git a/src/cbmc/DCCrankShaftAng.cpp b/src/cbmc/DCCrankShaftAng.cpp index 921d6f5ae..629c9df1b 100644 --- a/src/cbmc/DCCrankShaftAng.cpp +++ b/src/cbmc/DCCrankShaftAng.cpp @@ -350,7 +350,6 @@ double DCCrankShaftAng::CalcIntraBonded(TrialMol& mol, uint molIndex) double bondedEn = 0.0; uint box = mol.GetBox(); - const MoleculeKind& molKind = mol.GetKind(); XYZ b1, b2, b3; const XYZArray &coords = mol.GetCoords(); for(uint i = 0; i < ang.size(); i++) { diff --git a/src/cbmc/DCCrankShaftDih.cpp b/src/cbmc/DCCrankShaftDih.cpp index 1f0172d4f..bdae2b0ca 100644 --- a/src/cbmc/DCCrankShaftDih.cpp +++ b/src/cbmc/DCCrankShaftDih.cpp @@ -337,7 +337,6 @@ void DCCrankShaftDih::ChooseTorsionOld(TrialMol& mol, uint molIndex, double* torsion = data->angles; double* torWeights = data->angleWeights; double* torEnergy = data->angleEnergy; - double* intraNonbonded = data->nonbonded_1_4; XYZ center = mol.AtomPosition(a0); for (uint tor = 0; tor < nDihTrials; ++tor) { @@ -361,7 +360,6 @@ double DCCrankShaftDih::CalcIntraBonded(TrialMol& mol, uint molIndex) double bondedEn = 0.0; uint box = mol.GetBox(); - const MoleculeKind& molKind = mol.GetKind(); XYZ b1, b2, b3; const XYZArray &coords = mol.GetCoords(); for(uint i = 0; i < ang.size(); i++) { diff --git a/src/cbmc/DCCyclic.cpp b/src/cbmc/DCCyclic.cpp index 44edb5f12..e167d4424 100644 --- a/src/cbmc/DCCyclic.cpp +++ b/src/cbmc/DCCyclic.cpp @@ -88,9 +88,9 @@ DCCyclic::DCCyclic(System& sys, const Forcefield& ff, nodes.push_back(Node()); Node& node = nodes.back(); - //Check if the node belong to a ring or not + //Check if the node belongs to a ring or not if(isRing[atom]) { - uint prev = -1; + int prev = -1; for(uint i = 0; i < bonds.size(); i++) { //Use one of the atoms that is in the ring as prev if(isRing[bonds[i].a1]) { @@ -147,7 +147,7 @@ DCCyclic::DCCyclic(System& sys, const Forcefield& ff, //reassign destination values from atom indices to node indices for (uint i = 0; i < nodes.size(); ++i) { for (uint j = 0; j < nodes[i].edges.size(); ++j) { - uint& dest = nodes[i].edges[j].destination; + int& dest = nodes[i].edges[j].destination; dest = atomToNode[dest]; assert(dest != -1); } @@ -356,7 +356,7 @@ void DCCyclic::Regrowth(TrialMol& oldMol, TrialMol& newMol, uint molIndex) bool growAll = data.prng() < 1.0 / nodes.size(); //Randomely pick a node to keep it fix and not grow it - uint current = data.prng.randIntExc(nodes.size()); + int current = data.prng.randIntExc(nodes.size()); visited.assign(nodes.size(), false); destVisited.assign(totAtom, false); //Visiting the node @@ -616,8 +616,8 @@ void DCCyclic::BuildGrowOld(TrialMol& oldMol, uint molIndex) visited.assign(nodes.size(), false); destVisited.assign(totAtom, false); //Use backbone atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { if(nodes[i].atomIndex == oldMol.GetAtomBB(0)) { current = i; break; @@ -684,8 +684,8 @@ void DCCyclic::BuildGrowNew(TrialMol& newMol, uint molIndex) visited.assign(nodes.size(), false); destVisited.assign(totAtom, false); //Use backbone atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { if(nodes[i].atomIndex == newMol.GetAtomBB(0)) { current = i; break; @@ -763,9 +763,9 @@ void DCCyclic::BuildGrowInCav(TrialMol& oldMol, TrialMol& newMol, uint molIndex) } //Use seedIndex atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { - if(nodes[i].atomIndex == sIndex) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { + if((int) nodes[i].atomIndex == sIndex) { current = i; break; } diff --git a/src/cbmc/DCCyclic.h b/src/cbmc/DCCyclic.h index 41b5e665a..7e9186df8 100644 --- a/src/cbmc/DCCyclic.h +++ b/src/cbmc/DCCyclic.h @@ -55,7 +55,7 @@ class DCCyclic : public CBMC //Store edge's atom that are connected to node and has more than 1 bond //Each edge is a node as well struct Edge { - uint destination; //destination is partner node index. + int destination; //destination is partner node index. uint atomIndex; //atom index of the edge //To build the next segment from prev-focus DCComponent* connect; diff --git a/src/cbmc/DCFreeCycle.cpp b/src/cbmc/DCFreeCycle.cpp index d2ab6aec1..c7b585706 100644 --- a/src/cbmc/DCFreeCycle.cpp +++ b/src/cbmc/DCFreeCycle.cpp @@ -116,7 +116,7 @@ void DCFreeCycle::BuildNew(TrialMol& newMol, uint molIndex) seed.BuildNew(newMol, molIndex); PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald *calcEwald = data->calcEwald; + // const Ewald *calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -191,7 +191,7 @@ void DCFreeCycle::BuildOld(TrialMol& oldMol, uint molIndex) seed.BuildOld(oldMol, molIndex); PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald * calcEwald = data->calcEwald; + // const Ewald * calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -211,7 +211,6 @@ void DCFreeCycle::BuildOld(TrialMol& oldMol, uint molIndex) hed.ConstrainedAnglesOld(data->nAngleTrials - 1, oldMol, molIndex); const XYZ center = oldMol.AtomPosition(hed.Focus()); XYZArray* positions = data->multiPositions; - double prevPhi[MAX_BONDS]; for (uint i = 0; i < hed.NumBond(); ++i) { //get position and shift to origin positions[i].Set(0, oldMol.AtomPosition(hed.Bonded(i))); diff --git a/src/cbmc/DCFreeCycleSeed.cpp b/src/cbmc/DCFreeCycleSeed.cpp index f4ec8c01d..9ec5dacea 100644 --- a/src/cbmc/DCFreeCycleSeed.cpp +++ b/src/cbmc/DCFreeCycleSeed.cpp @@ -115,7 +115,7 @@ void DCFreeCycleSeed::BuildNew(TrialMol& newMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald *calcEwald = data->calcEwald; + // const Ewald *calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -189,7 +189,7 @@ void DCFreeCycleSeed::BuildOld(TrialMol& oldMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald * calcEwald = data->calcEwald; + // const Ewald * calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -209,7 +209,6 @@ void DCFreeCycleSeed::BuildOld(TrialMol& oldMol, uint molIndex) hed.ConstrainedAnglesOld(data->nAngleTrials - 1, oldMol, molIndex); const XYZ center = oldMol.AtomPosition(hed.Focus()); XYZArray* positions = data->multiPositions; - double prevPhi[MAX_BONDS]; for (uint i = 0; i < hed.NumBond(); ++i) { //get position and shift to origin positions[i].Set(0, oldMol.AtomPosition(hed.Bonded(i))); diff --git a/src/cbmc/DCFreeHedron.cpp b/src/cbmc/DCFreeHedron.cpp index 2311d47f1..0f7c6a74d 100644 --- a/src/cbmc/DCFreeHedron.cpp +++ b/src/cbmc/DCFreeHedron.cpp @@ -100,7 +100,7 @@ void DCFreeHedron::BuildNew(TrialMol& newMol, uint molIndex) seed.BuildNew(newMol, molIndex); PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald *calcEwald = data->calcEwald; + // const Ewald *calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -175,7 +175,7 @@ void DCFreeHedron::BuildOld(TrialMol& oldMol, uint molIndex) seed.BuildOld(oldMol, molIndex); PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald * calcEwald = data->calcEwald; + // const Ewald * calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -195,7 +195,6 @@ void DCFreeHedron::BuildOld(TrialMol& oldMol, uint molIndex) hed.ConstrainedAnglesOld(data->nAngleTrials - 1, oldMol, molIndex); const XYZ center = oldMol.AtomPosition(hed.Focus()); XYZArray* positions = data->multiPositions; - double prevPhi[MAX_BONDS]; for (uint i = 0; i < hed.NumBond(); ++i) { //get position and shift to origin positions[i].Set(0, oldMol.AtomPosition(hed.Bonded(i))); diff --git a/src/cbmc/DCFreeHedronSeed.cpp b/src/cbmc/DCFreeHedronSeed.cpp index 1684c2d32..ea0fdf149 100644 --- a/src/cbmc/DCFreeHedronSeed.cpp +++ b/src/cbmc/DCFreeHedronSeed.cpp @@ -99,7 +99,7 @@ void DCFreeHedronSeed::BuildNew(TrialMol& newMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald *calcEwald = data->calcEwald; + // const Ewald *calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -173,7 +173,7 @@ void DCFreeHedronSeed::BuildOld(TrialMol& oldMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald * calcEwald = data->calcEwald; + // const Ewald * calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; double* ljWeights = data->ljWeights; @@ -193,7 +193,6 @@ void DCFreeHedronSeed::BuildOld(TrialMol& oldMol, uint molIndex) hed.ConstrainedAnglesOld(data->nAngleTrials - 1, oldMol, molIndex); const XYZ center = oldMol.AtomPosition(hed.Focus()); XYZArray* positions = data->multiPositions; - double prevPhi[MAX_BONDS]; for (uint i = 0; i < hed.NumBond(); ++i) { //get position and shift to origin positions[i].Set(0, oldMol.AtomPosition(hed.Bonded(i))); diff --git a/src/cbmc/DCGraph.cpp b/src/cbmc/DCGraph.cpp index 1642f63df..1e91d0378 100644 --- a/src/cbmc/DCGraph.cpp +++ b/src/cbmc/DCGraph.cpp @@ -81,7 +81,7 @@ DCGraph::DCGraph(System& sys, const Forcefield& ff, //reassign destination values from atom indices to node indices for (uint i = 0; i < nodes.size(); ++i) { for (uint j = 0; j < nodes[i].edges.size(); ++j) { - uint& dest = nodes[i].edges[j].destination; + int& dest = nodes[i].edges[j].destination; dest = atomToNode[dest]; assert(dest != -1); } @@ -244,8 +244,8 @@ void DCGraph::BuildEdges(TrialMol& oldMol, TrialMol& newMol, uint molIndex, void DCGraph::Regrowth(TrialMol& oldMol, TrialMol& newMol, uint molIndex) { - //Randomly pick a node to keep it fix and not grow it - uint current = data.prng.randIntExc(nodes.size()); + //Randomly pick a node to keep it fixed and not grow it + int current = data.prng.randIntExc(nodes.size()); visited.assign(nodes.size(), false); //Visiting the node visited[current] = true; @@ -271,9 +271,9 @@ void DCGraph::Regrowth(TrialMol& oldMol, TrialMol& newMol, uint molIndex) newMol.AddAtom(partner, oldMol.AtomPosition(partner)); oldMol.ConfirmOldAtom(partner); } - //First we pick a edge that will be fix and continue copy the coordinate + //First we pick a edge that will be fixed and copy the coordinates //We continue the same until only one edge left from this node - //If current is the terminal node, we dont enter to while loop + //If current is the terminal node, we don't enter the while loop //Then continue to build the rest of the molecule from current //Copy the edges of the node to currFringe @@ -448,8 +448,8 @@ void DCGraph::BuildGrowOld(TrialMol& oldMol, uint molIndex) { visited.assign(nodes.size(), false); //Use backbone atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { if(nodes[i].atomIndex == oldMol.GetAtomBB(0)) { current = i; break; @@ -505,8 +505,8 @@ void DCGraph::BuildGrowNew(TrialMol& newMol, uint molIndex) { visited.assign(nodes.size(), false); //Use backbone atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { if(nodes[i].atomIndex == newMol.GetAtomBB(0)) { current = i; break; @@ -573,9 +573,9 @@ void DCGraph::BuildGrowInCav(TrialMol& oldMol, TrialMol& newMol, uint molIndex) } //Use backbone atom to start the node - uint current = -1; - for(uint i = 0; i < nodes.size(); i++) { - if(nodes[i].atomIndex == sIndex) { + int current = -1; + for(int i = 0; i < (int) nodes.size(); i++) { + if((int) nodes[i].atomIndex == sIndex) { current = i; break; } diff --git a/src/cbmc/DCGraph.h b/src/cbmc/DCGraph.h index face82f40..b3881f935 100644 --- a/src/cbmc/DCGraph.h +++ b/src/cbmc/DCGraph.h @@ -53,7 +53,7 @@ class DCGraph : public CBMC //Store edge's atom that are connected to node and has more than 1 bond //Each edge is a node as well struct Edge { - uint destination; //destination is partner node index. + int destination; //destination is partner node index. DCComponent* component; Edge(uint d, DCComponent* c) : destination(d), component(c) {} }; diff --git a/src/cbmc/DCHedron.cpp b/src/cbmc/DCHedron.cpp index 007b0fd1f..3f4064819 100644 --- a/src/cbmc/DCHedron.cpp +++ b/src/cbmc/DCHedron.cpp @@ -30,7 +30,7 @@ struct FindA1 { struct FindAngle { FindAngle(uint x, uint y) : x(x), y(y) {} - uint y, x; + uint x, y; bool operator()(const mol_setup::Angle& a) { return (a.a0 == x && a.a2 == y) || (a.a0 == y && a.a2 == x); @@ -122,7 +122,7 @@ void DCHedron::GenerateAnglesNew(TrialMol& newMol, uint molIndex, thetaFix = data->ff.angles->Angle(kind); } - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { if(angleFix) data->angles[i] = thetaFix; else @@ -132,7 +132,7 @@ void DCHedron::GenerateAnglesNew(TrialMol& newMol, uint molIndex, #ifdef _OPENMP #pragma omp parallel for default(none) shared(bType, kind, molIndex, newMol, nonbonded_1_3, nTrials) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angleEnergy[i] = data->ff.angles->Calc(kind, data->angles[i]); double distSq = newMol.AngleDist(anchorBond, bondLength[bType], @@ -158,7 +158,7 @@ void DCHedron::GenerateAnglesOld(TrialMol& oldMol, uint molIndex, thetaFix = data->ff.angles->Angle(kind); } - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { if(angleFix) data->angles[i] = thetaFix; else @@ -168,7 +168,7 @@ void DCHedron::GenerateAnglesOld(TrialMol& oldMol, uint molIndex, #ifdef _OPENMP #pragma omp parallel for default(none) shared(bType, kind, molIndex, nonbonded_1_3, nTrials, oldMol) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angleEnergy[i] = data->ff.angles->Calc(kind, data->angles[i]); double distSq = oldMol.AngleDist(anchorBondOld, bondLengthOld[bType], @@ -325,7 +325,7 @@ void DCHedron::ConstrainedAngles(TrialMol& newMol, uint molIndex, uint nTrials) #ifdef _OPENMP #pragma omp parallel for default(none) shared(energies, nonbonded_1_3, nTrials, weights) reduction(+:stepWeight) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { weights[i] = exp(-1 * data->ff.beta * (energies[i] + nonbonded_1_3[i])); stepWeight += weights[i]; diff --git a/src/cbmc/DCHedronCycle.cpp b/src/cbmc/DCHedronCycle.cpp index c7cd3cb61..058a7e54f 100644 --- a/src/cbmc/DCHedronCycle.cpp +++ b/src/cbmc/DCHedronCycle.cpp @@ -31,7 +31,7 @@ struct FindA1 { struct FindAngle { FindAngle(uint x, uint y) : x(x), y(y) {} - uint y, x; + uint x, y; bool operator()(const mol_setup::Angle& a) { return (a.a0 == x && a.a2 == y) || (a.a0 == y && a.a2 == x); @@ -186,14 +186,14 @@ void DCHedronCycle::GenerateAnglesNew(TrialMol& newMol, uint molIndex, return; } - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angles[i] = data->prng.rand(M_PI); } #ifdef _OPENMP #pragma omp parallel for default(none) shared(bType, kind, molIndex, newMol, nonbonded_1_3, nTrials) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angleEnergy[i] = data->ff.angles->Calc(kind, data->angles[i]); double distSq = newMol.AngleDist(anchorBond, bondLength[bType], data->angles[i]); @@ -224,14 +224,14 @@ void DCHedronCycle::GenerateAnglesOld(TrialMol& oldMol, uint molIndex, return; } - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angles[i] = data->prng.rand(M_PI); } #ifdef _OPENMP #pragma omp parallel for default(none) shared(bType, kind, molIndex, nonbonded_1_3, nTrials, oldMol) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { data->angleEnergy[i] = data->ff.angles->Calc(kind, data->angles[i]); double distSq = oldMol.AngleDist(anchorBondOld, bondLengthOld[bType], @@ -408,7 +408,7 @@ void DCHedronCycle::ConstrainedAngles(TrialMol& newMol, uint molIndex, uint nTri #ifdef _OPENMP #pragma omp parallel for default(none) shared(energies, nonbonded_1_3, nTrials, weights) reduction(+:stepWeight) #endif - for (int i = 0; i < nTrials; ++i) { + for (int i = 0; i < (int) nTrials; ++i) { weights[i] = exp(-1 * data->ff.beta * (energies[i] + nonbonded_1_3[i])); stepWeight += weights[i]; } diff --git a/src/cbmc/DCLinear.cpp b/src/cbmc/DCLinear.cpp index f86f0f364..cf6893c3c 100644 --- a/src/cbmc/DCLinear.cpp +++ b/src/cbmc/DCLinear.cpp @@ -65,7 +65,6 @@ void DCLinear::Regrowth(TrialMol& oldMol, TrialMol& newMol, uint molIndex) } else { //we only have two atoms in molecule: atom 0, 1 uint fix = data.prng.randInt(1); - uint grow = 1 - fix; //If fix == 0, forward (build atom 1), else backward (build atom 0) std::vector& comps = fix ? backward : forward; diff --git a/src/cbmc/DCLinkedCycle.cpp b/src/cbmc/DCLinkedCycle.cpp index 2aa091c02..ae673a493 100644 --- a/src/cbmc/DCLinkedCycle.cpp +++ b/src/cbmc/DCLinkedCycle.cpp @@ -172,8 +172,8 @@ void DCLinkedCycle::SetBondLengthOld(TrialMol& oldMol) void DCLinkedCycle::BuildNew(TrialMol& newMol, uint molIndex) { PRNG& prng = data->prng; - const CalculateEnergy& calc = data->calc; - const Forcefield& ff = data->ff; + // const CalculateEnergy& calc = data->calc; + // const Forcefield& ff = data->ff; double* torsion = data->angles; double* torWeights = data->angleWeights; double* torEnergy = data->angleEnergy; @@ -280,7 +280,7 @@ void DCLinkedCycle::BuildNew(TrialMol& newMol, uint molIndex) void DCLinkedCycle::BuildOld(TrialMol& oldMol, uint molIndex) { PRNG& prng = data->prng; - const CalculateEnergy& calc = data->calc; + // const CalculateEnergy& calc = data->calc; const Forcefield& ff = data->ff; double* torsion = data->angles; double* torWeights = data->angleWeights; @@ -371,7 +371,6 @@ void DCLinkedCycle::BuildOld(TrialMol& oldMol, uint molIndex) torEnergy[tor] = 0.0; nonbonded_1_4[tor] = 0.0; for (uint b = 0; b < hed.NumBond(); ++b) { - double theta1 = hed.Theta(b); double trialPhi = hed.Phi(b) + torsion[tor]; XYZ bondedC; if(oldMol.OneFour()) { @@ -497,7 +496,6 @@ void DCLinkedCycle::ChooseTorsion(TrialMol& mol, uint molIndex, torEnergy[tor] = 0.0; nonbonded_1_4[tor] = 0.0; for (uint b = 0; b < hed.NumBond(); ++b) { - double theta1 = hed.Theta(b); double trialPhi = hed.Phi(b) + torsion[tor]; XYZ bondedC; if(mol.OneFour()) { diff --git a/src/cbmc/DCLinkedCycle.h b/src/cbmc/DCLinkedCycle.h index 41a58865d..93af43d91 100644 --- a/src/cbmc/DCLinkedCycle.h +++ b/src/cbmc/DCLinkedCycle.h @@ -50,8 +50,8 @@ class DCLinkedCycle : public DCComponent uint prevBonded[MAX_BONDS]; //kind[bonded][previous] uint dihKinds[MAX_BONDS][MAX_BONDS]; - //Used in finding the atom bonded to prev and focus and bith are in the ring - uint prevBondedRing, focBondedRing; + //Used in finding the atom bonded to prev and focus and both are in the ring + int prevBondedRing, focBondedRing; //Calculate torsion difference to match ring dihedral double torDiff; diff --git a/src/cbmc/DCLinkedHedron.cpp b/src/cbmc/DCLinkedHedron.cpp index 3e64708ae..4ae413280 100644 --- a/src/cbmc/DCLinkedHedron.cpp +++ b/src/cbmc/DCLinkedHedron.cpp @@ -129,8 +129,8 @@ void DCLinkedHedron::SetBondLengthOld(TrialMol& oldMol) void DCLinkedHedron::BuildNew(TrialMol& newMol, uint molIndex) { PRNG& prng = data->prng; - const CalculateEnergy& calc = data->calc; - const Forcefield& ff = data->ff; + // const CalculateEnergy& calc = data->calc; + // const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; uint nDihTrials = data->nDihTrials; double* torsion = data->angles; @@ -212,7 +212,7 @@ void DCLinkedHedron::BuildNew(TrialMol& newMol, uint molIndex) void DCLinkedHedron::BuildOld(TrialMol& oldMol, uint molIndex) { PRNG& prng = data->prng; - const CalculateEnergy& calc = data->calc; + // const CalculateEnergy& calc = data->calc; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; uint nDihTrials = data->nDihTrials; @@ -283,7 +283,6 @@ void DCLinkedHedron::BuildOld(TrialMol& oldMol, uint molIndex) torEnergy[tor] = 0.0; nonbonded_1_4[tor] = 0.0; for (uint b = 0; b < hed.NumBond(); ++b) { - double theta1 = hed.Theta(b); double trialPhi = hed.Phi(b) + torsion[tor]; XYZ bondedC; if(oldMol.OneFour()) { @@ -384,7 +383,6 @@ void DCLinkedHedron::ChooseTorsion(TrialMol& mol, uint molIndex, torEnergy[tor] = 0.0; nonbonded_1_4[tor] = 0.0; for (uint b = 0; b < hed.NumBond(); ++b) { - double theta1 = hed.Theta(b); double trialPhi = hed.Phi(b) + torsion[tor]; XYZ bondedC; if(mol.OneFour()) { diff --git a/src/cbmc/DCRotateCOM.cpp b/src/cbmc/DCRotateCOM.cpp index 0ea034d2d..3969dc71c 100644 --- a/src/cbmc/DCRotateCOM.cpp +++ b/src/cbmc/DCRotateCOM.cpp @@ -128,7 +128,7 @@ void DCRotateCOM::BuildNew(TrialMol& newMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald *calcEwald = data->calcEwald; + // const Ewald *calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; uint fLJTrials = data->nLJTrialsFirst; @@ -239,7 +239,7 @@ void DCRotateCOM::BuildOld(TrialMol& oldMol, uint molIndex) { PRNG& prng = data->prng; const CalculateEnergy& calc = data->calc; - const Ewald * calcEwald = data->calcEwald; + // const Ewald * calcEwald = data->calcEwald; const Forcefield& ff = data->ff; uint nLJTrials = data->nLJTrialsNth; uint fLJTrials = data->nLJTrialsFirst; diff --git a/src/cbmc/DCRotateOnAtom.cpp b/src/cbmc/DCRotateOnAtom.cpp index 52f55de1f..a48c093fc 100644 --- a/src/cbmc/DCRotateOnAtom.cpp +++ b/src/cbmc/DCRotateOnAtom.cpp @@ -28,7 +28,7 @@ struct FindA1 { struct FindAngle { FindAngle(uint x, uint y) : x(x), y(y) {} - uint y, x; + uint x, y; bool operator()(const mol_setup::Angle& a) { return (a.a0 == x && a.a2 == y) || (a.a0 == y && a.a2 == x); @@ -378,7 +378,6 @@ double DCRotateOnAtom::CalcIntraBonded(TrialMol& mol, uint molIndex) double bondedEn = 0.0; uint box = mol.GetBox(); - const MoleculeKind& molKind = mol.GetKind(); XYZ b1, b2, b3; const XYZArray &coords = mol.GetCoords(); for(uint i = 0; i < ang.size(); i++) { diff --git a/src/cbmc/TrialMol.cpp b/src/cbmc/TrialMol.cpp index 00cf370d6..8869d7354 100644 --- a/src/cbmc/TrialMol.cpp +++ b/src/cbmc/TrialMol.cpp @@ -26,10 +26,11 @@ namespace cbmc TrialMol::TrialMol(const MoleculeKind& k, const BoxDimensions& ax, uint box) : kind(&k), axes(&ax), box(box), tCoords(k.NumAtoms()), cavMatrix(3), - totalWeight(1.0), bCoords(k.NumAtoms()), bonds(k.bondList) + bCoords(k.NumAtoms()), totalWeight(1.0), bonds(k.bondList) { - atomBuilt = new bool[k.NumAtoms()]; - std::fill_n(atomBuilt, k.NumAtoms(), false); + cavMatrix.Set(0, 1.0, 0.0, 0.0); + cavMatrix.Set(1, 0.0, 1.0, 0.0); + cavMatrix.Set(2, 0.0, 0.0, 1.0); growthToWorld.LoadIdentity(); backbone[0] = backbone[1] = 0; growingAtomIndex = 0; @@ -37,15 +38,14 @@ TrialMol::TrialMol(const MoleculeKind& k, const BoxDimensions& ax, comFix = false; rotateBB = false; overlap = false; - cavMatrix.Set(0, 1.0, 0.0, 0.0); - cavMatrix.Set(1, 0.0, 1.0, 0.0); - cavMatrix.Set(2, 0.0, 0.0, 1.0); + atomBuilt = new bool[k.NumAtoms()]; + std::fill_n(atomBuilt, k.NumAtoms(), false); } TrialMol::TrialMol() - : kind(NULL), axes(NULL), box(0), tCoords(0), atomBuilt(NULL), + : kind(NULL), axes(NULL), box(0), tCoords(0), cavMatrix(3), bCoords(0), comInCav(false), comFix(false), rotateBB(false), overlap(false), - cavMatrix(3), bCoords(0), bonds() + atomBuilt(NULL), bonds() { backbone[0] = backbone[1] = 0; growingAtomIndex = 0; @@ -56,8 +56,8 @@ TrialMol::TrialMol() TrialMol::TrialMol(const TrialMol& other) : kind(other.kind), axes(other.axes), box(other.box), - tCoords(other.tCoords), cavMatrix(other.cavMatrix), en(other.en), - bCoords(other.bCoords), totalWeight(other.totalWeight), + tCoords(other.tCoords), cavMatrix(other.cavMatrix), + bCoords(other.bCoords), en(other.en), totalWeight(other.totalWeight), basisPoint(other.basisPoint), bonds(other.bonds) { atomBuilt = new bool[kind->NumAtoms()]; diff --git a/src/moves/CFCMC.h b/src/moves/CFCMC.h index 6d19fe0b7..872406ebc 100644 --- a/src/moves/CFCMC.h +++ b/src/moves/CFCMC.h @@ -20,8 +20,8 @@ class CFCMC : public MoveBase public: CFCMC(System &sys, StaticVals const& statV) : - ffRef(statV.forcefield), molLookRef(sys.molLookupRef), - lambdaRef(sys.lambdaRef), MoveBase(sys, statV), MP(sys, statV) + MoveBase(sys, statV), lambdaRef(sys.lambdaRef), MP(sys, statV), + ffRef(statV.forcefield), molLookRef(sys.molLookupRef) { if(statV.cfcmcVal.enable) { MPEnable = statV.cfcmcVal.MPEnable; @@ -104,11 +104,10 @@ class CFCMC : public MoveBase XYZArray newMolPos; Intermolecular inter_LJ, inter_Real, recip; - cbmc::TrialMol oldMolCFCMC, newMolCFCMC; Energy oldEnergy[BOX_TOTAL], newEnergy[BOX_TOTAL]; - MoleculeLookup & molLookRef; Forcefield const& ffRef; + MoleculeLookup & molLookRef; SystemPotential sysPotNew; }; diff --git a/src/moves/MoleculeExchange1.h b/src/moves/MoleculeExchange1.h index 6d1ba5abf..686aa23cf 100644 --- a/src/moves/MoleculeExchange1.h +++ b/src/moves/MoleculeExchange1.h @@ -30,9 +30,9 @@ class MoleculeExchange1 : public MoveBase public: MoleculeExchange1(System &sys, StaticVals const& statV) : - ffRef(statV.forcefield), molLookRef(sys.molLookupRef), MoveBase(sys, statV), + MoveBase(sys, statV), perAdjust(statV.GetPerAdjust()), cavity(statV.memcVal.subVol), cavA(3), invCavA(3), - perAdjust(statV.GetPerAdjust()) + molLookRef(sys.molLookupRef), ffRef(statV.forcefield) { enableID = statV.memcVal.enable; trial.resize(BOX_TOTAL); @@ -101,7 +101,8 @@ class MoleculeExchange1 : public MoveBase int largeBB[2]; uint sourceBox, destBox; uint perAdjust, molInCavCount, counter; - uint numInCavA, numInCavB, kindS, kindL, totMolInCav; + uint numInCavA, numInCavB, totMolInCav; + int kindS, kindL; vector pStartA, pLenA, pStartB, pLenB; vector molIndexA, kindIndexA, molIndexB, kindIndexB; vector< vector > molInCav; @@ -214,8 +215,8 @@ inline void MoleculeExchange1::SetMEMC(StaticVals const& statV) inline void MoleculeExchange1::AdjustExRatio() { if(((counter + 1) % perAdjust) == 0) { - uint exMax = ceil((float)molInCavCount / (float)perAdjust); - uint exMin = ceil((float)exMax / 2.0); + int exMax = ceil((float)molInCavCount / (float)perAdjust); + int exMin = ceil((float)exMax / 2.0); if(exMin == 0) exMin = 1; @@ -612,8 +613,8 @@ inline void MoleculeExchange1::CalcEn() inline double MoleculeExchange1::GetCoeff() const { double volSource = boxDimRef.volume[sourceBox]; - double volDest = boxDimRef.volume[destBox]; #if ENSEMBLE == GEMC + double volDest = boxDimRef.volume[destBox]; if(insertL) { //kindA is the small molecule double ratioF = num::Factorial(totMolInCav) / diff --git a/src/moves/MoleculeExchange2.h b/src/moves/MoleculeExchange2.h index c5d5554c1..88e09bdd2 100644 --- a/src/moves/MoleculeExchange2.h +++ b/src/moves/MoleculeExchange2.h @@ -92,8 +92,8 @@ inline void MoleculeExchange2::SetMEMC(StaticVals const& statV) inline void MoleculeExchange2::AdjustExRatio() { if(((counter + 1) % perAdjust) == 0) { - uint exMax = ceil((float)molInCavCount / (float)perAdjust); - uint exMin = 1; + int exMax = ceil((float)molInCavCount / (float)perAdjust); + int exMin = 1; uint index = kindS + kindL * molRef.GetKindsCount(); double currAccept = (double)(accepted[sourceBox][index]) / (double)(trial[sourceBox][index]); if(std::abs(currAccept - lastAccept) >= 0.05 * currAccept) { @@ -391,9 +391,8 @@ inline void MoleculeExchange2::CalcEn() inline double MoleculeExchange2::GetCoeff() const { - double volSource = boxDimRef.volume[sourceBox]; - double volDest = boxDimRef.volume[destBox]; #if ENSEMBLE == GEMC + double volDest = boxDimRef.volume[destBox]; if(insertL) { //kindA is the small molecule double ratioF = num::Factorial(totMolInCav - 1) / diff --git a/src/moves/MoleculeExchange3.h b/src/moves/MoleculeExchange3.h index 64491d095..ba7c5141a 100644 --- a/src/moves/MoleculeExchange3.h +++ b/src/moves/MoleculeExchange3.h @@ -69,8 +69,8 @@ inline void MoleculeExchange3::SetMEMC(StaticVals const& statV) inline void MoleculeExchange3::AdjustExRatio() { if(((counter + 1) % perAdjust) == 0) { - uint exMax = ceil((float)molInCavCount / (float)perAdjust); - uint exMin = 1; + int exMax = ceil((float)molInCavCount / (float)perAdjust); + int exMin = 1; uint index = kindS + kindL * molRef.GetKindsCount(); double currAccept = (double)(accepted[sourceBox][index]) / (double)(trial[sourceBox][index]); if(std::abs(currAccept - lastAccept) >= 0.05 * currAccept) { @@ -362,9 +362,8 @@ inline void MoleculeExchange3::CalcEn() inline double MoleculeExchange3::GetCoeff() const { - double volSource = boxDimRef.volume[sourceBox]; - double volDest = boxDimRef.volume[destBox]; #if ENSEMBLE == GEMC + double volDest = boxDimRef.volume[destBox]; if(insertL) { //kindA is the small molecule double ratioF = num::Factorial(totMolInCav - 1) / diff --git a/src/moves/MoleculeTransfer.h b/src/moves/MoleculeTransfer.h index 0cf7eccfb..9ac47e3b7 100644 --- a/src/moves/MoleculeTransfer.h +++ b/src/moves/MoleculeTransfer.h @@ -19,8 +19,8 @@ class MoleculeTransfer : public MoveBase public: MoleculeTransfer(System &sys, StaticVals const& statV) : - ffRef(statV.forcefield), molLookRef(sys.molLookupRef), - MoveBase(sys, statV) {} + MoveBase(sys, statV), molLookRef(sys.molLookupRef), + ffRef(statV.forcefield) {} virtual uint Prep(const double subDraw, const double movPerc); virtual uint Transform(); diff --git a/src/moves/Regrowth.h b/src/moves/Regrowth.h index 1447bcd00..0c60db1ec 100644 --- a/src/moves/Regrowth.h +++ b/src/moves/Regrowth.h @@ -18,7 +18,7 @@ class Regrowth : public MoveBase public: Regrowth(System &sys, StaticVals const& statV) : MoveBase(sys, statV), - ffRef(statV.forcefield), molLookRef(sys.molLookupRef) {} + molLookRef(sys.molLookupRef), ffRef(statV.forcefield) {} virtual uint Prep(const double subDraw, const double movPerc); virtual uint Transform(); diff --git a/src/moves/TargetedSwap.h b/src/moves/TargetedSwap.h index 58cafc4d7..ef87a732a 100644 --- a/src/moves/TargetedSwap.h +++ b/src/moves/TargetedSwap.h @@ -64,8 +64,7 @@ class TargetedSwap : public MoveBase public: TargetedSwap(System &sys, StaticVals const& statV) : - ffRef(statV.forcefield), molLookRef(sys.molLookupRef), - MoveBase(sys, statV) + MoveBase(sys, statV), molLookRef(sys.molLookupRef), ffRef(statV.forcefield) { rigidSwap = true; for(int b = 0; b < BOX_TOTAL; b++) { @@ -75,7 +74,7 @@ class TargetedSwap : public MoveBase } if(statV.targetedSwapVal.enable) { - for(int s = 0; s < statV.targetedSwapVal.targetedSwap.size(); s++) { + for(int s = 0; s < (int) statV.targetedSwapVal.targetedSwap.size(); s++) { config_setup::TargetSwapParam tsp = statV.targetedSwapVal.targetedSwap[s]; TSwapParam tempVar; // copy data from TargetSwapParam struct to TSwapParam @@ -153,7 +152,7 @@ class TargetedSwap : public MoveBase bool found = false; std::string resname = start->first; double cpot = start->second; - for (int k = 0; k < tempVar.selectedResKind.size(); ++k) { + for (int k = 0; k < (int) tempVar.selectedResKind.size(); ++k) { int kIndex = tempVar.selectedResKind[k]; if(resname == molRef.kinds[kIndex].name) { found = true; @@ -733,7 +732,7 @@ uint TargetedSwap::GetGrowingAtomIndex(const uint k) FloydWarshallCycle flw(kind.NumAtoms()); //Setup the node's degree uint bondCount = kind.bondList.count; - for (int i = 0; i < bondCount; ++i) { + for (int i = 0; i < (int) bondCount; ++i) { flw.AddEdge(kind.bondList.part1[i], kind.bondList.part2[i]); } @@ -755,16 +754,16 @@ void TargetedSwap::PrintTargetedSwapInfo() { int i, k, b; for(b = 0; b < BOX_TOTAL; ++b) { - for (i = 0; i < targetSwapParam[b].size(); ++i) { + for (i = 0; i < (int) targetSwapParam[b].size(); ++i) { TSwapParam tsp = targetSwapParam[b][i]; printf("%-40s %d: \n", "Info: Targeted Swap parameter for subVolume index", tsp.subVolumeIdx); printf("%-40s %d \n", " SubVolume Box:", b); if (tsp.calcSubVolCenter) { - printf("%-40s Using %d defined atom index/es \n", " Calculating subVolume center:", + printf("%-40s Using %lu defined atom indexes \n", " Calculating subVolume center:", tsp.atomList.size()); int max = *std::max_element(tsp.atomList.begin(), tsp.atomList.end()); - if(max >= coordCurrRef.Count()) { + if(max >= (int) coordCurrRef.Count()) { printf("Error: Atom index %d is beyond total number of atoms (%d) in the system!\n", max, coordCurrRef.Count()); printf(" Make sure to use 0 based atom index!\n"); @@ -781,12 +780,12 @@ void TargetedSwap::PrintTargetedSwapInfo() tsp.subVolumeDim.x, tsp.subVolumeDim.y, tsp.subVolumeDim.z); printf("%-40s %s \n", " SubVolume Swap type:", (tsp.rigidSwap ? "Rigid body" : "Flexible")); printf("%-40s ", " Targeted residue kind:"); - for (k = 0; k < tsp.selectedResKind.size(); ++k) { + for (k = 0; k < (int) tsp.selectedResKind.size(); ++k) { printf("%-5s ", molRef.kinds[tsp.selectedResKind[k]].name.c_str()); } printf("\n"); if(!tsp.rigidSwap) { - for (k = 0; k < tsp.selectedResKind.size(); ++k) { + for (k = 0; k < (int) tsp.selectedResKind.size(); ++k) { int kIdx = tsp.selectedResKind[k]; printf("%-40s %s: (%d, %s) \n", " Starting atom (index, name) for", molRef.kinds[kIdx].name.c_str(), growingAtomIndex[kIdx], @@ -795,7 +794,7 @@ void TargetedSwap::PrintTargetedSwapInfo() } #if ENSEMBLE == GCMC printf("%-40s ", (ffRef.isFugacity ? " Targeted fugacity (bar):" : " Targeted chemical potential (K):")); - for (k = 0; k < tsp.selectedResKind.size(); ++k) { + for (k = 0; k < (int) tsp.selectedResKind.size(); ++k) { int kIdx = tsp.selectedResKind[k]; double value = tsp.chemPot[kIdx] / (ffRef.isFugacity ? unit::BAR_TO_K_MOLECULE_PER_A3 : 1.0); printf("(%-4s: %g) ", molRef.kinds[kIdx].name.c_str(), value); @@ -855,7 +854,7 @@ bool TargetedSwap::FindMolInSubVolume(const uint box, const uint kind, break; default: - printf("Error: Unknown PBC mode %d in targetedSwap move!\n", pbcMode); + printf("Error: Unknown PBC mode %d in targetedSwap move!\n", pbcMode[box]); exit(EXIT_FAILURE); break; } @@ -892,7 +891,7 @@ bool TargetedSwap::FindMolInSubVolume(const uint box, const uint kind, break; default: - printf("Error: Unknown PBC mode %d in targetedSwap move!\n", pbcMode); + printf("Error: Unknown PBC mode %d in targetedSwap move!\n", pbcMode[box]); exit(EXIT_FAILURE); break; } @@ -1012,7 +1011,7 @@ bool TargetedSwap::SearchCavity_AC(std::vector &mol, const XYZ& center, } else { MoleculeLookup::box_iterator n = molLookRef.BoxBegin(box); MoleculeLookup::box_iterator end = molLookRef.BoxEnd(box); - uint start, length, p; + int start, length, p; while (n != end) { molIndex = *n; molKind = molRef.GetMolKind(molIndex); diff --git a/test/src/CircuitTester.cpp b/test/src/CircuitTester.cpp index c2b026134..9dd1a967c 100644 --- a/test/src/CircuitTester.cpp +++ b/test/src/CircuitTester.cpp @@ -58,7 +58,7 @@ TEST(CircuitTester, DialaTest) { cyclicFWAtoms = fw.GetAllCommonCycles(); /* FW leaves empty vectors when unioning */ - for (int i = 0; i < cyclicFWAtoms.size(); ) { + for (int i = 0; i < (int) cyclicFWAtoms.size(); ) { if (cyclicFWAtoms[i].size() == 0) { cyclicFWAtoms.erase(cyclicFWAtoms.begin() + i); } else ++i; @@ -69,7 +69,7 @@ TEST(CircuitTester, DialaTest) { /* The two algorithms don't guaruntee ordering of cyclic atoms */ /* First we sort within cycles */ - for (int i = 0; i < cyclicFWAtoms.size(); i++) { + for (int i = 0; i < (int) cyclicFWAtoms.size(); i++) { std::sort (cyclicCFAtoms[i].begin(), cyclicCFAtoms[i].end()); std::sort (cyclicFWAtoms[i].begin(), cyclicFWAtoms[i].end()); } @@ -78,7 +78,7 @@ TEST(CircuitTester, DialaTest) { std::sort(cyclicFWAtoms.begin(), cyclicFWAtoms.end(), std::greater>()); /* Cycles are the same size */ - for (int i = 0; i < cyclicCFAtoms.size(); i++) { + for (int i = 0; i < (int) cyclicCFAtoms.size(); i++) { EXPECT_EQ(cyclicCFAtoms[i].size() == cyclicFWAtoms[i].size(), true); }