Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .github/workflows/check-news-item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check for News
on:
pull_request_target:
branches:
- main # GitHub does not evaluate expressions in trigger filters; edit this value if your base branch is not main
- main # GitHub does not evaluate expressions in trigger filters; edit this value if your base branch is not main

jobs:
check-news-item:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/matrix-and-codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ jobs:
project: diffpy.cmistructure
c_extension: false
headless: false
run: |
set -Eeuo pipefail
python -m pip install --no-deps diffpy.srfit==3.4.0rc0
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ jobs:
project: diffpy.cmistructure
c_extension: false
headless: false
run: |
set -Eeuo pipefail
python -m pip install --no-deps diffpy.srfit==3.4.0rc0
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
34 changes: 34 additions & 0 deletions LICENSE_DANSE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This program is part of the DiffPy and DANSE open-source projects at Columbia
University and is available subject to the conditions and terms laid out below.

Copyright (c) 2008-2011, The Trustees of Columbia University in
the City of New York. All rights reserved.

For more information please visit the diffpy web-page at
http://www.diffpy.org
or email Prof. Simon Billinge at sb2896@columbia.edu.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the names of COLUMBIA UNIVERSITY, MICHIGAN STATE UNIVERSITY nor the
names of their contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4 changes: 2 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"package_dir_name": "diffpy.cmistructure",
"project_short_description": "diffpy.cmi package for doing refinements with structure objects",
"project_keywords": "diffraction, PDF, X-ray, neutron",
"minimum_supported_python_version": "3.12",
"maximum_supported_python_version": "3.14",
"minimum_supported_python_version": "3.11",
"maximum_supported_python_version": "3.13",
"project_needs_c_code_compiled": "No",
"project_has_gui_tests": "No"
}
31 changes: 0 additions & 31 deletions docs/source/api/diffpy.cmistructure.example_package.rst

This file was deleted.

66 changes: 52 additions & 14 deletions docs/source/api/diffpy.cmistructure.rst
Original file line number Diff line number Diff line change
@@ -1,30 +1,68 @@
:tocdepth: -1

|title|
=======

.. |title| replace:: diffpy.cmistructure package
diffpy.cmistructure package
===========================

.. automodule:: diffpy.cmistructure
:members:
:undoc-members:
:show-inheritance:

Subpackages
-----------

.. toctree::
diffpy.cmistructure.example_package

Submodules
----------

|module|
--------
diffpy.cmistructure.objcrystparset module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.objcrystparset
:members:
:undoc-members:
:show-inheritance:

diffpy.cmistructure.basestructureparset module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.basestructureparset
:members:
:undoc-members:
:show-inheritance:

diffpy.cmistructure.srrealparset module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.srrealparset
:members:
:undoc-members:
:show-inheritance:

diffpy.cmistructure.diffpyparset module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.diffpyparset
:members:
:undoc-members:
:show-inheritance:

diffpy.cmistructure.cctbxparset module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.cctbxparset
:members:
:undoc-members:
:show-inheritance:

diffpy.cmistructure.bvsrestraint module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.bvsrestraint
:members:
:undoc-members:
:show-inheritance:

.. |module| replace:: diffpy.cmistructure.example_submodule module
diffpy.cmistructure.sgconstraints module
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: diffpy.cmistructure.example_submodule
.. automodule:: diffpy.cmistructure.sgconstraints
:members:
:undoc-members:
:show-inheritance:
23 changes: 23 additions & 0 deletions news/migrate-structure.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news added.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ maintainers = [
description = "diffpy.cmi package for doing refinements with structure objects"
keywords = ['diffraction', 'PDF', 'X-ray', 'neutron']
readme = "README.rst"
requires-python = ">=3.12, <3.15"
requires-python = ">=3.11, <3.14"
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
Expand All @@ -25,9 +25,9 @@ classifiers = [
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Scientific/Engineering :: Chemistry',
]
Expand All @@ -49,11 +49,17 @@ exclude = [] # exclude packages matching these glob patterns (empty by default)
namespaces = false # to disable scanning PEP 420 namespaces (true by default)

[project.scripts]
diffpy-cmistructure = "diffpy.cmistructure.app:main"
diffpy-cmistructure = "diffpy.cmistructure.cmistructure_app:main"

[tool.setuptools.dynamic]
dependencies = {file = ["requirements/pip.txt"]}

[tool.pytest.ini_options]
# Fail when cmistructure source calls one of its own deprecated names.
filterwarnings = [
"error:'diffpy\\.cmistructure\\.:DeprecationWarning:diffpy\\.cmistructure",
]

[tool.codespell]
exclude-file = ".codespell/ignore_lines.txt"
ignore-words = ".codespell/ignore_words.txt"
Expand Down
4 changes: 4 additions & 0 deletions requirements/conda.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
numpy
diffpy.srreal
diffpy.srfit
diffpy.structure
pyobjcryst
4 changes: 4 additions & 0 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
numpy
diffpy.srreal
diffpy.srfit
diffpy.structure
pyobjcryst
1 change: 1 addition & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ codecov
coverage
pytest-cov
pytest-env
pyobjcryst
3 changes: 3 additions & 0 deletions src/diffpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@
# See LICENSE.rst for license information.
#
##############################################################################
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
56 changes: 55 additions & 1 deletion src/diffpy/cmistructure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,65 @@
# See LICENSE.rst for license information.
#
##############################################################################
"""diffpy.cmi package for doing refinements with structure objects"""
"""Modules and classes that adapt structure representations to the
ParameterSet interface and automatic structure constraint generation
from space group information."""

from diffpy.cmistructure.sgconstraints import constrain_as_space_group

# package version
from diffpy.cmistructure.version import __version__ # noqa

__all__ = ["constrain_as_space_group", "structure_to_parameter_set"]


def structure_to_parameter_set(name, structure):
"""Create a ParameterSet adapted to a structure object.
The adapter is chosen from the type of `structure`. Supported types are
diffpy.structure.Structure, pyobjcryst.crystal.Crystal,
pyobjcryst.molecule.Molecule and cctbx.crystal.special_position_settings.
Parameters
----------
name : str
The name to give the structure.
structure : object
The structure object to adapt.
Returns
-------
BaseStructureParSet
The ParameterSet adapting `structure`.
Raises
------
TypeError
If `structure` is not one of the supported structure types.
"""
from diffpy.cmistructure.diffpyparset import DiffpyStructureParSet

if DiffpyStructureParSet.can_adapt(structure):
return DiffpyStructureParSet(name, structure)

from diffpy.cmistructure.objcrystparset import ObjCrystCrystalParSet

if ObjCrystCrystalParSet.can_adapt(structure):
return ObjCrystCrystalParSet(name, structure)

from diffpy.cmistructure.objcrystparset import ObjCrystMoleculeParSet

if ObjCrystMoleculeParSet.can_adapt(structure):
return ObjCrystMoleculeParSet(name, structure)

from diffpy.cmistructure.cctbxparset import CCTBXCrystalParSet

if CCTBXCrystalParSet.can_adapt(structure):
return CCTBXCrystalParSet(name, structure)

raise TypeError("Unadaptable structure format")


# silence the pyflakes syntax checker
assert __version__ or True

Expand Down
Loading
Loading