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
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))