Exemple #1
0
    def test_build_iz_from_z(self):
        tmp_goo = PerfectZeolite.make('GOO')
        z = PerfectZeolite.build_from_cif_with_labels('data/GOO.cif')
        iz = Zeolite(z)
        # tests inheritance
        self.assertIsInstance(iz, Zeolite)
        self.assertIsInstance(iz, PerfectZeolite)
        self.assertIsInstance(iz, Atoms)
        # tests empty list attributes
        # tests corretly defined parameters
        self.assertEqual(iz._site_to_atom_indices, None)
        self.assertEqual(iz._atom_indices_to_site, None)
        #self.assertEqual(iz.name)
        self.assertEqual(iz.parent_zeotype, z)
        #tests atoms are there and behave the same
        self.assertCountEqual(iz.get_tags(), z.get_tags())
        self.assertCountEqual(iz.get_chemical_symbols(),
                              z.get_chemical_symbols())
        self.assertEqual(id(iz.parent_zeotype), id(z.parent_zeotype))
        self.assertEqual(id(iz.index_mapper), id(z.index_mapper))
        self.assertEqual(id(iz.parent_zeotype), id(z.parent_zeotype))
        self.assertNotEqual(iz.index_mapper, None)

        self.assertEqual(iz.parent_zeotype, z)
        self.assertEqual(iz.index_mapper, z.index_mapper)
        self.assertEqual(iz.index_mapper, z.index_mapper)
Exemple #2
0
 def test_init_with_zeolite_obj(self):
     tmp_goo = PerfectZeolite.make('GOO')
     z = PerfectZeolite.build_from_cif_with_labels('data/GOO.cif')
     my_zeotype = PerfectZeolite(z)
     print(os.getcwd())
     # tests inheritance
     self.assertIsInstance(my_zeotype, PerfectZeolite)
     self.assertIsInstance(my_zeotype, Atoms)
     # tests empty list attributes
     # tests corretly defined parameters
     self.assertEqual(my_zeotype._site_to_atom_indices,
                      z._site_to_atom_indices)
     self.assertEqual(my_zeotype._atom_indices_to_site,
                      z._atom_indices_to_site)
     self.assertEqual(my_zeotype.name, z.name)
     self.assertEqual(my_zeotype.parent_zeotype, my_zeotype)
     #tests atoms are there and behave the same
     self.assertCountEqual(my_zeotype.get_tags(), z.get_tags())
     self.assertCountEqual(my_zeotype.get_chemical_symbols(),
                           z.get_chemical_symbols())
     self.assertNotEqual(id(my_zeotype.parent_zeotype),
                         id(z.parent_zeotype))
     self.assertNotEqual(id(my_zeotype.index_mapper), id(z.index_mapper))
     self.assertNotEqual(id(my_zeotype.index_mapper), id(z.parent_zeotype))
     self.assertNotEqual(my_zeotype.index_mapper, None)
Exemple #3
0
 def test_build_from_cif_with_labels(
     self
 ):  # TODO: Write test case for building from CIF file (use rel path)
     abs_path = '/Users/dda/Code/MAZE-sim/tests/data/CHA.cif'
     cha_site_dict = {
         'O1':
         [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
         'O2': [
             18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
             34, 35
         ],
         'O3': [
             36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
             52, 53
         ],
         'O4': [
             54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
             70, 71
         ],
         'T1': [
             72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
             88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
             103, 104, 105, 106, 107
         ]
     }
     z = PerfectZeolite.build_from_cif_with_labels(abs_path)
     self.assertIsInstance(z, PerfectZeolite)
     self.assertIs(z, z.parent_zeotype)
     self.assertDictEqual(cha_site_dict, z._site_to_atom_indices)
Exemple #4
0
    def __init__(self,
                 iza_code=None,
                 optimized_zeolite_path=None,
                 user_input_path=None):
        """ This is an extra-framework class
        :param iza_code: 3 letter code for the zeolite structures (IZA database)
        """
        if iza_code is not None:
            self.EFzeolite = Zeolite.make(iza_code)
        if optimized_zeolite_path is not None:
            read_vasp(optimized_zeolite_path, Zeolite.make(iza_code))
        if user_input_path is not None:
            # self.EFzeolite = read(user_input_path, '0')
            self.EFzeolite = Zeolite(
                PerfectZeolite.build_from_cif_with_labels(
                    filepath=user_input_path))

        self.t_site_indices = {}
        self.t_site_indices_count = {}
        self.traj_1Al = []
        self.traj_2Al = []
        self.count_all_Al_pairs = 0
        self.TM_list = ['Pt', 'Cu', 'Co', 'Pd', 'Fe', 'Cr', 'Rh', 'Ru']
        self.dict_1Al_replaced = {}
        self.dict_2Al_replaced = {}
        self.T_site_pair = []
        self.T_index_pair = []
Exemple #5
0
def main():
    cif_dir = "/Users/dda/Code/MAZE-sim/data/BEA.cif"
    zeolite = PerfectZeolite.build_from_cif_with_labels(cif_dir)
    print('t_site_to_atom_indices', zeolite._site_to_atom_indices)
    print('atom_indices_to_t_site', zeolite._atom_indices_to_site)
    atom_types = zeolite.get_atom_types()
    for key, val in atom_types.items():
        print(key, val)

    indices, count = zeolite.count_elements()
    print('atom type count', dict(count))
Exemple #6
0
import os
from maze.zeolite import PerfectZeolite
from maze.io_zeolite import *

if __name__ == "__main__":
    data_path = '/Users/dda/Code/MAZE-sim/data/'
    cif_path = os.path.join(data_path, 'BEA.cif')
    output_path = os.path.join(data_path, 'my_first_zeotype')
    my_zeotype = PerfectZeolite.build_from_cif_with_labels(cif_path)
    print(my_zeotype.index_mapper.main_index)
    cluster, od = my_zeotype.get_cluster(1, 10, 10)
    # data_dir = os.path.join(Path(os.getcwd()).parent, 'data')
    # output_traj = os.path.join(data_dir, 'test.traj')
    # cif_dir = os.path.join(data_dir, 'BEA.cif')
    # zeolite = Zeotype.build_from_cif_with_labels(cif_dir)
    save_zeolites(output_path, [my_zeotype, cluster, od])
    new_dict = read_zeotypes(output_path + '.zeo')
    print(new_dict)
    print(new_dict['parent'])
    print(new_dict['parent'].index_mapper.main_index)
    # Trajectory(output_traj,'w', zeolite)