diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml deleted file mode 100644 index 235c9f71..00000000 --- a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: CI - -on: - push: - branches: - - main - release: - types: - - prereleased - - published - workflow_dispatch: - -jobs: - matrix-coverage: - uses: scikit-package/release-scripts/.github/workflows/_matrix-and-codecov-on-merge-to-main.yml@v0 - with: - project: diffpy.structure - c_extension: false - headless: false - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-docs-on-release.yml b/.github/workflows/publish-docs-on-release.yml deleted file mode 100644 index 461e8ac3..00000000 --- a/.github/workflows/publish-docs-on-release.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Deploy Documentation on Release - -on: - workflow_dispatch: - -jobs: - docs: - uses: scikit-package/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 - with: - project: diffpy.structure - c_extension: false - headless: false diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 66a1a4b8..9a35bf76 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,227 @@ Release notes .. current developments +3.4.0 +===== + +**Added:** + +* Added ``set_latt_parms`` method into ``Lattice`` class +* Added ``set_new_latt_base_vec`` method into ``Lattice`` class +* Added ``parse_lines`` method in ``p_auto.py`` +* Added ``parse_lines`` method in ``p_cif.py`` +* Added ``parse_lines`` method in ``p_discus.py`` +* Added ``parse_lines`` method in ``p_pdb.py`` +* Added ``parse_lines`` method in ``p_pdffit.py`` +* Added ``parse_lines`` method in ``p_rawxyz.py`` +* Added ``parse_lines`` method in ``p_xcfg.py`` +* Added ``parse_lines`` method in ``p_xyz.py`` +* Added ``parse_lines`` method in ``structureparser.py`` +* Added ``_suppress_cif_parser_output`` method in ``p_cif.py`` +* Add deprecation warning for ``diffpy.Structure`` import. +* Added `diffpy.structure.Structure.add_new_atom` in replace of `addNewAtom` +* Added ``load_structure_file`` method in ``apps/anyeye.py`` +* Added ``convert_structure_file`` method in ``apps/anyeye.py`` +* Added ``watch_structure_file`` method in ``apps/anyeye.py`` +* Added ``clean_up`` method in ``apps/anyeye.py`` +* Added ``parse_formula`` method in ``apps/anyeye.py`` +* Added ``signal_handler`` method in ``apps/anyeye.py`` +* Added method ``load_structure`` in ``__init__.py`` +* Added `diffpy.structure.Structure.assign_unique_labels` in replace of `assignUniqueLabels` +* Support for Python 3.14 +* Added ``place_in_lattice`` method to ``Structure`` +* Added ``read_structure`` method to ``Structure`` +* Added ``write_structure`` method to ``Structure`` +* Added ``position_formula`` method in ``GeneratorSite`` class +* Added ``u_formula`` method in ``GeneratorSite`` class +* Added ``eq_index`` method in ``GeneratorSite`` class +* Added ``prune_formula_dictionary`` method in ``symmetryutilities.py`` +* Added ``_link_atom_attribute`` method in ``diffpy.structure.utils`` +* Added ``msd_latt`` method in ``atom.py`` +* Added ``msd_cart`` method in ``atom.py`` +* Added ``_get_uij`` method in ``atom.py`` +* Added ``_set_uij`` method in ``atom.py`` +* Added ``parse_file`` method in ``structureparser.py`` +* Added ``parse_lines`` method in ``p_cif.py`` +* Added ``parse_lines`` method in ``p_auto.py`` +* Added parser for vesta specific files and viewer for vesta +* Added ``atom_bare_symbol`` method in ``utils.py`` +* Added ``_get_ordered_formats`` method in ``p_auto.py`` +* Added ``_wrap_parse_method`` method in ``p_auto.py`` +* Added ``_tr_atom_site_u_iso_or_equiv`` method in ``p_cif.py`` +* Added ``_tr_atom_site_b_iso_or_equiv`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_11`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_22`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_33`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_12`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_13`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_u_23`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_11`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_22`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_33`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_12`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_13`` method in ``p_cif.py`` +* Added ``_tr_atom_site_aniso_b_23`` method in ``p_cif.py`` +* Added ``get_symop`` method in ``parsers/p_cif.py`` +* Added ``get_space_group`` method in ``spacegroups.py`` +* Added ``find_space_group`` method in ``spacegroups.py`` +* Added ``is_space_group_identifier`` method in ``spacegroups.py`` +* Added ``_hash_symop_list`` method in ``spacegroups.py`` +* Added ``_build_sg_lookup_table`` method in ``spacegroups.py`` +* Added ``_get_sg_hash_lookup_table`` method in ``spacegroups.py`` +* Added ``read_structure`` method into ``PDFFitStructure`` class +* Added ``cell_parms`` method into ``Lattice`` class +* Added ``_find_constraints`` method in ``SymmetryConstraints`` class +* Added ``pos_parm_symbols`` method in ``SymmetryConstraints`` class +* Added ``pos_parm_values`` method in ``SymmetryConstraints`` class +* Added ``u_parm_symbols`` method in ``SymmetryConstraints`` class +* Added ``u_parm_values`` method in ``SymmetryConstraints`` class +* Added ``u_formulas`` method in ``SymmetryConstraints`` class +* Added `diffpy.structure.Structure.get_last_atom` in replace of `getLastAtom` +* Added ``get_parser`` method in ``p_auto.py`` +* Added ``get_parser`` method in ``p_cif.py`` +* Added ``get_parser`` method in ``p_discus.py`` +* Added ``get_parser`` method in ``p_pdb.py`` +* Added ``get_parser`` method in ``p_pdffit.py`` +* Added ``get_parser`` method in ``p_rawxyz.py`` +* Added ``get_parser`` method in ``p_xcfg.py`` +* Added ``get_parser`` method in ``p_xyz.py`` +* Added ``get_parser`` method in ``parsers/__init__.py`` +* Added ``position_formulas`` method in ``SymmetryConstraints`` class +* Added ``position_formulas_pruned`` method in ``SymmetryConstraints`` class +* Added ``u_formulas_pruned`` method in ``SymmetryConstraints`` class +* Added ``_parse_cif_data_source`` method in ``p_cif.py`` +* Added ``_parse_cif_block`` method in ``p_cif.py`` +* Added ``to_lines`` method in ``p_cif.py`` +* Added ``to_lines`` method in ``p_pdb.py`` +* Added ``to_lines`` method in ``p_rawxyz.py`` +* Added ``to_lines`` method in ``p_xcfg.py`` +* Added ``to_lines`` method in ``p_xyz.py`` +* Added ``to_lines`` method in ``structureparser.py`` +* Added ``_lines_iterator`` method in ``p_discus.py`` +* Added ``to_lines`` method in ``p_discus.py`` +* Added ``is_space_group_latt_parms`` method in ``symmetryutilities.py`` +* Added ``is_constant_formula`` method in ``symmetryutilities.py`` +* Added ``find_center`` method in ``expansion/shapeutils.py`` +* Added ``make_sphere`` method in ``expansion/makeellipsoid.py`` +* Added ``make_ellipsoid`` method in ``expansion/makeellipsoid.py`` +* Added ``position_difference`` method in ``symmetryutilities.py`` +* Added ``nearest_site_index`` method in ``symmetryutilities.py`` +* Added ``_find_invariants`` method in ``symmetryutilities.py`` +* Added ``equal_positions`` method in ``symmetryutilities.py`` +* Added ``expand_position`` method in ``symmetryutilities.py`` +* Added ``null_space`` method in ``symmetryutilities.py`` +* Added ``input_formats`` method in ``parsers/__init__.py`` +* Added ``output_formats`` method in ``parsers/__init__.py`` +* Added ``title_lines`` method in ``p_pdb.py`` +* Added ``cryst1_lines`` method in ``p_pdb.py`` +* Added ``atom_lines`` method in ``p_pdb.py`` +* Added ``convert_fp_num_to_signed_rational`` method in ``GeneratorSite`` class +* Added ``_find_null_space`` method in ``GeneratorSite`` class +* Added ``_find_pos_parameters`` method in ``GeneratorSite`` class +* Added ``_find_u_space`` method in ``GeneratorSite`` class +* Added ``_find_u_parameters`` method in ``GeneratorSite`` class +* Added ``_find_eq_uij`` method in ``GeneratorSite`` class + +**Changed:** + +* Changed private method ``__emptySharedStructure`` to ``__empty_shared_structure`` + +**Deprecated:** + +* Deprecated ``setLatPar`` method in ``Lattice`` class for removal in version 4.0.0 +* Deprecated ``setLatBase`` method in ``Lattice`` class for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_auto.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_cif.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_discus.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_pdffit.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_rawxyz.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_xcfg.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``p_xyz.py`` for removal in version 4.0.0 +* Deprecated ``parseLines`` method in ``structureparser.py`` for removal in version 4.0.0 +* Deprecated `diffpy.structure.Structure.addNewAtom` method for removal in version 4.0.0 +* Deprecated ``loadStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated ``convertStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated ``watchStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated ``cleanUp`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated ``parseFormula`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated ``signalHandler`` method in ``apps/anyeye.py`` for removal in version 4.0.0 +* Deprecated method ``loadStructure`` in ``__init__.py`` for removal in version 4.0.0 +* Deprecated `diffpy.structure.Structure.assignUniqueLabels` for removal in 4.0.0 +* Deprecated ``placeInLattice`` method of ``Structure`` for removal in version 4.0.0 +* Deprecated ``readStr`` method of ``Structure`` for removal in version 4.0.0 +* Deprecated ``writeStr`` method of ``Structure`` for removal in version 4.0.0 +* Deprecated ``positionFormula`` method in ``GeneratorSite`` class for removal in version 4.0.0 +* Deprecated ``UFormula`` method in ``GeneratorSite`` class for removal in version 4.0.0 +* Deprecated ``eqIndex`` method in ``GeneratorSite`` class for removal in version 4.0.0 +* Deprecated ``pruneFormulaDictionary`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Derecated ``_linkAtomAttribute`` method in ``diffpy.structure.utils`` for removal in version 4.0.0 +* Deprecated ``msdLat`` method in ``atom.py`` for removal in version 4.0.0 +* Deprecated ``msdCart`` method in ``atom.py`` for removal in version 4.0.0 +* Deprecated ``parse_file`` method in ``structureparser.py`` for removal in version 4.0.0 +* Deprecated ``parse_file`` method in ``p_cif.py`` for removal in version 4.0.0 +* Deprecated ``parse_file`` method in ``p_auto.py`` for removal in version 4.0.0 +* Deprecated ``atomBareSymbol`` method in ``utils.py`` for removal in version 4.0.0 +* Deprecated ``getSymOp`` method in ``parsers/p_cif.py`` for removal in version 4.0.0 +* Deprecated ``GetSpaceGroup`` method in ``spacegroups.py`` for removal in version 4.0.0 +* Deprecated ``IsSpaceGroupIdentifier`` method in ``spacegroups.py`` for removal in version 4.0.0 +* Deprecated ``FindSpaceGroup`` method in ``spacegroups.py`` for removal in version 4.0.0 +* Deprecated ``_hashSymOpList`` method in ``spacegroups.py`` for removal in version 4.0.0 +* Deprecated ``readStr`` method in ``PDFFitStructure`` class for removal in version 4.0.0 +* Deprecated ``abcABG`` method in ``Lattice`` class for removal in version 4.0.0 +* Deprecated ``posparSymbols`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``posparValues`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``UparSymbols`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``UparValues`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``UFormulas`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated `diffpy.structure.Structure.getLastAtom` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_auto.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_cif.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_discus.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_pdffit.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_rawxyz.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_xcfg.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``p_xyz.py`` for removal in version 4.0.0 +* Deprecated ``getParser`` method in ``parsers/__init__.py`` for removal in version 4.0.0 +* Deprecated ``positionFormulas`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``positionFormulasPruned`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``UFormulasPruned`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_cif.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_rawxyz.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_xcfg.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_xyz.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``structureparser.py`` for removal in version 4.0.0 +* Deprecated ``toLines`` method in ``p_discus.py`` for removal in version 4.0.0 +* Deprecated ``isSpaceGroupLatPar`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``isconstantFormula`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``findCenter`` method in ``expansion/shapeutils.py`` for removal in version 4.0.0 +* Deprecated ``makeSphere`` method in ``expansion/makeellipsoid.py`` for removal in version 4.0.0 +* Deprecated ``makeEllipsoid`` method in ``expansion/makeellipsoid.py`` for removal in version 4.0.0 +* Deprecated ``positionDifference`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``nearestSiteIndex`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``equalPositions`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``expandPosition`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``nullSpace`` method in ``symmetryutilities.py`` for removal in version 4.0.0 +* Deprecated ``inputFormats`` method in ``parsers/__init__.py`` for removal in version 4.0.0 +* Deprecated ``outputFormats`` method in ``parsers/__init__.py`` for removal in version 4.0.0 +* Deprecated ``titleLines`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``crystl1Lines`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``atomLines`` method in ``p_pdb.py`` for removal in version 4.0.0 +* Deprecated ``signedRatStr`` method in in ``GeneratorSite`` class for removal in version 4.0.0 + +**Fixed:** + +* Fixed ``load_structure`` with successfully loading `Path` object +* Fix deprecation for open file for Python 3.14 + +**Removed:** + +* Support for Python 3.11 + + 3.3.1 ===== diff --git a/LICENSE-DANSE.rst b/LICENSE-DANSE.rst index d56af619..a650d915 100644 --- a/LICENSE-DANSE.rst +++ b/LICENSE-DANSE.rst @@ -9,14 +9,11 @@ Copyright 2006-2007, Board of Trustees of Michigan State University, Copyright 2008-2012, The Trustees of Columbia University in the City of New York. (Copyright holder indicated in each source file). -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. -All rights reserved. - For more information please visit the project web-page: 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 diff --git a/LICENSE.rst b/LICENSE.rst index 1f91b0ba..c967838d 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -18,6 +18,9 @@ Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Labo Copyright (c) 2024-2025, The Trustees of Columbia University in the City of New York. All rights reserved. +Copyright (c) 2026-present, The Contributors to the diffpy.structure project. +All rights reserved. + The "DiffPy-CMI" is distributed subject to the following license conditions: .. code-block:: text diff --git a/README.rst b/README.rst index c1059381..3ce08dfa 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,8 @@ .. |Black| image:: https://img.shields.io/badge/code_style-black-black :target: https://github.com/psf/black -.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov-on-merge-to-main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov-on-merge-to-main.yml +.. |CI| image:: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml/badge.svg + :target: https://github.com/diffpy/diffpy.structure/actions/workflows/matrix-and-codecov.yml .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.structure/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.structure diff --git a/docs/source/api/diffpy.structure.apps.rst b/docs/source/api/diffpy.structure.apps.rst index 8b91adf5..3986ab73 100644 --- a/docs/source/api/diffpy.structure.apps.rst +++ b/docs/source/api/diffpy.structure.apps.rst @@ -26,3 +26,11 @@ diffpy.structure.apps.anyeye module :members: :undoc-members: :show-inheritance: + +diffpy.structure.apps.vesta_viewer module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.apps.vesta_viewer + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/api/diffpy.structure.parsers.rst b/docs/source/api/diffpy.structure.parsers.rst index 74a27bcb..8a5e9476 100644 --- a/docs/source/api/diffpy.structure.parsers.rst +++ b/docs/source/api/diffpy.structure.parsers.rst @@ -83,6 +83,14 @@ diffpy.structure.parsers.p_discus module :undoc-members: :show-inheritance: +diffpy.structure.parsers.p_vesta module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.parsers.p_vesta + :members: + :undoc-members: + :show-inheritance: + diffpy.structure.parsers.p_xyz module ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/source/api/diffpy.structure.rst b/docs/source/api/diffpy.structure.rst index d6ffb2ad..7807ec06 100644 --- a/docs/source/api/diffpy.structure.rst +++ b/docs/source/api/diffpy.structure.rst @@ -1,9 +1,7 @@ :tocdepth: -1 -|title| -======= - -.. |title| replace:: diffpy.structure package +diffpy.structure package +======================== .. automodule:: diffpy.structure :members: @@ -23,6 +21,14 @@ Subpackages Submodules ---------- +diffpy.structure.structure_app module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.structure_app + :members: + :undoc-members: + :show-inheritance: + diffpy.structure.spacegroups module ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/source/conf.py b/docs/source/conf.py index 960f8fbb..e3c1fd99 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ fullversion = version("diffpy.structure") except Exception: fullversion = "No version found. The correct version will appear in the released version." # noqa: E501 - +autodoc_mock_imports = ["diffpy.utils"] # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use Path().resolve() to make it absolute, like shown here. # noqa: E501 diff --git a/docs/source/license.rst b/docs/source/license.rst index 00315fc7..e4c7e6c5 100644 --- a/docs/source/license.rst +++ b/docs/source/license.rst @@ -25,6 +25,9 @@ Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Labo Copyright (c) 2024-2025, The Trustees of Columbia University in the City of New York. All rights reserved. +Copyright (c) 2026-present, The Contributors to the diffpy.structure project. +All rights reserved. + The "DiffPy-CMI" is distributed subject to the following license conditions: .. code-block:: text diff --git a/news/fix-deprecation.rst b/news/CI-badge-fix.rst similarity index 74% rename from news/fix-deprecation.rst rename to news/CI-badge-fix.rst index 5be83709..2df63a8f 100644 --- a/news/fix-deprecation.rst +++ b/news/CI-badge-fix.rst @@ -1,6 +1,6 @@ **Added:** -* +* No News Added: fix CI badge and target in README.rst **Changed:** @@ -16,7 +16,7 @@ **Fixed:** -* Fix deprecation for open file for Python 3.14 +* **Security:** diff --git a/news/add-devutils-readme.rst b/news/add-devutils-readme.rst deleted file mode 100644 index 9cf9b8b6..00000000 --- a/news/add-devutils-readme.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* No news added: add devutils readme - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/ase-adapter.rst b/news/ase-adapter.rst new file mode 100644 index 00000000..30b585bd --- /dev/null +++ b/news/ase-adapter.rst @@ -0,0 +1,30 @@ +**Added:** + +* Added ``Structure.get_lattice_vectors()`` method to return the lattice vectors. +* Added ``Structure.get_lattice_vector_angles()`` method to return the angles between the lattice vectors. +* Added ``Structure.get_isotropic_displacement_parameters()`` method to return the isotropic displacement parameters. +* Added ``Structure.get_anisotropic_displacement_parameters()`` method to return the anisotropic displacement parameters. +* Added ``Structure.get_occupancies()`` method to return the occupancies of the sites. +* Added ``Structure.get_cartesian_coordinates()`` method to return the Cartesian coordinates of the sites. +* Added ``Structure.get_fractional_coordinates()`` method to return the fractional coordinates of the sites. +* Added ``Structure.get_chemical_symbols()`` method to return the chemical symbols of the sites. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/news/assignUniqueLabels-deprecation.rst b/news/assignUniqueLabels-deprecation.rst deleted file mode 100644 index 76b16072..00000000 --- a/news/assignUniqueLabels-deprecation.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* No news added: add deprecation message for `assignUniqueLabels` - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/change-utility-script.rst b/news/change-utility-script.rst deleted file mode 100644 index 04546e44..00000000 --- a/news/change-utility-script.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* No news added: Change any utility scripts that outside of package distribution method to snake_cae method - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/dep-warning1.rst b/news/dep-warning1.rst deleted file mode 100644 index bd4b2fbd..00000000 --- a/news/dep-warning1.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Add deprecation warning for ``diffpy.Structure`` import. - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-addNewItem.rst b/news/deprecate-addNewItem.rst deleted file mode 100644 index 922d41c9..00000000 --- a/news/deprecate-addNewItem.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added `diffpy.structure.Structure.add_new_atom` in replace of `addNewAtom` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated `diffpy.structure.Structure.addNewAtom` method for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-apps.rst b/news/deprecate-apps.rst deleted file mode 100644 index f9ebb7af..00000000 --- a/news/deprecate-apps.rst +++ /dev/null @@ -1,33 +0,0 @@ -**Added:** - -* Added ``load_structure_file`` method in ``apps/anyeye.py`` -* Added ``convert_structure_file`` method in ``apps/anyeye.py`` -* Added ``watch_structure_file`` method in ``apps/anyeye.py`` -* Added ``clean_up`` method in ``apps/anyeye.py`` -* Added ``parse_formula`` method in ``apps/anyeye.py`` -* Added ``signal_handler`` method in ``apps/anyeye.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``loadStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 -* Deprecated ``convertStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 -* Deprecated ``watchStructureFile`` method in ``apps/anyeye.py`` for removal in version 4.0.0 -* Deprecated ``cleanUp`` method in ``apps/anyeye.py`` for removal in version 4.0.0 -* Deprecated ``parseFormula`` method in ``apps/anyeye.py`` for removal in version 4.0.0 -* Deprecated ``signalHandler`` method in ``apps/anyeye.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-assignUniqueLabels.rst b/news/deprecate-assignUniqueLabels.rst deleted file mode 100644 index cf07ff63..00000000 --- a/news/deprecate-assignUniqueLabels.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added `diffpy.structure.Structure.assign_unique_labels` in replace of `assignUniqueLabels` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated `diffpy.structure.Structure.assignUniqueLabels` for removal in 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-atom.rst b/news/deprecate-atom.rst deleted file mode 100644 index 2ddd8b79..00000000 --- a/news/deprecate-atom.rst +++ /dev/null @@ -1,28 +0,0 @@ -**Added:** - -* Added ``msd_latt`` method in ``atom.py`` -* Added ``msd_cart`` method in ``atom.py`` -* Added ``_get_uij`` method in ``atom.py`` -* Added ``_set_uij`` method in ``atom.py`` - - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``msdLat`` method in ``atom.py`` for removal in version 4.0.0 -* Deprecated ``msdCart`` method in ``atom.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-expansion-utilities-1.rst b/news/deprecate-expansion-utilities-1.rst deleted file mode 100644 index ba3c4b6a..00000000 --- a/news/deprecate-expansion-utilities-1.rst +++ /dev/null @@ -1,27 +0,0 @@ -**Added:** - -* Added ``find_center`` method in ``expansion/shapeutils.py`` -* Added ``make_sphere`` method in ``expansion/makeellipsoid.py`` -* Added ``make_ellipsoid`` method in ``expansion/makeellipsoid.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``findCenter`` method in ``expansion/shapeutils.py`` for removal in version 4.0.0 -* Deprecated ``makeSphere`` method in ``expansion/makeellipsoid.py`` for removal in version 4.0.0 -* Deprecated ``makeEllipsoid`` method in ``expansion/makeellipsoid.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-getLastAtom.rst b/news/deprecate-getLastAtom.rst deleted file mode 100644 index 9f2824ad..00000000 --- a/news/deprecate-getLastAtom.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added `diffpy.structure.Structure.get_last_atom` in replace of `getLastAtom` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated `diffpy.structure.Structure.getLastAtom` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-getParser.rst b/news/deprecate-getParser.rst deleted file mode 100644 index 99e3f33d..00000000 --- a/news/deprecate-getParser.rst +++ /dev/null @@ -1,39 +0,0 @@ -**Added:** - -* Added ``get_parser`` method in ``p_auto.py`` -* Added ``get_parser`` method in ``p_cif.py`` -* Added ``get_parser`` method in ``p_discus.py`` -* Added ``get_parser`` method in ``p_pdb.py`` -* Added ``get_parser`` method in ``p_pdffit.py`` -* Added ``get_parser`` method in ``p_rawxyz.py`` -* Added ``get_parser`` method in ``p_xcfg.py`` -* Added ``get_parser`` method in ``p_xyz.py`` -* Added ``get_parser`` method in ``parsers/__init__.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``getParser`` method in ``p_auto.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_cif.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_discus.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_pdb.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_pdffit.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_rawxyz.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_xcfg.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``p_xyz.py`` for removal in version 4.0.0 -* Deprecated ``getParser`` method in ``parsers/__init__.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-lattice-readstr-method.rst b/news/deprecate-lattice-readstr-method.rst deleted file mode 100644 index 31ff9ff4..00000000 --- a/news/deprecate-lattice-readstr-method.rst +++ /dev/null @@ -1,25 +0,0 @@ -**Added:** - -* Added ``read_structure`` method into ``PDFFitStructure`` class -* Added ``cell_parms`` method into ``Lattice`` class - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``readStr`` method in ``PDFFitStructure`` class for removal in version 4.0.0 -* Deprecated ``abcABG`` method in ``Lattice`` class for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-lattice.rst b/news/deprecate-lattice.rst deleted file mode 100644 index d3ef5438..00000000 --- a/news/deprecate-lattice.rst +++ /dev/null @@ -1,25 +0,0 @@ -**Added:** - -* Added ``set_latt_parms`` method into ``Lattice`` class -* Added ``set_new_latt_base_vec`` method into ``Lattice`` class - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``setLatPar`` method in ``Lattice`` class for removal in version 4.0.0 -* Deprecated ``setLatBase`` method in ``Lattice`` class for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-parsefile.rst b/news/deprecate-parsefile.rst deleted file mode 100644 index 855b4bb2..00000000 --- a/news/deprecate-parsefile.rst +++ /dev/null @@ -1,27 +0,0 @@ -**Added:** - -* Added ``parse_file`` method in ``structureparser.py`` -* Added ``parse_lines`` method in ``p_cif.py`` -* Added ``parse_lines`` method in ``p_auto.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``parse_file`` method in ``structureparser.py`` for removal in version 4.0.0 -* Deprecated ``parse_file`` method in ``p_cif.py`` for removal in version 4.0.0 -* Deprecated ``parse_file`` method in ``p_auto.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-parser-1.rst b/news/deprecate-parser-1.rst deleted file mode 100644 index f6d7b3ff..00000000 --- a/news/deprecate-parser-1.rst +++ /dev/null @@ -1,40 +0,0 @@ -**Added:** - -* Added ``parse_lines`` method in ``p_auto.py`` -* Added ``parse_lines`` method in ``p_cif.py`` -* Added ``parse_lines`` method in ``p_discus.py`` -* Added ``parse_lines`` method in ``p_pdb.py`` -* Added ``parse_lines`` method in ``p_pdffit.py`` -* Added ``parse_lines`` method in ``p_rawxyz.py`` -* Added ``parse_lines`` method in ``p_xcfg.py`` -* Added ``parse_lines`` method in ``p_xyz.py`` -* Added ``parse_lines`` method in ``structureparser.py`` -* Added ``_suppress_cif_parser_output`` method in ``p_cif.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``parseLines`` method in ``p_auto.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_cif.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_discus.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_pdb.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_pdffit.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_rawxyz.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_xcfg.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``p_xyz.py`` for removal in version 4.0.0 -* Deprecated ``parseLines`` method in ``structureparser.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-parser-display.rst b/news/deprecate-parser-display.rst deleted file mode 100644 index 4aaa4e08..00000000 --- a/news/deprecate-parser-display.rst +++ /dev/null @@ -1,31 +0,0 @@ -**Added:** - -* Added ``input_formats`` method in ``parsers/__init__.py`` -* Added ``output_formats`` method in ``parsers/__init__.py`` -* Added ``title_lines`` method in ``p_pdb.py`` -* Added ``cryst1_lines`` method in ``p_pdb.py`` -* Added ``atom_lines`` method in ``p_pdb.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``inputFormats`` method in ``parsers/__init__.py`` for removal in version 4.0.0 -* Deprecated ``outputFormats`` method in ``parsers/__init__.py`` for removal in version 4.0.0 -* Deprecated ``titleLines`` method in ``p_pdb.py`` for removal in version 4.0.0 -* Deprecated ``crystl1Lines`` method in ``p_pdb.py`` for removal in version 4.0.0 -* Deprecated ``atomLines`` method in ``p_pdb.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-private-linkatom.rst b/news/deprecate-private-linkatom.rst deleted file mode 100644 index 860f7b08..00000000 --- a/news/deprecate-private-linkatom.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added ``_link_atom_attribute`` method in ``diffpy.structure.utils`` - -**Changed:** - -* - -**Deprecated:** - -* Derecated ``_linkAtomAttribute`` method in ``diffpy.structure.utils`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-spacegroup.rst b/news/deprecate-spacegroup.rst deleted file mode 100644 index 902e4fdb..00000000 --- a/news/deprecate-spacegroup.rst +++ /dev/null @@ -1,33 +0,0 @@ -**Added:** - -* Added ``get_symop`` method in ``parsers/p_cif.py`` -* Added ``get_space_group`` method in ``spacegroups.py`` -* Added ``find_space_group`` method in ``spacegroups.py`` -* Added ``is_space_group_identifier`` method in ``spacegroups.py`` -* Added ``_hash_symop_list`` method in ``spacegroups.py`` -* Added ``_build_sg_lookup_table`` method in ``spacegroups.py`` -* Added ``_get_sg_hash_lookup_table`` method in ``spacegroups.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``getSymOp`` method in ``parsers/p_cif.py`` for removal in version 4.0.0 -* Deprecated ``GetSpaceGroup`` method in ``spacegroups.py`` for removal in version 4.0.0 -* Deprecated ``IsSpaceGroupIdentifier`` method in ``spacegroups.py`` for removal in version 4.0.0 -* Deprecated ``FindSpaceGroup`` method in ``spacegroups.py`` for removal in version 4.0.0 -* Deprecated ``_hashSymOpList`` method in ``spacegroups.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-structure-function.rst b/news/deprecate-structure-function.rst deleted file mode 100644 index 73071f43..00000000 --- a/news/deprecate-structure-function.rst +++ /dev/null @@ -1,27 +0,0 @@ -**Added:** - -* Added ``place_in_lattice`` method to ``Structure`` -* Added ``read_structure`` method to ``Structure`` -* Added ``write_structure`` method to ``Structure`` - -**Changed:** - -* Changed private method ``__emptySharedStructure`` to ``__empty_shared_structure`` - -**Deprecated:** - -* Deprecated ``placeInLattice`` method of ``Structure`` for removal in version 4.0.0 -* Deprecated ``readStr`` method of ``Structure`` for removal in version 4.0.0 -* Deprecated ``writeStr`` method of ``Structure`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-1.rst b/news/deprecate-symmetryutilities-1.rst deleted file mode 100644 index 36cde7fa..00000000 --- a/news/deprecate-symmetryutilities-1.rst +++ /dev/null @@ -1,25 +0,0 @@ -**Added:** - -* Added ``is_space_group_latt_parms`` method in ``symmetryutilities.py`` -* Added ``is_constant_formula`` method in ``symmetryutilities.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``isSpaceGroupLatPar`` method in ``symmetryutilities.py`` for removal in version 4.0.0 -* Deprecated ``isconstantFormula`` method in ``symmetryutilities.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-2.rst b/news/deprecate-symmetryutilities-2.rst deleted file mode 100644 index 4e2d5abe..00000000 --- a/news/deprecate-symmetryutilities-2.rst +++ /dev/null @@ -1,26 +0,0 @@ -**Added:** - -* Added ``position_difference`` method in ``symmetryutilities.py`` -* Added ``nearest_site_index`` method in ``symmetryutilities.py`` -* Added ``_find_invariants`` method in ``symmetryutilities.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``positionDifference`` method in ``symmetryutilities.py`` for removal in version 4.0.0 -* Deprecated ``nearestSiteIndex`` method in ``symmetryutilities.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-3.rst b/news/deprecate-symmetryutilities-3.rst deleted file mode 100644 index 0527f8ba..00000000 --- a/news/deprecate-symmetryutilities-3.rst +++ /dev/null @@ -1,27 +0,0 @@ -**Added:** - -* Added ``equal_positions`` method in ``symmetryutilities.py`` -* Added ``expand_position`` method in ``symmetryutilities.py`` -* Added ``null_space`` method in ``symmetryutilities.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``equalPositions`` method in ``symmetryutilities.py`` for removal in version 4.0.0 -* Deprecated ``expandPosition`` method in ``symmetryutilities.py`` for removal in version 4.0.0 -* Deprecated ``nullSpace`` method in ``symmetryutilities.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-4.rst b/news/deprecate-symmetryutilities-4.rst deleted file mode 100644 index 35d02131..00000000 --- a/news/deprecate-symmetryutilities-4.rst +++ /dev/null @@ -1,28 +0,0 @@ -**Added:** - -* Added ``convert_fp_num_to_signed_rational`` method in ``GeneratorSite`` class -* Added ``_find_null_space`` method in ``GeneratorSite`` class -* Added ``_find_pos_parameters`` method in ``GeneratorSite`` class -* Added ``_find_u_space`` method in ``GeneratorSite`` class -* Added ``_find_u_parameters`` method in ``GeneratorSite`` class -* Added ``_find_eq_uij`` method in ``GeneratorSite`` class - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``signedRatStr`` method in in ``GeneratorSite`` class for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-5.rst b/news/deprecate-symmetryutilities-5.rst deleted file mode 100644 index 8e572454..00000000 --- a/news/deprecate-symmetryutilities-5.rst +++ /dev/null @@ -1,29 +0,0 @@ -**Added:** - -* Added ``position_formula`` method in ``GeneratorSite`` class -* Added ``u_formula`` method in ``GeneratorSite`` class -* Added ``eq_index`` method in ``GeneratorSite`` class -* Added ``prune_formula_dictionary`` method in ``symmetryutilities.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``positionFormula`` method in ``GeneratorSite`` class for removal in version 4.0.0 -* Deprecated ``UFormula`` method in ``GeneratorSite`` class for removal in version 4.0.0 -* Deprecated ``eqIndex`` method in ``GeneratorSite`` class for removal in version 4.0.0 -* Deprecated ``pruneFormulaDictionary`` method in ``symmetryutilities.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-6.rst b/news/deprecate-symmetryutilities-6.rst deleted file mode 100644 index b78e0917..00000000 --- a/news/deprecate-symmetryutilities-6.rst +++ /dev/null @@ -1,32 +0,0 @@ -**Added:** - -* Added ``_find_constraints`` method in ``SymmetryConstraints`` class -* Added ``pos_parm_symbols`` method in ``SymmetryConstraints`` class -* Added ``pos_parm_values`` method in ``SymmetryConstraints`` class -* Added ``u_parm_symbols`` method in ``SymmetryConstraints`` class -* Added ``u_parm_values`` method in ``SymmetryConstraints`` class -* Added ``u_formulas`` method in ``SymmetryConstraints`` class - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``posparSymbols`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``posparValues`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``UparSymbols`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``UparValues`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``UFormulas`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-symmetryutilities-7.rst b/news/deprecate-symmetryutilities-7.rst deleted file mode 100644 index e014dac4..00000000 --- a/news/deprecate-symmetryutilities-7.rst +++ /dev/null @@ -1,27 +0,0 @@ -**Added:** - -* Added ``position_formulas`` method in ``SymmetryConstraints`` class -* Added ``position_formulas_pruned`` method in ``SymmetryConstraints`` class -* Added ``u_formulas_pruned`` method in ``SymmetryConstraints`` class - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``positionFormulas`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``positionFormulasPruned`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 -* Deprecated ``UFormulasPruned`` method in ``SymmetryConstraints`` class for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-toLine.rst b/news/deprecate-toLine.rst deleted file mode 100644 index ca25c38c..00000000 --- a/news/deprecate-toLine.rst +++ /dev/null @@ -1,38 +0,0 @@ -**Added:** - -* Added ``_parse_cif_data_source`` method in ``p_cif.py`` -* Added ``_parse_cif_block`` method in ``p_cif.py`` -* Added ``to_lines`` method in ``p_cif.py`` -* Added ``to_lines`` method in ``p_pdb.py`` -* Added ``to_lines`` method in ``p_rawxyz.py`` -* Added ``to_lines`` method in ``p_xcfg.py`` -* Added ``to_lines`` method in ``p_xyz.py`` -* Added ``to_lines`` method in ``structureparser.py`` -* Added ``_lines_iterator`` method in ``p_discus.py`` -* Added ``to_lines`` method in ``p_discus.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``toLines`` method in ``p_cif.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``p_pdb.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``p_rawxyz.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``p_xcfg.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``p_xyz.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``structureparser.py`` for removal in version 4.0.0 -* Deprecated ``toLines`` method in ``p_discus.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/deprecate-utils.rst b/news/deprecate-utils.rst deleted file mode 100644 index 693b86ca..00000000 --- a/news/deprecate-utils.rst +++ /dev/null @@ -1,39 +0,0 @@ -**Added:** - -* Added ``atom_bare_symbol`` method in ``utils.py`` -* Added ``_get_ordered_formats`` method in ``p_auto.py`` -* Added ``_wrap_parse_method`` method in ``p_auto.py`` -* Added ``_tr_atom_site_u_iso_or_equiv`` method in ``p_cif.py`` -* Added ``_tr_atom_site_b_iso_or_equiv`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_11`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_22`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_33`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_12`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_13`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_u_23`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_11`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_22`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_33`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_12`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_13`` method in ``p_cif.py`` -* Added ``_tr_atom_site_aniso_b_23`` method in ``p_cif.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated ``atomBareSymbol`` method in ``utils.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/fix-load-structure.rst b/news/fix-load-structure.rst deleted file mode 100644 index a324ad4f..00000000 --- a/news/fix-load-structure.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added method ``load_structure`` in ``__init__.py`` - -**Changed:** - -* - -**Deprecated:** - -* Deprecated method ``loadStructure`` in ``__init__.py`` for removal in version 4.0.0 - -**Removed:** - -* - -**Fixed:** - -* Fixed ``load_structure`` with successfully loading `Path` object - -**Security:** - -* diff --git a/news/skpkg-update.rst b/news/skpkg-update.rst deleted file mode 100644 index a037a121..00000000 --- a/news/skpkg-update.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Support for Python 3.14 - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* Support for Python 3.11 - -**Fixed:** - -* - -**Security:** - -* diff --git a/news/vesta_view.rst b/news/vesta_view.rst deleted file mode 100644 index b8564ee6..00000000 --- a/news/vesta_view.rst +++ /dev/null @@ -1,23 +0,0 @@ -**Added:** - -* Added parser for vesta specific files and viewer for vesta - -**Changed:** - -* - -**Deprecated:** - -* - -**Removed:** - -* - -**Fixed:** - -* - -**Security:** - -* diff --git a/src/diffpy/structure/structure.py b/src/diffpy/structure/structure.py index 1593af40..a33f4643 100644 --- a/src/diffpy/structure/structure.py +++ b/src/diffpy/structure/structure.py @@ -236,6 +236,135 @@ def get_last_atom(self): last_atom = self[-1] return last_atom + def get_chemical_symbols(self): + """Return list of chemical symbols for all `Atoms` in this + structure. + + Returns + ------- + list of str + The list of chemical symbols for all `Atoms` in this structure. + """ + symbols_with_charge = [a.element for a in self] + symbols = [atom_bare_symbol(sym) for sym in symbols_with_charge] + return symbols + + def get_fractional_coordinates(self): + """Return array of fractional coordinates of all `Atoms` in this + structure. + + Returns + ------- + numpy.ndarray + The array of fractional coordinates of all `Atoms` in this structure + in the same order as `Structure.get_chemical_symbols()`. + """ + coords = numpy.array([a.xyz for a in self]) + return coords + + def get_cartesian_coordinates(self): + """Return array of Cartesian coordinates of all `Atoms` in this + structure. + + Returns + ------- + numpy.ndarray + The array of Cartesian coordinates of all `Atoms` in this structure + in the same order as `Structure.get_chemical_symbols()`. + """ + cartn_coords = numpy.array([a.xyz_cartn for a in self]) + return cartn_coords + + def get_anisotropic_displacement_parameters(self, return_array=False): + """Return the anisotropic displacement parameters for all atoms. + + Parameters + ---------- + return_array : bool, optional + If True, return anisotropic displacement parameters as a numpy array instead of a dictionary. + + Returns + ------- + dict + The dictionary of anisotropic displacement parameters for all atoms in this structure. + Keys are of the form 'Element_i_Ujk', e.g. 'C_0_11', 'C_0_12'. + """ + if return_array: + aniso_adps = numpy.array([a.U for a in self]) + return aniso_adps + else: + adp_dict = {} + for i, atom in enumerate(self): + element = atom_bare_symbol(atom.element) + adp_dict[f"{element}_{i}_11"] = self.U11[i] + adp_dict[f"{element}_{i}_22"] = self.U22[i] + adp_dict[f"{element}_{i}_33"] = self.U33[i] + adp_dict[f"{element}_{i}_12"] = self.U12[i] + adp_dict[f"{element}_{i}_13"] = self.U13[i] + adp_dict[f"{element}_{i}_23"] = self.U23[i] + return adp_dict + + def get_isotropic_displacement_parameters(self, return_array=False): + """Return a the isotropic displacement parameters for all atoms. + + Parameters + ---------- + return_array : bool, optional + If True, return isotropic displacement parameters as a numpy array instead of a dictionary. + Default is False. + + Returns + ------- + dict + The dictionary of isotropic displacement parameters for all atoms in this structure. + Keys are of the form 'Element_i_Uiso', e.g. 'C_0_Uiso'. + """ + if return_array: + iso_adps = numpy.array([a.Uisoequiv for a in self]) + return iso_adps + else: + iso_dict = {} + for i, atom in enumerate(self): + element = atom_bare_symbol(atom.element) + iso_dict[f"{element}_{i+1}_Uiso"] = self.Uisoequiv[i] + return iso_dict + + def get_occupancies(self): + """Return array of occupancies of all `Atoms` in this structure. + + Returns + ------- + numpy.ndarray + The array of occupancies of all `Atoms` in this structure. + """ + occupancies = numpy.array([a.occupancy for a in self]) + return occupancies + + def get_lattice_vectors(self): + """Return array of lattice vectors for this structure. + + Returns + ------- + numpy.ndarray + The array of lattice vectors for this structure. + """ + lattice_vectors = self.lattice.base + return lattice_vectors + + def get_lattice_vector_angles(self): + """Return array of lattice vector angles for this structure. + + Returns + ------- + numpy.ndarray + The array of lattice vector angles for this structure. + """ + a, b, c = self.lattice.base + alpha = self.lattice.angle(b, c) + beta = self.lattice.angle(a, c) + gamma = self.lattice.angle(a, b) + return numpy.array([alpha, beta, gamma]) + def assign_unique_labels(self): """Set a unique label string for each `Atom` in this structure. diff --git a/tests/test_structure.py b/tests/test_structure.py index 43872477..39591bc1 100644 --- a/tests/test_structure.py +++ b/tests/test_structure.py @@ -19,7 +19,7 @@ import pickle import unittest -import numpy +import numpy as np import pytest from diffpy.structure import Atom, Lattice, Structure @@ -87,8 +87,8 @@ def __copy__(self): pbte = self.pbte pbte2 = pbte.copy() self.assertFalse(pbte2.lattice is pbte.lattice) - self.assertTrue(numpy.array_equal(pbte.xyz_cartn, pbte2.xyz_cartn)) - self.assertTrue(numpy.array_equal(pbte.U, pbte2.U)) + self.assertTrue(np.array_equal(pbte.xyz_cartn, pbte2.xyz_cartn)) + self.assertTrue(np.array_equal(pbte.U, pbte2.U)) stru = MyDerivedStructure() stru += pbte2[pbte2.element.startswith("Pb")] pb3 = stru.copy() @@ -126,7 +126,7 @@ def test_getLastAtom(self): structure = Structure(atoms=[Atom("C", [0, 0, 0])], lattice=s_lat) actual = structure.getLastAtom() assert actual.element == expected.element - assert numpy.allclose(expected.xyz, actual.xyz) + assert np.allclose(expected.xyz, actual.xyz) def test_get_last_atom(self): """Check Structure.get_last_atom()""" @@ -135,7 +135,7 @@ def test_get_last_atom(self): structure = Structure(atoms=[Atom("C", [0, 0, 0])], lattice=s_lat) actual = structure.get_last_atom() assert actual.element == expected.element - assert numpy.allclose(expected.xyz, actual.xyz) + assert np.allclose(expected.xyz, actual.xyz) def test_addNewAtom(self): """Duplicate test for the deprecated addNewAtom method. @@ -152,7 +152,7 @@ def test_addNewAtom(self): assert expected == actual atom_object = structure[-1] assert atom_object.element == "C" - assert numpy.allclose(atom_object.xyz, [0.1, 0.2, 0.3]) + assert np.allclose(atom_object.xyz, [0.1, 0.2, 0.3]) def test_assignUniqueLabels(self): """Check Structure.assignUniqueLabels()""" @@ -197,9 +197,9 @@ def test_placeInLattice(self): new_lattice = Lattice(0.5, 0.5, 0.5, 90, 90, 60) stru.placeInLattice(new_lattice) a0 = stru[0] - self.assertTrue(numpy.allclose(a0.xyz, [0.0, 0.0, 0.0])) + self.assertTrue(np.allclose(a0.xyz, [0.0, 0.0, 0.0])) a1 = stru[1] - self.assertTrue(numpy.allclose(a1.xyz, [2.0, 0.0, 2.0])) + self.assertTrue(np.allclose(a1.xyz, [2.0, 0.0, 2.0])) def test_place_in_lattice(self): """Check Structure.placeInLattice() -- conversion of @@ -208,9 +208,9 @@ def test_place_in_lattice(self): new_lattice = Lattice(0.5, 0.5, 0.5, 90, 90, 60) stru.place_in_lattice(new_lattice) a0 = stru[0] - self.assertTrue(numpy.allclose(a0.xyz, [0.0, 0.0, 0.0])) + self.assertTrue(np.allclose(a0.xyz, [0.0, 0.0, 0.0])) a1 = stru[1] - self.assertTrue(numpy.allclose(a1.xyz, [2.0, 0.0, 2.0])) + self.assertTrue(np.allclose(a1.xyz, [2.0, 0.0, 2.0])) # def test_read(self): # """check Structure.read()""" @@ -244,7 +244,7 @@ def test_append(self): self.assertEqual(3, len(self.stru)) self.assertEqual("Si", alast.element) self.assertTrue(lat is alast.lattice) - self.assertTrue(numpy.array_equal(a.xyz, alast.xyz)) + self.assertTrue(np.array_equal(a.xyz, alast.xyz)) self.assertFalse(a is alast) self.assertFalse(lat is a.lattice) return @@ -258,7 +258,7 @@ def test_insert(self): self.assertEqual(3, len(self.stru)) self.assertEqual("Si", a1.element) self.assertTrue(lat is a1.lattice) - self.assertTrue(numpy.array_equal(a.xyz, a1.xyz)) + self.assertTrue(np.array_equal(a.xyz, a1.xyz)) self.assertFalse(a is a1) self.assertFalse(lat is a.lattice) return @@ -281,7 +281,7 @@ def test___getitem__(self): self.assertTrue(stru[0] is stru.tolist()[0]) intidx = list(range(len(stru)))[::-1] self.assertEqual(stru[intidx].tolist(), stru.tolist()[::-1]) - flagidx = numpy.arange(len(stru)) > 0 + flagidx = np.arange(len(stru)) > 0 self.assertEqual(stru[flagidx].tolist(), stru.tolist()[1:]) cdse = Structure(self.cdse) self.assertEqual([cdse[0], cdse[-2]], cdse[0, -2].tolist()) @@ -318,7 +318,7 @@ def test___setitem__(self): self.assertEqual(2, len(self.stru)) self.assertEqual("Si", a1.element) self.assertTrue(lat is a1.lattice) - self.assertTrue(numpy.array_equal(a.xyz, a1.xyz)) + self.assertTrue(np.array_equal(a.xyz, a1.xyz)) self.assertFalse(a is a1) self.assertFalse(lat is a.lattice) return @@ -332,7 +332,7 @@ def test___setitem__slice(self): self.assertEqual(1, len(self.stru)) self.assertEqual("Si", a0.element) self.assertTrue(lat is a0.lattice) - self.assertTrue(numpy.array_equal(a.xyz, a0.xyz)) + self.assertTrue(np.array_equal(a.xyz, a0.xyz)) self.assertFalse(a is a0) self.assertFalse(lat is a.lattice) return @@ -346,9 +346,9 @@ def test___add__(self): ta0 = total[0] tam1 = total[-1] self.assertEqual("C", ta0.element) - self.assertTrue(numpy.array_equal(stru[0].xyz, ta0.xyz)) + self.assertTrue(np.array_equal(stru[0].xyz, ta0.xyz)) self.assertEqual("Se", tam1.element) - self.assertTrue(numpy.array_equal(cdse[-1].xyz, tam1.xyz)) + self.assertTrue(np.array_equal(cdse[-1].xyz, tam1.xyz)) self.assertFalse(total.lattice in (stru.lattice, cdse.lattice)) self.assertTrue(all([a.lattice is total.lattice for a in total])) return @@ -364,7 +364,7 @@ def test___iadd__(self): self.assertEqual(lst, stru[:2].tolist()) am1 = stru[-1] self.assertEqual("Se", am1.element) - self.assertTrue(numpy.array_equal(cdse[-1].xyz, am1.xyz)) + self.assertTrue(np.array_equal(cdse[-1].xyz, am1.xyz)) self.assertTrue(lat0 is stru.lattice) self.assertFalse(stru.lattice is cdse.lattice) self.assertTrue(all([a.lattice is stru.lattice for a in stru])) @@ -377,8 +377,8 @@ def test___sub__(self): self.assertEqual(2, len(cadmiums)) self.assertEqual("Cd", cadmiums[0].element) self.assertEqual("Cd", cadmiums[1].element) - self.assertTrue(numpy.array_equal(cdse[0].xyz, cadmiums[0].xyz)) - self.assertTrue(numpy.array_equal(cdse[1].xyz, cadmiums[1].xyz)) + self.assertTrue(np.array_equal(cdse[0].xyz, cadmiums[0].xyz)) + self.assertTrue(np.array_equal(cdse[1].xyz, cadmiums[1].xyz)) self.assertFalse(cdse[0] is cadmiums[0]) self.assertFalse(cdse.lattice is cadmiums.lattice) return @@ -405,7 +405,7 @@ def test___mul__(self): cdsex3 = 3 * cdse self.assertEqual(12, len(cdsex3)) self.assertEqual(3 * "Cd Cd Se Se".split(), [a.element for a in cdsex3]) - self.assertTrue(numpy.array_equal(3 * [a.xyz for a in cdse], [a.xyz for a in cdsex3])) + self.assertTrue(np.array_equal(3 * [a.xyz for a in cdse], [a.xyz for a in cdsex3])) self.assertFalse(set(cdse).intersection(cdsex3)) self.assertFalse(cdse.lattice is cdsex3.lattice) return @@ -420,8 +420,8 @@ def test___imul__(self): cdse *= 2 self.assertEqual(8, len(cdse)) self.assertEqual(lst, cdse[:4].tolist()) - self.assertEqual(numpy.tile(els, 2).tolist(), cdse.element.tolist()) - self.assertTrue(numpy.array_equal(numpy.tile(xyz, (2, 1)), cdse.xyz)) + self.assertEqual(np.tile(els, 2).tolist(), cdse.element.tolist()) + self.assertTrue(np.array_equal(np.tile(xyz, (2, 1)), cdse.xyz)) self.assertEqual(8, len(set(cdse))) self.assertEqual(8 * [lat], [a.lattice for a in cdse]) self.stru *= -3 @@ -477,18 +477,18 @@ def test_xyz(self): """Check Structure.xyz.""" stru = self.stru self.assertEqual((2, 3), stru.xyz.shape) - self.assertTrue(numpy.array_equal([1, 1, 1], stru.xyz[1])) + self.assertTrue(np.array_equal([1, 1, 1], stru.xyz[1])) stru.xyz += 0.1 - self.assertTrue(numpy.array_equal([0.1, 0.1, 0.1], stru[0].xyz)) - self.assertTrue(numpy.array_equal([1.1, 1.1, 1.1], stru[1].xyz)) + self.assertTrue(np.array_equal([0.1, 0.1, 0.1], stru[0].xyz)) + self.assertTrue(np.array_equal([1.1, 1.1, 1.1], stru[1].xyz)) stru.xyz = 0 stru[1].xyz[:] = 1 - self.assertTrue(numpy.array_equal([0, 0, 0], stru[0].xyz)) - self.assertTrue(numpy.array_equal([1, 1, 1], stru[1].xyz)) + self.assertTrue(np.array_equal([0, 0, 0], stru[0].xyz)) + self.assertTrue(np.array_equal([1, 1, 1], stru[1].xyz)) # verify noop when changing empty slice - xyz0 = numpy.copy(stru.xyz) + xyz0 = np.copy(stru.xyz) stru[1:1].xyz += 1 - self.assertTrue(numpy.array_equal(xyz0, stru.xyz)) + self.assertTrue(np.array_equal(xyz0, stru.xyz)) return def test_x(self): @@ -537,7 +537,7 @@ def test_label(self): def test_occupancy(self): """Check Structure.occupancy.""" cdse = self.cdse - self.assertTrue(numpy.array_equal(numpy.ones(4), cdse.occupancy)) + self.assertTrue(np.array_equal(np.ones(4), cdse.occupancy)) self.stru.occupancy *= 0.5 self.assertEqual(1.0, sum([a.occupancy for a in self.stru])) cdse.occupancy = 1 @@ -548,25 +548,25 @@ def test_xyz_cartn(self): """Check Structure.xyz_cartn.""" pbte = copy.copy(self.pbte) self.assertEqual((8, 3), pbte.xyz_cartn.shape) - self.assertTrue(numpy.allclose(6.461 / 2.0 * numpy.ones(3), pbte.xyz_cartn[0])) - pbte.xyz_cartn += numpy.array([0.1, 0.2, 0.3]) * 6.461 - self.assertTrue(numpy.allclose([0.6, 0.7, 0.8], pbte[0].xyz)) - self.assertTrue(numpy.allclose([0.6, 0.7, 0.3], pbte[7].xyz)) + self.assertTrue(np.allclose(6.461 / 2.0 * np.ones(3), pbte.xyz_cartn[0])) + pbte.xyz_cartn += np.array([0.1, 0.2, 0.3]) * 6.461 + self.assertTrue(np.allclose([0.6, 0.7, 0.8], pbte[0].xyz)) + self.assertTrue(np.allclose([0.6, 0.7, 0.3], pbte[7].xyz)) return def test_anisotropy(self): """Check Structure.anisotropy.""" self.assertEqual((2,), self.stru.anisotropy.shape) - self.assertFalse(numpy.any(self.stru.anisotropy)) + self.assertFalse(np.any(self.stru.anisotropy)) tei = copy.copy(self.tei) - self.assertTrue(numpy.all(tei.anisotropy)) + self.assertTrue(np.all(tei.anisotropy)) tei.anisotropy = False - self.assertFalse(numpy.any(tei.anisotropy)) + self.assertFalse(np.any(tei.anisotropy)) self.assertAlmostEqual(0.019227, tei[0].U11, 6) self.assertAlmostEqual(0.019227, tei[0].U22, 6) self.assertAlmostEqual(0.019227, tei[0].U33, 6) self.assertAlmostEqual(0.0, tei[0].U12, 6) - self.assertAlmostEqual(0.019227 * -numpy.cos(numpy.radians(128.09)), tei[0].U13, 6) + self.assertAlmostEqual(0.019227 * -np.cos(np.radians(128.09)), tei[0].U13, 6) self.assertAlmostEqual(0.0, tei[0].U23, 6) self.assertAlmostEqual(0.019227, tei[0].Uisoequiv, 6) return @@ -575,22 +575,22 @@ def test_U(self): """Check Structure.U.""" stru = self.stru self.assertEqual((2, 3, 3), stru.U.shape) - self.assertFalse(numpy.any(stru.anisotropy)) - stru.U = numpy.identity(3) + self.assertFalse(np.any(stru.anisotropy)) + stru.U = np.identity(3) self.assertEqual(2, len(set([id(a.U) for a in stru]))) isou = stru.lattice.isotropicunit - self.assertTrue(numpy.array_equal(2 * [isou], stru.U)) - self.assertFalse(numpy.any(stru.anisotropy)) + self.assertTrue(np.array_equal(2 * [isou], stru.U)) + self.assertFalse(np.any(stru.anisotropy)) stru.anisotropy = True - stru.U = numpy.identity(3) - self.assertTrue(numpy.array_equal(2 * [numpy.identity(3)], stru.U)) - self.assertTrue(numpy.all(stru.anisotropy)) + stru.U = np.identity(3) + self.assertTrue(np.array_equal(2 * [np.identity(3)], stru.U)) + self.assertTrue(np.all(stru.anisotropy)) stru.U = 0 - self.assertTrue(numpy.all(stru.anisotropy)) - self.assertFalse(numpy.any(stru.U != 0.0)) + self.assertTrue(np.all(stru.anisotropy)) + self.assertFalse(np.any(stru.U != 0.0)) stru[1].U[:] = 1 - self.assertTrue(numpy.all(stru[0].U == 0.0)) - self.assertTrue(numpy.all(stru[1].U == 1.0)) + self.assertTrue(np.all(stru[0].U == 0.0)) + self.assertTrue(np.all(stru[1].U == 1.0)) return def test_Uisoequiv(self): @@ -611,19 +611,19 @@ def test_Uij(self): stru = self.stru stru[1].anisotropy = True stru[1].U = [[1.1, 0.12, 0.13], [0.12, 2.2, 0.23], [0.13, 0.23, 3.3]] - self.assertTrue(numpy.array_equal([0, 1.1], stru.U11)) - self.assertTrue(numpy.array_equal([0, 2.2], stru.U22)) - self.assertTrue(numpy.array_equal([0, 3.3], stru.U33)) - self.assertTrue(numpy.array_equal([0, 0.12], stru.U12)) - self.assertTrue(numpy.array_equal([0, 0.13], stru.U13)) - self.assertTrue(numpy.array_equal([0, 0.23], stru.U23)) + self.assertTrue(np.array_equal([0, 1.1], stru.U11)) + self.assertTrue(np.array_equal([0, 2.2], stru.U22)) + self.assertTrue(np.array_equal([0, 3.3], stru.U33)) + self.assertTrue(np.array_equal([0, 0.12], stru.U12)) + self.assertTrue(np.array_equal([0, 0.13], stru.U13)) + self.assertTrue(np.array_equal([0, 0.23], stru.U23)) stru.U11 = stru.U22 = stru.U33 = stru.U12 = stru.U13 = stru.U23 = 0.0 - self.assertFalse(numpy.any(stru.U != 0.0)) + self.assertFalse(np.any(stru.U != 0.0)) return def test_Bisoequiv(self): """Check Structure.Bisoequiv.""" - utob = 8 * numpy.pi**2 + utob = 8 * np.pi**2 tei = copy.copy(self.tei) self.assertEqual((16,), tei.Bisoequiv.shape) self.assertAlmostEqual(utob * 0.019227, tei.Bisoequiv[0], 4) @@ -640,15 +640,15 @@ def test_Bij(self): stru = self.stru stru[1].anisotropy = True stru[1].U = [[1.1, 0.12, 0.13], [0.12, 2.2, 0.23], [0.13, 0.23, 3.3]] - stru[1].U /= 8 * numpy.pi**2 - self.assertTrue(numpy.allclose([0, 1.1], stru.B11)) - self.assertTrue(numpy.allclose([0, 2.2], stru.B22)) - self.assertTrue(numpy.allclose([0, 3.3], stru.B33)) - self.assertTrue(numpy.allclose([0, 0.12], stru.B12)) - self.assertTrue(numpy.allclose([0, 0.13], stru.B13)) - self.assertTrue(numpy.allclose([0, 0.23], stru.B23)) + stru[1].U /= 8 * np.pi**2 + self.assertTrue(np.allclose([0, 1.1], stru.B11)) + self.assertTrue(np.allclose([0, 2.2], stru.B22)) + self.assertTrue(np.allclose([0, 3.3], stru.B33)) + self.assertTrue(np.allclose([0, 0.12], stru.B12)) + self.assertTrue(np.allclose([0, 0.13], stru.B13)) + self.assertTrue(np.allclose([0, 0.23], stru.B23)) stru.B11 = stru.B22 = stru.B33 = stru.B12 = stru.B13 = stru.B23 = 0.0 - self.assertFalse(numpy.any(stru.U != 0.0)) + self.assertFalse(np.any(stru.U != 0.0)) return def test_pickling(self): @@ -664,6 +664,242 @@ def test_pickling(self): # End of class TestStructure +def test_get_chemical_symbols(datafile): + """Check Structure.get_chemical_symbols()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_chemical_symbols = pbte_stru.get_chemical_symbols() + expected_chemical_symbols = ["Pb"] * 4 + ["Te"] * 4 + assert actual_chemical_symbols == expected_chemical_symbols + + +def test_get_fractional_coordinates(datafile): + """Check Structure.get_fractional_coordinates()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_fractional_coords = pbte_stru.get_fractional_coordinates() + expected_fractional_coords = np.array( + [ + [0.5, 0.5, 0.5], + [0.5, 0.0, 0.0], + [0.0, 0.5, 0.0], + [0.0, 0.0, 0.5], + [0.0, 0.0, 0.0], + [0.0, 0.5, 0.5], + [0.5, 0.0, 0.5], + [0.5, 0.5, 0.0], + ] + ) + assert np.allclose(actual_fractional_coords, expected_fractional_coords) + + +def test_get_cartesian_coordinates(datafile): + """Check Structure.get_cartesian_coordinates()""" + cdse_stru = Structure(filename=datafile("CdSe_bulk.stru")) + actual_cartesian_coords = cdse_stru.get_cartesian_coordinates() + expected_cartesian_coords = np.array( + [ + [1.22284264, 2.11760202, 0.0], + [2.44495161, 0.0, 3.4530135], + [1.22284264, 2.11760202, 2.60129319], + [2.44495161, 0.0, 6.05430669], + ] + ) + assert np.allclose(actual_cartesian_coords, expected_cartesian_coords, atol=1e-6) + + +@pytest.mark.parametrize( + "input,expected", + [ # case: user wants ADPs as an array so they set return_array=True + # expected: a 3D array of shape (num_atoms, 3, 3) with the Uij values + [ + True, + np.array( + [ + [[0.0211, 0.0, 0.0109], [0.0, 0.0195, 0.0], [0.0109, 0.0, 0.016]], + [[0.0223, 0.0, 0.0179], [0.0, 0.018, 0.0], [0.0179, 0.0, 0.0254]], + [[0.025, 0.0, 0.0226], [0.0, 0.0234, 0.0], [0.0226, 0.0, 0.0345]], + [[0.0234, 0.0, 0.0138], [0.0, 0.0295, 0.0], [0.0138, 0.0, 0.0253]], + ] + ), + ], + # case: user wants ADPs as a dictionary so they set return_array=False (default behavior) + # expected: a dictionary with keys like "I_8_11" and values as the corresponding Uij values + [ + False, + { + # Iodine + "I_8_11": 0.025, + "I_8_12": 0.0, + "I_8_13": 0.0226, + "I_8_22": 0.0234, + "I_8_23": 0.0, + "I_8_33": 0.0345, + "I_9_11": 0.025, + "I_9_12": 0.0, + "I_9_13": 0.0226, + "I_9_22": 0.0234, + "I_9_23": 0.0, + "I_9_33": 0.0345, + "I_10_11": 0.025, + "I_10_12": 0.0, + "I_10_13": 0.0226, + "I_10_22": 0.0234, + "I_10_23": 0.0, + "I_10_33": 0.0345, + "I_11_11": 0.025, + "I_11_12": 0.0, + "I_11_13": 0.0226, + "I_11_22": 0.0234, + "I_11_23": 0.0, + "I_11_33": 0.0345, + "I_12_11": 0.0234, + "I_12_12": 0.0, + "I_12_13": 0.0138, + "I_12_22": 0.0295, + "I_12_23": 0.0, + "I_12_33": 0.0253, + "I_13_11": 0.0234, + "I_13_12": 0.0, + "I_13_13": 0.0138, + "I_13_22": 0.0295, + "I_13_23": 0.0, + "I_13_33": 0.0253, + "I_14_11": 0.0234, + "I_14_12": 0.0, + "I_14_13": 0.0138, + "I_14_22": 0.0295, + "I_14_23": 0.0, + "I_14_33": 0.0253, + "I_15_11": 0.0234, + "I_15_12": 0.0, + "I_15_13": 0.0138, + "I_15_22": 0.0295, + "I_15_23": 0.0, + "I_15_33": 0.0253, + # Tellurium + "Te_0_11": 0.0211, + "Te_0_12": 0.0, + "Te_0_13": 0.0109, + "Te_0_22": 0.0195, + "Te_0_23": 0.0, + "Te_0_33": 0.016, + "Te_1_11": 0.0211, + "Te_1_12": 0.0, + "Te_1_13": 0.0109, + "Te_1_22": 0.0195, + "Te_1_23": 0.0, + "Te_1_33": 0.016, + "Te_2_11": 0.0211, + "Te_2_12": 0.0, + "Te_2_13": 0.0109, + "Te_2_22": 0.0195, + "Te_2_23": 0.0, + "Te_2_33": 0.016, + "Te_3_11": 0.0211, + "Te_3_12": 0.0, + "Te_3_13": 0.0109, + "Te_3_22": 0.0195, + "Te_3_23": 0.0, + "Te_3_33": 0.016, + "Te_4_11": 0.0223, + "Te_4_12": 0.0, + "Te_4_13": 0.0179, + "Te_4_22": 0.018, + "Te_4_23": 0.0, + "Te_4_33": 0.0254, + "Te_5_11": 0.0223, + "Te_5_12": 0.0, + "Te_5_13": 0.0179, + "Te_5_22": 0.018, + "Te_5_23": 0.0, + "Te_5_33": 0.0254, + "Te_6_11": 0.0223, + "Te_6_12": 0.0, + "Te_6_13": 0.0179, + "Te_6_22": 0.018, + "Te_6_23": 0.0, + "Te_6_33": 0.0254, + "Te_7_11": 0.0223, + "Te_7_12": 0.0, + "Te_7_13": 0.0179, + "Te_7_22": 0.018, + "Te_7_23": 0.0, + "Te_7_33": 0.0254, + }, + ], + ], +) +def test_get_anisotropic_displacement_parameters(datafile, input, expected): + """Check Structure.get_anisotropic_displacement_parameters()""" + tei_stru = Structure(filename=datafile("TeI.cif")) + actual_displacement = tei_stru.get_anisotropic_displacement_parameters(return_array=input) + if isinstance(expected, np.ndarray): + expected_displacement = np.repeat(expected, 4, axis=0) + assert np.allclose(actual_displacement, expected_displacement) + if isinstance(expected, dict): + assert actual_displacement == expected + + +@pytest.mark.parametrize( + "input,expected", + [ # case: user wants isotropic displacement parameters as an array + # so they set return_array=True + # expected: a 1D array of shape (num_atoms,) with the Uiso values + [ + True, + np.array([0.0225566, 0.0225566, 0.0225566, 0.0225566, 0.0155528, 0.0155528, 0.0155528, 0.0155528]), + ], + # case: user wants isotropic displacement parameters as a dictionary + # so they set return_array=False (default behavior) + # expected: a dictionary with keys like "I_Uiso" and values as the corresponding Uiso values + [ + False, + { + "Pb_1_Uiso": 0.0225566, + "Pb_2_Uiso": 0.0225566, + "Pb_3_Uiso": 0.0225566, + "Pb_4_Uiso": 0.0225566, + "Te_5_Uiso": 0.0155528, + "Te_6_Uiso": 0.0155528, + "Te_7_Uiso": 0.0155528, + "Te_8_Uiso": 0.0155528, + }, + ], + ], +) +def test_get_isotropic_displacement_parameters(datafile, input, expected): + """Check Structure.get_isotropic_displacement_parameters()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_isotropic_displacement = pbte_stru.get_isotropic_displacement_parameters(return_array=input) + if isinstance(expected, np.ndarray): + assert np.allclose(actual_isotropic_displacement, expected) + if isinstance(expected, dict): + assert actual_isotropic_displacement == expected + + +def test_get_occupancies(datafile): + """Check Structure.get_occupancies()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_occupancies = pbte_stru.get_occupancies() + expected_occupancies = np.ones(8) + assert np.allclose(actual_occupancies, expected_occupancies) + + +def test_get_lattice_vectors(datafile): + """Check Structure.get_lattice_vectors()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_lattice_vectors = pbte_stru.get_lattice_vectors() + expected_lattice_vectors = np.array([[6.461, 0.0, 0.0], [0.0, 6.461, 0.0], [0.0, 0.0, 6.461]]) + assert np.allclose(actual_lattice_vectors, expected_lattice_vectors) + + +def test_get_lattice_vector_angles(datafile): + """Check Structure.get_lattice_vector_angles()""" + pbte_stru = Structure(filename=datafile("PbTe.cif")) + actual_lattice_vector_angles = pbte_stru.get_lattice_vector_angles() + expected_lattice_vector_angles = np.array([90.0, 90.0, 90.0]) + assert np.allclose(actual_lattice_vector_angles, expected_lattice_vector_angles) + + # ---------------------------------------------------------------------------- @pytest.mark.parametrize( "existing, atype, xyz, expected_len, expected_element, expected_xyz", @@ -700,7 +936,7 @@ def test_add_new_atom(existing, atype, xyz, expected_len, expected_element, expe assert expected_len == actual_length atom_object = structure[-1] assert atom_object.element == expected_element - assert numpy.allclose(atom_object.xyz, expected_xyz) + assert np.allclose(atom_object.xyz, expected_xyz) def test_add_new_atom_duplicate(): @@ -714,7 +950,7 @@ def test_add_new_atom_duplicate(): structure.add_new_atom(atype="C", xyz=[0.1, 0.2, 0.3]) assert len(structure) == 3 assert structure[-1].element == "C" - assert numpy.allclose(structure[-1].xyz, [0.1, 0.2, 0.3]) + assert np.allclose(structure[-1].xyz, [0.1, 0.2, 0.3]) if __name__ == "__main__":