Skip to content

Commit

Permalink
secret spacegroup number hidden option
Browse files Browse the repository at this point in the history
  • Loading branch information
jonwright committed Mar 3, 2024
1 parent 9b21b07 commit d5f970e
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions ImageD11/unitcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,22 @@ def __init__(self, lattice_parameters, symmetry = "P", verbose = 0 ):
"""
Unit cell class
supply a list (tuple etc) of a,b,c,alpha,beta,gamma
optionally a symmetry, one of "P","A","B","C","I","F","R"
optionally a lattice symmetry, one of "P","A","B","C","I","F","R"
or : a space group number (integer)
"""
self.lattice_parameters = np.array(lattice_parameters)
if self.lattice_parameters.shape[0]!=6:
raise Exception("You must supply 6 lattice parameters\n"+\
" a,b,c,alpha,beta,gamma")
self.symmetry = symmetry
if self.symmetry not in ["P","A","B","C","I","F","R"]:
raise Exception("Your symmetry "+self.symmetry+\
" was not recognised")
# assigning a function here!
self.absent = outif[self.symmetry]
if isinstance( symmetry, int ):
self.symmetry = symmetry
else:
if self.symmetry not in ["P","A","B","C","I","F","R"]:
raise Exception("Your symmetry "+self.symmetry+\
" was not recognised")
# assigning a function here!
self.absent = outif[self.symmetry]
a = self.lattice_parameters[0]
b = self.lattice_parameters[1]
c = self.lattice_parameters[2]
Expand Down Expand Up @@ -238,21 +242,26 @@ def tostring(self):
self.symmetry)


def gethkls_xfab(self,dsmax,spg):
def gethkls_xfab(self,dsmax,spg=None):
"""
Generate hkl list
Argument dsmax is the d* limit (eg 1/d)
Argument spg is the space group name, e.g. 'R3-c'
"""
stl_max = dsmax/2.
if isinstance(self.symmetry, int):
sgnum = self.symmetry
else:
sgnum = None
raw_peaks = tools.genhkl_all(self.lattice_parameters,
0 , stl_max,
sgname=spg,
sgno = sgnum,
output_stl=True)
peaks = []
for i in range(len(raw_peaks)):
peaks.append([raw_peaks[i,3]*2,
(raw_peaks[i,0],raw_peaks[i,1],raw_peaks[i,2])])
(int(raw_peaks[i,0]),int(raw_peaks[i,1]),int(raw_peaks[i,2]))])
self.peaks = peaks
self.limit = dsmax
return peaks
Expand All @@ -267,6 +276,8 @@ def gethkls(self,dsmax):
"""
if dsmax == self.limit and self.peaks is not None:
return self.peaks
if isinstance(self.symmetry, int):
self.gethkls_xfab( dsmax, self.sgname )
h=k=0
l=1 # skip 0,0,0
hs=ks=ls=1
Expand Down

0 comments on commit d5f970e

Please sign in to comment.