get crystal structure info from DADF5

This commit is contained in:
Vitesh Shah 2023-10-30 11:10:33 +01:00
parent 796e1ae2d5
commit 27168f2234
1 changed files with 14 additions and 3 deletions

View File

@ -1987,7 +1987,9 @@ class Result:
N_digits = int(np.floor(np.log10(max(1,self.incs[-1]))))+1 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} Phase_types = {'Primary': 0}
lattice_dict = {}
#further additions to these can be done by looking at 'Create Ensemble Info' filter #further additions to these can be done by looking at 'Create Ensemble Info' filter
# other options could be 'Precipitate' and so on. # other options could be 'Precipitate' and so on.
# also crystal structures be added in a similar way # also crystal structures be added in a similar way
@ -2007,6 +2009,7 @@ class Result:
for count,label in enumerate(self.visible['phases']): for count,label in enumerate(self.visible['phases']):
try: try:
data = ma.array(_read(f['/'.join([inc,'phase',label,'mechanical/O'])])) 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],:] = \ cell_orientation_array[at_cell_ph[c][label],:] = \
Rotation(data[in_data_ph[c][label],:]).as_Euler_angles() Rotation(data[in_data_ph[c][label],:]).as_Euler_angles()
# Dream3D handles euler angles better # Dream3D handles euler angles better
@ -2058,9 +2061,17 @@ class Result:
ensemble_label = data_container_label + '/CellEnsembleData' ensemble_label = data_container_label + '/CellEnsembleData'
# Data CrystalStructures # Data CrystalStructures
o[ensemble_label + '/CrystalStructures'] = np.uint32(np.array([999] + [1]*len(self.phases))) crystal_structure_list = [999]
# assuming only cubic crystal structures for label in self.visible['phases']:
# Damask can give the crystal structure info 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 # 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)))\ o[ensemble_label + '/PhaseTypes'] = np.uint32(np.array([999] + [Phase_types['Primary']]*len(self.phases)))\
.reshape((len(self.phases)+1,1)) .reshape((len(self.phases)+1,1))