Esempio n. 1
0
def topology(tmpdir_factory, struct=datafile("1ake_A_protein.pdb")):
    # note: use protein-only input 1ake_A_protein.pdb because solvation fails
    #       if crystal waters are included (in 1ake_A.pdb)
    TMPDIR = tmpdir_factory.mktemp('1ake')
    with TMPDIR.as_cwd():
        topol_args = gromacs.setup.topology(struct=struct, ff="oplsaa", water="tip4p")
    return TMPDIR, topol_args
Esempio n. 2
0
def topology(tmpdir_factory, struct=datafile("1ake_A_protein.pdb")):
    # note: use protein-only input 1ake_A_protein.pdb because solvation fails
    #       if crystal waters are included (in 1ake_A.pdb)
    TMPDIR = tmpdir_factory.mktemp('1ake')
    with TMPDIR.as_cwd():
        topol_args = gromacs.setup.topology(struct=struct,
                                            ff="oplsaa",
                                            water="tip4p")
    return TMPDIR, topol_args
Esempio n. 3
0
def test_grompp_qtot(tmpdir):
    pdb = datafile("1ake_A.pdb")
    top = tmpdir.mkdir("top")
    with top.as_cwd():
        f = gromacs.setup.topology(struct=pdb, ff="oplsaa", water="tip4p")
        with open('none.mdp','w') as mdp:
            mdp.write('; empty mdp file\nrcoulomb = 1\nrvdw = 1\nrlist = 1\n')
        qtot = cbook.grompp_qtot(f="none.mdp", c=f['struct'], p=f['top'],
                                 stdout=False, maxwarn=10)
    assert_almost_equal(qtot, -4, decimal=5,
                        err_msg="grompp_qtot() failed to compute total charge correctly")
Esempio n. 4
0
def test_trj_compact_main(tmpdir):
    pdb = datafile("1ake_A.pdb")
    top = tmpdir.mkdir("top")
    mdpfile = "simple.mdp"
    tprfile = "simple.tpr"
    outfile = "compact.pdb"
    with top.as_cwd():
        f = gromacs.setup.topology(struct=pdb, ff="oplsaa", water="tip4p")
        with open(mdpfile, 'w') as mdp:
            mdp.write('; empty mdp file\nrcoulomb = 1\nrvdw = 1\nrlist = 1\n')
        gromacs.grompp(f=mdpfile, o=tprfile, c=f["struct"], p=f["top"])
        gromacs.setup.trj_compact_main(s=tprfile, f=f["struct"], o=outfile, input=("protein", "system"))
        assert os.path.exists(outfile)
Esempio n. 5
0
def test_trj_compact_main(tmpdir):
    pdb = datafile("1ake_A.pdb")
    top = tmpdir.mkdir("top")
    mdpfile = "simple.mdp"
    tprfile = "simple.tpr"
    outfile = "compact.pdb"
    with top.as_cwd():
        f = gromacs.setup.topology(struct=pdb, ff="oplsaa", water="tip4p")
        with open(mdpfile, 'w') as mdp:
            mdp.write('; empty mdp file\nrcoulomb = 1\nrvdw = 1\nrlist = 1\n')
        gromacs.grompp(f=mdpfile, o=tprfile, c=f["struct"], p=f["top"])
        gromacs.setup.trj_compact_main(s=tprfile,
                                       f=f["struct"],
                                       o=outfile,
                                       input=("protein", "system"))
        assert os.path.exists(outfile)
Esempio n. 6
0
def test_energy_minimize_custom_mdp(solvate, low_performance,
                                    mdp=datafile("custom_em.mdp")):
    TMPDIR, solvate_args = solvate
    nt = 2 if low_performance else 0
    with TMPDIR.as_cwd():
        try:
            em_args = gromacs.setup.energy_minimize(mdrun_args={'nt': nt},
                                                    mdp=mdp,
                                                    emtol=5000,
                                                    **solvate_args)
        except gromacs.exceptions.GromacsError as err:
            # sometimes the em does not converge at all, e.g. 5.02988e+04 on atom 3277;
            # (happens on Travis Linux with Gromacs 4.6.5 but not locally or on Travis OSX) so we
            # re-run with a ridiculous tolerance so that we can at least test that the whole
            # function can run to completion
            em_args = gromacs.setup.energy_minimize(mdrun_args={'nt': nt},
                                                    mdp=mdp,
                                                    emtol=6e4,
                                                    **solvate_args)
    assert os.path.exists(em_args['struct'])
    assert os.path.exists(em_args['top'])
    assert em_args['mainselection'] == '"Protein"'
Esempio n. 7
0
def test_energy_minimize_custom_mdp(solvate,
                                    low_performance,
                                    mdp=datafile("custom_em.mdp")):
    TMPDIR, solvate_args = solvate
    nt = 2 if low_performance else 0
    with TMPDIR.as_cwd():
        try:
            em_args = gromacs.setup.energy_minimize(mdrun_args={'nt': nt},
                                                    mdp=mdp,
                                                    emtol=5000,
                                                    **solvate_args)
        except gromacs.exceptions.GromacsError as err:
            # sometimes the em does not converge at all, e.g. 5.02988e+04 on atom 3277;
            # (happens on Travis Linux with Gromacs 4.6.5 but not locally or on Travis OSX) so we
            # re-run with a ridiculous tolerance so that we can at least test that the whole
            # function can run to completion
            em_args = gromacs.setup.energy_minimize(mdrun_args={'nt': nt},
                                                    mdp=mdp,
                                                    emtol=6e4,
                                                    **solvate_args)
    assert os.path.exists(em_args['struct'])
    assert os.path.exists(em_args['top'])
    assert em_args['mainselection'] == '"Protein"'