def test_singleterm_charmm(self): from foyer import Forcefield from mbuild.formats.lammpsdata import write_lammpsdata cmpd = mb.load(get_fn("charmm_dihedral.mol2")) for i in cmpd.particles(): i.name = "_{}".format(i.name) structure = cmpd.to_parmed( box=cmpd.get_boundingbox(), residues=set([p.parent.name for p in cmpd.particles()]), ) ff = Forcefield( forcefield_files=[get_fn("charmm_truncated_singleterm.xml")]) structure = ff.apply(structure, assert_dihedral_params=False) write_lammpsdata(structure, "charmm_dihedral_singleterm.lammps") out_lammps = open("charmm_dihedral_singleterm.lammps", "r").readlines() found_dihedrals = False for i, line in enumerate(out_lammps): if "Dihedral Coeffs" in line: assert "# charmm" in line assert "#k, n, phi, weight" in out_lammps[i + 1] assert len(out_lammps[i + 2].split("#")[0].split()) == 5 assert float( out_lammps[i + 2].split("#")[0].split()[4]) == float("1.0") found_dihedrals = True else: pass assert found_dihedrals
def test_save_charmm(self): from foyer import Forcefield cmpd = mb.load(get_fn("charmm_dihedral.mol2")) for i in cmpd.particles(): i.name = "_{}".format(i.name) structure = cmpd.to_parmed( box=cmpd.get_boundingbox(), residues=set([p.parent.name for p in cmpd.particles()]), ) ff = Forcefield(forcefield_files=[get_fn("charmm_truncated.xml")]) structure = ff.apply(structure, assert_dihedral_params=False) write_lammpsdata(structure, "charmm_dihedral.lammps") out_lammps = open("charmm_dihedral.lammps", "r").readlines() found_angles = False found_dihedrals = False for i, line in enumerate(out_lammps): if "Angle Coeffs" in line: assert "# charmm" in line assert ( "#\tk(kcal/mol/rad^2)\t\ttheteq(deg)\tk(kcal/mol/angstrom^2)\treq(angstrom)\n" in out_lammps[i + 1]) assert len(out_lammps[i + 2].split("#")[0].split()) == 5 found_angles = True elif "Dihedral Coeffs" in line: assert "# charmm" in line assert "#k, n, phi, weight" in out_lammps[i + 1] assert len(out_lammps[i + 2].split("#")[0].split()) == 5 found_dihedrals = True else: pass assert found_angles assert found_dihedrals
def test_save_charmm(self): cmpd = mb.load(get_fn('charmm_dihedral.mol2')) for i in cmpd.particles(): i.name = "_{}".format(i.name) structure = cmpd.to_parmed(box=cmpd.boundingbox, residues=set([p.parent.name for \ p in cmpd.particles()])) from foyer import Forcefield ff = Forcefield(forcefield_files=[get_fn('charmm_truncated.xml')]) structure = ff.apply(structure, assert_dihedral_params=False) from mbuild.formats.lammpsdata import write_lammpsdata write_lammpsdata(structure, 'charmm_dihedral.lammps') out_lammps = open('charmm_dihedral.lammps', 'r').readlines() for i, line in enumerate(out_lammps): if 'Angle Coeffs' in line: assert '# charmm' in line assert '#\tk(kcal/mol/rad^2)\t\ttheteq(deg)\tk(kcal/mol/angstrom^2)\treq(angstrom)\n' in out_lammps[ i + 1] assert len(out_lammps[i + 2].split('#')[0].split()) == 5 elif 'Dihedral Coeffs' in line: assert '# charmm' in line assert '#k, n, phi, weight' in out_lammps[i + 1] assert len(out_lammps[i + 2].split('#')[0].split()) == 5 else: pass
def test_hoomdsimulation_restart(self): import gsd.hoomd import hoomd from foyer.forcefield import Forcefield from mbuild.formats.hoomd_simulation import create_hoomd_simulation box = mb.Compound() box.add(mb.Compound(name="Ar", pos=[1, 1, 1])) box.add(mb.Compound(name="Ar", pos=[1, 1, 1])) ff = Forcefield(forcefield_files=get_fn("lj.xml")) structure = ff.apply(box) structure.box = [10, 10, 10, 90, 90, 90] sim = hoomd.context.SimulationContext() with sim: hoomd_obj, ref_vals = create_hoomd_simulation( structure, 2.5, restart=get_fn("restart.gsd")) sim_forces = hoomd.context.current.forces pair_force = import_("hoomd.md.pair") assert isinstance(sim_forces[0], pair_force.lj) snap = hoomd_obj[0] with gsd.hoomd.open(get_fn("restart.gsd")) as f: rsnap = f[0] assert np.array_equal(snap.particles.position, rsnap.particles.position)
def test_save_forcefield_with_file_foyerkwargs(self, methane): foyerkwargs = {'assert_improper_params': True} with pytest.raises(Exception): methane.save('lythem.hoomdxml', forcefield_files=get_fn('methane_oplssaa.xml'), overwrite=True, foyerkwargs=foyerkwargs) methane.save('lythem.hoomdxml', forcefield_files=get_fn('methane_oplssaa.xml'), overwrite=True, foyerkwargs={})
def test_save_missing_topo_params(self, ff_filename, foyer_kwargs): """Test that the user is notified if not all topology parameters are found.""" from foyer.tests.utils import get_fn ethane = mb.load(get_fn('ethane.mol2')) with pytest.raises(Exception): ethane.save('ethane.mol2', forcefield_files=get_fn(ff_filename)) with pytest.warns(UserWarning): ethane.save('ethane.mol2', forcefield_files=get_fn(ff_filename), overwrite=True, foyer_kwargs=foyer_kwargs)
def test_save_charmm(self): cmpd = mb.load(get_fn('charmm_dihedral.mol2')) for i in cmpd.particles(): i.name = "_{}".format(i.name) structure = cmpd.to_parmed(box=cmpd.boundingbox, residues=set([p.parent.name for \ p in cmpd.particles()])) from foyer import Forcefield ff = Forcefield(forcefield_files=[get_fn('charmm_truncated.xml')]) structure = ff.apply(structure, assert_dihedral_params=False) write_par(structure, 'charmm_dihedral.par')
def benzene_from_parts(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' mb.translate(ch, -ch[0].pos) ch.add(mb.Port(anchor=ch[0]), 'a') mb.translate(ch['a'], [0, 0.07, 0]) mb.rotate_around_z(ch['a'], 120.0 * (np.pi / 180.0)) ch.add(mb.Port(anchor=ch[0]), 'b') mb.translate(ch['b'], [0, 0.07, 0]) mb.rotate_around_z(ch['b'], -120.0 * (np.pi / 180.0)) benzene = mb.Compound(name='Benzene') benzene.add(ch) current = ch for _ in range(5): ch_new = mb.clone(ch) mb.force_overlap(move_this=ch_new, from_positions=ch_new['a'], to_positions=current['b']) current = ch_new benzene.add(ch_new) carbons = [p for p in benzene.particles_by_name('C')] benzene.add_bond((carbons[0], carbons[-1])) return benzene
def test_save_forcefield_with_same_struct(self): from foyer import Forcefield from mbuild.formats.lammpsdata import write_lammpsdata system = mb.load("C1(=CC=CC=C1)F", smiles=True) ff = Forcefield(forcefield_files=[get_fn("gaff_test.xml")]) struc = ff.apply( system, assert_angle_params=False, assert_dihedral_params=False, assert_improper_params=False, ) write_lammpsdata(struc, "charmm_improper.lammps", zero_dihedral_weighting_factor=True) for i in range(3): xyz = struc.coordinates xyz = xyz + np.array([1, 1, 1]) struc.coordinates = xyz write_lammpsdata( struc, f"charmm_improper{i}.lammps", zero_dihedral_weighting_factor=True, )
def test_save_forcefield_with_file(self, methane): exts = ['.gsd', '.hoomdxml', '.lammps', '.lmp', '.top', '.gro', '.mol2', '.pdb', '.xyz'] for ext in exts: methane.save('lythem' + ext, forcefield_files=get_fn('methane_oplssaa.xml'), overwrite=True)
def benzene_from_parts(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' ch.translate(-ch[0].pos) ch.add(mb.Port(anchor=ch[0], separation=0.07), 'a') ch['a'].rotate(120.0 * (np.pi/180.0), around=np.asarray([0, 0, 1])) ch.add(mb.Port(anchor=ch[0], separation=0.07), 'b') ch['b'].rotate(-120.0 * (np.pi/180.0), around=np.asarray([0, 0, 1])) ch_copy = mb.clone(ch) benzene = mb.Compound(name='Benzene') benzene.add(ch) current = ch for _ in range(5): ch_new = mb.clone(ch_copy) mb.force_overlap(move_this=ch_new, from_positions=ch_new['a'], to_positions=current['b']) current = ch_new benzene.add(ch_new) carbons = [p for p in benzene.particles_by_name('C')] benzene.add_bond((carbons[0],carbons[-1])) return benzene
def test_from_pybel(self): pybel = import_('pybel') benzene = list(pybel.readfile('mol2', get_fn('benzene.mol2')))[0] cmpd = mb.Compound() cmpd.from_pybel(benzene) assert benzene.OBMol.NumAtoms() == cmpd.n_particles assert benzene.OBMol.NumBonds() == cmpd.n_bonds
def benzene_from_parts(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' mb.translate(ch, -ch[0].pos) ch.add(mb.Port(anchor=ch[0]), 'a') mb.translate(ch['a'], [0, 0.07, 0]) mb.rotate_around_z(ch['a'], 120.0 * (np.pi/180.0)) ch.add(mb.Port(anchor=ch[0]), 'b') mb.translate(ch['b'], [0, 0.07, 0]) mb.rotate_around_z(ch['b'], -120.0 * (np.pi/180.0)) benzene = mb.Compound(name='Benzene') benzene.add(ch) current = ch for _ in range(5): ch_new = mb.clone(ch) mb.force_overlap(move_this=ch_new, from_positions=ch_new['a'], to_positions=current['b']) current = ch_new benzene.add(ch_new) carbons = [p for p in benzene.particles_by_name('C')] benzene.add_bond((carbons[0],carbons[-1])) return benzene
def test_save(self): methyl = mb.load(get_fn('methyl.pdb')) extensions = ['.xyz', '.pdb', '.mol2'] for ext in extensions: outfile = 'methyl_out' + ext methyl.save(filename=outfile) assert os.path.exists(outfile)
def test_gmso_backend_lj_site_type(self): pmd_silica_surface = mb.load( filename_or_object=get_fn("beta-cristobalite-expanded.mol2"), backend="parmed", ) gmso_silica_surface = mb.load( filename_or_object=get_fn("beta-cristobalite-expanded.mol2"), backend="gmso", site_type="lj", ) assert pmd_silica_surface.n_particles == gmso_silica_surface.n_particles assert pmd_silica_surface.n_bonds == gmso_silica_surface.n_bonds for particle in gmso_silica_surface: assert particle.element is None
def test_non_resolved_elements(self): tip3p_water = mb.load(get_fn("tip3p_water.xyz")) assert tip3p_water[0].element is None assert tip3p_water[0].name == "opls_111" assert tip3p_water[1].element is None assert tip3p_water[1].name == "opls_112" assert tip3p_water[2].element is None assert tip3p_water[2].name == "opls_112"
def test_structure_reproducibility(self, alkane_monolayer): filename = 'monolayer-tmp.pdb' alkane_monolayer.save(filename) with open(get_fn('monolayer.pdb')) as file1: with open('monolayer-tmp.pdb') as file2: diff = difflib.ndiff(file1.readlines(), file2.readlines()) changes = [l for l in diff if l.startswith('+ ') or l.startswith('- ')] assert not changes
def test_non_resolved_elements(self): tip3p_water = mb.load(get_fn('tip3p_water.xyz')) assert tip3p_water[0].element is None assert tip3p_water[0].name == 'opls_111' assert tip3p_water[1].element is None assert tip3p_water[1].name == 'opls_112' assert tip3p_water[2].element is None assert tip3p_water[2].name == 'opls_112'
def test_gmso_backend(self): pmd_silica_surface = mb.load( filename_or_object=get_fn("beta-cristobalite-expanded.mol2"), backend="parmed", ) gmso_silica_surface = mb.load( filename_or_object=get_fn("beta-cristobalite-expanded.mol2"), backend="gmso", ) assert pmd_silica_surface.n_particles == gmso_silica_surface.n_particles assert pmd_silica_surface.n_bonds == gmso_silica_surface.n_bonds element_set = set() for particle in gmso_silica_surface: element_set.add(particle.element) assert len(element_set) == 2
def test_from_pybel_monolayer(self): import pybel monolayer = list(pybel.readfile('pdb', get_fn('monolayer.pdb')))[0] # TODO: Actually store the box information cmpd = mb.Compound() cmpd.from_pybel(monolayer) assert monolayer.OBMol.NumAtoms() == cmpd.n_particles assert monolayer.OBMol.NumBonds() == cmpd.n_bonds first_atom = monolayer.OBMol.GetAtom(1) assert np.allclose(cmpd[0].pos, [first_atom.GetX()/10, first_atom.GetY()/10, first_atom.GetZ()/10])
def test_structure_reproducibility(self): from mbuild.lib.recipes import Alkane filename = 'decane-tmp.xyz' decane = Alkane(10) decane.save(filename) with open(get_fn('decane.xyz')) as file1: with open(filename) as file2: diff = difflib.ndiff(file1.readlines(), file2.readlines()) changes = [l for l in diff if l.startswith('+ ') or l.startswith('- ')] assert not changes
def test_cif_triclinic_box_properties(self): lattice_cif = load_cif(file_or_path=get_fn("ETV_triclinic.cif")) periodic_boxed_molecule = lattice_cif.populate(x=1, y=1, z=1) periodic_box = periodic_boxed_molecule.box manual_num_atoms = 42 manual_angles = [105.72, 100.19, 97.02] manual_lengths = [0.87503, 0.96479, 1.02719] assert np.all(np.isclose(manual_lengths, list(periodic_box.lengths))) assert np.all(np.isclose(manual_angles, list(periodic_box.angles))) assert len(periodic_boxed_molecule.children) == manual_num_atoms
def test_cif_vs_manual_triclinic(self): spacing = [0.641910000, 0.652305930, 0.704466251] angles = [91.77954616, 103.97424201, 118.83663410] points_dict = { "Re": [ [0.94176500, 0.68947700, 0.50807400], [0.05823500, 0.31052300, 0.49192600], [0.51250400, 0.71441700, 0.50209100], [0.48749600, 0.28558300, 0.49790900], ], "S": [ [0.74798600, 0.13254800, 0.67588400], [0.73127300, 0.34781000, 0.26679600], [0.21989400, 0.10784400, 0.70096800], [0.25920200, 0.38690600, 0.24012300], [0.74079800, 0.61309400, 0.75987700], [0.78010600, 0.89215600, 0.29903200], [0.25201400, 0.86745200, 0.32411600], [0.26872700, 0.65219000, 0.73320400], ], } lattice_manual = mb.Lattice( lattice_spacing=spacing, lattice_points=points_dict, angles=angles ) lattice_cif = load_cif(file_or_path=get_fn("ReS2.cif")) assert np.all( np.isclose( lattice_manual.lattice_spacing, lattice_cif.lattice_spacing ) ) assert np.all(np.isclose(lattice_manual.angles, lattice_cif.angles)) # sort dicts first (not necessary once we support py 3.7+ only) # dict sorted by keys dict_manual = OrderedDict( sorted(lattice_manual.lattice_points.items(), key=lambda t: t[0]) ) dict_cif = OrderedDict( sorted(lattice_cif.lattice_points.items(), key=lambda t: t[0]) ) keys_m = dict_manual.keys() keys_c = dict_cif.keys() for k_man, k_cif in zip(keys_m, keys_c): # sort the lists of lists points_man = dict_manual[k_man] points_cif = dict_cif[k_cif] points_man.sort() points_cif.sort() points_man = np.asarray(points_man) points_cif = np.asarray(points_cif) assert np.all(np.isclose(points_man, points_cif))
def main(): from mbuild.utils.io import get_fn from mbuild.lib.moieties import H2O water = H2O() ecerns = mb.load(get_fn('ecer2.pdb')) chol = mb.load(get_fn('cg-chol.pdb')) # Orient along the z-direction. mb.rotate_around_x(chol, -135.0*np.pi/180) mb.rotate_around_y(chol, -45.0*np.pi/180) lipids = [(ecerns, 0.5), (chol, 0.5)] bilayer = Bilayer(lipids, n_lipids_x=15, n_lipids_y=15, area_per_lipid=1.4, solvent=water, ref_atoms=[1, 6], spacing_z=0.7, solvent_per_lipid=20, mirror=False) bilayer.save(filename='bilayer.pdb') return bilayer
def rigid_ch(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' ch.label_rigid_bodies() mb.translate(ch, -ch[0].pos) ch.add(mb.Port(anchor=ch[0]), 'a') mb.translate(ch['a'], [0, 0.07, 0]) mb.rotate_around_z(ch['a'], 120.0 * (np.pi/180.0)) ch.add(mb.Port(anchor=ch[0]), 'b') mb.translate(ch['b'], [0, 0.07, 0]) mb.rotate_around_z(ch['b'], -120.0 * (np.pi/180.0)) return ch
def test_cif_monoclinic_box_properties(self): lattice_cif = load_cif(file_or_path=get_fn("ITG_monoclinic.cif")) periodic_boxed_molecule = lattice_cif.populate(x=1, y=1, z=1) periodic_box = periodic_boxed_molecule.box manual_num_atoms = 168 # manual_num_atoms was found using VESTA: https://gist.github.com/ramanishsingh/d712f57b8101eb073cfe010fc3b4edc3 # xyz file used: https://gist.github.com/ramanishsingh/154cf03d12e25f3d608e526500453e2e # cif file used: https://gist.github.com/ramanishsingh/2db4ff2a266390242a6a05913d31414a manual_angles = [90.0, 96.29, 90] manual_lengths = [1.27411, 1.26989, 2.09991] assert np.all(np.isclose(manual_lengths, list(periodic_box.lengths))) assert np.all(np.isclose(manual_angles, list(periodic_box.angles))) assert len(periodic_boxed_molecule.children) == manual_num_atoms
def rigid_ch(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' ch.label_rigid_bodies() mb.translate(ch, -ch[0].pos) ch.add(mb.Port(anchor=ch[0]), 'a') mb.translate(ch['a'], [0, 0.07, 0]) mb.rotate_around_z(ch['a'], 120.0 * (np.pi / 180.0)) ch.add(mb.Port(anchor=ch[0]), 'b') mb.translate(ch['b'], [0, 0.07, 0]) mb.rotate_around_z(ch['b'], -120.0 * (np.pi / 180.0)) return ch
def rigid_ch(self): ch = mb.load(get_fn('ch.mol2')) ch.name = 'CH' ch.label_rigid_bodies() ch.translate(-ch[0].pos) ch.add(mb.Port(anchor=ch[0]), 'a') ch['a'].translate([0, 0.07, 0]) ch['a'].rotate(120.0 * (np.pi/180.0), around=np.asarray([0, 0, 1])) ch.add(mb.Port(anchor=ch[0]), 'b') ch['b'].translate([0, 0.07, 0]) ch['b'].rotate(-120.0 * (np.pi/180.0), around=np.asarray([0, 0, 1])) return ch
def test_from_pybel_molecule(self): pybel = import_('pybel') chol = list(pybel.readfile('pdb', get_fn('cholesterol.pdb')))[0] # TODO: Actually store the box information cmpd = mb.Compound() cmpd.from_pybel(chol) assert chol.OBMol.NumAtoms() == cmpd.n_particles assert chol.OBMol.NumBonds() == cmpd.n_bonds first_atom = chol.OBMol.GetAtom(1) assert np.allclose(cmpd[0].pos, [ first_atom.GetX() / 10, first_atom.GetY() / 10, first_atom.GetZ() / 10 ])
def test_cif_vs_manual(self): spacing = [0.760296570, 0.760296570, 0.437540800] points_dict = { "La": [[1 / 3, 2 / 3, 1 / 4], [2 / 3, 1 / 3, 3 / 4]], "Cl": [ [0.69490400, 0.08690400, 1 / 4], [0.60800000, 0.69490400, 3 / 4], [0.30509600, 0.91309600, 3 / 4], [0.39200000, 0.30509600, 1 / 4], [0.91309600, 0.60800000, 1 / 4], [0.08690400, 0.39200000, 3 / 4], ], } lattice_manual = mb.Lattice( lattice_spacing=spacing, lattice_points=points_dict, angles=[90, 90, 120], ) lattice_cif = load_cif(file_or_path=get_fn("LaCl3.cif")) assert np.all( np.isclose( lattice_manual.lattice_spacing, lattice_cif.lattice_spacing ) ) assert np.all(np.isclose(lattice_manual.angles, lattice_cif.angles)) # sort dicts first (not necessary once we support py 3.7+ only) # dict sorted by keys dict_manual = OrderedDict( sorted(lattice_manual.lattice_points.items(), key=lambda t: t[0]) ) dict_cif = OrderedDict( sorted(lattice_cif.lattice_points.items(), key=lambda t: t[0]) ) keys_m = dict_manual.keys() keys_c = dict_cif.keys() for k_man, k_cif in zip(keys_m, keys_c): # sort the lists of lists points_man = dict_manual[k_man] points_cif = dict_cif[k_cif] points_man.sort() points_cif.sort() points_man = np.asarray(points_man) points_cif = np.asarray(points_cif) assert np.all(np.isclose(points_man, points_cif))
def rigid_ch(self): ch = mb.load(get_fn("ch.mol2")) ch.name = "CH" ch.label_rigid_bodies() ch.translate(-ch[0].pos) ch.add(mb.Port(anchor=ch[0]), "a") ch["a"].translate([0, 0.07, 0]) ch["a"].rotate(120.0 * (np.pi / 180.0), around=np.asarray([0, 0, 1])) ch.add(mb.Port(anchor=ch[0]), "b") ch["b"].translate([0, 0.07, 0]) ch["b"].rotate(-120.0 * (np.pi / 180.0), around=np.asarray([0, 0, 1])) return ch
def test_lj_to_hoomdsimulation(self): hoomd = import_("hoomd") hoomd_simulation = import_("mbuild.formats.hoomd_simulation") forcefield = import_("foyer.forcefield") box = mb.Compound() box.add(mb.Compound(name='Ar', pos=[1, 1, 1])) box.add(mb.Compound(name='Ar', pos=[1, 1, 1])) ff = forcefield.Forcefield(forcefield_files=get_fn('lj.xml')) structure = ff.apply(box) structure.box = [10, 10, 10, 90, 90, 90] hoomd_simulation.create_hoomd_simulation(structure) sim_forces = hoomd.context.current.forces pair_force = import_("hoomd.md.pair") assert isinstance(sim_forces[0], pair_force.lj)
def test_lj_to_hoomd_forcefield(self): import hoomd from foyer.forcefield import Forcefield from mbuild.formats.hoomd_forcefield import create_hoomd_forcefield box = mb.Compound() box.add(mb.Compound(name="Ar", pos=[1, 1, 1])) box.add(mb.Compound(name="Ar", pos=[1, 1, 1])) ff = Forcefield(forcefield_files=get_fn("lj.xml")) structure = ff.apply(box) structure.box = [10, 10, 10, 90, 90, 90] snapshot, forces, ref_values = create_hoomd_forcefield(structure, 2.5) assert isinstance(forces[0], hoomd.md.pair.LJ)
def test_wrong_n_atoms(self): with pytest.raises(MBuildError): mb.load(get_fn('too_few_atoms.xyz')) with pytest.raises(MBuildError): mb.load(get_fn('too_many_atoms.xyz'))
def test_smarts_from_file(self): p3ht = mb.load(get_fn('p3ht.smi'), smiles=True) assert p3ht.n_bonds == 33 assert p3ht.n_particles == 33
def test_load_mol2_mdtraj(self): with pytest.raises(KeyError): mb.load(get_fn('benzene-nonelement.mol2')) mb.load(get_fn('benzene-nonelement.mol2'), use_parmed=True)
def test_update_from_file(self, ch3): ch3.update_coordinates(get_fn("methyl.pdb"))
def test_fn(self): get_fn('benzene.mol2') with pytest.raises((IOError, OSError)): get_fn('garbage_file_name.foo')
def rigid_benzene(self): compound = mb.load(get_fn('benzene.mol2')) compound.name = 'Benzene' compound.label_rigid_bodies() return compound
def benzene(self): compound = mb.load(get_fn('benzene.mol2')) compound.name = 'Benzene' return compound
def test_update_coordinates(self): methyl = CH3() methyl.update_coordinates(get_fn('methyl.mol2'))
def test_save(self): methyl = mb.load(get_fn('methyl.mol2')) methyl.save(filename='methyl_out.mol2')
def test_load_and_create(self): mb.load(get_fn('methyl.mol2'))