Esempio n. 1
0
    def setup_class(self):
        """Initialize all data."""
        lipids_tops = lipids.read_lipids_topH(
            [lipids.PATH_JSON / "Berger_POPC.json"])

        # Input parameters
        self.pdb = self.PATH_DATA / "10POPC.pdb"
        self.defop = self.PATH_DATA / "OP_def_BergerPOPC.def"
        self.dic_lipid = lipids_tops["Berger_POPC"]

        self.begin = 0
        self.end = 1

        # attributes
        self.universe_woH = mda.Universe(str(self.pdb))
        self.dic_atname2genericname = init_dics.make_dic_atname2genericname(
            self.defop)
        self.dic_OP, self.dic_corresp_numres_index_dic_OP = init_dics.init_dic_OP(
            self.universe_woH, self.dic_atname2genericname,
            self.dic_lipid['resname'])
        self.dic_Cname2Hnames = init_dics.make_dic_Cname2Hnames(self.dic_OP)

        # Compute the order parameter
        core.fast_build_all_Hs_calc_OP(self.universe_woH, self.begin, self.end,
                                       self.dic_OP, self.dic_lipid,
                                       self.dic_Cname2Hnames)
Esempio n. 2
0
    def setup_method(self):
        """Reset some attributes.

        self.dic_op needs to be reinitialized
        since it is modified by some of the functions tested.
        """
        self.dic_OP, self.dic_corresp_numres_index_dic_OP = init_dics.init_dic_OP(
            self.universe_woH, self.dic_atname2genericname,
            self.dic_lipid['resname'])
Esempio n. 3
0
    def _recreate_dicts(self, def_file):
        """Recreate dicts variable from a new `def_file`.

        Parameters
        ----------
        def_file : str
            path of the new definiton file.
        """
        self.dic_atname2genericname = init_dics.make_dic_atname2genericname(
            def_file)
        self.dic_OP, self.dic_corresp_numres_index_dic_OP = init_dics.init_dic_OP(
            self.universe_woH, self.dic_atname2genericname,
            self.dic_lipid['resname'])
        self.dic_Cname2Hnames = init_dics.make_dic_Cname2Hnames(self.dic_OP)
Esempio n. 4
0
    def setup_class(self):
        """Initialize attributes."""
        lipids_tops = lipids.read_lipids_topH(
            [lipids.PATH_JSON / "Berger_POPC.json"])

        # Input parameters
        self.pdb = self.PATH_DATA / "2POPC.pdb"
        self.defop = self.PATH_DATA / "OP_def_BergerPOPC.def"
        self.dic_lipid = lipids_tops["Berger_POPC"]

        # attributes
        self.universe_woH = mda.Universe(str(self.pdb))

        self.dic_atname2genericname = init_dics.make_dic_atname2genericname(
            self.defop)
        self.dic_OP, self.dic_corresp_numres_index_dic_OP = init_dics.init_dic_OP(
            self.universe_woH, self.dic_atname2genericname,
            self.dic_lipid['resname'])
        self.dic_Cname2Hnames = init_dics.make_dic_Cname2Hnames(self.dic_OP)
Esempio n. 5
0
def test_make_dic_Cname2Hnames(inputs):
    """Test for make_dic_Cname2Hnames().

    Parameters
    ----------
    inputs : function
        Callback which generates input data.
    """
    dic_OP, _ = init_dics.init_dic_OP(inputs['universe'],
                                      inputs['dic_atname2genericname'],
                                      inputs['dic_lipid']['resname'])

    dic = init_dics.make_dic_Cname2Hnames(dic_OP)

    # Number of Carbons with attached hydrogens
    assert len(dic) == 40
    assert dic['C1'] == ('H11', 'H12', 'H13')
    assert dic['C13'] == ('H131', )
    assert dic['C49'] == ('H491', 'H492')
    assert dic['CA2'] == ('HA21', 'HA22', 'HA23')
Esempio n. 6
0
def test_init_dic_OP(inputs):
    """Test for init_dic_OP().

    Parameters
    ----------
    inputs : function
        Callback which generates input data.
    """
    dic_OP, dic_corresp_numres_index_dic_OP = init_dics.init_dic_OP(
        inputs['universe'], inputs['dic_atname2genericname'],
        inputs['dic_lipid']['resname'])
    # Number of Order parmeters
    assert len(dic_OP) == 82
    for key in [('C1', 'H11'), ('C44', 'H442'), ('C17', 'H171'),
                ('CA1', 'HA11')]:
        assert key in dic_OP.keys()
    # Number of lipid molecules
    assert len(dic_OP[('C37', 'H371')]) == 10

    # Number of lipid molecules
    assert len(dic_corresp_numres_index_dic_OP) == 10
    assert dic_corresp_numres_index_dic_OP[2] == 0
    assert dic_corresp_numres_index_dic_OP[11] == 9