Пример #1
0
        def test_mdrun(self, tmpdir):
                """Check if grompp can be run successfully at all"""
                f = self.mdp
                c = self.conf
                processed = self.processed
                with tmpdir.as_cwd():
                        tpr = grompp(f, c, processed, prefix="reference")
                        reference_trr = mdrun(tpr, prefix="reference")
                        df1 = rerun_energy(tpr, reference_trr, prefix="reference")

                        scaled = "scaled.top"
                        args = Namespace(banned_lines='', input=processed, output=scaled, scale_lipids=1.0, scale_protein=1.0)
                        partial_tempering(args)

                        assert os.path.exists(scaled), "failed to produce {0}".format(scaled)

                        tpr = grompp(f, c, scaled, prefix="scaled")
                        df2 = rerun_energy(tpr, reference_trr, prefix="scaled")

                        assert_frame_equal(df1.sort(axis=1), df2.sort(axis=1), check_names=True)

                        scaled = "scaled.top"
                        args = Namespace(banned_lines='', input=processed, output=scaled, scale_lipids=1.0, scale_protein=0.5)
                        partial_tempering(args)
                        tpr = grompp(f, c, scaled, prefix="scaled")
                        df3 = rerun_energy(tpr, reference_trr, prefix="scaled")
                        # print(df1, df1.columns)
                        # print(df3, df3.columns)
                        unscaled_terms = ['Time (ps)', 'Improper Dih.']
                        scaled_terms = ['Proper Dih.']

                        assert_frame_equal(df1[unscaled_terms].sort(axis=1), df3[unscaled_terms].sort(axis=1), check_names=True)
                        assert_frame_equal(df1[scaled_terms].sort(axis=1), 2*df3[scaled_terms].sort(axis=1), check_names=True)
Пример #2
0
    def test_mdrun(self, tmpdir):
        """Check if grompp can be run successfully at all"""
        f = self.mdp
        c = self.conf
        processed = self.processed
        with tmpdir.as_cwd():
            tpr = grompp(f, c, processed, prefix="reference")
            reference_trr = mdrun(tpr, prefix="reference")
            df1 = rerun_energy(tpr, reference_trr, prefix="reference")

            scaled = "scaled.top"
            args = Namespace(banned_lines='',
                             input=processed,
                             output=scaled,
                             scale_lipids=1.0,
                             scale_protein=1.0)
            partial_tempering(args)

            assert os.path.exists(scaled), "failed to produce {0}".format(
                scaled)

            tpr = grompp(f, c, scaled, prefix="scaled")
            df2 = rerun_energy(tpr, reference_trr, prefix="scaled")

            assert_frame_equal(df1.sort(axis=1),
                               df2.sort(axis=1),
                               check_names=True)

            scaled = "scaled.top"
            args = Namespace(banned_lines='',
                             input=processed,
                             output=scaled,
                             scale_lipids=1.0,
                             scale_protein=0.5)
            partial_tempering(args)
            tpr = grompp(f, c, scaled, prefix="scaled")
            df3 = rerun_energy(tpr, reference_trr, prefix="scaled")
            # print(df1, df1.columns)
            # print(df3, df3.columns)
            unscaled_terms = ['Time (ps)', 'Improper Dih.']
            scaled_terms = ['Proper Dih.']

            assert_frame_equal(df1[unscaled_terms].sort(axis=1),
                               df3[unscaled_terms].sort(axis=1),
                               check_names=True)
            assert_frame_equal(df1[scaled_terms].sort(axis=1),
                               2 * df3[scaled_terms].sort(axis=1),
                               check_names=True)
# GromacsWrapper: gw-partial_tempering.py
# Copyright (c) 2009 Oliver Beckstein <*****@*****.**>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.

from gromacs.scaling import partial_tempering
import argparse

description="""
Modify gromacs processed topology (processed.top, generated by `grompp -pp` command)
for running with solute tempering replica exchange (REST2). 
"""

def parse_args():
	parser = argparse.ArgumentParser(description=description)
	parser.add_argument("--scale_protein", type=float, help="scale protein interactions by this scaling factor (0-1)")
	parser.add_argument("--scale_lipids", type=float, help="scale lipid interactions by this scaling factor (0-1)")
	parser.add_argument("--scale_protein_lipids", type=float, help="scale lipid-lipid interactions by this scaling factor (0-1)")
	parser.add_argument("input", help="input topology (processed.top)")
	parser.add_argument("output", help="output topology")
	parser.add_argument("--banned_lines", default="", help="line numbers of dihedrals/impropers that one wishes to exclude from scaling")
	return parser.parse_args()

args = parse_args()
partial_tempering(args)