Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: use non-deprecated diffpy.structure APIs
Replace calls that diffpy.structure has deprecated for removal in 4.0.0
with their snake_case equivalents: GetSpaceGroup -> get_space_group,
positionFormulas -> position_formulas, UFormulas -> u_formulas,
IsSpaceGroupIdentifier -> is_space_group_identifier and, in the tests,
Lattice.setLatPar -> set_latt_parms. All of these exist in
diffpy.structure 3.4.0 and later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
  • Loading branch information
cadenmyers13 and claude committed Oct 7, 2026
commit d77495052cd84d2c9224ad2729367964345a3b97
8 changes: 4 additions & 4 deletions src/diffpy/cmistructure/objcrystparset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,17 +1919,17 @@ def _create_space_group(sgobjcryst):
"""
import copy

from diffpy.structure.spacegroups import GetSpaceGroup, SymOp
from diffpy.structure.spacegroups import SymOp, get_space_group

name = sgobjcryst.GetName()
extnstr = ":%s" % sgobjcryst.GetExtension()
if name.endswith(extnstr):
name = name[: -len(extnstr)]

# Get whatever spacegroup we can get by name. This will set the proper
# crystal system. Creating a copy of the singleton from GetSpaceGroup,
# as this function messes with sg.symop_list.
space_group = copy.copy(GetSpaceGroup(name))
# crystal system. Creating a copy of the singleton from
# get_space_group, as this function messes with symop_list.
space_group = copy.copy(get_space_group(name))

# Replace the symmetry operations to guarantee that we get it right.
symops = sgobjcryst.GetSymmetryOperations()
Expand Down
8 changes: 4 additions & 4 deletions src/diffpy/cmistructure/sgconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ def constrain_as_space_group(
b and c are constrained to a, and alpha, beta and gamma are fixed
to 90.
"""
from diffpy.structure.spacegroups import GetSpaceGroup, SpaceGroup
from diffpy.structure.spacegroups import SpaceGroup, get_space_group

space_group = spacegroup
if not isinstance(spacegroup, SpaceGroup):
space_group = GetSpaceGroup(spacegroup)
space_group = get_space_group(spacegroup)
sgp = _constrain_as_space_group(
phase,
space_group,
Expand Down Expand Up @@ -494,7 +494,7 @@ def _constrain_xyzs(self, positions):
self._xyz_parameters.add_parameter(newpar)

# Constrain non-free xyz parameters
fpos = g.positionFormulas(xyznames)
fpos = g.position_formulas(xyznames)
for index, tmp in enumerate(zip(scatterers, fpos)):
scatterer, fp = tmp

Expand Down Expand Up @@ -599,7 +599,7 @@ def _constrain_adps(self, positions):
isosymbol, isoname, params=self._parameters
)

fadp = g.UFormulas(adpnames)
fadp = g.u_formulas(adpnames)

# Constrain dependent anisotropics. We use the fact that an
# anisotropic cannot be dependent on an isotropic.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_diffpyparset.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _testLattice():
a1.xyz[1] = 0.123
a1.U11 = 0.321
a1.B32 = 0.111
dsstru.lattice.setLatPar(a=3.0, gamma=121)
dsstru.lattice.set_latt_parms(a=3.0, gamma=121)
_testAtoms()
_testLattice()

Expand Down
4 changes: 2 additions & 2 deletions tests/test_objcrystparset.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,8 @@ def xtestCreateSpaceGroup(self):
for smbls in sgtbx.space_group_symbol_iterator():
shn = smbls.hermann_mauguin()
short_name = shn.replace(" ", "")
if spacegroups.IsSpaceGroupIdentifier(short_name):
space_group = spacegroups.GetSpaceGroup(shn)
if spacegroups.is_space_group_identifier(short_name):
space_group = spacegroups.get_space_group(shn)
sgnew = self.getObjCrystParSetSpaceGroup(space_group)
actual_equivalent = self.sgsEquivalent(space_group, sgnew)
expected_equivalent = True
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sgconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ def test_constrain_as_space_group_args(datafile):
function."""
from diffpy.cmistructure.diffpyparset import DiffpyStructureParSet
from diffpy.cmistructure.sgconstraints import constrain_as_space_group
from diffpy.structure.spacegroups import GetSpaceGroup
from diffpy.structure.spacegroups import get_space_group

# C1: The space group is given as a symbol or as a SpaceGroup object.
# Expected: Both create the same space group Parameters.
structure = makeLaMnO3_P1(datafile)
parameter_set = DiffpyStructureParSet("LaMnO3", structure)
symbol_parameters = constrain_as_space_group(parameter_set, "P b n m")
space_group = GetSpaceGroup("P b n m")
space_group = get_space_group("P b n m")
object_parameter_set = DiffpyStructureParSet(
"LMO", makeLaMnO3_P1(datafile)
)
Expand Down
Loading