diff --git a/LICENSE_DANSE.rst b/LICENSE_DANSE.rst index 1c0ab5d..96d47ea 100644 --- a/LICENSE_DANSE.rst +++ b/LICENSE_DANSE.rst @@ -14,7 +14,7 @@ For more information please visit the project web-page at http://www.diffpy.org -or email Prof. Simon Billinge at sb2896@columbia.edu. +or email Prof. Simon Billinge at sbillinge@ucsb.edu. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/devutils/tunePeakPrecision.py b/devutils/tunePeakPrecision.py index f9f0683..3499352 100755 --- a/devutils/tunePeakPrecision.py +++ b/devutils/tunePeakPrecision.py @@ -48,7 +48,7 @@ """ nickel = Structure() -nickel.readStr(nickel_discus_data, format="discus") +nickel.read_structure(nickel_discus_data, format="discus") def Gpdffit2(qmax): diff --git a/docs/examples/distanceprinter.py b/docs/examples/distanceprinter.py index 356f112..fd8ab3e 100755 --- a/docs/examples/distanceprinter.py +++ b/docs/examples/distanceprinter.py @@ -39,7 +39,7 @@ def _addPairContribution(self, bnds, sumscale): """ nickel = Structure() -nickel.readStr(nickel_discus_data, format="discus") +nickel.read_structure(nickel_discus_data, format="discus") bucky = Structure(filename="datafiles/C60bucky.stru", format="discus") distprint = DistancePrinter() diff --git a/news/fix-structure-deprecations.rst b/news/fix-structure-deprecations.rst new file mode 100644 index 0000000..5edb391 --- /dev/null +++ b/news/fix-structure-deprecations.rst @@ -0,0 +1,24 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Use ``Lattice.cell_parms`` in place of the deprecated ``Lattice.abcABG`` when converting ``diffpy.structure`` objects to silence deprecation warnings. +* Use ``load_structure``, ``get_parser``, ``parse_file``, ``read_structure``, ``set_latt_parms``, and ``add_new_atom`` in place of the deprecated ``diffpy.structure`` functions in tests, examples, and docstrings. + +**Security:** + +* diff --git a/src/diffpy/srreal/sfaverage.py b/src/diffpy/srreal/sfaverage.py index 3f12e8c..d216e9e 100644 --- a/src/diffpy/srreal/sfaverage.py +++ b/src/diffpy/srreal/sfaverage.py @@ -25,10 +25,10 @@ sfavg1 = SFAverage.fromComposition({'Na' : 1, 'Cl' : 1}, xtb, qa) sfavg2 = SFAverage.fromComposition([('Mn', 1), ('O', 2)], xtb, qa) - from diffpy.structure import loadStructure + from diffpy.structure import load_structure from diffpy.srreal.pdfcalculator import DebyePDFCalculator dpdfc = DebyePDFCalculator() - dpdfc(loadStructure('rutile.cif')) + dpdfc(load_structure('rutile.cif')) sfavg3 = SFAverage.fromStructure(dpdfc.getStructure(), dpdfc.scatteringfactortable, dpdfc.qgrid) """ diff --git a/src/diffpy/srreal/structureconverters.py b/src/diffpy/srreal/structureconverters.py index 834003f..b27513f 100644 --- a/src/diffpy/srreal/structureconverters.py +++ b/src/diffpy/srreal/structureconverters.py @@ -41,7 +41,7 @@ @RegisterStructureAdapter("diffpy.structure.structure.Structure") def convertDiffPyStructure(stru): """Adapt Structure class from diffpy.structure package.""" - haslattice = (1, 1, 1, 90, 90, 90) != stru.lattice.abcABG() + haslattice = (1, 1, 1, 90, 90, 90) != stru.lattice.cell_parms() isperiodic = haslattice hasmeta = _DiffPyStructureMetadata.hasMetadata(stru) if hasmeta: @@ -173,7 +173,7 @@ def _fetchDiffPyStructureData(adpt, stru): aa.uij_cartn = a0.U adpt.append(aa) if hasattr(adpt, "setLatPar"): - adpt.setLatPar(*stru.lattice.abcABG()) + adpt.setLatPar(*stru.lattice.cell_parms()) for aa in adpt: adpt.toCartesian(aa) return diff --git a/tests/test_bvscalculator.py b/tests/test_bvscalculator.py index 6424dc9..742252c 100644 --- a/tests/test_bvscalculator.py +++ b/tests/test_bvscalculator.py @@ -74,7 +74,7 @@ def test_bvrmsdiff(self): # check mixed occupancy rutilemix = self.rutile.copy() for a in self.rutile: - rutilemix.addNewAtom(a) + rutilemix.add_new_atom(a) for a in rutilemix: a.occupancy = 0.5 self.bvc(rutilemix) diff --git a/tests/test_structureadapter.py b/tests/test_structureadapter.py index 6e3cb1e..b1e15e0 100644 --- a/tests/test_structureadapter.py +++ b/tests/test_structureadapter.py @@ -64,7 +64,7 @@ def test_createStructureAdapterTypes(self): self.nickel.pdffit = None adpt1 = createStructureAdapter(self.nickel) self.assertTrue(type(adpt1) is PeriodicStructureAdapter) - self.nickel.lattice.setLatPar(1, 1, 1, 90, 90, 90) + self.nickel.lattice.set_latt_parms(1, 1, 1, 90, 90, 90) adpt2 = createStructureAdapter(self.nickel) self.assertTrue(type(adpt2) is AtomicStructureAdapter) self.nickel.pdffit = dict(scale=1) diff --git a/tests/testutils.py b/tests/testutils.py index 345f09f..8ff5d76 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -14,7 +14,7 @@ PeriodicStructureAdapter, StructureAdapter, ) -from diffpy.structure.parsers import getParser +from diffpy.structure.parsers import get_parser # helper functions @@ -36,7 +36,7 @@ def loadObjCrystCrystal(filename): def loadDiffPyStructure(filename): fullpath = datafile(filename) - stru = mod_structure.loadStructure(fullpath) + stru = mod_structure.load_structure(fullpath) return stru @@ -44,8 +44,8 @@ def loadCrystalStructureAdapter(filename): from diffpy.srreal.structureconverters import _fetchDiffPyStructureData fullpath = datafile(filename) - pcif = getParser("cif") - stru = pcif.parseFile(fullpath) + pcif = get_parser("cif") + stru = pcif.parse_file(fullpath) asu = stru[:0] + pcif.asymmetric_unit adpt = CrystalStructureAdapter() _fetchDiffPyStructureData(adpt, asu)