Skip to content

Commit 04aa3c2

Browse files
committed
add radial_grid_lmg_bse which can accept basis set name
1 parent 34fae67 commit 04aa3c2

File tree

5 files changed

+56
-41
lines changed

5 files changed

+56
-41
lines changed

README.rst

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,6 @@ As an example let us generate a grid for the water molecule:
202202
{0: 0.122, 1: 0.727}, # H
203203
]
204204
205-
hardness = 3
206-
207205
for center_index in range(len(center_coordinates_bohr)):
208206
# atom grid using explicit basis set parameters
209207
coordinates, weights = numgrid.atom_grid(
@@ -215,7 +213,7 @@ As an example let us generate a grid for the water molecule:
215213
proton_charges,
216214
center_index,
217215
center_coordinates_bohr,
218-
hardness,
216+
hardness=3,
219217
)
220218
221219
# atom grid using basis set name
@@ -228,32 +226,29 @@ As an example let us generate a grid for the water molecule:
228226
proton_charges,
229227
center_index,
230228
center_coordinates_bohr,
231-
hardness,
229+
hardness=3,
232230
)
233231
234-
# radial grid using explicit basis set parameters
235-
radii, weights = numgrid.radial_grid(
236-
alpha_min[center_index],
237-
alpha_max[center_index],
238-
radial_precision,
239-
proton_charges[center_index],
240-
)
241-
242-
# angular grid with 14 points
243-
coordinates, weights = numgrid.angular_grid(14)
244-
245-
246-
Unreleased functionality
247-
------------------------
248-
249-
These will be released soon but I need to think carefully about the API.
250-
251-
.. code:: python
252-
253-
import numgrid
232+
# radial grid (LMG) using explicit basis set parameters
233+
radii, weights = numgrid.radial_grid_lmg(
234+
alpha_min={0: 0.3023, 1: 0.2753, 2: 1.185},
235+
alpha_max=11720.0,
236+
radial_precision=1.0e-12,
237+
proton_charge=8,
238+
)
239+
240+
# radial grid (LMG) using basis set name
241+
radii, weights = numgrid.radial_grid_lmg_bse(
242+
basis_set="cc-pVDZ",
243+
radial_precision=1.0e-12,
244+
proton_charge=8,
245+
)
254246
255247
# radial grid with 100 points using Krack-Koster approach
256-
radii, weights = numgrid.radial_grid_kk(100)
248+
radii, weights = numgrid.radial_grid_kk(num_points=100)
249+
250+
# angular grid with 14 points
251+
coordinates, weights = numgrid.angular_grid(num_points=14)
257252
258253
259254
Notes and recommendations

example.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
{0: 0.122, 1: 0.727}, # H
2121
]
2222

23-
hardness = 3
24-
2523
for center_index in range(len(center_coordinates_bohr)):
2624
# atom grid using explicit basis set parameters
2725
coordinates, weights = numgrid.atom_grid(
@@ -33,7 +31,7 @@
3331
proton_charges,
3432
center_index,
3533
center_coordinates_bohr,
36-
hardness,
34+
hardness=3,
3735
)
3836

3937
# atom grid using basis set name
@@ -46,19 +44,26 @@
4644
proton_charges,
4745
center_index,
4846
center_coordinates_bohr,
49-
hardness,
47+
hardness=3,
5048
)
5149

52-
# radial grid (LMG) using explicit basis set parameters
53-
radii, weights = numgrid.radial_grid_lmg(
54-
alpha_min[center_index],
55-
alpha_max[center_index],
56-
radial_precision,
57-
proton_charges[center_index],
58-
)
50+
# radial grid (LMG) using explicit basis set parameters
51+
radii, weights = numgrid.radial_grid_lmg(
52+
alpha_min={0: 0.3023, 1: 0.2753, 2: 1.185},
53+
alpha_max=11720.0,
54+
radial_precision=1.0e-12,
55+
proton_charge=8,
56+
)
57+
58+
# radial grid (LMG) using basis set name
59+
radii, weights = numgrid.radial_grid_lmg_bse(
60+
basis_set="cc-pVDZ",
61+
radial_precision=1.0e-12,
62+
proton_charge=8,
63+
)
5964

60-
# radial grid with 100 points using Krack-Koster approach
61-
radii, weights = numgrid.radial_grid_kk(100)
65+
# radial grid with 100 points using Krack-Koster approach
66+
radii, weights = numgrid.radial_grid_kk(num_points=100)
6267

63-
# angular grid with 14 points
64-
coordinates, weights = numgrid.angular_grid(14)
68+
# angular grid with 14 points
69+
coordinates, weights = numgrid.angular_grid(num_points=14)

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ pub use crate::atom::atom_grid_bse;
1616
pub use crate::lebedev::angular_grid;
1717
pub use crate::radial::radial_grid_kk;
1818
pub use crate::radial::radial_grid_lmg;
19+
pub use crate::radial::radial_grid_lmg_bse;

src/python.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::atom::__pyo3_get_function_atom_grid_bse;
66
use crate::lebedev::__pyo3_get_function_angular_grid;
77
use crate::radial::__pyo3_get_function_radial_grid_kk;
88
use crate::radial::__pyo3_get_function_radial_grid_lmg;
9+
use crate::radial::__pyo3_get_function_radial_grid_lmg_bse;
910

1011
#[pymodule]
1112
fn numgrid(_py: Python, m: &PyModule) -> PyResult<()> {
@@ -14,8 +15,9 @@ fn numgrid(_py: Python, m: &PyModule) -> PyResult<()> {
1415
m.add_function(wrap_pyfunction!(atom_grid, m)?)?;
1516
m.add_function(wrap_pyfunction!(atom_grid_bse, m)?)?;
1617
m.add_function(wrap_pyfunction!(angular_grid, m)?)?;
17-
m.add_function(wrap_pyfunction!(radial_grid_lmg, m)?)?;
1818
m.add_function(wrap_pyfunction!(radial_grid_kk, m)?)?;
19+
m.add_function(wrap_pyfunction!(radial_grid_lmg, m)?)?;
20+
m.add_function(wrap_pyfunction!(radial_grid_lmg_bse, m)?)?;
1921

2022
Ok(())
2123
}

src/radial.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use pyo3::prelude::*;
55
use std::collections::HashMap;
66

77
use crate::bragg;
8+
use crate::bse;
89
use crate::parameters;
910
use statrs::function::gamma;
1011

@@ -71,6 +72,17 @@ fn test_radial_grid_kk() {
7172
));
7273
}
7374

75+
#[pyfunction]
76+
pub fn radial_grid_lmg_bse(
77+
basis_set: &str,
78+
radial_precision: f64,
79+
proton_charge: i32,
80+
) -> (Vec<f64>, Vec<f64>) {
81+
let (alpha_min, alpha_max) = bse::ang_min_and_max(basis_set, proton_charge as usize);
82+
83+
radial_grid_lmg(alpha_min, alpha_max, radial_precision, proton_charge)
84+
}
85+
7486
#[pyfunction]
7587
pub fn radial_grid_lmg(
7688
alpha_min: HashMap<usize, f64>,

0 commit comments

Comments
 (0)