Skip to content

Commit

Permalink
Merge branch 'libAtoms:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
imaliyov authored Jul 25, 2024
2 parents afd27ca + be9ac29 commit 851f9dd
Show file tree
Hide file tree
Showing 29 changed files with 229 additions and 313 deletions.
86 changes: 0 additions & 86 deletions .cirrus.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/paper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
pytest -v --junitxml=report.xml --durations=20
- name: report
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: "**/report.xml"
17 changes: 12 additions & 5 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,29 +37,34 @@ jobs:
IS_32_BIT: ${{ matrix.buildplat[2] == 'x86' }}

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

- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}*
CIBW_ARCHS: ${{ matrix.buildplat[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
CIBW_TEST_COMMAND: python {project}/tests/test_ffi.py

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}

- name: Release wheels
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: wheelhouse/*.whl
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

0 comments on commit 851f9dd

Please sign in to comment.