diff --git a/.github/workflows/build_python.yml b/.github/workflows/build_python.yml index aff6ef5..6951b7c 100644 --- a/.github/workflows/build_python.yml +++ b/.github/workflows/build_python.yml @@ -7,8 +7,6 @@ on: pull_request: branches: [main] types: [opened, reopened, synchronize] - release: - types: [published] workflow_dispatch: concurrency : @@ -31,9 +29,13 @@ jobs: - uses: mamba-org/setup-micromamba@v1 with: cache-downloads: true + - name: Tag if release + if: contains(github.event.pull_request.title, 'RELEASE') + run: | + git tag $(python release.py --version_check) - name: Build wheels run: | - $MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11 + $MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11=3.0.1 eval "$($MAMBA_EXE shell activate cibuildwheel)" python -m pip install cibuildwheel if [[ $OSTYPE == "linux-gnu" ]] diff --git a/CHANGELOG.md b/CHANGELOG.md index 13ed9fc..54c495b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +### [v0.2.0](https://github.com/mducle/libmcphase/compare/v0.1.3...v0.2.0) + +Add `fitengy` algorithm and refactor physical properties calculations. +Add new webassembly version (runs under Pyodide) + +* Refactor physical properties into a separate class inherited by `cf1ion` and `ic1ion`. +* This allows heat capacity and magnetisation / susceptibility calculations to both classes. +* Fix constants and units bug in physical properties calculations +* Change behaviour of magnetisation to be consistent with McPhase and not FOCUS/Mantid + That is, M(H) is outputed as the component parallel to H (`M_parallel`) not the + mean-square of individual components. +* Update CMakeFile and switch to using pyproject.toml and scikit-build +* Add `fitengy` algorithm +* Add Fabi normalised parameters and `split2range` function. + + ### [v0.1.3](https://github.com/mducle/libmcphase/compare/v0.1.2...v0.1.3) Library / dependencies update diff --git a/CITATION.cff b/CITATION.cff index 2424b2d..4d85146 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ authors: given-names: "Manh Duc" orcid: "https://orcid.org/0000-0003-3012-6053" title: "libmcphase" -version: "0.1.3" +version: "0.2.0" date-released: "2024-09-05" license: "GPL-3.0-only" repository: "https://github.com/mducle/libmcphase" diff --git a/CMakeLists.txt b/CMakeLists.txt index bb55f4a..1d47116 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(libMcPhase) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set(CMAKE_MACOSX_RPATH TRUE) -set(CMAKE_CXX_STANDARD 11) -set(CXX_STANDARD_REQUIRED 11) +set(CMAKE_CXX_STANDARD 14) +set(CXX_STANDARD_REQUIRED 14) set(LIBMCPHASE_PYTHON_MODULE libmcphase) @@ -36,6 +36,9 @@ if (EMSCRIPTEN) endif() find_package(Eigen3 REQUIRED NO_MODULE) +if (NOT EIGEN3_INCLUDE_DIR) + get_target_property(EIGEN3_INCLUDE_DIR Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES) +endif() include_directories(${EIGEN3_INCLUDE_DIR}) find_package(pybind11 CONFIG) diff --git a/release.py b/release.py index 49f9550..69012ed 100644 --- a/release.py +++ b/release.py @@ -17,7 +17,7 @@ def main(): if args.version_check: file_ver, _ = _version_check() - print(f'Version string "{file_ver}" in files match') + print(file_ver) token = args.token if token is None and 'GITHUB_TOKEN' in os.environ: @@ -32,11 +32,10 @@ def main(): def release_github(test=True, create_tag=False, token=None): - rv = subprocess.run([sys.executable, 'setup.py', 'version'], capture_output=True) - __version__ = rv.stdout.decode().split("version': '")[1].split("',")[0] - git_ver = 'v' + __version__ + rv = subprocess.run(['git', 'describe', '--tags', '--dirty', '--always'], capture_output=True) + git_ver = rv.stdout.decode() file_ver, changelog = _version_check() - if '+' in git_ver and create_tag: + if ('-' in git_ver or '+' in git_ver) and create_tag: # Not in a release, create a new tag rv = subprocess.run(['git', 'tag', file_ver], capture_output=True) if rv.returncode != 0: @@ -45,7 +44,7 @@ def release_github(test=True, create_tag=False, token=None): elif git_ver != file_ver: raise Exception(f'version mismatch! __version__: {git_ver}; files: {file_ver}') - desc = re.search('# \[v[0-9\.]*\]\(http.*?\)\n(.*?)# \[v[0-9\.]*\]', changelog, + desc = re.search(r'# \[v[0-9\.]*\]\(http.*?\)\n(.*?)# \[v[0-9\.]*\]', changelog, re.DOTALL | re.MULTILINE).groups()[0].strip() payload = { "tag_name": git_ver, @@ -62,7 +61,7 @@ def release_github(test=True, create_tag=False, token=None): if not upload_url: upload_url = _create_gh_release(payload, token) else: - upload_url = re.search('^(.*)\{\?', upload_url).groups()[0] + upload_url = re.search(r'^(.*)\{\?', upload_url).groups()[0] _upload_assets(upload_url, token) @@ -126,7 +125,7 @@ def _version_check(): changelog = f.read() with open('CITATION.cff') as f: citation = f.read() - cl_ver = re.findall('# \[(.*)\]\(http', changelog)[0] + cl_ver = re.findall(r'# \[(.*)\]\(http', changelog)[0] cit_ver = 'v' + re.findall('\nversion: "(.*)"', citation)[0] if cl_ver != cit_ver: raise Exception(f'version mismatch! CHANGELOG.md: {cl_ver}; CITATION.cff: {cit_ver}') @@ -143,7 +142,7 @@ def _create_gh_release(payload, token): print(response.text) if response.status_code != 201: raise RuntimeError('Could not create release') - upload_url = re.search('^(.*)\{\?', json.loads(response.text)['upload_url']).groups()[0] + upload_url = re.search(r'^(.*)\{\?', json.loads(response.text)['upload_url']).groups()[0] return upload_url diff --git a/src/singleion/racah.cpp b/src/singleion/racah.cpp index 8f12a11..0913597 100644 --- a/src/singleion/racah.cpp +++ b/src/singleion/racah.cpp @@ -211,8 +211,8 @@ double racah::ninej(int j1, int j2, int J12, int j3, int j4, int J34, int J13, i double out = 0.; // Finds the allowed values of g - min_g = G[0]; for(g=1; g<3; g++) if(G[g]max_g) max_g = G[g]; + min_g = G[0]; for(g=1; g<3; g++) if(G[g]>min_g) min_g = G[g]; + max_g = G[3]; for(g=4; g<6; g++) if(G[g]