def test_all_interstice_and_packing_mro(self):
     all_df = self.cluster_packing_df.join(self.atomic_packing_df)
     all_df = all_df.join(self.sro_volume_area_df)
     mro = MRO(save=False)
     result_df = mro.fit_transform(X=all_df, dependent_df=self.nn_df)
     self.assertEqual(len(result_df.columns), 72)
     self.assertEqual(result_df.iloc[3, -1], -0.026077608080648407)
 def test_voro_index_mro(self):
     mro = MRO(save=False)
     result_df = mro.fit_transform(X=self.voro_idx_df,
                                   dependent_df=self.nn_df)
     self.assertTrue('MRO_mean_Voronoi_idx_5_voro' in result_df.columns)
     self.assertEqual(len(result_df), len(self.voro_idx_df))
     self.assertAlmostEqual(
         result_df.iloc[4]['MRO_mean_Voronoi_idx_3_voro'], 0.777778, 6)
     self.assertAlmostEqual(result_df.iloc[4]['MRO_std_Voronoi_idx_3_voro'],
                            1.227262, 6)
     self.assertAlmostEqual(result_df.iloc[4]['MRO_min_Voronoi_idx_3_voro'],
                            0.000000, 6)
     self.assertAlmostEqual(result_df.iloc[4]['MRO_max_Voronoi_idx_3_voro'],
                            4.000000, 6)
     self.assertAlmostEqual(result_df.iloc[4]['MRO_Avg_5_fold_symm_idx'],
                            0.375000, 6)
     self.assertAlmostEqual(result_df.iloc[4]['MRO_Avg_6_fold_symm_idx'],
                            0.250000, 6)
 def test_interstice_pipeline(self):
     featurizers = [
         VoroNN(bds=self.sc_bds,
                cutoff=5,
                allow_neighbor_limit=300,
                n_neighbor_limit=80,
                pbc=[1, 1, 1],
                save=False),
         DistanceNN(bds=self.sc_bds,
                    cutoff=4,
                    allow_neighbor_limit=300,
                    n_neighbor_limit=80,
                    pbc=[1, 1, 1],
                    save=False),
         VolumeAreaInterstice(atomic_number_list=[29, 40],
                              save=False,
                              radii=None,
                              radius_type="miracle_radius",
                              verbose=1),
         ClusterPackingEfficiency(atomic_number_list=[29, 40],
                                  save=False,
                                  radii=None,
                                  radius_type="miracle_radius",
                                  verbose=1),
         AtomicPackingEfficiency(atomic_number_list=[29, 40],
                                 save=False,
                                 radii=None,
                                 radius_type="miracle_radius",
                                 verbose=1),
         MRO(output_file_prefix='pipeline_mro', save=False)
     ]
     multi_featurizer = FeaturizePipeline(featurizers=featurizers,
                                          save=False)
     result_df = multi_featurizer.fit_transform(X=self.sc_df,
                                                bds=self.sc_bds,
                                                lammps_df=self.sc_df)
     self.assertAlmostEqual(
         result_df.iloc[4]['Volume_interstice_mean_voro'], 0.144229, 6)
     self.assertAlmostEqual(result_df.iloc[4]['Volume_interstice_std_voro'],
                            0.196815, 6)
     self.assertAlmostEqual(result_df.iloc[4]['Volume_interstice_min_voro'],
                            0.000000, 6)
     self.assertAlmostEqual(result_df.iloc[4]['Volume_interstice_max_voro'],
                            0.539218, 6)
     self.assertAlmostEqual(
         result_df.iloc[4]['MRO_mean_Atomic_packing_efficiency_'
                           'miracle_voro'], 0.158738, 6)
     self.assertAlmostEqual(
         result_df.iloc[4]['MRO_std_Atomic_packing_efficiency_'
                           'miracle_voro'], 0.164291, 6)
     self.assertAlmostEqual(
         result_df.iloc[4]['MRO_min_Atomic_packing_efficiency_'
                           'miracle_voro'], 0.038186, 6)
     self.assertAlmostEqual(
         result_df.iloc[4]['MRO_max_Atomic_packing_efficiency_'
                           'miracle_voro'], 0.509640, 6)
 def test_atomic_packing_mro(self):
     mro = MRO(save=False, stats_types=[0, 1, 1, 1, 1, 0])
     result_df = mro.fit_transform(X=self.atomic_packing_df,
                                   dependent_df=self.nn_df)
     self.assertEqual(len(result_df.columns), 4)
     self.assertEqual(result_df.iloc[5, 0], 0.18774192756735897)
 def test_cluster_packing_mro(self):
     mro = MRO(save=False, stat_ops=['sum', 'mean', 'std', 'min', 'max'])
     result_df = mro.fit_transform(X=self.cluster_packing_df,
                                   dependent_df=self.nn_df)
     self.assertEqual(len(result_df.columns), 5)
     self.assertEqual(result_df.iloc[7, 0], 11.287025655788824)
 def test_volume_area_interstice_mro(self):
     mro = MRO(save=False, stats_types="all")
     result_df = mro.fit_transform(X=self.sro_volume_area_df,
                                   dependent_df=self.nn_df)
     self.assertEqual(len(result_df.columns), 60)
     self.assertEqual(result_df.iloc[3, -1], -0.026077608080648407)
    VoroNN(bds=bds, cutoff=5.0, output_path=output_path),
    DistanceNN(bds=bds, cutoff=4.0, output_path=output_path),

    # distance interstice
    DistanceInterstice(atomic_number_list=atomic_number_list,
                       dependent_class='voro',
                       stat_ops=stat_ops,
                       output_path=output_path),
    DistanceInterstice(atomic_number_list=atomic_number_list,
                       dependent_class='dist',
                       stat_ops=stat_ops,
                       output_path=output_path),

    # area and volume interstice
    VolumeAreaInterstice(atomic_number_list=atomic_number_list,
                         stat_ops=stat_ops,
                         output_path=output_path),

    # from SRO to MRO
    MRO(stats_types=[0, 1, 1, 1, 1, 0], output_path=output_path)
]

# defining a featurize_pipeline
featurize_pipeline = FeaturizePipeline(featurizers=featurizers,
                                       output_path=output_path)

# featurization
feature_df = featurize_pipeline.fit_transform(X=structure,
                                              bds=bds,
                                              lammps_df=structure)