How to use the stk.MacroModelMD function in stk

To help you get started, we’ve selected a few stk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
def test_md_com_exceptions(amine2):
    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            conformers=10000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            simulation_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            time_step=100000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
)

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )

    mm = stk.MacroModelMD(
        macromodel_path='dummy_path',
        simulation_time=100000,
        eq_time=100000
    )

    mm._generate_com(amine2, join(test_dir, 'com_test'))
    with open(join(test_dir, 'com_test.com'), 'r') as o:
        comfile = o.read().splitlines()
        expect1 = (
            ' MDYN       0      0      0      0     1.0000 -10'
            '00.0000   300.0000     0.0000'
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )

    mm = stk.MacroModelMD(
        macromodel_path='dummy_path',
        simulation_time=100000,
        eq_time=100000
    )

    mm._generate_com(amine2, join(test_dir, 'com_test'))
    with open(join(test_dir, 'com_test.com'), 'r') as o:
        comfile = o.read().splitlines()
        expect1 = (
            ' MDYN       0      0      0      0     1.0000 -10'
            '00.0000   300.0000     0.0000'
        )
        expect2 = (
            ' MDYN       1      0      0      0     1.0000 -10'
            '00.0000   300.0000     0.0000'
        )
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
)

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            simulation_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            time_step=100000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
)

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            time_step=100000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )

    mm = stk.MacroModelMD(
        macromodel_path='dummy_path',
        simulation_time=100000,
        eq_time=100000
    )
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
def test_restricted_md(tmp_four_plus_six, macromodel_path):

    mm_energy = stk.MacroModelEnergy(macromodel_path, force_field=16)
    init_energy = mm_energy.get_energy(tmp_four_plus_six)
    tmp_four_plus_six.write(join(test_dir, 'rmm_md_before.mol'))

    # Freeze one of the bonders.
    bonder = tmp_four_plus_six.func_groups[0].bonders[0].id
    rdkit_mol = tmp_four_plus_six.to_rdkit_mol()
    restricted_bonds = []
    for neighbor in rdkit_mol.GetAtomWithIdx(bonder).GetNeighbors():
        restricted_bonds.append(frozenset((bonder, neighbor.GetIdx())))

    mm = stk.MacroModelMD(
        macromodel_path=macromodel_path,
        output_dir='rmm_md',
        minimum_gradient=1,
        simulation_time=20,
        eq_time=2,
        conformers=2,
        time_step=0.1,
        force_field=16,
        restricted_bonds=restricted_bonds
    )
    mm.optimize(tmp_four_plus_six)
    tmp_four_plus_six.write(join(test_dir, 'rmm_md_after.mol'))

    assert mm_energy.get_energy(tmp_four_plus_six) < init_energy
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
)

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            time_step=100000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )

    mm = stk.MacroModelMD(
        macromodel_path='dummy_path',
        simulation_time=100000,
        eq_time=100000
    )
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
)

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            eq_time=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            maximum_iterations=1000000
        )

    with pytest.raises(stk.MacroModelInputError):
        mm = stk.MacroModelMD(
            macromodel_path='dummy_path',
            minimum_gradient=0.00001
        )

    mm = stk.MacroModelMD(
        macromodel_path='dummy_path',
        simulation_time=100000,
        eq_time=100000
    )

    mm._generate_com(amine2, join(test_dir, 'com_test'))
    with open(join(test_dir, 'com_test.com'), 'r') as o:
        comfile = o.read().splitlines()
        expect1 = (
            ' MDYN       0      0      0      0     1.0000 -10'
            '00.0000   750.0000     0.0000'
github lukasturcani / stk / tests / external_software / test_macromodel.py View on Github external
def test_unrestricted_md(tmp_four_plus_six, macromodel_path):

    mm_energy = stk.MacroModelEnergy(macromodel_path, force_field=16)
    init_energy = mm_energy.get_energy(tmp_four_plus_six)
    tmp_four_plus_six.write(join(test_dir, 'umm_md_before.mol'))

    mm = stk.MacroModelMD(
        macromodel_path=macromodel_path,
        output_dir='umm_md',
        minimum_gradient=1,
        simulation_time=20,
        eq_time=2,
        conformers=2,
        time_step=0.1,
        force_field=16
    )
    mm.optimize(tmp_four_plus_six)
    tmp_four_plus_six.write(join(test_dir, 'umm_md_after.mol'))

    assert mm_energy.get_energy(tmp_four_plus_six) < init_energy