예제 #1
0
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)
예제 #2
0
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))
예제 #3
0
#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')