2222
2323__all__ = ["constrainAsSpaceGroup" ]
2424
25- def constrainAsSpaceGroup (phase , sgsymbol , scatterers = None ,
25+ def constrainAsSpaceGroup (phase , spacegroup , scatterers = None ,
2626 sgoffset = [0 , 0 , 0 ], constrainlat = True , constrainadps = True ,
2727 adpsymbols = None , isosymbol = "Uiso" ):
2828 """Constrain the structure to the space group.
@@ -33,8 +33,8 @@ def constrainAsSpaceGroup(phase, sgsymbol, scatterers = None,
3333
3434 Arguments:
3535 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 .
3838 sgoffset -- Optional offset for sg origin (default [0, 0, 0]).
3939 scatterers -- The scatterer ParameterSets to constrain. If scatterers
4040 is None (default), then all scatterers accessible from
@@ -77,9 +77,11 @@ def constrainAsSpaceGroup(phase, sgsymbol, scatterers = None,
7777
7878 """
7979
80- from diffpy .Structure .SpaceGroups import GetSpaceGroup
80+ from diffpy .Structure .SpaceGroups import GetSpaceGroup , SpaceGroup
8181
82- sg = GetSpaceGroup (sgsymbol )
82+ sg = spacegroup
83+ if not isinstance (spacegroup , SpaceGroup ):
84+ sg = GetSpaceGroup (spacegroup )
8385 sgp = _constrainAsSpaceGroup (phase , sg , scatterers , sgoffset ,
8486 constrainlat , constrainadps , adpsymbols , isosymbol )
8587
0 commit comments