sel = (sel & amask) allboundatoms = numpy.array(allboundatoms) fboundatoms = numpy.array(allboundatoms[sel]) icom = numpy.sum(fboundatoms, axis=0) / float(len(fboundatoms)) fboundatoms = fboundatoms - icom nstruc = 0 f1 = sys.stdout if output is not None: f1 = open(output, 'w') print >> f1, "\n".join(struc_header) for structure in structures: ligands = structure[1] assert len(ligands) == len(pivots), (len(ligands), len(pivots)) sys.stdout.flush() result = collectlib.collect_next() if result: break nstruc += 1 coor = collectlib.collect_all_coor() coor = numpy.array(coor) fcoor = coor[sel] irotmat, ipivot = align_interface(fboundatoms, fcoor) print >> f1, "#" + str(nstruc) if len(structure[0]): print >> f1, "\n".join(structure[0]) for lignr, lig in enumerate(ligands): ll = lig.split() if str(lignr + 1) in ensembles: ens = ll[0] + " " dofs = ll[1:]
sigma = sqrt(varmap / 3.0) emdata_gaussian = scipy.ndimage.filters.gaussian_filter(emdata, sigma, mode="constant") initargs = [datfile] + pdbfiles if modefile: initargs += ["--modes", modefile] if imodefile: initargs += ["--imodes", imodefile] for nr, ensfile in ensfiles: initargs += ["--ens", nr, ensfile] collectlib.collect_init(initargs) blocksize0 = 100 poolsize = multiprocessing.cpu_count() blocksize = max(poolsize * int(blocksize0 / poolsize), 1) pool = multiprocessing.Pool(poolsize) while 1: coors = [] for nstruc in range(blocksize): eof = collectlib.collect_next() if eof: break coor = collectlib.collect_coor(copy=True) coors.append(coor) if eof and not nstruc: break #corr = [calc_emcorr(coor) for coor in coors] corr = pool.map(calc_emcorr, coors) for c in corr: print "%.6f" % c if eof: break