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)
def test_make_dic_atname2genericname(inputs): """Test for make_dic_atname2genericname(). Parameters ---------- inputs : function Callback which generates input data. """ dic = init_dics.make_dic_atname2genericname(inputs['defop']) assert dic[('C1', 'H11')] == 'gamma1_1' assert dic[('C32', 'H322')] == 'g1_2' assert dic[('C39', 'H392')] == 'palmitoyl_C5b' assert dic[('C17', 'H171')] == 'oleoyl_C2a' assert dic[('CA2', 'HA23')] == 'oleoyl_C18c' # Test non existent file with pytest.raises(ValueError) as err: init_dics.make_dic_atname2genericname("none") assert "Can't read order parameter" in str(err.value)
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)
def inputs(): """Define some input parameters for the tests.""" # Input parameters path_data = PATH_ROOT_DATA / "Berger_POPC" pdb = path_data / "10POPC.pdb" defop = path_data / "OP_def_BergerPOPC.def" lipids_tops = lipids.read_lipids_topH( [lipids.PATH_JSON / "Berger_POPC.json"]) dic_lipid = lipids_tops["Berger_POPC"] universe_woH = mda.Universe(str(pdb)) dic_atname2genericname = init_dics.make_dic_atname2genericname(defop) return { 'universe': universe_woH, 'defop': defop, 'dic_lipid': dic_lipid, 'dic_atname2genericname': dic_atname2genericname }
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)