Skip to content

Commit 94de735

Browse files
authored
RELEASE v0.2.0 (#7)
* Backport fix by Danny from main code * Update CMakeList for new Eigen syntax * Update logs for v0.2 * Pin pybind to 3.0.1 to avoid crosscompiling bug * Update release.py * Update CI release script * Remove CI run on release publishing
1 parent 30646b5 commit 94de735

6 files changed

Lines changed: 37 additions & 17 deletions

File tree

.github/workflows/build_python.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
pull_request:
88
branches: [main]
99
types: [opened, reopened, synchronize]
10-
release:
11-
types: [published]
1210
workflow_dispatch:
1311

1412
concurrency :
@@ -31,9 +29,13 @@ jobs:
3129
- uses: mamba-org/setup-micromamba@v1
3230
with:
3331
cache-downloads: true
32+
- name: Tag if release
33+
if: contains(github.event.pull_request.title, 'RELEASE')
34+
run: |
35+
git tag $(python release.py --version_check)
3436
- name: Build wheels
3537
run: |
36-
$MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11
38+
$MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11=3.0.1
3739
eval "$($MAMBA_EXE shell activate cibuildwheel)"
3840
python -m pip install cibuildwheel
3941
if [[ $OSTYPE == "linux-gnu" ]]

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
### [v0.2.0](https://github.com/mducle/libmcphase/compare/v0.1.3...v0.2.0)
2+
3+
Add `fitengy` algorithm and refactor physical properties calculations.
4+
Add new webassembly version (runs under Pyodide)
5+
6+
* Refactor physical properties into a separate class inherited by `cf1ion` and `ic1ion`.
7+
* This allows heat capacity and magnetisation / susceptibility calculations to both classes.
8+
* Fix constants and units bug in physical properties calculations
9+
* Change behaviour of magnetisation to be consistent with McPhase and not FOCUS/Mantid
10+
That is, M(H) is outputed as the component parallel to H (`M_parallel`) not the
11+
mean-square of individual components.
12+
* Update CMakeFile and switch to using pyproject.toml and scikit-build
13+
* Add `fitengy` algorithm
14+
* Add Fabi normalised parameters and `split2range` function.
15+
16+
117
### [v0.1.3](https://github.com/mducle/libmcphase/compare/v0.1.2...v0.1.3)
218

319
Library / dependencies update

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors:
88
given-names: "Manh Duc"
99
orcid: "https://orcid.org/0000-0003-3012-6053"
1010
title: "libmcphase"
11-
version: "0.1.3"
11+
version: "0.2.0"
1212
date-released: "2024-09-05"
1313
license: "GPL-3.0-only"
1414
repository: "https://github.com/mducle/libmcphase"

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ project(libMcPhase)
33

44
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
55
set(CMAKE_MACOSX_RPATH TRUE)
6-
set(CMAKE_CXX_STANDARD 11)
7-
set(CXX_STANDARD_REQUIRED 11)
6+
set(CMAKE_CXX_STANDARD 14)
7+
set(CXX_STANDARD_REQUIRED 14)
88

99
set(LIBMCPHASE_PYTHON_MODULE libmcphase)
1010

@@ -36,6 +36,9 @@ if (EMSCRIPTEN)
3636
endif()
3737

3838
find_package(Eigen3 REQUIRED NO_MODULE)
39+
if (NOT EIGEN3_INCLUDE_DIR)
40+
get_target_property(EIGEN3_INCLUDE_DIR Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
41+
endif()
3942
include_directories(${EIGEN3_INCLUDE_DIR})
4043
find_package(pybind11 CONFIG)
4144

release.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def main():
1717

1818
if args.version_check:
1919
file_ver, _ = _version_check()
20-
print(f'Version string "{file_ver}" in files match')
20+
print(file_ver)
2121

2222
token = args.token
2323
if token is None and 'GITHUB_TOKEN' in os.environ:
@@ -32,11 +32,10 @@ def main():
3232

3333

3434
def release_github(test=True, create_tag=False, token=None):
35-
rv = subprocess.run([sys.executable, 'setup.py', 'version'], capture_output=True)
36-
__version__ = rv.stdout.decode().split("version': '")[1].split("',")[0]
37-
git_ver = 'v' + __version__
35+
rv = subprocess.run(['git', 'describe', '--tags', '--dirty', '--always'], capture_output=True)
36+
git_ver = rv.stdout.decode()
3837
file_ver, changelog = _version_check()
39-
if '+' in git_ver and create_tag:
38+
if ('-' in git_ver or '+' in git_ver) and create_tag:
4039
# Not in a release, create a new tag
4140
rv = subprocess.run(['git', 'tag', file_ver], capture_output=True)
4241
if rv.returncode != 0:
@@ -45,7 +44,7 @@ def release_github(test=True, create_tag=False, token=None):
4544
elif git_ver != file_ver:
4645
raise Exception(f'version mismatch! __version__: {git_ver}; files: {file_ver}')
4746

48-
desc = re.search('# \[v[0-9\.]*\]\(http.*?\)\n(.*?)# \[v[0-9\.]*\]', changelog,
47+
desc = re.search(r'# \[v[0-9\.]*\]\(http.*?\)\n(.*?)# \[v[0-9\.]*\]', changelog,
4948
re.DOTALL | re.MULTILINE).groups()[0].strip()
5049
payload = {
5150
"tag_name": git_ver,
@@ -62,7 +61,7 @@ def release_github(test=True, create_tag=False, token=None):
6261
if not upload_url:
6362
upload_url = _create_gh_release(payload, token)
6463
else:
65-
upload_url = re.search('^(.*)\{\?', upload_url).groups()[0]
64+
upload_url = re.search(r'^(.*)\{\?', upload_url).groups()[0]
6665
_upload_assets(upload_url, token)
6766

6867

@@ -126,7 +125,7 @@ def _version_check():
126125
changelog = f.read()
127126
with open('CITATION.cff') as f:
128127
citation = f.read()
129-
cl_ver = re.findall('# \[(.*)\]\(http', changelog)[0]
128+
cl_ver = re.findall(r'# \[(.*)\]\(http', changelog)[0]
130129
cit_ver = 'v' + re.findall('\nversion: "(.*)"', citation)[0]
131130
if cl_ver != cit_ver:
132131
raise Exception(f'version mismatch! CHANGELOG.md: {cl_ver}; CITATION.cff: {cit_ver}')
@@ -143,7 +142,7 @@ def _create_gh_release(payload, token):
143142
print(response.text)
144143
if response.status_code != 201:
145144
raise RuntimeError('Could not create release')
146-
upload_url = re.search('^(.*)\{\?', json.loads(response.text)['upload_url']).groups()[0]
145+
upload_url = re.search(r'^(.*)\{\?', json.loads(response.text)['upload_url']).groups()[0]
147146
return upload_url
148147

149148

src/singleion/racah.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ double racah::ninej(int j1, int j2, int J12, int j3, int j4, int J34, int J13, i
211211
double out = 0.;
212212

213213
// Finds the allowed values of g
214-
min_g = G[0]; for(g=1; g<3; g++) if(G[g]<min_g) min_g = G[g];
215-
max_g = G[3]; for(g=4; g<6; g++) if(G[g]>max_g) max_g = G[g];
214+
min_g = G[0]; for(g=1; g<3; g++) if(G[g]>min_g) min_g = G[g];
215+
max_g = G[3]; for(g=4; g<6; g++) if(G[g]<max_g) max_g = G[g];
216216
for(g=min_g; g<=max_g; g++) // g==2g, as all integers here represents twice their values (to accomodate half integral values).
217217
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);
218218

0 commit comments

Comments
 (0)