Skip to content
This repository was archived by the owner on Jul 28, 2022. It is now read-only.

Commit 0413498

Browse files
authored
Remove ndarray-linalg from dependencies (#6)
* Remove ndarray-linalg from dependencies * update Cargo.toml * updates for release
1 parent 2a55bcc commit 0413498

File tree

11 files changed

+163
-37
lines changed

11 files changed

+163
-37
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
jobs:
8+
release-crates-io:
9+
name: Release crates.io
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions-rs/toolchain@v1
14+
with:
15+
profile: minimal
16+
toolchain: stable
17+
override: true
18+
- uses: actions-rs/cargo@v1
19+
with:
20+
command: login
21+
args: ${{ secrets.CRATES_IO_TOKEN }}
22+
- uses: actions-rs/cargo@v1
23+
with:
24+
command: publish

.github/workflows/test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18-
- name: Install openBLAS
19-
run: sudo apt-get install -y libopenblas-dev
2018
- name: Build
2119
run: cargo build --release
2220
- name: Run tests
23-
run: cargo test --release --features="openblas-system"
21+
run: cargo test --release

.github/workflows/wheels.yml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,64 @@ jobs:
1818
maturin-version: latest
1919
manylinux: auto
2020
command: build
21-
args: --release --out dist --no-sdist --cargo-extra-args="--features python --features openblas-static"
21+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
2222
- name: Upload wheels
2323
uses: actions/upload-artifact@v2
2424
with:
2525
name: dist
2626
path: dist
27+
macos:
28+
runs-on: macos-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.9
34+
architecture: x64
35+
- name: Install Rust toolchain
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: stable
39+
profile: minimal
40+
default: true
41+
- name: Build wheels - x86_64
42+
uses: messense/maturin-action@main
43+
with:
44+
target: x86_64
45+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
46+
- name: Build wheels - universal2
47+
uses: messense/maturin-action@main
48+
with:
49+
args: --release --universal2 --out dist --no-sdist -m build_wheel/Cargo.toml
50+
- name: Upload wheels
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: dist
54+
path: dist
55+
windows:
56+
runs-on: windows-latest
57+
strategy:
58+
matrix:
59+
target: [x64, x86]
60+
steps:
61+
- uses: actions/checkout@v2
62+
- uses: actions/setup-python@v2
63+
with:
64+
python-version: 3.9
65+
architecture: ${{ matrix.target }}
66+
- name: Install Rust toolchain
67+
uses: actions-rs/toolchain@v1
68+
with:
69+
toolchain: stable
70+
profile: minimal
71+
default: true
72+
- name: Build wheels
73+
uses: messense/maturin-action@main
74+
with:
75+
target: ${{ matrix.target }}
76+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
77+
- name: Upload wheels
78+
uses: actions/upload-artifact@v2
79+
with:
80+
name: dist
81+
path: dist

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
## [0.1.0] - 2021-12-22
10+
### Added
11+
- Initial release

Cargo.toml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,37 @@
11
[package]
22
name = "feos-dft"
33
version = "0.1.0"
4-
authors = ["Philipp Rehner <rehner@itt.uni-stuttgart.de>"]
4+
authors = ["Philipp Rehner <prehner@ethz.ch>"]
55
edition = "2018"
6+
license = "MIT OR Apache-2.0"
7+
description = "Generic classical DFT implementations for the `feos` project."
8+
homepage = "https://github.com/feos-org"
9+
readme = "README.md"
10+
repository = "https://github.com/feos-org/feos-dft"
11+
keywords = ["physics", "thermodynamics", "interfaces", "adsorption"]
12+
categories = ["science"]
13+
exclude = ["/.github/*", "*.ipynb"]
614

7-
[lib]
8-
name = "feos_dft"
9-
crate-type = ["rlib", "cdylib"]
15+
[package.metadata.docs.rs]
16+
rustdoc-args = [ "--html-in-header", "./docs-header.html" ]
1017

1118
[dependencies]
12-
quantity = "0.3"
19+
quantity = { version = "0.4", features = ["linalg"] }
1320
feos-core = "0.1"
14-
num-dual = "0.3"
21+
num-dual = "0.4"
1522
ndarray = { version = "0.15", features = ["serde", "rayon"] }
16-
ndarray-linalg = "0.14"
1723
ndarray-stats = "0.5"
1824
rustdct = "0.6"
1925
rustfft = "6.0"
2026
log = "0.4"
21-
special-fun = "0.2"
2227
ang = "0.5"
2328
num-traits = "0.2"
24-
numpy = { version = "0.14", optional = true }
2529
libc = "0.2"
2630
gauss-quad = "0.1"
2731
petgraph = "0.6"
28-
29-
[dependencies.pyo3]
30-
version = "0.14"
31-
features = ["extension-module", "abi3", "abi3-py36"]
32-
optional = true
32+
numpy = { version = "0.15", optional = true }
33+
pyo3 = { version = "0.15", optional = true }
3334

3435
[features]
3536
default = []
36-
python = ["pyo3", "numpy", "feos-core/python"]
37-
openblas-system = ["feos-core/openblas-system"]
38-
openblas-static = ["feos-core/openblas-static"]
39-
intel-mkl-system = ["feos-core/intel-mkl-system"]
40-
intel-mkl-static = ["feos-core/intel-mkl-static"]
41-
netlib-system = ["feos-core/netlib-system"]
42-
netlib-static = ["feos-core/netlib-static"]
37+
python = ["pyo3", "numpy", "feos-core/python"]

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
11
# FeOs-DFT
2+
3+
[![crate](https://img.shields.io/crates/v/feos-dft.svg)](https://crates.io/crates/feos-dft)
4+
[![documentation](https://docs.rs/feos-dft/badge.svg)](https://docs.rs/feos-dft)
5+
[![minimum rustc 1.51](https://img.shields.io/badge/rustc-1.51+-red.svg)](https://rust-lang.github.io/rfcs/2495-min-rust-version.html)
6+
7+
Generic classical DFT implementations for the `feos` project.
8+
9+
## Installation
10+
11+
Add this to your `Cargo.toml`
12+
13+
```toml
14+
[dependencies]
15+
feos-dft = "0.1"
16+
```
17+
18+
## Test building python wheel
19+
20+
From within a Python virtual environment with `maturin` installed, type
21+
22+
```
23+
maturin build --release --out dist --no-sdist -m build_wheel/Cargo.toml
24+
```

build_wheel/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "feos_dft"
3+
version = "0.1.0"
4+
authors = ["Philipp Rehner <prehner@ethz.ch"]
5+
edition = "2018"
6+
7+
[lib]
8+
crate-type = ["cdylib"]
9+
10+
[dependencies]
11+
feos-dft = { path = "..", features = ["python"] }
12+
pyo3 = { version = "0.15", features = ["extension-module", "abi3", "abi3-py36"] }
13+

build_wheel/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use feos_dft::python::feos_dft;
2+
use pyo3::prelude::*;
3+
4+
#[pymodule]
5+
pub fn build_wheel(py: Python<'_>, m: &PyModule) -> PyResult<()> {
6+
feos_dft(py, m)
7+
}

examples/FundamentalMeasureTheory.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@
3939
"name": "stdout",
4040
"output_type": "stream",
4141
"text": [
42-
"CPU times: user 8.56 s, sys: 4.3 s, total: 12.9 s\n",
43-
"Wall time: 7.2 s\n"
42+
"CPU times: user 5.22 s, sys: 0 ns, total: 5.22 s\n",
43+
"Wall time: 5.22 s\n"
4444
]
4545
},
4646
{
4747
"data": {
4848
"text/plain": [
49-
"<matplotlib.legend.Legend at 0x7fd0ebb7ff40>"
49+
"<matplotlib.legend.Legend at 0x7f53cf1c8a30>"
5050
]
5151
},
5252
"execution_count": 3,
@@ -180,9 +180,9 @@
180180
],
181181
"metadata": {
182182
"kernelspec": {
183-
"display_name": "feos-dft",
183+
"display_name": "feos",
184184
"language": "python",
185-
"name": "feos-dft"
185+
"name": "feos"
186186
},
187187
"language_info": {
188188
"codemirror_mode": {

src/convolver/transform.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use ndarray::*;
44
use num_dual::*;
55
use rustdct::{DctNum, DctPlanner, TransformType2And3};
66
use rustfft::{num_complex::Complex, Fft, FftPlanner};
7-
use special_fun::FloatSpecial;
87
use std::f64::consts::PI;
98
use std::ops::{DivAssign, SubAssign};
109
use std::rc::Rc;
@@ -250,14 +249,14 @@ impl<T: DualNum<f64> + DctNum + ScalarOperand> PolarTransform<T> {
250249

251250
let mut j = Array1::from_shape_fn(2 * points, |i| {
252251
Complex::from(T::from(
253-
(gamma * x0 * (alpha * ((i + 1) as f64 - points as f64)).exp()).besselj(1.0)
252+
(gamma * x0 * (alpha * ((i + 1) as f64 - points as f64)).exp()).bessel_j1()
254253
/ ((2 * points) as f64),
255254
))
256255
});
257256
ifft.process(j.as_slice_mut().unwrap());
258257
let mut jv = Array1::from_shape_fn(2 * points, |i| {
259258
Complex::from(T::from(
260-
(gamma * x0 * (alpha * ((i + 1) as f64 - points as f64)).exp()).besselj(2.0)
259+
(gamma * x0 * (alpha * ((i + 1) as f64 - points as f64)).exp()).bessel_j2()
261260
/ ((2 * points) as f64),
262261
))
263262
});

0 commit comments

Comments
 (0)