Пример #1
0
def test_independent_residues_molecules():
    """Test to see that _check_independent_residues works for molecules."""
    butane = Alkane(4)
    structure = butane.to_parmed()
    topo, NULL = generate_topology(structure)
    assert _check_independent_residues(topo)
    structure = butane.to_parmed(residues=['RES', 'CH3'])
    topo, NULL = generate_topology(structure)
    assert not _check_independent_residues(topo)
Пример #2
0
def test_independent_residues_molecules():
    """Test to see that _check_independent_residues works for molecules."""
    butane = Alkane(4)
    structure = butane.to_parmed()
    topo, NULL = generate_topology(structure)
    assert _check_independent_residues(topo)
    structure = butane.to_parmed(residues=['RES', 'CH3'])
    topo, NULL = generate_topology(structure)
    assert not _check_independent_residues(topo)
def initialize(job):
    "Inialize the simulation"
    alkane = Alkane(job.statepoint()['C_n'])
    n_alkane = 200
    # A cleaner packing approach would involve pull #372
    system_box = mb.Box([4, 4, 4])
    system = mb.fill_box(compound=alkane, n_compounds=n_alkane, box=system_box)
    system.save('init.gro', overwrite=True)
    system.save('init.top', forcefield_name='oplsaa', overwrite=True)
Пример #4
0
 def test_opls(self):
     eth = Alkane(n=10)
     cmpd = mb.fill_box(eth, n_compounds=10, box=[10, 10, 10])
     ff = foyer.Forcefield(name='oplsaa')
     structure = ff.apply(cmpd)
     df = commpare.openmm.build_run_measure_openmm(structure)
     assert 'bond' in df
     assert 'angle' in df
     assert 'dihedral' in df
     assert 'nonbond' in df
Пример #5
0
 def test_opls(self):
     eth = Alkane(n=10)
     cmpd = mb.fill_box(eth, n_compounds=10, box=[10, 10, 10])
     ff = foyer.Forcefield(name='oplsaa')
     structure = ff.apply(cmpd)
     df = commpare.hoomd.build_run_measure_hoomd(structure,
                                                 ref_energy=1 / 4.184,
                                                 ref_distance=10)
     assert 'bond' in df
     assert 'angle' in df
     assert 'dihedral' in df
     assert 'nonbond' in df
Пример #6
0
    def test_conversions(self):
        # Check to see if we can correctly spawn engine simulations
        eth = Alkane(n=10)
        cmpd = mb.fill_box(eth, n_compounds=10, box=[10, 10, 10])
        ff = foyer.Forcefield(name='oplsaa')
        structure = ff.apply(cmpd)

        df = commpare.spawn_engine_simulations(structure,
                                               hoomd_kwargs={
                                                   'ref_distance': 10,
                                                   'ref_energy': 1 / 4.184
                                               })
        assert df is not None
Пример #7
0
 def alkyl(self):
     from mbuild.examples import Alkane
     return Alkane(2, cap_front=True, cap_end=False)
    def test_mbuild_examples(self):
        import mbuild as mb
        from mbuild.examples import (Alkane, Methane, Ethane, PMPCLayer,
                                     AlkaneMonolayer)
        import foyer
        for i in range(4, 20):
            my_alkane = Alkane(n=i)
            ff = foyer.Forcefield(name='oplsaa')
            structure = ff.apply(my_alkane)
            bbox = my_alkane.boundingbox
            bbox.lengths *= 10
            if any(bbox.lengths < 10):
                bbox.lengths = [100, 100, 100]

            structure.box = [
                bbox.lengths[0], bbox.lengths[1], bbox.lengths[2], 90, 90, 90
            ]
            structure.combining_rule = 'lorentz'
            energies = commpare.spawn_engine_simulations(structure,
                                                         hoomd_kwargs={
                                                             'ref_distance':
                                                             10,
                                                             'ref_energy':
                                                             1 / 4.184
                                                         })
            print('Alkane, n={}'.format(i))
            print(energies)
            print('=' * 20)

        eth = Ethane()
        structure = ff.apply(eth)
        bbox = eth.boundingbox
        bbox.lengths *= 10
        if any(bbox.lengths < 10):
            bbox.lengths = [100, 100, 100]

        structure.box = [
            bbox.lengths[0], bbox.lengths[1], bbox.lengths[2], 90, 90, 90
        ]

        structure.combining_rule = 'lorentz'
        energies = commpare.spawn_engine_simulations(structure,
                                                     hoomd_kwargs={
                                                         'ref_distance': 10,
                                                         'ref_energy':
                                                         1 / 4.184
                                                     })
        print("Ethane")
        print(energies)
        print('=' * 20)

        methan = Methane()
        structure = ff.apply(methan)
        bbox = methan.boundingbox
        bbox.lengths *= 10
        if any(bbox.lengths < 10):
            bbox.lengths = [100, 100, 100]

        structure.box = [
            bbox.lengths[0], bbox.lengths[1], bbox.lengths[2], 90, 90, 90
        ]

        structure.combining_rule = 'lorentz'
        energies = commpare.spawn_engine_simulations(structure,
                                                     hoomd_kwargs={
                                                         'ref_distance': 10,
                                                         'ref_energy':
                                                         1 / 4.184
                                                     })
        print("Methane")
        print(energies)
        print('=' * 20)
Пример #9
0
 def octane(self):
     from mbuild.examples import Alkane
     return Alkane(8, cap_front=True, cap_end=True)
Пример #10
0
    def test_remove_port(self):
        from mbuild.examples import Alkane

        butane = Alkane(n=4)
        butane.remove(butane[-1])
        box = mb.fill_box(butane, n_compounds=10, density=1)