From 01bb3032c78e79e8fecc601dbd8f7b350b79a3a0 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:22:06 -0400 Subject: [PATCH 01/16] Replace github workflows --- .github/workflows/check-news-item.yml | 12 +++++ .github/workflows/codecov.yml | 53 ------------------- .github/workflows/docs.yml | 48 ----------------- .github/workflows/main.yml | 42 --------------- .../matrix-and-codecov-on-merge-to-main.yml | 21 ++++++++ .github/workflows/publish-docs-on-release.yml | 14 +++++ .github/workflows/tests-on-pr.yml | 16 ++++++ 7 files changed, 63 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/check-news-item.yml delete mode 100644 .github/workflows/codecov.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/matrix-and-codecov-on-merge-to-main.yml create mode 100644 .github/workflows/publish-docs-on-release.yml create mode 100644 .github/workflows/tests-on-pr.yml diff --git a/.github/workflows/check-news-item.yml b/.github/workflows/check-news-item.yml new file mode 100644 index 00000000..1301ca85 --- /dev/null +++ b/.github/workflows/check-news-item.yml @@ -0,0 +1,12 @@ +name: Check for News + +on: + pull_request_target: + branches: + - main + +jobs: + build: + uses: Billingegroup/release-scripts/.github/workflows/_check-news-item.yml@v0 + with: + project: diffpy.structure diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml deleted file mode 100644 index fd96a710..00000000 --- a/.github/workflows/codecov.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Gather coverage report and upload to codecov - -on: - push: - branches: - - main - release: - types: - - prereleased - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - coverage: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.structure - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.structure and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.structure - run: | - coverage run -m pytest -vv -s - coverage report -m - codecov - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index df2b392f..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build and Deploy Documentation - -on: - release: - types: - - published - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.structure - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: build - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.structure and build requirements - run: | - conda install --file requirements/build.txt - conda install --file requirements/run.txt - conda install --file requirements/docs.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: build documents - run: make -C doc html - - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./doc/build/html diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 33ece6cf..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Test - -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -defaults: - run: - shell: bash -l {0} - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Check out diffpy.structure - uses: actions/checkout@v4 - - - name: Initialize miniconda - uses: conda-incubator/setup-miniconda@v3 - with: - activate-environment: test - auto-update-conda: true - environment-file: environment.yml - auto-activate-base: false - - - name: Conda config - run: >- - conda config --set always_yes yes - --set changeps1 no - - - name: Install diffpy.structure and requirements - run: | - conda install --file requirements/run.txt - conda install --file requirements/test.txt - python -m pip install -r requirements/pip.txt - python -m pip install . --no-deps - - - name: Validate diffpy.structure - run: python -m pytest diff --git a/.github/workflows/matrix-and-codecov-on-merge-to-main.yml b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml new file mode 100644 index 00000000..c1905e0d --- /dev/null +++ b/.github/workflows/matrix-and-codecov-on-merge-to-main.yml @@ -0,0 +1,21 @@ +name: CI + +on: + push: + branches: + - main + release: + types: + - prereleased + - published + workflow_dispatch: null + +jobs: + coverage: + uses: Billingegroup/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 new file mode 100644 index 00000000..1c5981db --- /dev/null +++ b/.github/workflows/publish-docs-on-release.yml @@ -0,0 +1,14 @@ +name: Build and Deploy Docs + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + docs: + uses: Billingegroup/release-scripts/.github/workflows/_publish-docs-on-release.yml@v0 + with: + project: diffpy.structure + c_extension: false diff --git a/.github/workflows/tests-on-pr.yml b/.github/workflows/tests-on-pr.yml new file mode 100644 index 00000000..614b16f2 --- /dev/null +++ b/.github/workflows/tests-on-pr.yml @@ -0,0 +1,16 @@ +name: Tests on PR + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + validate: + uses: Billingegroup/release-scripts/.github/workflows/_tests-on-pr.yml@v0 + with: + project: diffpy.structure + c_extension: false + headless: false From 88414c00c4b6d611e13bfacdc2c40ee76f78dcd6 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:25:34 -0400 Subject: [PATCH 02/16] Add requirements, add pytest-cov --- requirements/build.txt | 2 -- requirements/run.txt | 4 ++-- requirements/test.txt | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/requirements/build.txt b/requirements/build.txt index f72d870d..e69de29b 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -1,2 +0,0 @@ -python -setuptools diff --git a/requirements/run.txt b/requirements/run.txt index 5413a934..0fdcecb6 100644 --- a/requirements/run.txt +++ b/requirements/run.txt @@ -1,2 +1,2 @@ -numpy -pycifrw +numpy +pycifrw diff --git a/requirements/test.txt b/requirements/test.txt index 6f9ccf84..a7277865 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -2,4 +2,5 @@ flake8 pytest codecov coverage +pytest-cov pytest-env From 373dc722a43a2861afc5cdcbe328390e43e889e1 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:26:16 -0400 Subject: [PATCH 03/16] Delete gitattributes and add pre-commit config --- .gitattributes | 1 - .pre-commit-config.yaml | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index de811ba3..00000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -diffpy.structure/_version.py export-subst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c4588061..3070e199 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,10 @@ repos: - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - exclude: '\.(rst|txt)$' + - id: check-case-conflict + - id: check-merge-conflict + - id: check-toml + - id: check-added-large-files - repo: https://github.com/psf/black rev: 24.4.2 hooks: From 31f61f530e6360f2454760495bec7a0db1bf787c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:27:37 -0400 Subject: [PATCH 04/16] Remove devutils --- devutils/makesdist | 60 ---------- devutils/sgtbx_extra_groups.py | 210 --------------------------------- 2 files changed, 270 deletions(-) delete mode 100755 devutils/makesdist delete mode 100644 devutils/sgtbx_extra_groups.py diff --git a/devutils/makesdist b/devutils/makesdist deleted file mode 100755 index dccfaa99..00000000 --- a/devutils/makesdist +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -"""Create source distribution tar.gz archive, where each file belongs -to a root user and modification time is set to the git commit time. -""" - -import glob -import gzip -import os -import subprocess -import sys -import tarfile - -from setup import FALLBACK_VERSION, versiondata - -BASEDIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) -sys.path.insert(0, BASEDIR) - -timestamp = versiondata.getint("DEFAULT", "timestamp") - -vfb = versiondata.get("DEFAULT", "version").split(".post")[0] + ".post0" -emsg = "Invalid FALLBACK_VERSION. Expected %r got %r." -assert vfb == FALLBACK_VERSION, emsg % (vfb, FALLBACK_VERSION) - - -def inform(s): - sys.stdout.write(s) - sys.stdout.flush() - return - - -inform('Run "setup.py sdist --formats=tar" ') -cmd_sdist = [sys.executable] + "setup.py sdist --formats=tar".split() -ec = subprocess.call(cmd_sdist, cwd=BASEDIR, stdout=open(os.devnull, "w")) -if ec: - sys.exit(ec) -inform("[done]\n") - -tarname = max(glob.glob(BASEDIR + "/dist/*.tar"), key=os.path.getmtime) - -tfin = tarfile.open(tarname) -fpout = gzip.GzipFile(tarname + ".gz", "w", mtime=0) -tfout = tarfile.open(fileobj=fpout, mode="w") - - -def fixtarinfo(tinfo): - tinfo.uid = tinfo.gid = 0 - tinfo.uname = tinfo.gname = "root" - tinfo.mtime = timestamp - tinfo.mode &= ~0o022 - return tinfo - - -inform("Filter %s --> %s.gz " % (2 * (os.path.basename(tarname),))) -for ti in tfin: - tfout.addfile(fixtarinfo(ti), tfin.extractfile(ti)) - -tfin.close() -os.remove(tarname) -inform("[done]\n") diff --git a/devutils/sgtbx_extra_groups.py b/devutils/sgtbx_extra_groups.py deleted file mode 100644 index 4cab28c2..00000000 --- a/devutils/sgtbx_extra_groups.py +++ /dev/null @@ -1,210 +0,0 @@ -#!/usr/bin/env python - -"""Quick and extremely dirty script for generating code for SpaceGroup that -are defined in cctbx, but not in mmLib. It was used to generate module -sgtbxspacegroups. - -This is a utility script that should not be included with code distribution. - -Not to be included with code distributions. -""" - - -import math -import re - -import numpy -from cctbx import sgtbx - -from diffpy.structure.spacegroups import IsSpaceGroupIdentifier, SpaceGroup, SymOp, mmLibSpaceGroupList - - -def tupleToSGArray(tpl): - if not _rtarrays: - import diffpy.structure.SpaceGroups as sgmod - - for n in dir(sgmod): - if not n.startswith("Rot_") and not n.startswith("Tr_"): - continue - a = getattr(sgmod, n) - t = tuple(a.flatten()) - _rtarrays[t] = a - if len(tpl) == 3: - tpl = tuple([(x - math.floor(x)) for x in tpl]) - if tpl not in _rtarrays: - _rtarrays[tpl] = numpy.array(tpl, dtype=float) - return _rtarrays[tpl] - - -_rtarrays = {} - - -def mmSpaceGroupFromSymbol(symbol): - """Construct SpaceGroup instance from a string symbol using sgtbx data.""" - sginfo = sgtbx.space_group_info(symbol) - symop_list = [] - symop_list = getSymOpList(sginfo.group()) - sgtype = sginfo.type() - uhm = sgtype.lookup_symbol() - sgsmbls = sgtbx.space_group_symbols(uhm) - kw = {} - kw["number"] = sgtype.number() - kw["num_sym_equiv"] = len(symop_list) - kw["num_primitive_sym_equiv"] = countUniqueRotations(symop_list) - kw["short_name"] = sgsmbls.hermann_mauguin().replace(" ", "") - pgt = sgsmbls.point_group_type() - pgn = "PG" + re.sub(r"-(\d)", "\\1bar", pgt) - kw["point_group_name"] = pgn - kw["crystal_system"] = sgsmbls.crystal_system().upper() - kw["pdb_name"] = sgsmbls.hermann_mauguin() - kw["symop_list"] = symop_list - mmsg = SpaceGroup(**kw) - return mmsg - - -def adjustMMSpaceGroupNumber(mmsg): - sg0 = [x for x in mmLibSpaceGroupList if x.number == mmsg.number] - if sg0 and cmpSpaceGroups(sg0[0], mmsg): - return - while mmsg.number in sgnumbers: - mmsg.number += 1000 - sgnumbers.append(mmsg.number) - - -def getSymOpList(grp): - symop_list = [] - for op in grp: - r_sgtbx = op.r().as_double() - t_sgtbx = op.t().as_double() - R = tupleToSGArray(r_sgtbx) - t = tupleToSGArray(t_sgtbx) - symop_list.append(SymOp(R, t)) - return symop_list - - -def countUniqueRotations(symop_list): - unique_rotations = set() - for op in symop_list: - tpl = tuple(op.R.flatten()) - unique_rotations.add(tpl) - return len(unique_rotations) - - -def cmpSpaceGroups(sg0, sg1): - if sg0 is sg1: - return True - s0 = hashMMSpaceGroup(sg0) - s1 = hashMMSpaceGroup(sg1) - return s0 == s1 - - -def findEquivalentMMSpaceGroup(grp): - if not _equivmmsg: - for sgn in mmLibSpaceGroupList: - ssgn = hashMMSpaceGroup(sgn) - _equivmmsg.setdefault(ssgn, sgn) - ssg = hashSgtbxGroup(grp) - return _equivmmsg.get(ssg) - - -_equivmmsg = {} - - -def findEquivalentSgtbxSpaceGroup(sgmm): - if not _equivsgtbx: - for smbls in sgtbx.space_group_symbol_iterator(): - uhm = smbls.universal_hermann_mauguin() - grp = sgtbx.space_group_info(uhm).group() - hgrp = hashSgtbxGroup(grp) - _equivsgtbx.setdefault(hgrp, grp) - hgmm = hashMMSpaceGroup(sgmm) - return _equivsgtbx.get(hgmm) - - -_equivsgtbx = {} - - -def hashMMSpaceGroup(sg): - lines = [str(sg.number % 1000)] + sorted(map(str, sg.iter_symops())) - s = "\n".join(lines) - return s - - -def hashSgtbxGroup(grp): - n = grp.type().number() - lines = [str(n)] + sorted(map(str, getSymOpList(grp))) - s = "\n".join(lines) - return s - - -sgnumbers = [sg.number for sg in mmLibSpaceGroupList] - -_SGsrc = """\ -sg%(number)i = SpaceGroup( - number = %(number)i, - num_sym_equiv = %(num_sym_equiv)i, - num_primitive_sym_equiv = %(num_sym_equiv)i, - short_name = %(short_name)r, - point_group_name = %(point_group_name)r, - crystal_system = %(crystal_system)r, - pdb_name = %(pdb_name)r, - symop_list = [ - @SYMOPS@ - ] -) -""" - - -def SGCode(mmsg): - src0 = _SGsrc % mmsg.__dict__ - src1 = src0.replace("@SYMOPS@", SymOpsCode(mmsg)) - return src1 - - -def SymOpsCode(mmsg): - lst = ["%8s%s," % ("", SymOpCode(op)) for op in mmsg.iter_symops()] - src = "\n".join(lst).strip() - return src - - -def SymOpCode(op): - if not _rtnames: - import diffpy.structure.SpaceGroups as sgmod - - for n in dir(sgmod): - if not n.startswith("Rot_") and not n.startswith("Tr_"): - continue - a = getattr(sgmod, n) - at = tuple(a.flatten()) - _rtnames[at] = "sgmod." + n - nR = _rtnames[tuple(op.R.flatten())] - nt = _rtnames[tuple(op.t)] - src = "SymOp(%s, %s)" % (nR, nt) - return src - - -_rtnames = {} - - -def main(): - duplicates = set() - for smbls in sgtbx.space_group_symbol_iterator(): - uhm = smbls.universal_hermann_mauguin() - grp = sgtbx.space_group_info(uhm).group() - if findEquivalentMMSpaceGroup(grp): - continue - shn = smbls.hermann_mauguin().replace(" ", "") - if IsSpaceGroupIdentifier(shn): - continue - sg = mmSpaceGroupFromSymbol(uhm) - hsg = hashMMSpaceGroup(sg) - if hsg in duplicates: - continue - adjustMMSpaceGroupNumber(sg) - duplicates.add(hsg) - print(SGCode(sg)) - return - - -if __name__ == "__main__": - main() From 848b25e5727c180cb5b3dd892d87764f3774ad33 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:29:41 -0400 Subject: [PATCH 05/16] Add devutils script --- devutils/sgtbx_extra_groups.py | 210 +++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 devutils/sgtbx_extra_groups.py diff --git a/devutils/sgtbx_extra_groups.py b/devutils/sgtbx_extra_groups.py new file mode 100644 index 00000000..4cab28c2 --- /dev/null +++ b/devutils/sgtbx_extra_groups.py @@ -0,0 +1,210 @@ +#!/usr/bin/env python + +"""Quick and extremely dirty script for generating code for SpaceGroup that +are defined in cctbx, but not in mmLib. It was used to generate module +sgtbxspacegroups. + +This is a utility script that should not be included with code distribution. + +Not to be included with code distributions. +""" + + +import math +import re + +import numpy +from cctbx import sgtbx + +from diffpy.structure.spacegroups import IsSpaceGroupIdentifier, SpaceGroup, SymOp, mmLibSpaceGroupList + + +def tupleToSGArray(tpl): + if not _rtarrays: + import diffpy.structure.SpaceGroups as sgmod + + for n in dir(sgmod): + if not n.startswith("Rot_") and not n.startswith("Tr_"): + continue + a = getattr(sgmod, n) + t = tuple(a.flatten()) + _rtarrays[t] = a + if len(tpl) == 3: + tpl = tuple([(x - math.floor(x)) for x in tpl]) + if tpl not in _rtarrays: + _rtarrays[tpl] = numpy.array(tpl, dtype=float) + return _rtarrays[tpl] + + +_rtarrays = {} + + +def mmSpaceGroupFromSymbol(symbol): + """Construct SpaceGroup instance from a string symbol using sgtbx data.""" + sginfo = sgtbx.space_group_info(symbol) + symop_list = [] + symop_list = getSymOpList(sginfo.group()) + sgtype = sginfo.type() + uhm = sgtype.lookup_symbol() + sgsmbls = sgtbx.space_group_symbols(uhm) + kw = {} + kw["number"] = sgtype.number() + kw["num_sym_equiv"] = len(symop_list) + kw["num_primitive_sym_equiv"] = countUniqueRotations(symop_list) + kw["short_name"] = sgsmbls.hermann_mauguin().replace(" ", "") + pgt = sgsmbls.point_group_type() + pgn = "PG" + re.sub(r"-(\d)", "\\1bar", pgt) + kw["point_group_name"] = pgn + kw["crystal_system"] = sgsmbls.crystal_system().upper() + kw["pdb_name"] = sgsmbls.hermann_mauguin() + kw["symop_list"] = symop_list + mmsg = SpaceGroup(**kw) + return mmsg + + +def adjustMMSpaceGroupNumber(mmsg): + sg0 = [x for x in mmLibSpaceGroupList if x.number == mmsg.number] + if sg0 and cmpSpaceGroups(sg0[0], mmsg): + return + while mmsg.number in sgnumbers: + mmsg.number += 1000 + sgnumbers.append(mmsg.number) + + +def getSymOpList(grp): + symop_list = [] + for op in grp: + r_sgtbx = op.r().as_double() + t_sgtbx = op.t().as_double() + R = tupleToSGArray(r_sgtbx) + t = tupleToSGArray(t_sgtbx) + symop_list.append(SymOp(R, t)) + return symop_list + + +def countUniqueRotations(symop_list): + unique_rotations = set() + for op in symop_list: + tpl = tuple(op.R.flatten()) + unique_rotations.add(tpl) + return len(unique_rotations) + + +def cmpSpaceGroups(sg0, sg1): + if sg0 is sg1: + return True + s0 = hashMMSpaceGroup(sg0) + s1 = hashMMSpaceGroup(sg1) + return s0 == s1 + + +def findEquivalentMMSpaceGroup(grp): + if not _equivmmsg: + for sgn in mmLibSpaceGroupList: + ssgn = hashMMSpaceGroup(sgn) + _equivmmsg.setdefault(ssgn, sgn) + ssg = hashSgtbxGroup(grp) + return _equivmmsg.get(ssg) + + +_equivmmsg = {} + + +def findEquivalentSgtbxSpaceGroup(sgmm): + if not _equivsgtbx: + for smbls in sgtbx.space_group_symbol_iterator(): + uhm = smbls.universal_hermann_mauguin() + grp = sgtbx.space_group_info(uhm).group() + hgrp = hashSgtbxGroup(grp) + _equivsgtbx.setdefault(hgrp, grp) + hgmm = hashMMSpaceGroup(sgmm) + return _equivsgtbx.get(hgmm) + + +_equivsgtbx = {} + + +def hashMMSpaceGroup(sg): + lines = [str(sg.number % 1000)] + sorted(map(str, sg.iter_symops())) + s = "\n".join(lines) + return s + + +def hashSgtbxGroup(grp): + n = grp.type().number() + lines = [str(n)] + sorted(map(str, getSymOpList(grp))) + s = "\n".join(lines) + return s + + +sgnumbers = [sg.number for sg in mmLibSpaceGroupList] + +_SGsrc = """\ +sg%(number)i = SpaceGroup( + number = %(number)i, + num_sym_equiv = %(num_sym_equiv)i, + num_primitive_sym_equiv = %(num_sym_equiv)i, + short_name = %(short_name)r, + point_group_name = %(point_group_name)r, + crystal_system = %(crystal_system)r, + pdb_name = %(pdb_name)r, + symop_list = [ + @SYMOPS@ + ] +) +""" + + +def SGCode(mmsg): + src0 = _SGsrc % mmsg.__dict__ + src1 = src0.replace("@SYMOPS@", SymOpsCode(mmsg)) + return src1 + + +def SymOpsCode(mmsg): + lst = ["%8s%s," % ("", SymOpCode(op)) for op in mmsg.iter_symops()] + src = "\n".join(lst).strip() + return src + + +def SymOpCode(op): + if not _rtnames: + import diffpy.structure.SpaceGroups as sgmod + + for n in dir(sgmod): + if not n.startswith("Rot_") and not n.startswith("Tr_"): + continue + a = getattr(sgmod, n) + at = tuple(a.flatten()) + _rtnames[at] = "sgmod." + n + nR = _rtnames[tuple(op.R.flatten())] + nt = _rtnames[tuple(op.t)] + src = "SymOp(%s, %s)" % (nR, nt) + return src + + +_rtnames = {} + + +def main(): + duplicates = set() + for smbls in sgtbx.space_group_symbol_iterator(): + uhm = smbls.universal_hermann_mauguin() + grp = sgtbx.space_group_info(uhm).group() + if findEquivalentMMSpaceGroup(grp): + continue + shn = smbls.hermann_mauguin().replace(" ", "") + if IsSpaceGroupIdentifier(shn): + continue + sg = mmSpaceGroupFromSymbol(uhm) + hsg = hashMMSpaceGroup(sg) + if hsg in duplicates: + continue + adjustMMSpaceGroupNumber(sg) + duplicates.add(hsg) + print(SGCode(sg)) + return + + +if __name__ == "__main__": + main() From 84182c446614b1735757d2f9b97474fbd0375d3d Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:31:13 -0400 Subject: [PATCH 06/16] Resolve authors --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index 9f6a419f..1abf16be 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,6 +1,7 @@ Authors ======= +Billinge Group and community contributors, Pavol Juhas, Christopher L. Farrow, Xiaohao Yang, From f3029fb1b42df9edb46b23a6f9204cd376de0085 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:31:47 -0400 Subject: [PATCH 07/16] Add updated doc --- .../api/diffpy.structure.example_package.rst | 31 +++++ doc/source/api/diffpy.structure.rst | 106 ++---------------- doc/source/conf.py | 14 --- doc/source/index.rst | 43 +------ 4 files changed, 43 insertions(+), 151 deletions(-) create mode 100644 doc/source/api/diffpy.structure.example_package.rst diff --git a/doc/source/api/diffpy.structure.example_package.rst b/doc/source/api/diffpy.structure.example_package.rst new file mode 100644 index 00000000..3595000a --- /dev/null +++ b/doc/source/api/diffpy.structure.example_package.rst @@ -0,0 +1,31 @@ +.. _example_package documentation: + +|title| +======= + +.. |title| replace:: diffpy.structure.example_package package + +.. automodule:: diffpy.structure.example_package + :members: + :undoc-members: + :show-inheritance: + +|foo| +----- + +.. |foo| replace:: diffpy.structure.example_package.foo module + +.. automodule:: diffpy.structure.example_package.foo + :members: + :undoc-members: + :show-inheritance: + +|bar| +----- + +.. |bar| replace:: diffpy.structure.example_package.bar module + +.. automodule:: diffpy.structure.example_package.foo + :members: + :undoc-members: + :show-inheritance: diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index 95ff1285..cdcc80ea 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -1,7 +1,9 @@ :tocdepth: -1 -diffpy.structure package -======================== +|title| +======= + +.. |title| replace:: diffpy.structure package .. automodule:: diffpy.structure :members: @@ -12,107 +14,17 @@ Subpackages ----------- .. toctree:: - :titlesonly: - - diffpy.structure.parsers - diffpy.structure.expansion - diffpy.structure.apps + diffpy.structure.example_package Submodules ---------- -diffpy.structure.spacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.spacegroups - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure._legacy_importer module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure._legacy_importer - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.structureerrors module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.structureerrors - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.spacegroupmod module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.spacegroupmod - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.utils module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.utils - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.lattice module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.lattice - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.structure module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.structure - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.mmlibspacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.mmlibspacegroups - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.symmetryutilities module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.symmetryutilities - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.atom module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.atom - :members: - :undoc-members: - :show-inheritance: - -diffpy.structure.pdffitstructure module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. automodule:: diffpy.structure.pdffitstructure - :members: - :undoc-members: - :show-inheritance: +|module| +-------- -diffpy.structure.sgtbxspacegroups module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. |module| replace:: diffpy.structure.example_submodule module -.. automodule:: diffpy.structure.sgtbxspacegroups +.. automodule:: diffpy.structure.example_submodule :members: :undoc-members: :show-inheritance: diff --git a/doc/source/conf.py b/doc/source/conf.py index d3af3e37..f7b1c770 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -18,8 +18,6 @@ from importlib.metadata import version from pathlib import Path -autodoc_mock_imports = ["importlib.metadata"] - # 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. @@ -48,8 +46,6 @@ "m2r", ] -autodoc_member_order = "groupwise" - # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] @@ -120,12 +116,6 @@ # Display all warnings for missing links. nitpicky = True -nitpick_ignore = [ - ("py:class", "array_like"), - ("py:class", "Parser"), - ("py:class", "CifFile"), -] - # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for @@ -297,7 +287,3 @@ # Example configuration for intersphinx: refer to the Python standard library. # intersphinx_mapping = {'http://docs.python.org/': None} -intersphinx_mapping = { - "python": ("https://docs.python.org/3", None), - "numpy": ("https://numpy.org/doc/stable/", None), -} diff --git a/doc/source/index.rst b/doc/source/index.rst index 4fabbaa1..54ec3695 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,57 +4,21 @@ .. |title| replace:: diffpy.structure documentation -diffpy.structure - Crystal structure container and parsers for structure formats. +diffpy.structure - Crystal structure container and parsers for structure formats.. | Software version |release|. | Last updated |today|. -The diffpy.structure package provides objects for storing atomic -coordinates, displacement parameters and other crystal structure data. -diffpy.structure supports import and export of structure data in several -structure formats such as CIF, PDB, xyz. It provides conversion -between fractional and absolute Cartesian coordinates, functions for -symmetry expansion from asymmetric unit and generation of symmetry -constraints for atom positions and displacement parameters. diffpy.structure -includes definitions of all space groups in over 500 symmetry settings. - ======= Authors ======= -diffpy.structure is developed by members of the Billinge Group at -Columbia University and at Brookhaven National Laboratory including -Pavol Juhás, Christopher L. Farrow, Xiaohao Yang, Simon J.L. Billinge. +diffpy.structure is developed by Billinge Group +and its community contributors. For a detailed list of contributors see https://github.com/diffpy/diffpy.structure/graphs/contributors. -Acknowledgments -=============== - -Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* -originate from the pymmlib project, http://pymmlib.sourceforge.net. -Less common settings of space groups were generating using the -Computational Crystallography Toolbox, -http://cctbx.sourceforge.net. - - -.. index:: citation, reference - -Reference -========= - -If you use this program for a scientific research that leads -to publication, we ask that you acknowledge use of the program -by citing the following paper in your publication: - - P. Juhás, C. L. Farrow, X. Yang, K. R. Knox and S. J. L. Billinge, - `Complex modeling: a strategy and software program for combining - multiple information sources to solve ill posed structure and - nanostructure inverse problems - `__, - *Acta Crystallogr. A* **71**, 562-568 (2015). - ============ Installation ============ @@ -65,7 +29,6 @@ file included with the distribution. ================= Table of contents ================= - .. toctree:: :titlesonly: From de0ab3787eb328c5acf4dd65ffc29bcb5973a404 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:34:22 -0400 Subject: [PATCH 08/16] Remove legacy import --- src/diffpy/Structure.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 src/diffpy/Structure.py diff --git a/src/diffpy/Structure.py b/src/diffpy/Structure.py deleted file mode 100644 index 1f65df4b..00000000 --- a/src/diffpy/Structure.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.structure Complex Modeling Initiative -# (c) 2017 Brookhaven Science Associates, -# Brookhaven National Laboratory. -# All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. -# -############################################################################## - -"""Support import of old camel-case module names with `DeprecationWarning`. - -The imported camel-case modules are aliases for the current module -instances. Their `__name__` attributes are thus all in lower-case. - -Warning -------- -This module is deprecated and will be removed in the future. -""" - - -import sys - -# install legacy import hooks -import diffpy.structure._legacy_importer - -# replace this module with the new one -sys.modules["diffpy.Structure"] = diffpy.structure - -# End of file From 0500e49af3a6addda73ad837abd5e3c225b1b2f8 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:38:30 -0400 Subject: [PATCH 09/16] Add license --- LICENSE.rst | 2 +- LICENSE_DANSE.rst | 4 +- LICENSE_pymmlib.rst | 2 +- doc/source/license.rst | 169 +++++++++++++++++++++++++++++++++-------- 4 files changed, 143 insertions(+), 34 deletions(-) diff --git a/LICENSE.rst b/LICENSE.rst index f1fe010e..2e8d4ba9 100644 --- a/LICENSE.rst +++ b/LICENSE.rst @@ -15,7 +15,7 @@ Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. All rights reserved. The "DiffPy-CMI" is distributed subject to the following license conditions: diff --git a/LICENSE_DANSE.rst b/LICENSE_DANSE.rst index c05648e1..d56af619 100644 --- a/LICENSE_DANSE.rst +++ b/LICENSE_DANSE.rst @@ -9,13 +9,13 @@ 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. +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 Redistribution and use in source and binary forms, with or without diff --git a/LICENSE_pymmlib.rst b/LICENSE_pymmlib.rst index e0b82c94..ef484f5a 100644 --- a/LICENSE_pymmlib.rst +++ b/LICENSE_pymmlib.rst @@ -1,5 +1,5 @@ .. code-block:: text - + The Artistic License 2.0 Copyright (c) 2000-2006, The Perl Foundation. diff --git a/doc/source/license.rst b/doc/source/license.rst index cfab61c2..39176b12 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -7,33 +7,142 @@ License OPEN SOURCE LICENSE AGREEMENT ============================= -BSD 3-Clause License - -Copyright (c) 2024, The Trustees of Columbia University in -the City of New York. -All Rights Reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. 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. - -3. Neither the name of the copyright holder nor the names of its - 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 HOLDER 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. + +Copyright (c) 1989, 1991 Free Software Foundation, Inc. + +Copyright (c) 2006, The Regents of the University of California through Lawrence Berkeley National Laboratory + +Copyright (c) 2006-2007, Board of Trustees of Michigan State University + +Copyright (c) 2008-2012, The Trustees of Columbia University in the City of New York + +Copyright (c) 2009-2011, University of Tennessee + +Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") + +Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory + +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +All rights reserved. + +The "DiffPy-CMI" is distributed subject to the following license conditions: + +.. code-block:: text + + SOFTWARE LICENSE AGREEMENT + + Software: DiffPy-CMI + + + (1) The "Software", below, refers to the aforementioned DiffPy-CMI (in either + source code, or binary form and accompanying documentation). + + Part of the software was derived from the DANSE, ObjCryst++ (with permission), + PyCifRW, Python periodictable, CCTBX, and SasView open source projects, of + which the original Copyrights are contained in each individual file. + + Each licensee is addressed as "you" or "Licensee." + + + (2) The copyright holders shown above and their third-party Licensors hereby + grant licensee a royalty-free nonexclusive license, subject to the limitations + stated herein and U.S. Government license rights. + + + (3) You may modify and make a copy or copies of the software for use within + your organization, if you meet the following conditions: + + (a) Copies in source code must include the copyright notice and this + software license agreement. + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy. + + + (4) You may modify a copy or copies of the Software or any portion of it, thus + forming a work based on the Software, and distribute copies of such work + outside your organization, if you meet all of the following conditions: + + (a) Copies in source code must include the copyright notice and this + Software License Agreement; + + (b) Copies in binary form must include the copyright notice and this + Software License Agreement in the documentation and/or other materials + provided with the copy; + + (c) Modified copies and works based on the Software must carry prominent + notices stating that you changed specified portions of the Software. + + (d) Neither the name of Brookhaven Science Associates or Brookhaven + National Laboratory nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + written permission. + + + (5) Portions of the Software resulted from work developed under a U.S. + Government contract and are subject to the following license: + The Government is granted for itself and others acting on its behalf a + paid-up, nonexclusive, irrevocable worldwide license in this computer software + to reproduce, prepare derivative works, and perform publicly and display + publicly. + + + (6) WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT + WARRANTY OF ANY KIND. THE COPYRIGHT HOLDERS, THEIR THIRD PARTY + LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND + THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL + LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF + THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE + PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION + UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED. + + + (7) LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDERS, THEIR + THIRD PARTY LICENSORS, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF + ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, + CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING + BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, + WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING + NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS + BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. + + +Brookhaven National Laboratory Notice +===================================== + +Acknowledgment of sponsorship +----------------------------- + +This software was produced by the Brookhaven National Laboratory, under +Contract DE-AC02-98CH10886 with the Department of Energy. + + +Government disclaimer of liability +---------------------------------- + +Neither the United States nor the United States Department of Energy, nor +any of their employees, makes any warranty, express or implied, or assumes +any legal liability or responsibility for the accuracy, completeness, or +usefulness of any data, apparatus, product, or process disclosed, or +represents that its use would not infringe privately owned rights. + + +Brookhaven disclaimer of liability +---------------------------------- + +Brookhaven National Laboratory makes no representations or warranties, +express or implied, nor assumes any liability for the use of this software. + + +Maintenance of notice +--------------------- + +In the interest of clarity regarding the origin and status of this +software, Brookhaven National Laboratory requests that any recipient of it +maintain this notice affixed to any distribution by the recipient that +contains a copy or derivative of this software. + +END OF LICENSE From dc12979efd51e6765b4f0df4dfb809e2255d848e Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:40:23 -0400 Subject: [PATCH 10/16] Resolve README --- README.rst | 22 +++++----------------- doc/source/license.rst | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 5dd3a227..5ae201ad 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/main.yml/badge.svg - :target: https://github.com/diffpy/diffpy.structure/actions/workflows/main.yml +.. |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 .. |Codecov| image:: https://codecov.io/gh/diffpy/diffpy.structure/branch/main/graph/badge.svg :target: https://codecov.io/gh/diffpy/diffpy.structure @@ -47,6 +47,7 @@ of symmetry constraints for atom positions and displacement parameters. diffpy.structure includes definitions of all space groups in over 500 symmetry settings. + For more information about the diffpy.structure library, please consult our `online documentation `_. Citation @@ -86,11 +87,7 @@ Then, to fully install ``diffpy.structure`` in our active environment, run :: Another option is to use ``pip`` to download and install the latest release from `Python Package Index `_. -To install using ``pip`` into your ``diffpy.structure_env`` environment, we will also have to install dependencies :: - - pip install -r https://raw.githubusercontent.com/diffpy/diffpy.structure/main/requirements/run.txt - -and then install the package :: +To install using ``pip`` into your ``diffpy.structure_env`` environment, type :: pip install diffpy.structure @@ -105,7 +102,7 @@ Support and Contribute `Diffpy user group `_ is the discussion forum for general questions and discussions about the use of diffpy.structure. Please join the diffpy.structure users community by joining the Google group. The diffpy.structure project welcomes your expertise and enthusiasm! -If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. +If you see a bug or want to request a feature, please `report it as an issue `_ and/or `submit a fix as a PR `_. You can also post it to the `Diffpy user group `_. Feel free to fork the project and contribute. To install diffpy.structure in a development mode, with its sources being directly used by Python @@ -130,15 +127,6 @@ Improvements and fixes are always appreciated. Before contribuing, please read our `Code of Conduct `_. -Acknowledgement ---------------- - -Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* -originate from the `pymmlib project `_. - -Less common settings of space groups were generating using the -`Computational Crystallography Toolbox `_. - Contact ------- diff --git a/doc/source/license.rst b/doc/source/license.rst index 39176b12..33a363ae 100644 --- a/doc/source/license.rst +++ b/doc/source/license.rst @@ -22,7 +22,7 @@ Copyright (c) 2014, Australian Synchrotron Research Program Inc., ("ASRP") Copyright (c) 2014-2019, Brookhaven Science Associates, Brookhaven National Laboratory -Copyright (c) 2024, The Trustees of Columbia University in the City of New York. +Copyright (c) 2024, The Trustees of Columbia University in the City of New York. All rights reserved. The "DiffPy-CMI" is distributed subject to the following license conditions: From 89e8b4686caebce54a87c738b6f22c77f4f98a31 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:41:59 -0400 Subject: [PATCH 11/16] Use existing index.rst --- doc/source/index.rst | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/doc/source/index.rst b/doc/source/index.rst index 54ec3695..4fabbaa1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -4,21 +4,57 @@ .. |title| replace:: diffpy.structure documentation -diffpy.structure - Crystal structure container and parsers for structure formats.. +diffpy.structure - Crystal structure container and parsers for structure formats. | Software version |release|. | Last updated |today|. +The diffpy.structure package provides objects for storing atomic +coordinates, displacement parameters and other crystal structure data. +diffpy.structure supports import and export of structure data in several +structure formats such as CIF, PDB, xyz. It provides conversion +between fractional and absolute Cartesian coordinates, functions for +symmetry expansion from asymmetric unit and generation of symmetry +constraints for atom positions and displacement parameters. diffpy.structure +includes definitions of all space groups in over 500 symmetry settings. + ======= Authors ======= -diffpy.structure is developed by Billinge Group -and its community contributors. +diffpy.structure is developed by members of the Billinge Group at +Columbia University and at Brookhaven National Laboratory including +Pavol Juhás, Christopher L. Farrow, Xiaohao Yang, Simon J.L. Billinge. For a detailed list of contributors see https://github.com/diffpy/diffpy.structure/graphs/contributors. +Acknowledgments +=============== + +Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* +originate from the pymmlib project, http://pymmlib.sourceforge.net. +Less common settings of space groups were generating using the +Computational Crystallography Toolbox, +http://cctbx.sourceforge.net. + + +.. index:: citation, reference + +Reference +========= + +If you use this program for a scientific research that leads +to publication, we ask that you acknowledge use of the program +by citing the following paper in your publication: + + P. Juhás, C. L. Farrow, X. Yang, K. R. Knox and S. J. L. Billinge, + `Complex modeling: a strategy and software program for combining + multiple information sources to solve ill posed structure and + nanostructure inverse problems + `__, + *Acta Crystallogr. A* **71**, 562-568 (2015). + ============ Installation ============ @@ -29,6 +65,7 @@ file included with the distribution. ================= Table of contents ================= + .. toctree:: :titlesonly: From 9a93d8ebf9ca4071aade442d64c6bf3597505a49 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:42:59 -0400 Subject: [PATCH 12/16] Add sgroup acknowledgements in readme --- README.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 5ae201ad..076bc7e3 100644 --- a/README.rst +++ b/README.rst @@ -127,6 +127,15 @@ Improvements and fixes are always appreciated. Before contribuing, please read our `Code of Conduct `_. +Acknowledgement +--------------- + +Space group codes in *spacegroupmod.py* and *mmlibspacegroups.py* +originate from the `pymmlib project `_. + +Less common settings of space groups were generating using the +`Computational Crystallography Toolbox `_. + Contact ------- From 2e992d9fa8505bef99561a8feba7adf429c7050c Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:48:19 -0400 Subject: [PATCH 13/16] Remove older import tests --- tests/test_oldimports.py | 77 ---------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 tests/test_oldimports.py diff --git a/tests/test_oldimports.py b/tests/test_oldimports.py deleted file mode 100644 index 9c6ff11d..00000000 --- a/tests/test_oldimports.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -############################################################################## -# -# diffpy.structure Complex Modeling Initiative -# (c) 2017 Brookhaven Science Associates, -# Brookhaven National Laboratory. -# All rights reserved. -# -# File coded by: Pavol Juhas -# -# See AUTHORS.txt for a list of people who contributed. -# See LICENSE.txt for license information. -# -############################################################################## - -""" -Unit tests for imports of old camel-case names. -""" - - -import importlib -import sys -import unittest -import warnings - -import diffpy - -# ---------------------------------------------------------------------------- - - -class TestOldImports(unittest.TestCase): - - @classmethod - def setUpClass(cls): - "Uncache any already-imported old modules." - for modname in tuple(sys.modules): - if modname.startswith("diffpy.Structure"): - del sys.modules[modname] # pragma: no cover - return - - def test_00TopImport(self): - """check import of diffpy.Structure""" - with warnings.catch_warnings(): - warnings.simplefilter("ignore", category=DeprecationWarning) - import diffpy.Structure as m0 - self.assertIs(diffpy.structure, m0) - # second import should raise no warning - with warnings.catch_warnings(): - warnings.simplefilter("error") - import diffpy.Structure as m1 - self.assertIs(diffpy.structure, m1) - return - - def test_O1SubmoduleImport(self): - """check import of diffpy.Structure submodules.""" - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", category=DeprecationWarning) - import diffpy.Structure.SymmetryUtilities as symutil - - self.assertIs(DeprecationWarning, w[0].category) - self.assertIs(diffpy.structure.symmetryutilities, symutil) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always", category=DeprecationWarning) - import diffpy.Structure.Parsers.P_cif as pcif - - self.assertIs(DeprecationWarning, w[0].category) - self.assertIs(diffpy.structure.parsers.p_cif, pcif) - self.assertRaises(ImportError, importlib.import_module, "diffpy.Structure.SSpaceGroups") - return - - -# End of class TestOldImports - -# ---------------------------------------------------------------------------- - -if __name__ == "__main__": - unittest.main() From 4cccb7a18c6cb077e9cb9a441a16c2246675ca59 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:51:13 -0400 Subject: [PATCH 14/16] Add api generated docs --- doc/source/api/diffpy.structure.apps.rst | 1 + .../api/diffpy.structure.example_package.rst | 31 ----- doc/source/api/diffpy.structure.expansion.rst | 1 + doc/source/api/diffpy.structure.parsers.rst | 1 + doc/source/api/diffpy.structure.rst | 107 ++++++++++++++++-- 5 files changed, 101 insertions(+), 40 deletions(-) delete mode 100644 doc/source/api/diffpy.structure.example_package.rst diff --git a/doc/source/api/diffpy.structure.apps.rst b/doc/source/api/diffpy.structure.apps.rst index 8b91adf5..5ac351dd 100644 --- a/doc/source/api/diffpy.structure.apps.rst +++ b/doc/source/api/diffpy.structure.apps.rst @@ -26,3 +26,4 @@ diffpy.structure.apps.anyeye module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.example_package.rst b/doc/source/api/diffpy.structure.example_package.rst deleted file mode 100644 index 3595000a..00000000 --- a/doc/source/api/diffpy.structure.example_package.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _example_package documentation: - -|title| -======= - -.. |title| replace:: diffpy.structure.example_package package - -.. automodule:: diffpy.structure.example_package - :members: - :undoc-members: - :show-inheritance: - -|foo| ------ - -.. |foo| replace:: diffpy.structure.example_package.foo module - -.. automodule:: diffpy.structure.example_package.foo - :members: - :undoc-members: - :show-inheritance: - -|bar| ------ - -.. |bar| replace:: diffpy.structure.example_package.bar module - -.. automodule:: diffpy.structure.example_package.foo - :members: - :undoc-members: - :show-inheritance: diff --git a/doc/source/api/diffpy.structure.expansion.rst b/doc/source/api/diffpy.structure.expansion.rst index 34529fcd..afce983c 100644 --- a/doc/source/api/diffpy.structure.expansion.rst +++ b/doc/source/api/diffpy.structure.expansion.rst @@ -34,3 +34,4 @@ diffpy.structure.expansion.supercell_mod module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.parsers.rst b/doc/source/api/diffpy.structure.parsers.rst index 74a27bcb..54a88f2e 100644 --- a/doc/source/api/diffpy.structure.parsers.rst +++ b/doc/source/api/diffpy.structure.parsers.rst @@ -90,3 +90,4 @@ diffpy.structure.parsers.p_xyz module :members: :undoc-members: :show-inheritance: + diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index cdcc80ea..eb13f679 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -1,9 +1,7 @@ :tocdepth: -1 -|title| -======= - -.. |title| replace:: diffpy.structure package +diffpy.structure package +======================== .. automodule:: diffpy.structure :members: @@ -14,17 +12,108 @@ Subpackages ----------- .. toctree:: - diffpy.structure.example_package + :titlesonly: + + diffpy.structure.parsers + diffpy.structure.expansion + diffpy.structure.apps Submodules ---------- -|module| --------- +diffpy.structure.spacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.spacegroups + :members: + :undoc-members: + :show-inheritance: -.. |module| replace:: diffpy.structure.example_submodule module +diffpy.structure._legacy_importer module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. automodule:: diffpy.structure.example_submodule +.. automodule:: diffpy.structure._legacy_importer :members: :undoc-members: :show-inheritance: + +diffpy.structure.structureerrors module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.structureerrors + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.spacegroupmod module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.spacegroupmod + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.utils module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.utils + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.lattice module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.lattice + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.structure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.structure + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.mmlibspacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.mmlibspacegroups + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.symmetryutilities module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.symmetryutilities + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.atom module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.atom + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.pdffitstructure module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.pdffitstructure + :members: + :undoc-members: + :show-inheritance: + +diffpy.structure.sgtbxspacegroups module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. automodule:: diffpy.structure.sgtbxspacegroups + :members: + :undoc-members: + :show-inheritance: + From d3d5456af8a6a3b256f2837af3562aa41fbc86de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:53:16 +0000 Subject: [PATCH 15/16] [pre-commit.ci] auto fixes from pre-commit hooks --- doc/source/api/diffpy.structure.apps.rst | 1 - doc/source/api/diffpy.structure.expansion.rst | 1 - doc/source/api/diffpy.structure.parsers.rst | 1 - doc/source/api/diffpy.structure.rst | 1 - 4 files changed, 4 deletions(-) diff --git a/doc/source/api/diffpy.structure.apps.rst b/doc/source/api/diffpy.structure.apps.rst index 5ac351dd..8b91adf5 100644 --- a/doc/source/api/diffpy.structure.apps.rst +++ b/doc/source/api/diffpy.structure.apps.rst @@ -26,4 +26,3 @@ diffpy.structure.apps.anyeye module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.expansion.rst b/doc/source/api/diffpy.structure.expansion.rst index afce983c..34529fcd 100644 --- a/doc/source/api/diffpy.structure.expansion.rst +++ b/doc/source/api/diffpy.structure.expansion.rst @@ -34,4 +34,3 @@ diffpy.structure.expansion.supercell_mod module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.parsers.rst b/doc/source/api/diffpy.structure.parsers.rst index 54a88f2e..74a27bcb 100644 --- a/doc/source/api/diffpy.structure.parsers.rst +++ b/doc/source/api/diffpy.structure.parsers.rst @@ -90,4 +90,3 @@ diffpy.structure.parsers.p_xyz module :members: :undoc-members: :show-inheritance: - diff --git a/doc/source/api/diffpy.structure.rst b/doc/source/api/diffpy.structure.rst index eb13f679..95ff1285 100644 --- a/doc/source/api/diffpy.structure.rst +++ b/doc/source/api/diffpy.structure.rst @@ -116,4 +116,3 @@ diffpy.structure.sgtbxspacegroups module :members: :undoc-members: :show-inheritance: - From 866aa7de0508e3af26ae8193667e49587f695763 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Mon, 23 Sep 2024 19:56:28 -0400 Subject: [PATCH 16/16] Add news item of recut.rst --- news/recut.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/recut.rst diff --git a/news/recut.rst b/news/recut.rst new file mode 100644 index 00000000..973fc92b --- /dev/null +++ b/news/recut.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Recookiecut package to the group standard + +**Security:** + +*