def test_representation_transform(self):

        rep = SortedCoulombMatrix(**self.hypers)

        features = rep.transform([self.frame])

        test = features.get_features(rep)
Exemple #2
0
    def test_serialization(self):
        rep = SortedCoulombMatrix(**self.hypers)

        rep_dict = to_dict(rep)

        rep_copy = from_dict(rep_dict)

        rep_copy_dict = to_dict(rep_copy)

        self.assertTrue(rep_dict == rep_copy_dict)
Exemple #3
0
    "reference_data/CaCrP2O7_mvc-11955_symmetrized.json",
    "reference_data/small_molecule.json"
]

data = dict(filenames=fns_to_write, cutoffs=cutoffs, rep_info=[])
hypers = dict(central_decay=-1,
              interaction_cutoff=-1,
              interaction_decay=-1,
              size=10,
              sorting_algorithm='')

for fn in fns:
    for cutoff in cutoffs:
        print(fn, cutoff)
        data['rep_info'].append([])
        for sort in sorts:
            rep = SortedCoulombMatrix(cutoff, sorting_algorithm=sort)
            frame = [json2ase(load_json(fn))]
            features = rep.transform(frame)
            test = features.get_feature_matrix()
            hypers['size'] = rep.size
            print(rep.size)
            hypers['sorting_algorithm'] = sort
            data['rep_info'][-1].append(
                dict(feature_matrix=test.tolist(), hypers=copy(hypers)))

with open(
        os.path.join(path, "tests", "reference_data",
                     "sorted_coulomb_reference.ubjson"), 'wb') as f:
    ubjson.dump(data, f)
Exemple #4
0
 def test_pickle(self):
     rep = SortedCoulombMatrix(**self.hypers)
     serialized = pickle.dumps(rep)
     rep_ = pickle.loads(serialized)
     self.assertTrue(to_dict(rep) == to_dict(rep_))