From 27168f2234cc812196b59d2250c113d32f80b374 Mon Sep 17 00:00:00 2001 From: Vitesh Shah Date: Mon, 30 Oct 2023 11:10:33 +0100 Subject: [PATCH] get crystal structure info from DADF5 --- python/damask/_result.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/python/damask/_result.py b/python/damask/_result.py index 6fa4ca045..1a82fe2bf 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1987,7 +1987,9 @@ class Result: N_digits = int(np.floor(np.log10(max(1,self.incs[-1]))))+1 + Crystal_structure_types = {'Hexagonal': 0, 'Cubic': 1, 'Triclinic': 4, 'Monoclinic': 5, 'Orthorhombic': 6, 'Tetrogonal': 8} Phase_types = {'Primary': 0} + lattice_dict = {} #further additions to these can be done by looking at 'Create Ensemble Info' filter # other options could be 'Precipitate' and so on. # also crystal structures be added in a similar way @@ -2007,6 +2009,7 @@ class Result: for count,label in enumerate(self.visible['phases']): try: data = ma.array(_read(f['/'.join([inc,'phase',label,'mechanical/O'])])) + lattice_dict[label] = f['/'.join([inc,'phase',label,'mechanical/O'])].attrs['lattice'] cell_orientation_array[at_cell_ph[c][label],:] = \ Rotation(data[in_data_ph[c][label],:]).as_Euler_angles() # Dream3D handles euler angles better @@ -2058,9 +2061,17 @@ class Result: ensemble_label = data_container_label + '/CellEnsembleData' # Data CrystalStructures - o[ensemble_label + '/CrystalStructures'] = np.uint32(np.array([999] + [1]*len(self.phases))) - # assuming only cubic crystal structures - # Damask can give the crystal structure info + crystal_structure_list = [999] + for label in self.visible['phases']: + if lattice_dict[label] in ['hP']: + crystal_structure = 'Hexogonal' + elif lattice_dict[label] in ['cP','cI','cF']: + crystal_structure = 'Cubic' + elif lattice_dict[label] in ['']: + elif lattice_dict[label] in ['oP','oS','oI','oF']: + crystal_structure = 'Orthorhombic' + crystal_structure_list.append(Crystal_structure_types[crystal_structure]) + o[ensemble_label + '/CrystalStructures'] = np.uint32(crystal_struture_list) # but need to look into dream3d which crystal structure corresponds to which number o[ensemble_label + '/PhaseTypes'] = np.uint32(np.array([999] + [Phase_types['Primary']]*len(self.phases)))\ .reshape((len(self.phases)+1,1))