Skip to content

Commit

Permalink
Update gauss-quad to 0.2 (#261)
Browse files Browse the repository at this point in the history
* Update `gauss-quad` to version 0.2.

* `cargo fmt` only my changes.
  • Loading branch information
JSorngard authored Nov 24, 2024
1 parent 950a96e commit 3b7579c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion feos-dft/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rustdct = "0.7"
rustfft = "6.0"
num-traits = "0.2"
libm = "0.2"
gauss-quad = { version = "0.1", optional = true }
gauss-quad = { version = "0.2", optional = true }
petgraph = "0.6"
typenum = "1.16"
numpy = { version = "0.22", optional = true }
Expand Down
18 changes: 12 additions & 6 deletions feos-dft/src/adsorption/fea_potential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ pub fn calculate_fea_potential(
(nodes, weights)
}
Geometry::Spherical | Geometry::Cylindrical => {
let nodes = PI + Array1::from_vec(GaussLegendre::nodes_and_weights(n_grid[0]).0) * PI;
let weights = Array1::from_vec(GaussLegendre::nodes_and_weights(n_grid[0]).1) * PI;
let (unscaled_nodes, unscaled_weights) =
GaussLegendre::new(n_grid[0]).unwrap().into_iter().unzip();

let nodes = PI + Array1::from_vec(unscaled_nodes) * PI;
let weights = Array1::from_vec(unscaled_weights) * PI;

(nodes, weights)
}
};
Expand All @@ -75,11 +79,13 @@ pub fn calculate_fea_potential(
(nodes, weights)
}
Geometry::Spherical => {
let nodes = PI / 2.0
+ Array1::from_vec(GaussLegendre::nodes_and_weights(n_grid[1]).0) * PI / 2.0;
let weights = Array1::from_vec(GaussLegendre::nodes_and_weights(n_grid[1]).1) * PI
/ 2.0
let (unscaled_nodes, unscaled_weights) =
GaussLegendre::new(n_grid[1]).unwrap().into_iter().unzip();

let nodes = PI / 2.0 + Array1::from_vec(unscaled_nodes) * PI / 2.0;
let weights = Array1::from_vec(unscaled_weights) * PI / 2.0
* Array1::from_shape_fn(n_grid[1], |i| nodes[i].sin());

(nodes, weights)
}
};
Expand Down

0 comments on commit 3b7579c

Please sign in to comment.