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

Make argument names consistent, update docstring, & add units #240

Merged
merged 30 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3496de2
Make argument names consistent, update docstring, & add units
FarnazH Feb 1, 2024
4b9846d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 1, 2024
73097d7
Add defaults to angular grid __init__
marco-2023 Feb 2, 2024
b235b05
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
6036793
Fix last broken tests
marco-2023 Feb 2, 2024
3e640cb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
ddfd639
Fix notebooks (api changes)
marco-2023 Feb 1, 2024
be11ec9
Remove the default value of None for degrees in AngularGrid
FarnazH Feb 2, 2024
a72a87b
Update the paper notebook
FarnazH Feb 2, 2024
a11cfc0
Fix AtomGrid.from_pruned docstring
FarnazH Feb 2, 2024
8cd24d7
Rename _find_l_for_rad_list for clarity
FarnazH Feb 2, 2024
b5a5605
Rename _get_size_and_degree to _get_degree_and_size
FarnazH Feb 2, 2024
7b491dd
Update docstrings and add units
FarnazH Feb 2, 2024
68c8e0e
Use zip to loop over two arrays
FarnazH Feb 2, 2024
53990b2
Add proper checks to MolGrid.from_pruned
FarnazH Feb 2, 2024
5687778
Make AtomGrid degrees argument non-optional
FarnazH Feb 2, 2024
dbf2dfe
Fix failed tests
FarnazH Feb 2, 2024
0ce1806
Add Python 3.7, 3.8 to pytest git hub actions
Ali-Tehrani Feb 2, 2024
afb9a8e
Add future annotations to fix typing in molgrid
Ali-Tehrani Feb 2, 2024
d6f7351
Fix Ruff linters
Ali-Tehrani Feb 2, 2024
d605e4c
Fix python 3.7 problem with test_cubic
Ali-Tehrani Feb 2, 2024
dc903eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
8596ddc
Fix ruff import unordered
Ali-Tehrani Feb 2, 2024
144f425
Update Angular grid notebook
Ali-Tehrani Feb 2, 2024
4fef63c
Update JCP to new API
Ali-Tehrani Feb 2, 2024
455358f
Update Atom Grid Construction to new API
Ali-Tehrani Feb 2, 2024
5f7ca54
New API suggestion for the degree/size dilemma
FarnazH Feb 2, 2024
2235838
Update JCP notebook
marco-2023 Feb 2, 2024
559aad2
Make api changesof degrees
marco-2023 Feb 2, 2024
bb1605d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 2, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]
py: ["3.9", "3.10", "3.11"]
py: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: "actions/checkout@v3"
Expand Down
840 changes: 410 additions & 430 deletions examples/Angular_grid.ipynb

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions examples/Atom_Grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"\n",
"[AtomGrid](https://grid.qcdevs.org/pyapi/grid.atomgrid.html#grid.atomgrid.AtomGrid) constructs an atomic grid by combining a radial and angular components for evaluation, integration, interpolation, and differentiation in three-dimensional (3D) space. In quantum chemistry, this is typically used for computations of atomic properties. However, this is a general purpose grid that can be used for any function in 3D space.\n",
"\n",
"This notebook showcases various functionalities of [AtomGrid](https://grid.qcdevs.org/pyapi/grid.atomgrid.html#grid.atomgrid.AtomGrid). For computing properties on the grid, we use $\\textbf{He}$ in the triplet state ($1s^1 2s^1$) as an example. The corresponding wavefunction is obtained from formatted checkpoint file `\"doc/notebooks/He_t.fchk\"`. The [`qc-iodata`](https://github.com/theochem/iodata) package is used for parsing the wavefuction data from the fchk file, and [`qc-gbasis`](https://github.com/theochem/gbasis) package is used for analytical evaluation of various properties in the grid.\n"
"This notebook showcases various functionalities of [AtomGrid](https://grid.qcdevs.org/pyapi/grid.atomgrid.html#grid.atomgrid.AtomGrid). For computing properties on the grid, we use $\\textbf{He}$ in the triplet state ($1s^1 2s^1$) as an example. The corresponding wavefunction is obtained from formatted checkpoint file `\"doc/notebooks/He_t.fchk\"`. The [qc-iodata](https://github.com/theochem/iodata) package is used for parsing the wavefuction data from the fchk file, and [qc-gbasis](https://github.com/theochem/gbasis) package is used for analytical evaluation of various properties in the grid.\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -57,12 +57,12 @@
"\n",
"There are multiple ways to construct an atomic grid, for a complete description see the [Atomic_Grid_Construction.ipynb]().\n",
"\n",
"Here we construct an atomic grid from a radial grid instance and the degrees of the angular grid centered at the position of $\\textbf{He}$ nucleus. The radial grid is constructed by specifying the number of radial grid points. For more details on the radial and angular grids see [Radial_Grid.ipynb]() and [Angular_Grid.ipynb]().\n"
"Here we construct an atomic grid from a radial grid instance and the degrees of the angular grid centered at the position of $\\textbf{He}$ nucleus. The radial grid is constructed by specifying the number of radial grid points. For more details on the radial and angular grids see [One_dimensional_grids.ipynb](https://grid.qcdevs.org/notebooks/one_dimensional_grids.html) and [Angular_Grid.ipynb](https://grid.qcdevs.org/notebooks/angular_grid.html).\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -112,12 +112,12 @@
"source": [
"### Example: Integrate Electron Density\n",
"\n",
"To integrate a scalar function over the atomic grid, we first need to evaluate the function on the grid points. Here, we compute the electron density $\\rho(\\mathbf{r})$ of the $\\textbf{He}$ in the triplet state ($1s^1 2s^1$) using the [`gbasis.evals.density`]() function of the [`qc-gbasis`](https://github.com/theochem/gbasis) package. The wavefunction data are loaded from the formatted checkpoint file using [`load_one`](https://iodata.readthedocs.io/en/latest/pyapi/iodata.api.html#iodata.api.load_one) function of [`qc-iodata`](https://github.com/theochem/iodata)package. The density values are then integrated using the [`AtomGrid.integrate`](https://grid.qcdevs.org/pyapi/grid.basegrid.html#grid.basegrid.Grid.integrate) method.\n"
"To integrate a scalar function over the atomic grid, we first need to evaluate the function on the grid points. Here, we compute the electron density $\\rho(\\mathbf{r})$ of the $\\textbf{He}$ in the triplet state ($1s^1 2s^1$) using the [gbasis.evals.density](https://gbasis.qcdevs.org/_autosummary/gbasis.evals.html#gbasis.evals.density.evaluate_density) function of the [qc-gbasis](https://github.com/theochem/gbasis) package. The wavefunction data are loaded from the formatted checkpoint file using [load_one](https://iodata.readthedocs.io/en/latest/pyapi/iodata.api.html#iodata.api.load_one) function of [qc-iodata](https://github.com/theochem/iodata)package. The density values are then integrated using the [AtomGrid.integrate](https://grid.qcdevs.org/pyapi/grid.basegrid.html#grid.basegrid.Grid.integrate) method.\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -171,7 +171,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -222,12 +222,12 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"To identify the local maxima of radial electron density and corresponding radii, the [`scipy.signal.find_peaks`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html) is used.\n"
"To identify the local maxima of radial electron density and corresponding radii, the [scipy.signal.find_peaks](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html) is used.\n"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -265,7 +265,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -300,12 +300,12 @@
"$$\n",
"\n",
"where $\\mathbf{r}$ and $w(\\mathbf{r})$ represent the coordinates and weights of grid points.\n",
"When $i = j$, the denominator is zero denominator and the energy is undefined. To ensure that grid points do not coincide, different grids are used for $\\mathbf{r}_i$ and $\\mathbf{r}_j$ within the same spatial domain. This can be easily done by introducing a second atomic grid with different angular degree or one less radial grid points. The electron density values on this second grid can be either directly computed or obtained by interpolating from the values on the first grid using the [`AtomGrid.interpolate`](https://grid.qcdevs.org/pyapi/grid.atomgrid.html#grid.atomgrid.AtomGrid.interpolate) method.\n"
"When $i = j$, the denominator is zero denominator and the energy is undefined. To ensure that grid points do not coincide, different grids are used for $\\mathbf{r}_i$ and $\\mathbf{r}_j$ within the same spatial domain. This can be easily done by introducing a second atomic grid with different angular degree or one less radial grid points. The electron density values on this second grid can be either directly computed or obtained by interpolating from the values on the first grid using the [AtomGrid.interpolate](https://grid.qcdevs.org/pyapi/grid.atomgrid.html#grid.atomgrid.AtomGrid.interpolate) method.\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand Down
74 changes: 33 additions & 41 deletions examples/Atom_Grid_Construction.ipynb

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions examples/Interpolation_and_Poisson.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-08T20:58:10.192004233Z",
Expand All @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-08T20:58:10.461254804Z",
Expand All @@ -80,12 +80,12 @@
"btf = BeckeRTransform(rmin=1e-30, R=1.5)\n",
"radial = btf.transform_1d_grid(oned)\n",
"degree = 29\n",
"atgrid = AtomGrid.from_pruned(radial, 1, sectors_r=[], sectors_degree=[degree], center=center)"
"atgrid = AtomGrid.from_pruned(radial, 1, r_sectors=[], d_sectors=[degree], center=center)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-08T20:58:10.840072685Z",
Expand All @@ -99,11 +99,11 @@
"output_type": "stream",
"text": [
"Error difference between interpolation and true:\n",
"[1.89178096e-11 5.27372802e-11 5.82772147e-11 4.10898563e-15\n",
" 1.64881470e-11 2.55238009e-11 1.29296147e-12 2.59097473e-12\n",
" 2.75023420e-10 5.08640456e-11 8.28065238e-12 7.54837099e-10\n",
" 2.51240298e-11 6.69289698e-12 2.82764424e-11 2.35286288e-11\n",
" 4.27065323e-11 3.41960277e-11 5.42822891e-11 5.25577287e-11]\n"
"[5.50204594e-11 4.97960712e-11 9.96328462e-11 1.50277207e-11\n",
" 3.25926654e-11 2.01591117e-11 3.26607444e-11 8.44455422e-11\n",
" 4.00808614e-11 5.06480266e-10 7.52775412e-11 3.48676058e-11\n",
" 4.13636728e-11 1.11618694e-11 4.14768677e-11 4.12894238e-11\n",
" 7.26674645e-11 8.43535809e-11 5.25728962e-11 6.84093102e-11]\n"
]
}
],
Expand Down Expand Up @@ -150,7 +150,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2024-01-08T20:58:17.855028023Z",
Expand All @@ -164,8 +164,8 @@
"output_type": "stream",
"text": [
"The maximum error: 1.4653770128456663e-06\n",
"The mean error: 1.1070838082589734e-06\n",
"The standard dev: 4.6000482348200205e-07\n"
"The mean error: 1.1070838082577226e-06\n",
"The standard dev: 4.600048234819135e-07\n"
]
}
],
Expand Down Expand Up @@ -211,14 +211,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading
Loading