22
22
23
23
__all__ = ["constrainAsSpaceGroup" ]
24
24
25
- def constrainAsSpaceGroup (phase , sgsymbol , scatterers = None ,
25
+ def constrainAsSpaceGroup (phase , spacegroup , scatterers = None ,
26
26
sgoffset = [0 , 0 , 0 ], constrainlat = True , constrainadps = True ,
27
27
adpsymbols = None , isosymbol = "Uiso" ):
28
28
"""Constrain the structure to the space group.
@@ -33,8 +33,8 @@ def constrainAsSpaceGroup(phase, sgsymbol, scatterers = None,
33
33
34
34
Arguments:
35
35
phase -- A BaseStructure object.
36
- sgsymbol -- The space group number or symbol (compatible with
37
- diffpy.Structure.SpaceGroups.GetSpaceGroup .
36
+ spacegroup -- The space group number, symbol or an instance of
37
+ SpaceGroup class from diffpy.Structure package .
38
38
sgoffset -- Optional offset for sg origin (default [0, 0, 0]).
39
39
scatterers -- The scatterer ParameterSets to constrain. If scatterers
40
40
is None (default), then all scatterers accessible from
@@ -77,9 +77,11 @@ def constrainAsSpaceGroup(phase, sgsymbol, scatterers = None,
77
77
78
78
"""
79
79
80
- from diffpy .Structure .SpaceGroups import GetSpaceGroup
80
+ from diffpy .Structure .SpaceGroups import GetSpaceGroup , SpaceGroup
81
81
82
- sg = GetSpaceGroup (sgsymbol )
82
+ sg = spacegroup
83
+ if not isinstance (spacegroup , SpaceGroup ):
84
+ sg = GetSpaceGroup (spacegroup )
83
85
sgp = _constrainAsSpaceGroup (phase , sg , scatterers , sgoffset ,
84
86
constrainlat , constrainadps , adpsymbols , isosymbol )
85
87
0 commit comments