Commits

jfinkels  committed 4d05bac

reverted changes

  • Participants
  • Parent commits 5b351fd

Comments (0)

Files changed (4)

 warnings = ['-Wall', '-Wextra', '-pedantic']
 optimizations = ['-O3']
-otherflags = ['-fopenmp']
+otherflags = []#['-fopenmp']
 libs = ['m', 'gomp']
 
 env = Environment(CCFLAGS = warnings + optimizations + otherflags, LIBS = libs)
 	if (!chain->numTempResidues) return;
 
 	/* As many or more gaps as residues is bad. In that case, code to ignore SEQRES entries should work fine. */
-	if (chain->numTempResidues < maxSkip + 1) maxSkip = chain->numTempResidues-1;
+	if (chain->numTempResidues-1 < maxSkip) maxSkip = chain->numTempResidues-1;
 
 	for (res=1; res < chain->numTempResidues; res++) {
 		info[res].list = info[res-1].list + maxSkip+1;
 		/* Match up atom records with residues. */
 		for (i=0; i<chain->numAtoms; i++) {
 			while (!(chain->residues[pos].resNum == chain->atoms[i].res 
-		&& chain->residues[pos].resLetter == chain->atoms[i].resLetter)) {
+               && chain->residues[pos].resLetter == chain->atoms[i].resLetter)) {
 				pos++;
 			}
 
 	return out;
 }
 
-int GetResidueIndex(PDBChain *chain, int *position, int pdbPosition, char insertionCode) {
+int GetResidueIndex(PDBChain *chain, int *position, unsigned int pdbPosition, char insertionCode) {
 	unsigned int i;
 	int min = 0, max = chain->length-1;
 	/* normally use (min+max)/2, but guessing that the pdb numbering
 	 * actually makes sense for the first guess seems a good idea.
 	 */
-	int current = pdbPosition - 1;
-	if (current < 0 || current >= chain->length) current = (min+max/2);
+	unsigned int current;
+  if (pdbPosition < 1 || pdbPosition > chain->length) {
+    current = (min+max)/2;
+  } else {
+    current = pdbPosition - 1;
+  }
+	/* if (current < 0 || current >= chain->length) current = (min+max/2); */
 	while (min <= max)
 	{
 		/* compare numbers, and adjust range if no match. */
 	return out;
 }
 
-int GetResidueFirstIndex(PDBChain *chain, int *position, int pdbPosition, char insertionCode) {
+int GetResidueFirstIndex(PDBChain *chain, int *position, unsigned int pdbPosition, char insertionCode) {
 	/* PDB numbering might not actually make sense...In which case, logical searches
 	 * aren't guaranteed to work.  Also, insertion codes might not be in alphabetical
 	 * order (Or ' ' codes might occur after lettered ones), in which case,
 }
 
 int AreHbondedAsymmetric(PDBChain *chain, int res1, int res2, HydrogenBond **hbond) {
-	unsigned int min = 0;
-	unsigned int max = chain->numHbonds-1;
-	unsigned int mid;
+	int min = 0;
+	int max = chain->numHbonds-1;
+	int mid;
 	while (min < max) {
 		mid = (min+max)/2;
 		if (chain->hbonds[mid].res1 > res1) {
 }
 
 void AddAlphaHelix(PDBChain *chain, AlphaHelix *helix) {
-	int i = chain->numAlphaHelices;
+	unsigned int i = chain->numAlphaHelices;
 	chain->alphaHelices = (AlphaHelix*) realloc(chain->alphaHelices, sizeof(AlphaHelix)*(chain->numAlphaHelices+1));
 	while (i && chain->alphaHelices[i-1].start > helix->start) {
 		chain->alphaHelices[i] = chain->alphaHelices[i-1];
 			for (p = 0; p < chain->numBetaPairs; p++) {
 				BetaPair *pair = &chain->betaPairs[p];
 				BetaResiduePair res;
-				if ((unsigned int) (temp[p]) == i+1) continue;
+				if (temp[p] == (char) (i+1)) continue;
 				for (j = 0; j<pairs[0].length; j++) {
 					if (FindFirstMatch(pair, pairs[0].start1 + j, &res)) {
 						if (left<0 || (temp[left] && !temp[j])) {
 	chain->numBetaPairs++;
 }
 
-int AreAlignedPairs(PDBChain *chain, int res1, int res2) {
+int AreAlignedPairs(PDBChain *chain, unsigned int res1, unsigned int res2) {
 	unsigned int pair;
 	if (res2 < res1) {
 		int temp = res1;
 /* Checks if res1 and res2 are aligned in a beta sheet.  Returns 0 if they aren't,
  * 1 if they are and are parallel, -1 for antiparallel.
  */
-int AreAlignedPairs(PDBChain *chain, int res1, int res2);
+int AreAlignedPairs(PDBChain *chain, unsigned int res1, unsigned int res2);
 void CalcChainSecondary(PDBChain *chain);
 
 PDBChain *CreateChain(char *name, char chain);
  * to give the first occurence.  Takes O(log n) if numbering is sequential
  * and finds something.  Otherwise, takes O(n).
  */
-int GetResidueIndex(PDBChain *chain, int *position, int pdbPosition, char insertionCode);
+int GetResidueIndex(PDBChain *chain, int *position, unsigned int pdbPosition, char insertionCode);
 
 /* Guaranteed to give the first occurance with the given codes. */
-int GetResidueFirstIndex(PDBChain *chain, int *position, int pdbPosition, char insertionCode);
+int GetResidueFirstIndex(PDBChain *chain, int *position, unsigned int pdbPosition, char insertionCode);
 /* Does the same thing, but works with a portion of a string from a raw PDB line. */
 int GetResidueFirstIndexString(PDBChain *chain, int *position, char * rawString);
 void AddAlphaHelix(PDBChain *chain, AlphaHelix *helix);
 			int prevStart = -1;
 			int prevEnd = -1;
 			int prev, current;
-			int dir;
-      unsigned int len;
+			int dir, len;
 			PDBChain * lastChain = 0;
 			PDBChain * chain;
 			BetaSheet *sheet = 0;