643643 Tr_34_34_14 ,
644644 Tr_34_34_34 ,
645645)
646+ from diffpy .utils ._deprecator import build_deprecation_message , deprecated
646647
647648# Import SpaceGroup objects --------------------------------------------------
648-
649+ base = "diffpy.structure"
650+ removal_version = "4.0.0"
651+ GetSpaceGroup_deprecation_msg = build_deprecation_message (
652+ base ,
653+ "GetSpaceGroup" ,
654+ "get_space_group" ,
655+ removal_version ,
656+ )
657+ FindSpaceGroup_deprecation_msg = build_deprecation_message (
658+ base ,
659+ "FindSpaceGroup" ,
660+ "find_space_group" ,
661+ removal_version ,
662+ )
663+ IsSpaceGroupIdentifier_deprecation_msg = build_deprecation_message (
664+ base ,
665+ "IsSpaceGroupIdentifier" ,
666+ "is_space_group_identifier" ,
667+ removal_version ,
668+ )
669+ _hashSymOpList_deprecation_msg = build_deprecation_message (
670+ base ,
671+ "_hashSymOpList" ,
672+ "_hash_symop_list" ,
673+ removal_version ,
674+ )
649675
650676SpaceGroupList = mmLibSpaceGroupList + sgtbxSpaceGroupList
651677
652678
679+ @deprecated (GetSpaceGroup_deprecation_msg )
653680def GetSpaceGroup (sgid ):
681+ """This function has been deprecated and will be removed in version
682+ 4.0.0.
683+
684+ Please use diffpy.structure.get_space_group instead.
685+ """
686+ return get_space_group (sgid )
687+
688+
689+ def get_space_group (sgid ):
654690 """Returns the SpaceGroup instance for the given identifier.
655691
656692 Parameters
@@ -670,7 +706,7 @@ def GetSpaceGroup(sgid):
670706 When the identifier is not found.
671707 """
672708 if not _sg_lookup_table :
673- _buildSGLookupTable ()
709+ _build_sg_lookup_table ()
674710 if sgid in _sg_lookup_table :
675711 return _sg_lookup_table [sgid ]
676712 # Try different versions of sgid, first make sure it is a string
@@ -691,10 +727,22 @@ def GetSpaceGroup(sgid):
691727 raise ValueError (emsg )
692728
693729
730+ @deprecated (IsSpaceGroupIdentifier_deprecation_msg )
694731def IsSpaceGroupIdentifier (sgid ):
695732 """Check if identifier can be used as an argument to
696733 `GetSpaceGroup`.
697734
735+ Returns
736+ -------
737+ bool
738+ """
739+ return is_space_group_identifier (sgid )
740+
741+
742+ def is_space_group_identifier (sgid ):
743+ """Check if identifier can be used as an argument to
744+ `GetSpaceGroup`.
745+
698746 Returns
699747 -------
700748 bool
@@ -707,7 +755,17 @@ def IsSpaceGroupIdentifier(sgid):
707755 return rv
708756
709757
758+ @deprecated (FindSpaceGroup_deprecation_msg )
710759def FindSpaceGroup (symops , shuffle = False ):
760+ """This function has been deprecated and will be removed in version
761+ 4.0.0.
762+
763+ Please use diffpy.structure.find_space_group instead.
764+ """
765+ return find_space_group (symops , shuffle = shuffle )
766+
767+
768+ def find_space_group (symops , shuffle = False ):
711769 """Lookup SpaceGroup from a given list of symmetry operations.
712770
713771 Parameters
@@ -732,8 +790,8 @@ def FindSpaceGroup(symops, shuffle=False):
732790 When `symops` do not match any known SpaceGroup.
733791 """
734792
735- tb = _getSGHashLookupTable ()
736- hh = _hashSymOpList (symops )
793+ tb = _get_sg_hash_lookup_table ()
794+ hh = _hash_symop_list (symops )
737795 if hh not in tb :
738796 raise ValueError ("Cannot find SpaceGroup for the specified symops." )
739797 rv = tb [hh ]
@@ -746,7 +804,17 @@ def FindSpaceGroup(symops, shuffle=False):
746804 return rv
747805
748806
807+ @deprecated (_hashSymOpList_deprecation_msg )
749808def _hashSymOpList (symops ):
809+ """This function has been deprecated and will be removed in version
810+ 4.0.0.
811+
812+ Please use diffpy.structure._hash_symop_list instead.
813+ """
814+ return _hash_symop_list (symops )
815+
816+
817+ def _hash_symop_list (symops ):
750818 """Return hash value for a sequence of `SymOp` objects.
751819
752820 The symops are sorted so the results is independent of symops order.
@@ -766,7 +834,7 @@ def _hashSymOpList(symops):
766834 return rv
767835
768836
769- def _buildSGLookupTable ():
837+ def _build_sg_lookup_table ():
770838 """Rebuild space group lookup table from the `SpaceGroupList` data.
771839
772840 This routine updates the global `_sg_lookup_table` dictionary.
@@ -809,16 +877,16 @@ def _buildSGLookupTable():
809877_sg_lookup_table = {}
810878
811879
812- def _getSGHashLookupTable ():
880+ def _get_sg_hash_lookup_table ():
813881 """Return lookup table of symop hashes to standard `SpaceGroup`
814882 objects."""
815883 if _sg_hash_lookup_table :
816884 return _sg_hash_lookup_table
817885 for sg in SpaceGroupList :
818- h = _hashSymOpList (sg .symop_list )
886+ h = _hash_symop_list (sg .symop_list )
819887 _sg_hash_lookup_table [h ] = sg
820888 assert len (_sg_hash_lookup_table ) == len (SpaceGroupList )
821- return _getSGHashLookupTable ()
889+ return _get_sg_hash_lookup_table ()
822890
823891
824892_sg_hash_lookup_table = {}
0 commit comments