def Get_Dihedral_fromTOP(coor_file, base_list_1, PRINT=False): ''' calculate the dihedral from the top file. ''' Atom_list = Simple_atom.Get_atom_list(coor_file) reside_list = Simple_atom.Get_Residue_list(Atom_list) if PRINT == True: print "%11s%10s%10s%10s%10s%10s%10s%10s%8s%8s%8s%8s%8s%8s%8s"\ %("baseID","alpha","beta","gamma","delta","epslon","zeta","chi",\ "alpha","beta","gamma","delta","epslon","zeta","chi") for m in base_list_1: resu = DNA_param.Get_Dihedral(Atom_list, m) if PRINT == True: print "%8d%3s" % (reside_list[m - 1][1], reside_list[m - 1][0]), for i in range(7): if resu[i] == "-": print "%9s" % ("-" * 4), else: print "%9.2f" % (resu[i]), for i in range(7): if resu[i] == "-": print "%7s" % ("-" * 4), else: print "%7s" % (resu[i + 7]), print ""
time = float((ts.frame - 1) * dt) if dt > 0.0: if time < float(begin): continue if time > float(end) and end != -1: break if ts.frame % skip == 0: for atom in Atom_list: atom.atom_coor_x = ts._x[atom.atom_id - 1] atom.atom_coor_y = ts._y[atom.atom_id - 1] atom.atom_coor_z = ts._z[atom.atom_id - 1] for i in range(len(base_list)): fp = open(output_name[i], 'a') resu = DNA_param.Get_Dihedral(Atom_list, base_list[i]) fp.write("%12.4f" % (time / 1000)) for j in range(7): if resu[j] == "-": fp.write("%10s" % ("-" * 4)) else: fp.write("%10.2f" % (resu[j])) for j in range(7): if resu[j] == "-": fp.write("%8s" % ("-" * 4)) else: fp.write("%8s" % (resu[j + 7])) fp.write("\n")