Skip to content

Commit 8b6eaf8

Browse files
committed
Fixes to atom deformation stuff.
1 parent dbb1a02 commit 8b6eaf8

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed

GSASII/GSASIIphsGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9094,7 +9094,7 @@ def SelDeformAtom(event):
90949094
# orbDict.update(cofTerms)
90959095
# orbDict.update({'Ne':[float(orbs[orb]['Ne']),False]})
90969096
# data['Deformations'][Ids[indx]].append([orb,orbDict])
9097-
data['Deformations'][-Ids[indx]] = {'U':'X','V':'Y','UVmat':np.eye(3),
9097+
data['Deformations'][-Ids[indx]] = {'U':'X','V':'Y','UVmat':np.eye(3),'PtGrp':'1',
90989098
'MUV':"A: X'=U, Y'=(UxV)xU & Z'=UxV",'Radial':radial,'fxchoice':fxchoice}
90999099
dlg.Destroy()
91009100
if not len(indxes):

GSASII/GSASIIplot.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,8 +3523,8 @@ def PlotDeform(G2frame,general,atName,atType,deform,UVmat,radial,neigh):
35233523
RAP = G2mth.Cart2Polar(XYZ[0],XYZ[1],XYZ[2])
35243524
P = np.zeros((31,31))
35253525
for shc in SHC:
3526-
p = 2.*SHC[shc][0]*SHC[shc][2]**3*G2lat.KslCalc(shc,RAP[1],RAP[2]).reshape((31,31))
3527-
P += p**2
3526+
p = 2.*SHC[shc][0]*SHC[shc][2]**3*(G2lat.KslCalc(shc,RAP[1],RAP[2])**2).reshape((31,31))
3527+
P += p
35283528
if not np.any(P):
35293529
P = np.ones((31,31))
35303530
# P *= P
@@ -7353,20 +7353,21 @@ def Draw(caller='',Fade=[],NPkey=False):
73537353
defCtrls = deformationData[-atom[ci]]
73547354
defParms = deformationData[atom[ci]]
73557355
SytSym = G2spc.SytSym(atom[cx:cx+3],SGData)[0]
7356+
SGM = np.array(G2spc.GetOpFromCode(atom[cs-1],SGData)[0])
73567357
if defCtrls.get('showDef',False) and defCtrls['Radial'] == 'Slater':
73577358
useAtColor = defCtrls.get('atColor',True)
73587359
atcolor = None
73597360
if useAtColor:
73607361
atcolor = atColor*255
73617362
SHC = defParms[0][1]
73627363
SHC = {item.replace('D','C'):SHC[item] for item in SHC if item not in ['Ne','kappa']}
7363-
UVMat = defCtrls['UVmat']
7364+
UVMat = np.inner(SGM.T,defCtrls['UVmat'])
73647365
Npsi,Ngam = 90,45
73657366
PSI,GAM = np.mgrid[0:Npsi,0:Ngam] #[azm,pol]
73667367
PSI = PSI.flatten()*360./Npsi #azimuth 0-360 ncl
73677368
GAM = GAM.flatten()*180./Ngam #polar 0-180 incl
7368-
Rp,PSIp,GAMp = G2mth.RotPolbyM(np.ones_like(PSI),PSI,GAM,UVMat)
7369-
P = G2lat.SHarmcal(SytSym,SHC,PSIp,GAMp).reshape((Npsi,Ngam))
7369+
Rp,PSIp,GAMp = G2mth.RotPolbyM(np.ones_like(PSI),PSI,GAM,UVMat) #TODO: needs symmetry operation for equiv. positions
7370+
P = G2lat.SHarmcal(SytSym,SHC,PSIp,GAMp).reshape((Npsi,Ngam))**2
73707371
if np.min(P) < np.max(P):
73717372
P = (P-np.min(P))/(np.max(P)-np.min(P))
73727373
RenderTextureSphere(x,y,z,radius,atcolor,shape=[Npsi,Ngam],Texture=P.T,ifFade=False)

GSASII/GSASIIspc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,26 @@ def GetOpNum(Opr,SGData):
14591459
opNum += cent*Nops
14601460
return opNum
14611461

1462+
def GetOpFromCode(Code,SGData):
1463+
"takes Sym Op code from Draw Atoms table & returns space group operation details"
1464+
SGOps = SGData['SGOps']
1465+
SGCent = SGData['SGCen']
1466+
if '+' not in Code:
1467+
SymOp = Code
1468+
Unit = '(0,0,0)'
1469+
else:
1470+
SymOp,Unit = Code.split('+')
1471+
SymOp = int(SymOp)
1472+
opNum = abs(SymOp)%100-1
1473+
cent = abs(opNum)//100
1474+
Unit = list(eval(Unit))
1475+
Cent = SGCent[cent]
1476+
SGM,SGT = SGOps[opNum]
1477+
if SymOp < 0:
1478+
SGM *= -1
1479+
SGT *= -1
1480+
return SGM,SGT,Cent,Unit
1481+
14621482
################################################################################
14631483
#### Superspace group codes
14641484
################################################################################

GSASII/GSASIIstrMath.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def MakeSpHarmFF(HKL,Amat,Bmat,SHCdict,Tdata,hType,FFtables,ORBtables,BLtables,F
437437
:param str hType: histogram type
438438
:param dict FFtables: x-ray form factor tables
439439
:param dict ORBtables: x-ray orbital form factor tables
440-
:param dict BLtables: neutron scattering lenghts
440+
:param dict BLtables: neutron scattering lengths
441441
:param array FF: form factors - will be modified by adding the spin/deformation RB spherical harmonics terms
442442
:param array SQ: 1/4d^2 for the HKL set
443443
:param bool ifDeriv: True if dFF/dcoff to be returned
@@ -580,7 +580,7 @@ def MakePolar(Orient,QB):
580580
for term in orbs[orb]:
581581
if 'D(' in term:
582582
item = term.replace('D','C')
583-
SH = G2lat.KslCalc(item,Th,Ph)
583+
SH = G2lat.KslCalc(item,Th,Ph)**2
584584
FFval += SH*orbs[orb][term]*ff
585585
name = 'A%s%s:%d'%(term,orb,iAt)
586586
dFFdS[name] = SH*ff
@@ -597,7 +597,7 @@ def MakePolar(Orient,QB):
597597
for term in orbs[orb]:
598598
if 'D(' in term: #skip 'Ne'
599599
item = term.replace('D','C')
600-
SH = G2lat.KslCalc(item,Th,Ph)
600+
SH = G2lat.KslCalc(item,Th,Ph)**2
601601
FFval += SH*orbs[orb][term]*ff
602602
name = 'A%s%s:%d'%(term,orb,iAt)
603603
dFFdS[name] = SH*ff

GSASII/exports/G2export_PDB.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def Exporter(self,event=None):
277277
A,B = G2lat.cell2AB(Cell)
278278
self.Write('# GSAS-II generated ORCA input file\n# Basic Mode')
279279
self.Write('#%Sym SymThresh 0.01 End')
280-
self.Write('# after xyz is charge & multiplicity; change as needed')
280+
self.Write('# after xyz is charge & multiplicity; change as needed for ions')
281281
self.Write('* xyz 0 1')
282282
fmt = '{:4s}'+3*'{:12.4f}'
283283
for atom in Atoms:

0 commit comments

Comments
 (0)