Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernization: CI and numpy 2.0 #254

Merged
merged 15 commits into from
Jul 18, 2024
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
86 changes: 0 additions & 86 deletions .cirrus.yml

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
matrix:
buildplat:
- [ubuntu-20.04, manylinux, x86_64]
- [ubuntu-20.04, manylinux, aarch64]
- [macos-12, macosx, x86_64]
- [macos-12, macosx, arm64]
- [windows-2019, win, AMD64]

python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
Expand All @@ -35,6 +37,11 @@ jobs:
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}

steps:
- if: matrix.buildplat[2] == 'aarch64'
uses: docker/setup-qemu-action@v3
with:
platforms: all

- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down
8 changes: 7 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Change log
==========

v1.0.0 (24Jan24)
v1.1.0 (not yet released)
-------------------------

- Fixes for recent ASE and numpy 2.0
- Fix correct number of cores for quad of dissociated dislocations

v1.0.0 (24Jan24)
----------------

- JOSS paper!
- Significant updates documentation packages
- Displacement field and associated deformation tensors for dislocations in anisotropic elastic media
Expand Down
30 changes: 13 additions & 17 deletions c/angle_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@
#include <Python.h>
#define PY_ARRAY_UNIQUE_SYMBOL MATSCIPY_ARRAY_API
#define NO_IMPORT_ARRAY
#define NPY_NO_DEPRECATED_API NPY_1_5_API_VERSION
#define NPY_NO_DEPRECATED_API NPY_2_0_API_VERSION
#include <numpy/arrayobject.h>

#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#include <cmath>
#endif

#include "angle_distribution.h"

#define M_PI ((double)3.14159265358979323846) /* pi */

/*
* Compute bond angle distribution
*/
Expand All @@ -47,25 +44,25 @@ py_angle_distribution(PyObject *self, PyObject *args)
&j_arr, &PyArray_Type, &r_arr, &nbins, &cutoff))
return NULL;

if (PyArray_NDIM(i_arr) != 1 || PyArray_TYPE(i_arr) != NPY_INT) {
if (PyArray_NDIM((PyArrayObject *) i_arr) != 1 || PyArray_TYPE((PyArrayObject *) i_arr) != NPY_INT) {
PyErr_SetString(PyExc_TypeError, "First argument needs to be one-dimensional "
"integer array.");
return NULL;
}
if (PyArray_NDIM(j_arr) != 1 || PyArray_TYPE(j_arr) != NPY_INT) {
if (PyArray_NDIM((PyArrayObject *) j_arr) != 1 || PyArray_TYPE((PyArrayObject *) j_arr) != NPY_INT) {
PyErr_SetString(PyExc_TypeError, "Second argument needs to be one-dimensional "
"integer array.");
return NULL;
}
if (PyArray_NDIM(r_arr) != 2 || PyArray_DIM(r_arr, 1) != 3 ||
PyArray_TYPE(r_arr) != NPY_DOUBLE) {
if (PyArray_NDIM((PyArrayObject *) r_arr) != 2 || PyArray_DIM((PyArrayObject *) r_arr, 1) != 3 ||
PyArray_TYPE((PyArrayObject *) r_arr) != NPY_DOUBLE) {
PyErr_SetString(PyExc_TypeError, "Third argument needs to be two-dimensional "
"double array.");
return NULL;
}

npy_intp npairs = PyArray_DIM(i_arr, 0);
if (PyArray_DIM(j_arr, 0) != npairs || PyArray_DIM(r_arr, 0) != npairs) {
npy_intp npairs = PyArray_DIM((PyArrayObject *) i_arr, 0);
if (PyArray_DIM((PyArrayObject *) j_arr, 0) != npairs || PyArray_DIM((PyArrayObject *) r_arr, 0) != npairs) {
PyErr_SetString(PyExc_RuntimeError, "First three arguments need to be arrays of "
"identical length.");
return NULL;
Expand All @@ -75,11 +72,10 @@ py_angle_distribution(PyObject *self, PyObject *args)
PyObject *h_arr = PyArray_ZEROS(1, &dim, NPY_INT, 1);
PyObject *tmp_arr = PyArray_ZEROS(1, &dim, NPY_INT, 1);

npy_int *i = (npy_int*)PyArray_DATA(i_arr);
npy_int *j = (npy_int*)PyArray_DATA(j_arr);
double *r = (double*)PyArray_DATA(r_arr);
npy_int *h = (npy_int*)PyArray_DATA(h_arr);
npy_int *tmp = (npy_int*)PyArray_DATA(tmp_arr);
npy_int *i = (npy_int*)PyArray_DATA((PyArrayObject *) i_arr);
double *r = (double*)PyArray_DATA((PyArrayObject *) r_arr);
npy_int *h = (npy_int*)PyArray_DATA((PyArrayObject *) h_arr);
npy_int *tmp = (npy_int*)PyArray_DATA((PyArrayObject *) tmp_arr);

npy_int last_i = i[0], i_start = 0;
memset(tmp, 0, nbins*sizeof(npy_int));
Expand Down
Loading
Loading