diff --git a/FiveConf.py b/FiveConf.py index 9499b42..7c697ed 100755 --- a/FiveConf.py +++ b/FiveConf.py @@ -72,8 +72,8 @@ def main(f, settings): WasAbove90 = False rotangle = 2*(0.5*pi-angle) OldAtomCoords = outAtom.GetVector() - print "Atom " + str(outAtom.GetAtomicNum()) + " will be rotated by " +\ - str(rotangle*57.3) + ' degrees' + print("Atom " + str(outAtom.GetAtomicNum()) + " will be rotated by " +\ + str(rotangle*57.3) + ' degrees') RotateAtom(outAtom, AxisAtoms[0], AxisAtoms[1], rotangle) angle2 = FindRotAngle(AxisAtoms[0], AxisAtoms[1], outAtom, norm) @@ -82,7 +82,7 @@ def main(f, settings): if ((angle2 > 0.5*pi) and WasAbove90) or ((angle2 < 0.5*pi) and not WasAbove90): #Flip the sign of the rotation angle, restore the coords #and rotate the atom in the opposite direction - print "Atom was rotated the wrong way, switching the direction" + print("Atom was rotated the wrong way, switching the direction") rotangle = -rotangle outAtom.SetVector(OldAtomCoords) RotateAtom(outAtom, AxisAtoms[0], AxisAtoms[1], rotangle) @@ -93,7 +93,7 @@ def main(f, settings): RotateAtom(atom, AxisAtoms[0], AxisAtoms[1], rotangle) RotatedAtoms.append(atom) else: - print "Atom already rotated, skipping" + print("Atom already rotated, skipping") obconversion.SetOutFormat("sdf") obconversion.WriteFile(obmol, f[:-4] + 'rot.sdf') @@ -228,7 +228,7 @@ def LstSqPlane(atom1, atom2, atom3, atom4): # Inital guess of the plane [a0, b0, c0], d0 = FindPlane(atom1, atom2, atom3) - f = lambda (a, b, c, d): PlaneError([atom1, atom2, atom3, atom4], a, b, c, d) + f = lambda a: PlaneError([atom1, atom2, atom3, atom4], a[0], a[1], a[2], a[3]) res = sciopt.minimize(f, (a0, b0, c0, d0), method='nelder-mead') plane = list(res.x) diff --git a/Karplus.py b/Karplus.py index 1f47664..da06b57 100755 --- a/Karplus.py +++ b/Karplus.py @@ -51,8 +51,8 @@ def Karplus(f, inputformat): DihedralHs.append([atom.GetIdx()] + DihedNeighbours) if len(DihedralHs)==0: - print "No dihedral protons found, Karplus J value prediction " + \ - "impossible, quitting." + print("No dihedral protons found, Karplus J value prediction " + \ + "impossible, quitting.") quit() Jmatrix, Jlabels = CalcJMatrix(obmol, DihedralHs) diff --git a/TreeRenum.py b/TreeRenum.py index 0ecc63f..98179f4 100755 --- a/TreeRenum.py +++ b/TreeRenum.py @@ -12,7 +12,7 @@ def FindAllPaths(molgraph, start, end, path=[]): if start == end: return [path] if start not in [x[0] for x in molgraph]: - print "No such node in graph" + print("No such node in graph") return [] paths = [] for node in molgraph[start-1][1:]: @@ -26,7 +26,7 @@ def FindAllPaths(molgraph, start, end, path=[]): def FindTerminatingPaths(molgraph, start, trunk, path=[]): path = path + [start] if start not in [x[0] for x in molgraph]: - print "No such node in graph" + print("No such node in graph") return [] paths = [] for node in molgraph[start-1][1:]: @@ -109,7 +109,7 @@ def TreeRenumSDF(f, ExpNMR): if anum == 6: NMRmap.append(['C' + str(atom), 'C' + str(i)]) i += 1 - print NMRmap + print(NMRmap) RenumNMR(ExpNMR, NMRmap) @@ -118,7 +118,7 @@ def RenumNMR(ExpNMR, NMRmap): NMRfile = f.read(1000000) f.close() - print '\nOld NMR file:\n' + NMRfile + print('\nOld NMR file:\n' + NMRfile) #Replace old atom labels with new atom labels #tag replacements with '_' to avoid double replacement @@ -131,7 +131,7 @@ def RenumNMR(ExpNMR, NMRmap): #Strip temporary udnerscore tags NMRfile = NMRfile.replace('_', '') - print '\nNew NMR file:\n' + NMRfile + print('\nNew NMR file:\n' + NMRfile) f = open(ExpNMR + 'r', 'w') f.write(NMRfile) f.close()