Skip to content

Commit eb14489

Browse files
committed
Add Invert as RB Add option
Fix bug for when phase only has one reflection
1 parent ecabbdd commit eb14489

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

GSASII/GSASIImath.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,8 @@ def UpdateRBXYZ(Bmat,RBObj,RBData,RBType):
13841384
vecs = RBRes['rbVect']
13851385
mags = RBRes['VectMag']
13861386
Cart = np.zeros_like(vecs[0])
1387+
if RBRes.get('Invert',False):
1388+
Cart *= -1.
13871389
for vec,mag in zip(vecs,mags):
13881390
Cart += vec*mag
13891391
elif RBType == 'Residue':
@@ -1392,6 +1394,8 @@ def UpdateRBXYZ(Bmat,RBObj,RBData,RBType):
13921394
for tor,seq in zip(RBObj['Torsions'],RBRes['rbSeq']):
13931395
QuatA = AVdeg2Q(tor[0],Cart[seq[0]]-Cart[seq[1]])
13941396
Cart[seq[3]] = prodQVQ(QuatA,(Cart[seq[3]]-Cart[seq[1]]))+Cart[seq[1]]
1397+
if RBRes.get('Invert',False):
1398+
Cart *= -1.
13951399
elif RBType == 'Spin':
13961400
Cart = np.zeros(3)
13971401
XYZ = [np.array(RBObj['Orig'][0]),]

GSASII/GSASIIphsGUI.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10479,6 +10479,7 @@ def assignAtoms(RBData,selDict={},unmatchedRBatoms=None):
1047910479

1048010480
rbType = data['testRBObj']['rbType']
1048110481
rbObj = data['testRBObj']['rbObj']
10482+
rbObj['Invert'] = rbObj.get('Invert',False)
1048210483
rbId = rbObj['RBId']
1048310484
matchTable = []
1048410485
if rbType == 'Spin':
@@ -10915,6 +10916,9 @@ def OnOrigSet(event):
1091510916
item.ChangeValue(data['testRBObj']['rbObj']['Orig'][0][i])
1091610917
UpdateSytSym()
1091710918
UpdateTablePlot()
10919+
10920+
def OnInvert(event):
10921+
UpdateTablePlot()
1091810922

1091910923
showAtom = [None]
1092010924
def showCryAtom(*args,**kwargs):
@@ -11077,6 +11081,8 @@ def showCryAtom(*args,**kwargs):
1107711081
symRadioSet = wx.RadioBox(RigidBodies,choices=choices)
1107811082
symRadioSet.Bind(wx.EVT_RADIOBOX, OnSymRadioSet)
1107911083
OriSizer4.Add(symRadioSet)
11084+
Invert = G2G.G2CheckBox(RigidBodies,'Invert',rbObj,'Invert',OnInvert)
11085+
OriSizer4.Add(Invert,0,WACV)
1108011086
mainSizer.Add(OriSizer4)
1108111087
mainSizer.Add((5,5),0)
1108211088
RefSizer = wx.FlexGridSizer(0,7,5,5)

GSASII/GSASIIstrMath.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,8 @@ def StructureFactor2(refDict,G,hfx,pfx,SGData,calcControls,parmDict):
11811181
iFin = min(iBeg+blkSize,nRef)
11821182
refl = refDict['RefList'][iBeg:iFin] #array(blkSize,nItems)
11831183
H = refl.T[:3] #array(blkSize,3)
1184-
H = np.squeeze(np.inner(H.T,TwinLaw)) #maybe array(blkSize,nTwins,3) or (blkSize,3)
1184+
H = np.inner(H.T,TwinLaw)
1185+
H = np.squeeze(H,axis=1) #maybe array(blkSize,nTwins,3) or (blkSize,3)
11851186
TwMask = np.any(H,axis=-1)
11861187
if TwinLaw.shape[0] > 1 and TwDict: #need np.inner(TwinLaw[?],TwDict[iref][i])*TwinInv[i]
11871188
for ir in range(blkSize):

0 commit comments

Comments
 (0)