From 4bf43545bd4333dd89c6ccd9933093d9df04b2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Sat, 18 Nov 2023 23:03:35 +0100 Subject: [PATCH] Manula: Add precommit check for biblio refs --- docs/methods/cdft.md | 24 +++++++++++------------- docs/methods/lrigpw.md | 20 ++++++++------------ docs/methods/pao-ml.md | 3 +-- tools/precommit/check_file_properties.py | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/docs/methods/cdft.md b/docs/methods/cdft.md index 2552251ec9..ad07a20aad 100644 --- a/docs/methods/cdft.md +++ b/docs/methods/cdft.md @@ -30,9 +30,7 @@ within atom centered regions of space. The relevant theory has been derived by W a series of key papers: [paper 1](https://dx.doi.org/10.1103/PhysRevA.72.024502), [paper 2](https://dx.doi.org/10.1063/1.2360263), [paper 3](https://dx.doi.org/10.1063/1.2360263). Further useful references can be found in the aforementioned review article. The CDFT implementation -of CP2K has been throughly described in these two papers: -[paper 1](https://dx.doi.org/10.1021/acs.jctc.6b01085) and -[paper 2](https://dx.doi.org/10.1063/1.5038959). +of CP2K has been throughly described in these two papers: [](#Holmberg2017) and [](#Holmberg2018). In this tutorial, only the main theoretical aspects needed to understand what is happening during a CDFT simulation will be summarized. The charge/spin localized states can be generated by augmenting @@ -302,13 +300,13 @@ adjustments affect the Becke cell functions has been visualized above in Figure the size of the red atom is set to a value 30 % larger than the black atoms causing the red atom's contours to extend farther than without atomic size adjustments. -The algorithmic implementation of the Becke density partitioning method has been detailed -[here](https://dx.doi.org/10.1021/acs.jctc.6b01085). In brief, this involves iterating over each -atom pair permutation $\{\mathbf{R}_i, \mathbf{R}_j\}, j\neq i$ at every real space grid point -$\mathbf{r}$. This leads to a poor scaling with respect to the system size (cell size and planewave -cutoff) and the number of atoms within the system, and is particularly troublesome for solvated -system simulations. The computational cost of the Becke method can be considerably decreased by -noting that only the grid points within a cutoff distance $R_{cutoff}$ +The algorithmic implementation of the Becke density partitioning method has been detailed in +[](#Holmberg2017). In brief, this involves iterating over each atom pair permutation +$\{\mathbf{R}_i, \mathbf{R}_j\}, j\neq i$ at every real space grid point $\mathbf{r}$. This leads to +a poor scaling with respect to the system size (cell size and planewave cutoff) and the number of +atoms within the system, and is particularly troublesome for solvated system simulations. The +computational cost of the Becke method can be considerably decreased by noting that only the grid +points within a cutoff distance $R_{cutoff}$ ([CUTOFF_TYPE](#CP2K_INPUT.FORCE_EVAL.DFT.QS.CDFT.BECKE_CONSTRAINT.CUTOFF_TYPE)) of atoms involved in constraints actually need to be considered. The other grid points can be efficiently screened with constraint atom centered spherical Gaussian functions, activated by the keyword @@ -560,9 +558,9 @@ $$ where $\Delta A$ is the reaction free energy, $\xi$ is the solvent reorganization energy, and $\left|\mathbf{H}_\mathrm{ab}\right|$ is the electronic coupling. The first two quantities can be -obtained from free energy simulations as discussed e.g. in -[here](https://dx.doi.org/10.1021/acs.jctc.6b01085). The electronic coupling is rigorously defined -as the interaction energy between wavefunctions $\Psi$ representing the two reaction states +obtained from free energy simulations as discussed e.g. in [](#Holmberg2017). The electronic +coupling is rigorously defined as the interaction energy between wavefunctions $\Psi$ representing +the two reaction states $$ \mathbf{H}_\mathrm{ab} = \left<\Psi_\mathrm{a}\left| \mathcal{H}\right|\Psi_\mathrm{b}\right> diff --git a/docs/methods/lrigpw.md b/docs/methods/lrigpw.md index 64c31ceaf7..ae8c76f622 100644 --- a/docs/methods/lrigpw.md +++ b/docs/methods/lrigpw.md @@ -6,8 +6,7 @@ Density functional theory (DFT) calculations in CP2K employ the Gaussian and pla method. In GPW, the description of the total density on realspace grids is typically the computationally most expensive part. By introducing a local resolution-of-the-identity (LRI) approach, the linear scaling of the GPW approach can be retained, while reducing the prefactor for -the grid operations. The combined approach, LRIGPW, is comprehensively described in -[J. Chem. Theory Comput., 13, 2202 (2017)](https://dx.doi.org/10.1021/acs.jctc.7b00148). +the grid operations. The combined approach, LRIGPW, is comprehensively described in [](#Golze2017b). In LRIGPW, the atomic pair densities $\rho_{\mathrm{AB}}$ are approximated by an expansion in a set of fit functions centered at atom A $\{f_i^{\mathrm{A}}(\mathbf{r})\}$ and atom B @@ -59,9 +58,8 @@ sets are available in different sizes: `MEDIUM` and `LARGE`. Using the large aux the accuracy is improved, but the computational overhead increases. The LRI auxiliary basis sets are generally quite large leading to a potentially ill-conditioned -overlap matrix, Equation (10) in -[J. Chem. Theory Comput., 13, 2202 (2017)](https://dx.doi.org/10.1021/acs.jctc.7b00148). The -inversion of this matrix can thus be numerical instable. +overlap matrix, Equation (10) in [](#Golze2017b). The inversion of this matrix can thus be numerical +instable. If the SCF is not converging, set [LRI_OVERLAP_MATRIX](#CP2K_INPUT.FORCE_EVAL.DFT.QS.LRIGPW.LRI_OVERLAP_MATRIX) to `AUTOSELECT`. In @@ -70,13 +68,11 @@ pairs, the pseudoinverse instead of the regular inverse is calculated. The thres condition number can be given by [MAX_CONDITION_NUM](#CP2K_INPUT.FORCE_EVAL.DFT.QS.LRIGPW.MAX_CONDITION_NUM). -The LRI integrals, Equations (31)-(34) in -[J. Chem. Theory Comput., 13, 2202 (2017)](https://dx.doi.org/10.1021/acs.jctc.7b00148), are -calculated prior to the SCF. The traditionally used Obara-Saika scheme is computationally too -demanding here. Therefore, a more efficient integral scheme based on solid harmonic Gaussians (SHG) -is employed and invoked by -[SHG_LRI_INTEGRALS](#CP2K_INPUT.FORCE_EVAL.DFT.QS.LRIGPW.SHG_LRI_INTEGRALS), see -[J. Chem. Phys., 146, 034105, 2017](https://dx.doi.org/10.1063/1.4973510) for details. +The LRI integrals, Equations (31)-(34) in [](#Golze2017b), are calculated prior to the SCF. The +traditionally used Obara-Saika scheme is computationally too demanding here. Therefore, a more +efficient integral scheme based on solid harmonic Gaussians (SHG) is employed and invoked by +[SHG_LRI_INTEGRALS](#CP2K_INPUT.FORCE_EVAL.DFT.QS.LRIGPW.SHG_LRI_INTEGRALS), see [](#Golze2017) for +details. ## When to use it diff --git a/docs/methods/pao-ml.md b/docs/methods/pao-ml.md index f1f44b277e..1b9edfb633 100644 --- a/docs/methods/pao-ml.md +++ b/docs/methods/pao-ml.md @@ -5,8 +5,7 @@ generate geometry adopted small basis sets. It also provides exact ionic forces. serve as an almost drop-in replacement for conventional basis sets to speedup otherwise standard DFT calculations. The method is similar to semi-empirical models based on minimal basis sets, but offers improved accuracy and quasi-automatic parameterization. However, the method is still in an early -stage - so use with caution. For more information see: -[10.1021/acs.jctc.8b00378](https://dx.doi.org/10.1021/acs.jctc.8b00378). +stage - so use with caution. For more information see: [](#Schuett2018). ## Step 1: Obtain training structures diff --git a/tools/precommit/check_file_properties.py b/tools/precommit/check_file_properties.py index 24a0f488ca..f8101c6f61 100755 --- a/tools/precommit/check_file_properties.py +++ b/tools/precommit/check_file_properties.py @@ -133,6 +133,13 @@ def get_flags_src() -> str: return match.group(1) +@lru_cache(maxsize=None) +def get_bibliography_dois() -> list[str]: + bib = CP2K_DIR.joinpath("src/common/bibliography.F").read_text() + matches = re.findall(r'DOI="([^"]+)"', bib, flags=re.IGNORECASE) + return [doi for doi in matches if "/" in doi] # filter invalid DOIs. + + def check_file(path: pathlib.Path) -> List[str]: """ Check the given source file for convention violations, like: @@ -240,6 +247,13 @@ def check_file(path: pathlib.Path) -> List[str]: if flag not in get_flags_src(): warnings += [f"{path}: Flag '{flag}' not mentioned in cp2k_flags()"] + # Check for DOIs that could be a bibliography reference. + if re.match(r"docs/[^/]+/.*\.md", str(path)) and "docs/CP2K_INPUT" not in str(path): + for line in content.splitlines(): + for doi in get_bibliography_dois(): + if doi.lower() in line: + warnings += [f"{path}: Please replace doi:{doi} with biblio ref."] + return warnings