import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "ecer3-hairpin.xml" molecule_name = "ecer3" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[58, 104]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### ref_molecule = mb.load('ffa18.mol2') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('ffa18.itp') cmpd = itp_utils.coordinates_from_compound(ref_molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [3, 17]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb bilayer = mb.load('npt.pdb') molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('dspc.itp') cmpd = itp_utils.coordinates_from_compound(molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [32,89]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
#first_tail = cmpd.children[3:54] #second_tail = [a for a in cmpd.children[55:109] if 'C' in a.name] # Doing simple tail rotations #ref_vector = second_tail[-1].xyz - second_tail[0].xyz #cmpd_vector = first_tail[-1].xyz - first_tail[0].xyz # #theta = mb.coordinate_transform.angle(cmpd_vector[0], ref_vector[0]) #normal = np.cross(cmpd_vector[0], ref_vector[0]) # #for a in first_tail: # a.rotate(theta-0.2, normal) #cmpd.save('new_isis.gro', overwrite=True, residues='ISIS') # Then run then run an EM # Then reorient according to convention cmpd = itp_utils.compound_from_itp("ISIS.itp") coords = mb.load('em_nopbc.gro') cmpd = itp_utils.coordinates_from_compound(coords, cmpd) cmpd.name='ISIS' first_tail = cmpd.children[3:54] second_tail = [a for a in cmpd.children[55:109] if 'C' in a.name] cmpd = xml_utils.align_cmpd(cmpd, [3, 51]) cmpd.save('isis.mol2', residues=[cmpd.name], overwrite=True) xml_utils.write_compound_py(cmpd, 'isis.mol2')
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "ucer2-extended.xml" molecule_name = "ucer2" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[74, 70]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "ecer2-hairpin.xml" molecule_name = "ecer2" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[57, 101]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "ecer2-extended.xml" molecule_name = "ecer2" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[50, 46]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### bilayer = mb.load('npt.pdb') molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('dppc.itp') cmpd = itp_utils.coordinates_from_compound(molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [83, 47]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ####################### xmlfile = "cholesterol.xml" molecule_name = "chol" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[0, 64]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### ref_molecule = mb.load('oh16.pdb') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('oh16.itp') cmpd = itp_utils.coordinates_from_compound(ref_molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [46, 24]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### ref_molecule = mb.load('oh18.pdb') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('oh18.itp') cmpd = itp_utils.coordinates_from_compound(ref_molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [55,25]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### bilayer = mb.load('oh12.pdb') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('oh12.itp') cmpd = itp_utils.coordinates_from_compound(bilayer, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [34, 18]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ####################### xmlfile = "cer-eos-hairpin.xml" molecule_name = "cer1" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[24,195]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ####################### xmlfile = "c16ffa.xml" molecule_name = "ffa16" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[15, 0]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "ucer2-hairpin-charmm.xml" molecule_name = "ucer2" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[81, 125]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### charmmgui = mb.load('oh24.pdb') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('oh24.itp') cmpd = itp_utils.coordinates_from_compound(charmmgui, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [70, 36]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import scripts.xml_utils as xml_utils import mbuild as mb import pdb ######################### ## This is a code to generate an mBuild compound from prototype.xml ## While the prototype.xml may not be properly aligned, ## the resulting mBuild compound is aligned ## Tail tip is origin, headgroup at highest Z coordinate ## molecule_name is the name of the residue that gets used in mbuild and gromacs ## so ensure molecule_name matches the itp file ####################### xmlfile = "tip3p.xml" molecule_name = "SOL" structure_file = molecule_name + ".mol2" cmpd = xml_utils.compound_from_xml(xmlfile, a_to_nm=True, name=molecule_name) # Perform aligning cmpd = xml_utils.align_cmpd(cmpd, align_indices=[0, int(cmpd.n_particles / 2), -1]) # Save structure and bonding information cmpd.save('{}'.format(structure_file), overwrite=True, residues=[molecule_name]) # Write compound.py file xml_utils.write_compound_py(cmpd, structure_file)
import mbuild as mb import scripts.xml_utils as xml_utils dopc = mb.load('dopc.gro') dopc.name = 'DOPC' chl = mb.load('new_chl1.gro') chl.name = 'CHL1' new_dopc = xml_utils.align_cmpd(dopc, [0, 87]) new_dopc.name = dopc.name new_chl = xml_utils.align_cmpd(chl, [1, 64]) new_chl.name = chl.name new_dopc.save('aligned_dopc.gro', residues='DOPC') new_chl.save('aligned_chl.gro', residues='CHL1')
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb ####################### ## Example script to convert an ITP file into an mBuild compound python module ## Note that the xyz coordinates must be pulled from another file #################### ref_molecule = mb.load('oh20.pdb') #molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('oh20.itp') cmpd = itp_utils.coordinates_from_compound(ref_molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [30, 57]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))
import mbuild as mb import scripts.xml_utils as xml_utils import scripts.itp_utils as itp_utils import pdb bilayer = mb.load('npt.pdb') molecule = bilayer.children[0] cmpd = itp_utils.compound_from_itp('dppc.itp') cmpd = itp_utils.coordinates_from_compound(molecule, cmpd) aligned_cmpd = xml_utils.align_cmpd(cmpd, [44, 83]) aligned_cmpd.save('{}.mol2'.format(aligned_cmpd.name), residues=[aligned_cmpd.name], overwrite=True) xml_utils.write_compound_py(aligned_cmpd, '{}.mol2'.format(aligned_cmpd.name))