Ejemplo n.º 1
0
    def __init__(self, jdata, descrpt, fitting):
        self.descrpt = descrpt
        self.rcut = self.descrpt.get_rcut()
        self.ntypes = self.descrpt.get_ntypes()
        # fitting
        self.fitting = fitting
        self.numb_fparam = self.fitting.get_numb_fparam()

        args = ClassArg()\
               .add('type_map',         list,   default = []) \
               .add('rcond',            float,  default = 1e-3) \
               .add('use_srtab',        str)
        class_data = args.parse(jdata)
        self.type_map = class_data['type_map']
        self.srtab_name = class_data['use_srtab']
        self.rcond = class_data['rcond']
        if self.srtab_name is not None:
            self.srtab = TabInter(self.srtab_name)
            args.add('smin_alpha',      float,  must = True)\
                .add('sw_rmin',         float,  must = True)\
                .add('sw_rmax',         float,  must = True)
            class_data = args.parse(jdata)
            self.smin_alpha = class_data['smin_alpha']
            self.sw_rmin = class_data['sw_rmin']
            self.sw_rmax = class_data['sw_rmax']
        else:
            self.srtab = None
Ejemplo n.º 2
0
 def test_multi_add(self):
     ca = ClassArg().add('test', int)
     test_dict = {'test2': 'foo'}
     ca.parse(test_dict)
     self.assertEqual(ca.get_dict(), {'test': None})
     ca.add('test2', str)
     ca.parse(test_dict)
     self.assertEqual(ca.get_dict(), {'test': None, 'test2': 'foo'})