#print meta_crd[chaini] import time time_a = time.time() NSFAC = 1.0 disulfides = disulf_str.split(":") #nresprot = 0 for i in range(nchain): chaini = chains[i] print chaini #print meta_crd[chaini][142] bb_bonds = go_lib.calc_bonds(meta_crd[chaini], link) if (defbon == 1 or len(sequence) > 0): bb_bonds = map(lambda x: (x[0], x[1], go_lib.std_bond), bb_bonds) bb_angles = go_lib.calc_angles(meta_crd[chaini], link, stata) bb_dihedrals = go_lib.setup_dihe(meta_crd[chaini], link, fixalpha, zerodihe, nativedihe) nonbondedx[chaini] = {} if kh == 1: khmap[chaini] = {} #nonbonded[chaini][chaini],tmp_nsfac = go_lib.calc_ncon_intra(meta_crd[chaini],tfmap[chaini][chaini],ngdist,gamma,geomh,fixrep) if (aacut < 0.0): # do Karanicolas&Brooks nonbondedx[chaini][chaini] = go_lib.calc_ncon_intra( meta_crd[chaini], ngdist, gamma, geomh, fixrep) else: nonbondedx[chaini][chaini] = go_lib.calc_ncon_intra_simplecut(meta_crd[chaini], ngdist, \ gamma, fixrep, aacut) # if kh == 1: khmap[chaini][chaini] = go_lib.calc_kh_intra(meta_crd[chaini], E0,
idx += 1 name = meta_crd[c][i]["name"] mass = go_lib.massmap[name] residues.append(("G%i" % (idx), mass)) go_lib.write_topology(outp_base + "_top.inp", residues, key) # calculate parameters # ====================================================================== link = 0 eps_res = 0.0054 * Tf bonds_a = go_lib.calc_bonds(meta_crd[chains[0]], link) bonds_b = go_lib.calc_bonds(meta_crd[chains[1]], link) angles_a = go_lib.calc_angles(meta_crd[chains[0]], link) angles_b = go_lib.calc_angles(meta_crd[chains[1]], link) dihedrals_a = go_lib.setup_dihe(meta_crd[chains[0]], link) dihedrals_b = go_lib.setup_dihe(meta_crd[chains[1]], link) nonbonded_a = go_lib.calc_ncon_intra(meta_crd[chains[0]], ngdist, gamma) nonbonded_b = go_lib.calc_ncon_intra(meta_crd[chains[1]], ngdist, gamma) nonbonded_ab = go_lib.calc_ncon_inter(meta_crd[chains[0]], meta_crd[chains[1]], ngdist, gamma) if symm: bonds = go_lib.average_bonded(bonds_a, bonds_b) angles = go_lib.average_bonded(angles_a, angles_b) nonbonded = go_lib.average_nonbonded_intra(nonbonded_a, nonbonded_b) nonbonded_ab_sym = go_lib.symmetrize_nb(nonbonded_ab, nres_tot) dihedrals = dihedrals_a else: bonds = go_lib.merge_bonded(bonds_a, bonds_b)
# new ---------------------------------------------- bonds = {} angles = {} dihedrals = {} nonbonded = {} threebody ={} NSFAC = 1.0 disulfides = disulf_str.split(":") for i in range(nchain): chaini = chains[i] bb_bonds = go_lib.calc_bonds(meta_crd[chaini],link) if (defbon==1 or len(sequence)>0): bb_bonds = map(lambda x: (x[0],x[1],go_lib.std_bond), bb_bonds) bb_angles = go_lib.calc_angles(meta_crd[chaini],link,stata) bb_dihedrals = go_lib.setup_dihe(meta_crd[chaini],link) nonbonded[chaini] = {} #nonbonded[chaini][chaini],tmp_nsfac = go_lib.calc_ncon_intra(meta_crd[chaini],tfmap[chaini][chaini],ngdist,gamma,geomh,fixrep) nonbonded[chaini][chaini] = go_lib.calc_ncon_intra(meta_crd[chaini],ngdist,gamma,geomh,fixrep) # # include disulfides if necc... clen = len(chaini) my_disulfides = map(lambda x: x[clen:], filter(lambda x: x.find(chaini)==0,disulfides)) # if len(my_disulfides)>0: ds_bonds, ds_angles, ds_dihedrals = go_lib.calc_disulf_bonded(meta_crd[chaini],tfbb,my_disulfides) bonds[chaini] = bb_bonds+ds_bonds angles[chaini] = bb_angles+ds_angles dihedrals[chaini] = bb_dihedrals+ds_dihedrals else:
# calculate parameters # ====================================================================== link = 0 eps_res = 0.0054 * Tf bonds = {} angles = {} dihedrals = {} nonbonded = {} for i in range(nchain): chaini = chains[i] bonds[chaini] = go_lib.calc_bonds(meta_crd[chaini], link) angles[chaini] = go_lib.calc_angles(meta_crd[chaini], link) dihedrals[chaini] = go_lib.setup_dihe(meta_crd[chaini], link) nonbonded[chaini] = {} nonbonded[chaini][chaini] = go_lib.calc_ncon_intra(meta_crd[chaini], ngdist, gamma) for j in range(i + 1, nchain): chainj = chains[j] nonbonded[chaini][chainj] = go_lib.calc_ncon_inter( meta_crd[chaini], meta_crd[chainj], ngdist, gamma) #bonds = go_lib.average_bonded_list(bonds) #print nonbonded.keys() #print nonbonded['A'.keys() #print nonbonded.keys()