def test_write_bondlib(self): """Test the write_bondlib function""" mlib = self.get_mdt_library() mlib.bond_classes.read('data/bndgrp.lib') bondtype = mdt.features.BondType(mlib) bondlen = mdt.features.BondLength(mlib, bins=mdt.uniform_bins(200, 1.0, 0.005)) m = self.get_test_mdt(mlib, [bondtype, bondlen]) mdt.write_bondlib(open('test.out', 'w'), m) # Make sure that valid Python code was produced code = compile(open('test.out').read(), 'test.out', 'exec') os.unlink('test.out')
def test_write_bondlib(self): """Test the write_bondlib function""" mlib = self.get_mdt_library() mlib.bond_classes.read('data/bndgrp.lib') bondtype = mdt.features.BondType(mlib) bondlen = mdt.features.BondLength( mlib, bins=mdt.uniform_bins(200, 1.0, 0.005)) m = self.get_test_mdt(mlib, [bondtype, bondlen]) with open('test.out', 'w') as fh: mdt.write_bondlib(fh, m) # Make sure that valid Python code was produced with open('test.out') as fh: _ = compile(fh.read(), 'test.out', 'exec') os.unlink('test.out')
from modeller import * import mdt import mdt.features env = environ() mlib = mdt.Library(env) mlib.bond_classes.read('${LIB}/bndgrp.lib') xray = mdt.features.XRayResolution(mlib, bins=[(0.51, 2.001, 'High res(2.0A)')]) bond_type = mdt.features.BondType(mlib) bond_length = mdt.features.BondLength(mlib, bins=mdt.uniform_bins(400, 1.0, 0.0025)) m = mdt.Table(mlib, file='mdt.mdt') m = m.reshape(features=(xray, bond_type, bond_length), offset=(0,0,0), shape=(0,-1,-1)) m = m.integrate(features=(bond_type, bond_length)) mdt.write_bondlib(file('bonds.py', 'w'), m, density_cutoff=0.1)
from modeller import * import mdt import mdt.features env = Environ() mlib = mdt.Library(env) mlib.bond_classes.read('${LIB}/bndgrp.lib') xray = mdt.features.XRayResolution(mlib, bins=[(0.51, 2.001, 'High res(2.0A)')]) bond_type = mdt.features.BondType(mlib) bond_length = mdt.features.BondLength(mlib, bins=mdt.uniform_bins(400, 1.0, 0.0025)) m = mdt.Table(mlib, file='mdt.mdt') m = m.reshape(features=(xray, bond_type, bond_length), offset=(0, 0, 0), shape=(0, -1, -1)) m = m.integrate(features=(bond_type, bond_length)) mdt.write_bondlib(file('bonds.py', 'w'), m, density_cutoff=0.1)