nmdFilename = proteinName + ".nmd" atoms = [] ###BEGIN HEAVY LIFTING### #Read .pdb file and create Atom objects with corresponding data from file with open(pdbFilename) as pdbFile: pdbLines = pdbFile.readlines() for line in pdbLines: words = str.split(line) if len(words) < 1: pass elif words[0] == "ATOM": newAtom = Atom() newAtom.resID = words[1] newAtom.atomName = words[2] newAtom.resName = words[3] newAtom.coordinates = [words[5], words[6], words[7]] newAtom.bFactor = words[9] newAtom.tag = words[10] atoms.append(newAtom) #Read .out file add corresponding mode data from file to existing Atom objects ##This asssumes a very regular formatting after the first VIBRATION keyword. ##It will produce incorrect output if lines are malformed, or if ##the VIBRATION keyword's first appearance is not directly before mode data. with open(modeFilename) as modeFile: modeLines = modeFile.readlines()
nmdFilename = proteinName + ".nmd" atoms = [] ###BEGIN HEAVY LIFTING### #Read .pdb file and create Atom objects with corresponding data from file with open(pdbFilename) as pdbFile: pdbLines = pdbFile.readlines() for line in pdbLines: words = str.split(line) if len(words) < 1: pass elif words[0] == "ATOM": newAtom = Atom() newAtom.resID = words[1] newAtom.atomName = words[2] newAtom.resName = words[3] newAtom.coordinates = [words[5], words[6], words[7]] newAtom.bFactor = words[9] newAtom.tag = words[10] atoms.append(newAtom) #Read .out file add corresponding mode data from file to existing Atom objects ##This asssumes a very regular formatting after the first VIBRATION keyword. ##It will produce incorrect output if lines are malformed, or if ##the VIBRATION keyword's first appearance is not directly before mode data. with open(modeFilename) as modeFile: modeLines = modeFile.readlines() currentModeNumber = 0