amb_aname, amb_atype, amb_acharge = amb_atom # The following code for mapping GMX -> AMBER atom names # assumes that the atoms in the GMX .rtp and AMBER .off # dictionaries come in the same order. This is a sanity check # that checks to see if the atom type and atomic charge are # indeed the same. if gmx_atype != amb_atype: print "Atom types don't match for", resname, gmx_atom, amb_atom raise RuntimeError if gmx_acharge != amb_acharge: print "Atomic charges don't match for", resname, gmx_atom, amb_atom raise RuntimeError # Print the atoms that are renamed # if gmx_aname != amb_aname: # print "%s (AMBER) %s <-> %s (GMX)" % (resname, amb_aname, gmx_aname) gmx_amb_amap.setdefault(resname, OrderedDict())[gmx_aname] = amb_aname amb_gmx_amap.setdefault(resname, OrderedDict())[amb_aname] = gmx_aname amber_atomnames = OrderedDict([(k, set(v.keys())) for k, v in amb_gmx_amap.items()]) max_reslen = max([len(v) for v in amber_atomnames.values()]) # Begin with an AMBER-compatible PDB file # Please ensure by hand :) pdb = Molecule(sys.argv[1], build_topology=False) gmx_pdb = copy.deepcopy(pdb) del gmx_pdb.Data['elem'] # Convert to a GROMACS-compatible PDB file # This mainly involves renaming atoms and residues, # notably hydrogen names.
if chrm_atype[0] == '5': if chrm_atype[-1] == 'P': chrm_atype = '6+' else: chrm_atype = str(6) + chrm_atype[1:] if gmx_atype != chrm_atype: if gmx_atype not in chrm_star: print "Atom types don't match for", resname, gmx_atom, chrm_atom # raise RuntimeError if gmx_acharge != chrm_acharge: print "Atomic charges don't match for", resname, gmx_atom, chrm_atom # raise RuntimeError # Print the atoms that are renamed # if gmx_aname != chrm_aname: # print "%s (AMBER) %s <-> %s (CHARMM)" % (resname, chrm_aname, gmx_aname) gmx_chrm_amap.setdefault(resname, OrderedDict())[gmx_aname] = chrm_aname chrm_gmx_amap.setdefault(resname, OrderedDict())[chrm_aname] = gmx_aname chrm_atomnames = OrderedDict([(k, set(v.keys())) for k, v in chrm_gmx_amap.items()]) max_reslen = max([len(v) for v in chrm_atomnames.values()]) pdb_in = sys.argv[1] # rewrite the gmx pdb using mdtraj _exec('python ~/scripts/manip_proteins/mdt_rewrite_pdb.py --p0 %s --pf mdt_%s' % (pdb_in, pdb_in)) # run pdb thru/chrm charmming _exec('python ~/local/charmming/parser_v3.py mdt_%s' % (pdb_in)) # Begin with an GMX-compatible PDB file # Please ensure by hand :) pdb = Molecule(pdb_in, build_topology=False)