def calcInitDist(): """Calculates the "initial distance" based on the first frame of the coordinate file.""" global RUNANALYSIS global PRMTOPPATH global COORDPATH global STARTDIST global PROTEINATOM global LIGANDATOM if not RUNANALYSIS: log("Calculating initial distance.\n") with open(COORDPATH + "/initial.pdb") as pdb: STARTDIST = atomDist(list(pdb), LIGANDATOM, PROTEINATOM) else: # analysis STARTDIST = min([ float(name.split('/')[-1]) for name in glob("%s/*.*" % WORKDIR) if os.path.isdir(os.path.join(WORKDIR, name)) ]) if not RUNANALYSIS: log(BLUE + "Initial distance is " + MAGENTA + "%.3f" % STARTDIST + BLUE + ". " + END) if MAXDIST is not None: log(BLUE + "Analysis endpoint will be " + MAGENTA + "%.3f" % (MAXDIST + STARTDIST) + BLUE + " angstroms.\n" + END) else: log('\n')
def calcInitDist(): """Calculates the "initial distance" based on the first frame of the coordinate file.""" global RUNANALYSIS global PRMTOPPATH global COORDPATH global STARTDIST global PROTEINATOM global LIGANDATOM if not RUNANALYSIS: log("Calculating initial distance.\n") with open(COORDPATH + "/initial.pdb") as pdb: STARTDIST = atomDist(list(pdb), LIGANDATOM, PROTEINATOM) else: # analysis STARTDIST = min([float(name.split('/')[-1]) for name in glob("%s/*.*" % WORKDIR) if os.path.isdir(os.path.join(WORKDIR, name))]) if not RUNANALYSIS: log(BLUE + "Initial distance is " + MAGENTA + "%.3f" % STARTDIST + BLUE + ". " + END) if MAXDIST is not None: log(BLUE + "Analysis endpoint will be " + MAGENTA + "%.3f" % (MAXDIST + STARTDIST) + BLUE + " angstroms.\n" + END) else: log('\n')
def calcDist(frame): """Calculate the distance for a certain frame. Returns (frame, distance).""" with open("frame_%i.pdb" % frame) as pdb: dist = atomDist(list(pdb), LIGANDATOM, PROTEINATOM) log("Frame %i has distance %.3f\n" % (frame, dist)) return frame, dist