Skip to content

Commit

Permalink
Merge pull request #348 from janosh/typos
Browse files Browse the repository at this point in the history
Fix typos and add `codespell` `pre-commit` hook to catch future typos
  • Loading branch information
atztogo authored Feb 6, 2025
2 parents 1fb5cb4 + a4ae4d0 commit c7c680d
Show file tree
Hide file tree
Showing 58 changed files with 239 additions and 224 deletions.
90 changes: 50 additions & 40 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,55 @@
# See https://pre-commit.com for more informatio
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^example/AlN-LDA/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
exclude: ^example/AlN-LDA/

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks:
- id: ruff
args: [ "--fix", "--show-fixes" ]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4
hooks:
- id: ruff
args: [ "--fix", "--show-fixes" ]
- id: ruff-format

- repo: https://github.com/Takishima/cmake-pre-commit-hooks
rev: v1.9.6
hooks:
- id: clang-format
args:
- '-B_build-pre-commit'
- '-DWITH_Fortran=ON'
- '-DWITH_TESTS=ON'
- '-i'
stages: [manual]
- id: clang-tidy
args:
- '-B_build-pre-commit'
- '-DWITH_Fortran=ON'
- '-DWITH_TESTS=ON'
# - '--'
# - '-I/Users/togo/.miniforge/envs/dev/include'
# - '-I/Users/togo/.miniforge/envs/dev/include/python3.10'
# - '-I/Users/togo/.miniforge/envs/dev/lib/python3.10/site-packages/numpy/core/include'
stages: [manual]
- repo: https://github.com/Takishima/cmake-pre-commit-hooks
rev: v1.9.6
hooks:
- id: clang-format
args:
- "-B_build-pre-commit"
- "-DWITH_Fortran=ON"
- "-DWITH_TESTS=ON"
- "-i"
stages: [manual]
- id: clang-tidy
args:
- "-B_build-pre-commit"
- "-DWITH_Fortran=ON"
- "-DWITH_TESTS=ON"
# "- --"
# "- -I/Users/togo/.miniforge/envs/dev/include"
# "- -I/Users/togo/.miniforge/envs/dev/include/python3.10"
# "- -I/Users/togo/.miniforge/envs/dev/lib/python3.10/site-packages/numpy/core/include"
stages: [manual]

- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
stages: [pre-commit, commit-msg]
args:
- --ignore-words-list
- "te,groth,skelton,inout,mater"
- --check-filenames
2 changes: 1 addition & 1 deletion c/grgrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void grg_get_double_grid_address(int64_t address_double[3],
/* -------------------------------------------------------*/
/* Get address in single grid from address in double grid */
/* -------------------------------------------------------*/
/* This function shifts double-grid adress by PS and divides it by 2. */
/* This function shifts double-grid address by PS and divides it by 2. */
/* No modulo operation is applied to returned single-grid address. */
/* address : Single grid address. */
/* address_double : Double grid address. */
Expand Down
2 changes: 1 addition & 1 deletion c/gridsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ int64_t gridsys_get_thm_relative_grid_address(
return thm_get_relative_grid_address(relative_grid_addresses, rec_lattice);
}

/* relative_grid_addresses are given as P multipled with those from */
/* relative_grid_addresses are given as P multiplied with those from */
/* dataset, i.e., */
/* np.dot(relative_grid_addresses, P.T) */
int64_t gridsys_get_integration_weight(
Expand Down
14 changes: 7 additions & 7 deletions c/gridsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ int64_t gridsys_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
/**
* @brief Return D, P, Q of Smith normal form of A.
*
* @param D_diag Diagonal elements of diagnoal matrix D
* @param D_diag Diagonal elements of diagonal matrix D
* @param P Unimodular matrix P
* @param Q Unimodular matrix Q
* @param A Integer matrix
Expand All @@ -157,7 +157,7 @@ int64_t gridsys_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
* {tilde-R^T}
* @param rotations Original rotations matrices in reciprocal space {R^T}
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @return int64_t
*/
Expand All @@ -174,7 +174,7 @@ int64_t gridsys_transform_rotations(int64_t (*transformed_rots)[3][3],
* array size of prod(D_diag)
* @param rotations Transformed rotation matrices in reciprocal space
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param PS Shift in GR-grid
*/
void gridsys_get_ir_grid_map(int64_t *ir_grid_map,
Expand All @@ -193,7 +193,7 @@ void gridsys_get_ir_grid_map(int64_t *ir_grid_map,
* @param bzg2grg Mapping table of bz_grid_addresses to gr_grid_addresses. In
* type-II, len(bzg2grg) == len(bz_grid_addresses) <= (D_diag[0] + 1) *
* (D_diag[1] + 1) * (D_diag[2] + 1).
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param PS Shift in GR-grid
* @param rec_lattice Reduced reciprocal basis vectors in column vectors
Expand All @@ -211,7 +211,7 @@ int64_t gridsys_get_bz_grid_addresses(
*
* @param bz_grid_index BZ grid point index
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param bz_grid_addresses BZ grid point adddresses
* @param bz_grid_addresses BZ grid point addresses
* @param bz_map List of accumulated numbers of BZ grid points from the
* first GR grid point to the last grid point. In type-II, [0, 1, 3, 4, ...]
* means multiplicities of [1, 2, 1, ...], with len(bz_map)=product(D_diag) + 1.
Expand All @@ -234,7 +234,7 @@ int64_t gridsys_rotate_bz_grid_index(
* @param map_q Mapping table from all grid points to grid point indices of
* irreducible q-points under the stabilizer subgroup of q
* @param grid_index Grid point index of q in GR-grid
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param is_time_reversal With (1) or without (0) time reversal symmetry
* @param num_rot Number of rotation matrices
* @param rec_rotations Transformed rotation matrices in reciprocal space
Expand Down Expand Up @@ -262,7 +262,7 @@ int64_t gridsys_get_triplets_at_q(int64_t *map_triplets, int64_t *map_q,
* @param map_triplets Mapping table from all grid points to grid points of
* independent q'
* @param num_map_triplets First dimension of map_triplets
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param bz_grid_type Data structure type I (old and sparse) or II (new and
* dense, recommended) of bz_map
Expand Down
2 changes: 1 addition & 1 deletion c/imag_self_energy_with_g.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void ise_get_imag_self_energy_with_g(
/**
* g_pos contains the indices of g that are known non-zeros in series.
*
* ise_set_g_pos works for frquency points as bands.
* ise_set_g_pos works for frequency points as bands.
* set_g_pos_frequency_point works for frequency sampling mode.
*/
g_pos = (int64_t(*)[4])malloc(sizeof(int64_t[4]) * num_band_prod);
Expand Down
6 changes: 3 additions & 3 deletions c/phono3py.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ int64_t ph3py_get_BZ_triplets_at_q(
return num_ir;
}

/* relative_grid_addresses are given as P multipled with those from dataset,
/* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
int64_t ph3py_get_integration_weight(
Expand Down Expand Up @@ -601,7 +601,7 @@ void ph3py_get_relative_grid_address(int64_t relative_grid_address[24][4][3],
/* tpi_get_neighboring_grid_points around multiple grid points for using
* openmp
*
* relative_grid_addresses are given as P multipled with those from dataset,
* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
int64_t ph3py_get_neighboring_gird_points(
Expand Down Expand Up @@ -644,7 +644,7 @@ int64_t ph3py_get_neighboring_gird_points(

/* thm_get_integration_weight at multiple grid points for using openmp
*
* relative_grid_addresses are given as P multipled with those from dataset,
* relative_grid_addresses are given as P multiplied with those from dataset,
* i.e.,
* np.dot(relative_grid_addresses, P.T) */
int64_t ph3py_get_thm_integration_weights_at_grid_points(
Expand Down
10 changes: 5 additions & 5 deletions c/recgrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ int64_t recgrid_get_reciprocal_point_group(int64_t rec_rotations[48][3][3],
/**
* @brief Return D, P, Q of Smith normal form of A.
*
* @param D_diag Diagonal elements of diagnoal matrix D
* @param D_diag Diagonal elements of diagonal matrix D
* @param P Unimodular matrix P
* @param Q Unimodular matrix Q
* @param A Integer matrix
Expand All @@ -215,7 +215,7 @@ int64_t recgrid_get_snf3x3(int64_t D_diag[3], int64_t P[3][3], int64_t Q[3][3],
* {tilde-R^T}
* @param rotations Original rotations matrices in reciprocal space {R^T}
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @return int64_t
*/
Expand All @@ -232,7 +232,7 @@ int64_t recgrid_transform_rotations(int64_t (*transformed_rots)[3][3],
* array size of prod(D_diag)
* @param rotations Transformed rotation matrices in reciprocal space
* @param num_rot Number of rotation matrices
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param PS Shift in GR-grid
* @return int64_t Number of ir_grid_points.
*/
Expand All @@ -252,7 +252,7 @@ int64_t recgrid_get_ir_grid_map(int64_t *ir_grid_map,
* @param bzg2grg Mapping table of bz_grid_addresses to gr_grid_addresses. In
* type-II, len(bzg2grg) == len(bz_grid_addresses) <= (D_diag[0] + 1) *
* (D_diag[1] + 1) * (D_diag[2] + 1).
* @param D_diag Diagonal elements of diagnoal matrix D of Smith normal form
* @param D_diag Diagonal elements of diagonal matrix D of Smith normal form
* @param Q Unimodular matrix Q of Smith normal form
* @param PS Shift in GR-grid
* @param rec_lattice Reduced reciprocal basis vectors in column vectors
Expand All @@ -270,7 +270,7 @@ int64_t recgrid_get_bz_grid_addresses(
*
* @param bz_grid_index BZ grid point index
* @param rotation Transformed rotation in reciprocal space tilde-R^T
* @param bz_grid_addresses BZ grid point adddresses
* @param bz_grid_addresses BZ grid point addresses
* @param bz_map List of accumulated numbers of BZ grid points from the
* first GR grid point to the last grid point. In type-II, [0, 1, 3, 4, ...]
* means multiplicities of [1, 2, 1, ...], with len(bz_map)=product(D_diag) + 1.
Expand Down
2 changes: 1 addition & 1 deletion c/reciprocal_to_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void reciprocal_to_normal_squared(
double *inv_sqrt_masses;
lapack_complex_double *e0, *e1, *e2;

/* Inverse sqrt mass is multipled with eigenvectors to reduce number
/* Inverse sqrt mass is multiplied with eigenvectors to reduce number
* of */
/* operations in get_fc3_sum. Three eigenvector matrices are looped
* by */
Expand Down
2 changes: 1 addition & 1 deletion c/triplet.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */

/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */

Expand Down
2 changes: 1 addition & 1 deletion c/triplet.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */

/* Some of these codes were originally parts of spglib, but only develped */
/* Some of these codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */

Expand Down
2 changes: 1 addition & 1 deletion c/triplet_grid.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */

/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */

Expand Down
2 changes: 1 addition & 1 deletion c/triplet_grid.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright (C) 2015 Atsushi Togo */
/* All rights reserved. */

/* These codes were originally parts of spglib, but only develped */
/* These codes were originally parts of spglib, but only developed */
/* and used for phono3py. Therefore these were moved from spglib to */
/* phono3py. This file is part of phonopy. */

Expand Down
2 changes: 1 addition & 1 deletion c/triplet_iw.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void tpi_get_integration_weight_with_sigma(
}

/**
* @brief Return grid points of relative grid adddresses in BZ-grid
* @brief Return grid points of relative grid addresses in BZ-grid
*
* @param neighboring_grid_points Grid points of relative grid addresses in
* BZ-grid.
Expand Down
13 changes: 8 additions & 5 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,33 @@ This directory contains python-sphinx documentation source.

## How to compile

```
```bash
make html
```

## Source files

* `conf.py` contains the sphinx setting confiuration.
* `conf.py` contains the sphinx setting configuration.
* `*.rst` are the usual sphinx documentation source and the filenames without `.rst` are the keys to link from toctree mainly in `index.rst`.

## How to publish

Web page files are copied to `gh-pages` branch. At the phono3py github top directory,
```

```bash
git checkout gh-pages
rm -r .buildinfo .doctrees *
```

From the directory the sphinx doc is complied,
```

```bash
rsync -avh _build/ <phono3py-repository-directory>/
```

Again, at the phono3py github top directory,
```

```bash
git add .
git commit -a -m "Update documentation ..."
git push
Expand Down
2 changes: 1 addition & 1 deletion doc/auxiliary-tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Number of points to be sampled in the x-axis.

### Options for tensor properties

For cummulative thermal conductivity, the last value is given as the thermal
For cumulative thermal conductivity, the last value is given as the thermal
conductivity in W/mK. For the other properties, the last value is effectively
the sum of values on all mesh grids divided by number of mesh grids. This is
understood as normalized for one primitive cell. Before version 1.11.13.1, the
Expand Down
Loading

0 comments on commit c7c680d

Please sign in to comment.