def Boss2CharmmRTF(num2typ2symb, Qs, resid, bnd_df, angs,props,imps): charges = [float(Qs[i][1]) for i in range(len(Qs))] rtf = open(resid + '.top', 'w+') rtf.write('Remarks LigParGen generated XPLOR-TOP file for Bonvin group (by Leela Dodda)\n') rtf.write('\nset echo=false end\n') rtf.write('\nautogenerate angles=True dihedrals=True end\n') rtf.write('{ atomType mass }\n') Mass = ['MASS %s %3.4f \n' % (num2typ2symb[i][2], bossElement2Mass(bossPdbAtom2Element(num2typ2symb[i][0]))) for i in range(len(Qs))] for i in range(len(Mass)): rtf.write('%s' % Mass[i]) rtf.write('\nRESIdue %5s\n' % (resid)) rtf.write('\nGROUP\n') rtf.write('\n{ atomName atomType Charge } \n') for i in range(len(Qs)): rtf.write('ATOM %6s TYPE= %6s CHARGE= %8s END\n' % (num2typ2symb[i][0], bossPdbAtom2Element( num2typ2symb[i][0]) + num2typ2symb[i][1][-3:], Qs[i][1])) rtf.write('\n{ Bonds: atomName1 atomName2 } \n') for (x, y) in zip(bnd_df.cl1, bnd_df.cl2): rtf.write('BOND %s %s \n' % (num2typ2symb[x][0], num2typ2symb[y][0])) rtf.write('\n{ Angles: atomName1 atomName2 atomName3} \n') for a in angs: rtf.write('ANGLe %s \n'%a) rtf.write('\n{ Proper Dihedrals: aName1 aName2 aName3 aName4 } \n') for i in props: rtf.write('DIHEdral %s \n' % (i.replace("-", " "))) rtf.write('\n{ Improper Dihedrals: aName1 aName2 aName3 aName4 }\n') for i in imps: rtf.write('IMPRoper %s \n' % (i.replace("-", " "))) rtf.write('\nEND {RESIdue UNK}\n') rtf.write('\nset echo=true end\n') rtf.close() return None
def Boss2CharmmRTF(num2typ2symb, Qs, resid, bnd_df, imps): charges = [float(Qs[i][1]) for i in range(len(Qs))] rtf = open(resid + '.rtf', 'w+') rtf.write( '! generated RTF file for NAMD/CHARMM \n! Written by Leela S. Dodda ([email protected])\n' ) Mass = [ 'MASS %d %s %3.4f %s \n' % ((i + 1), num2typ2symb[i][2], bossElement2Mass(bossPdbAtom2Element( num2typ2symb[i][0])), bossPdbAtom2Element(num2typ2symb[i][0])) for i in range(len(Qs)) ] for i in range(len(Mass)): rtf.write('%s' % Mass[i]) rtf.write('AUTO ANGLES DIHE \n') rtf.write('RESI %5s %3.3f \n' % (resid, sum(charges))) for i in range(len(Qs)): rtf.write( 'ATOM %s %s %s \n' % (num2typ2symb[i][0], bossPdbAtom2Element(num2typ2symb[i][0]) + num2typ2symb[i][1][-3:], Qs[i][1])) for (x, y) in zip(bnd_df.cl1, bnd_df.cl2): rtf.write('BOND %s %s \n' % (num2typ2symb[x][0], num2typ2symb[y][0])) for i in imps: rtf.write('IMPR %s \n' % (i.replace("-", " "))) rtf.write('PATCH FIRST NONE LAST NONE \n') rtf.write('END \n') rtf.close() return None
def bossData(molecule_data): ats_file = molecule_data.MolData['ATOMS'] types = [] for i in enumerate(ats_file): types.append([i[1].split()[1], 'opls_' + i[1].split()[2]]) st_no = 3 Qs = molecule_data.MolData['Q_LJ'] assert len(Qs) == len(types), 'Please check the at_info and Q_LJ_dat files' # num2opls = {} # for i in range(0, len(types)): # num2opls[i] = Qs[i][0] num2typ2symb = {i: types[i] for i in range(len(Qs))} for i in range(len(Qs)): num2typ2symb[i].append( bossPdbAtom2Element(num2typ2symb[i][0]) + num2typ2symb[i][1][-3:]) # print(num2typ2symb[i],bossElement2Mass(num2typ2symb[i][0])) num2typ2symb[i].append(bossPdbAtom2Element(num2typ2symb[i][0])) num2typ2symb[i].append(bossElement2Mass(num2typ2symb[i][3])) num2typ2symb[i].append(Qs[i][0]) num2opls = {} for i in num2typ2symb.keys(): num2opls[i] = num2typ2symb[i][2] # return (types, Qs, num2opls, st_no, num2typ2symb) num2pqrtype = OrderedDict(num2typ2symb) for i in range(len(Qs)): num2pqrtype[i].append(Qs[i][1]) num2pqrtype[i].append(Qs[i][2]) return (types, Qs, num2opls, st_no, num2typ2symb, num2pqrtype)
def Boss2CharmmRTF(num2typ2symb, Qs, resid, bnd_df, angs, props, imps): charges = [float(Qs[i][1]) for i in range(len(Qs))] rtf = open(resid + '.lib', 'w+') rtf.write('#Remarks LigParGen generated for Q (by Leela Dodda)\n') rtf.write('\n{%s}\n' % resid) rtf.write('[ atoms ]\n') for i in range(len(Qs)): rtf.write( '%8d %6s %6s %8s \n' % (i + 1, num2typ2symb[i][0], bossPdbAtom2Element(num2typ2symb[i][0]) + num2typ2symb[i][1][-3:], Qs[i][1])) rtf.write('[bonds]') for (x, y) in zip(bnd_df.cl1, bnd_df.cl2): rtf.write('\n%8s %8s' % (num2typ2symb[x][0], num2typ2symb[y][0])) rtf.write('\n[impropers]\n') for i in imps: rtf.write('%s \n' % (i.replace("-", " "))) rtf.write('[charge_groups]\n') for i in range(len(Qs)): rtf.write('%4s' % num2typ2symb[i][0]) rtf.write( '\n*------------------------------------------------------------------\n' ) rtf.close() return None
def bossData(molecule_data): ats_file = molecule_data.MolData['ATOMS'] types = [] for i in enumerate(ats_file): types.append([i[1].split()[1], 'opls_' + i[1].split()[2]]) st_no = 3 Qs = molecule_data.MolData['Q_LJ'] assert len(Qs) == len(types), 'Please check the at_info and Q_LJ_dat files' num2opls = {} for i in range(0, len(types)): num2opls[i] = Qs[i][0] num2typ2symb = {i: types[i] for i in range(len(Qs))} for i in range(len(Qs)): trm = bossPdbAtom2Element(num2typ2symb[i][0]) + num2typ2symb[i][1][-3:] num2typ2symb[i].append(trm[0:4]) num2typ2symb[i].append(bossPdbAtom2Element(num2typ2symb[i][0])) num2typ2symb[i].append(bossElement2Mass(num2typ2symb[i][3])) num2typ2symb[i].append(Qs[i][0]) return (types, Qs, num2opls, st_no, num2typ2symb)
def Boss2CharmmPRM(resid, num2typ2symb, Qs, bnd_df, ang_df, tor_df): #### COLLECTING NONBONDING PART ####### prm = open(resid + '.Q.prm', 'w+') prm.write( '# LigParGen generated Q-PARAM file for Aqvist group (by Leela Dodda)\n' ) prm.write('\n[options]\n') prm.write('\n[atom_types]\n') for i in range(len(Qs)): eps = float(Qs[i][3]) sig = float(Qs[i][2]) ALJ = 2 * sig**6 * np.sqrt(eps) BLJ = 2 * sig**3 * np.sqrt(eps) prm.write('%4s %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f\n' % (num2typ2symb[i][2], ALJ, ALJ, 0.000, BLJ, BLJ, bossElement2Mass(bossPdbAtom2Element(num2typ2symb[i][0])))) prm.write('\n[bonds]\n') for i in bnd_df.index: prm.write( '%s %6s %8.1f %8.4f \n' % (num2typ2symb[bnd_df.cl1[i]][2], num2typ2symb[bnd_df.cl2[i]][2], bnd_df.KIJ[i], bnd_df.RIJ[i])) prm.write('\n[angles]\n') for i in ang_df.index: prm.write( '%s %5s %5s %8.1f %8.2f \n' % (num2typ2symb[ang_df.cl1[i]][2], num2typ2symb[ang_df.cl2[i]][2], num2typ2symb[ang_df.cl3[i]][2], ang_df.K[i], ang_df.R[i])) prm.write('\n[torsions]\n') if len(tor_df.index) > 0: tor_df = tor_df.drop_duplicates(['NAME', 'TY']) pro_df = tor_df[tor_df.TY == 'Proper'] for i in list(pro_df.index): ndf = pro_df.ix[i] pro_out = retDihed(ndf.to_dict()) for i in range(4): prm.write('%s' % pro_out[i]) prm.write( ' X X X X 0.00000 1 0.000000 ! WILD CARD FOR MISSING TORSION PARAMETERS\n' ) prm.write('\n[impropers]\n') imp_df = tor_df[tor_df.TY == 'Improper'] for i in list(imp_df.index): ndf = tor_df.ix[i] imp_out = retDihedImp(ndf.to_dict()) for i in range(len(imp_out)): prm.write('%s' % imp_out[i]) prm.write( ' X X X X 0.00000 2 0.000000 ! WILD CARD FOR MISSING IMPROPER PARAMETERS \n' ) prm.close() return None
def Boss2CharmmRTF(num2typ2symb, Qs, resid, bnd_df, angs, props, imps): charges = [float(Qs[i][1]) for i in range(len(Qs))] rtf = open(resid + '.top', 'w+') rtf.write( 'Remarks generated XPLOR-TOP file for Bonvin group (by Leela Dodda)\n') rtf.write('\nset echo=false end\n') rtf.write('\nautogenerate angles=True dihedrals=True end\n') rtf.write('{ atomType mass }\n') Mass = [ 'MASS %s %3.4f \n' % (num2typ2symb[i][2], bossElement2Mass(bossPdbAtom2Element(num2typ2symb[i][0]))) for i in range(len(Qs)) ] for i in range(len(Mass)): rtf.write('%s' % Mass[i]) rtf.write('\nRESIdue %5s\n' % (resid)) rtf.write('\nGROUP\n') rtf.write('\n{ atomName atomType Charge } \n') for i in range(len(Qs)): rtf.write('ATOM %6s TYPE= %6s CHARGE= %8s END\n' % (num2typ2symb[i][0], num2typ2symb[i][2], Qs[i][1])) rtf.write('\n{ Bonds: atomName1 atomName2 } \n') for (x, y) in zip(bnd_df.cl1, bnd_df.cl2): rtf.write('BOND %s %s \n' % (num2typ2symb[x][0], num2typ2symb[y][0])) bndlist = list(bnd_df.UR) + list(bnd_df.UR) imp_list = [] for i, dat in imps.iterrows(): ndata = tor_cent([dat.I, dat.J, dat.K, dat.L], bndlist) sdata = [num2typ2symb[j][0] for j in ndata] imp_list.append('-'.join(sdata)) rtf.write('\n{ Improper Dihedrals: aName1 aName2 aName3 aName4 }\n') for i in imp_list: rtf.write('IMPRoper %s \n' % (i.replace("-", " "))) rtf.write('\nEND {RESIdue UNK}\n') rtf.write('\nset echo=true end\n') rtf.close() return None