Skip to content

bug in material module for triclinic symmetries #104

@donald-e-boyce

Description

@donald-e-boyce

When you set the spacegroup number to 1 or 2 via the material.Material class, it breaks. I suspect the reason has to do with the crystal symmetry group has only one member, and a 3D array gets flattened to a 2D one. See code below:

In [2]: from hexrd.xrd.material import Material
In [3]: m = Material()
In [4]: m.sgnum = 1

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.py:234: RuntimeWarning: invalid value encountered in arcsin
tth = angConv * 2 * num.arcsin(wlen / 2 / d)
/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.py:241: RuntimeWarning: invalid value encountered in arcsin
p['tThetasLo'] = angConv * 2 * num.arcsin(wlen / 2 / (d*(1.+strainMag)))
/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.py:242: RuntimeWarning: invalid value encountered in arcsin

p['tThetasHi'] = angConv * 2 * num.arcsin(wlen / 2 / (d*(1.-strainMag)))

RuntimeError Traceback (most recent call last)
in ()
----> 1 m.sgnum = 1

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/material.py in _set_sgnum(self, v)
216 self._sgnum = v
217 self._spaceGroup = SG(self._sgnum)
--> 218 self._newPdata()
219
220 return

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/material.py in _newPdata(self)
164 self._pData = PData(hkls, lprm, laue,
165 self._beamEnergy, Material.DFLT_STR,
--> 166 tThWidth=Material.DFLT_TTH)
167 #
168 # Set default exclusions

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.pyc in init(self, hkls, _args, *_kwargs)
568 raise RuntimeError, 'have unparsed keyword arguments with keys: '+str(kwargs.keys())
569
--> 570 self.__calc()
571
572 return

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.pyc in __calc(self)
575 symmGroup = symmetry.ltypeOfLaueGroup(self.__laueGroup)
576 latPlaneData, latVecOps, hklDataList = PlaneData.makePlaneData(
--> 577 self.__hkls, self.__lparms, self.__qsym, symmGroup, self.__strainMag, self.wavelength)
578 'sort by tTheta'
579 tThs = num.array([hklDataList[iHKL]['tTheta'] for iHKL in range(len(hklDataList))])

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/crystallography.pyc in makePlaneData(hkls, lparms, qsym, symmGroup, strainMag, wavelength)
744 qsym,
745 csFlag=True,
--> 746 cullPM=False)
747
748 # check for +/- in symmetry group

/Users/cn-llnl/Source/hexrd-jvb/hexrd/xrd/symmetry.pyc in applySym(vec, qsym, csFlag, cullPM, tol)
321 Rsym = rotMatOfQuat(qsym)
322
--> 323 allhkl = multMatArray(Rsym, tile(vec, (nsym, 1, 1))).swapaxes(1, 2).reshape(nsym, 3).T
324
325 if csFlag:

/Users/cn-llnl/Source/hexrd-jvb/hexrd/matrixutil.pyc in multMatArray(ma1, ma2)
476 if len(shp1) != 3 or len(shp2) != 3:
477 raise RuntimeError, 'input is incorrect shape; '
--> 478 + 'expecting len(ma1).shape = len(ma2).shape = 3'
479
480 if shp1[0] != shp2[0]:

RuntimeError: input is incorrect shape; expecting len(ma1).shape = len(ma2).shape = 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions