Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
release:
types: [published]
workflow_dispatch:

concurrency :
Expand All @@ -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" ]]
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
17 changes: 8 additions & 9 deletions release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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,
Expand All @@ -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)


Expand Down Expand Up @@ -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}')
Expand All @@ -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


Expand Down
4 changes: 2 additions & 2 deletions src/singleion/racah.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]<min_g) min_g = G[g];
max_g = G[3]; for(g=4; g<6; 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]<max_g) max_g = G[g];
for(g=min_g; g<=max_g; g++) // g==2g, as all integers here represents twice their values (to accomodate half integral values).
out += pow(-1.,g) * (g+1) * sixj(j1,j2,J12,J34,J,g) * sixj(j3,j4,J34,j2,g,J24) * sixj(J13,J24,J,g,j1,j3);

Expand Down
Loading