From 32998f181ecef493cf3293c4436fc550f3144ca1 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 10 Jun 2022 02:47:21 -0400 Subject: [PATCH] fix typos in docs and docstrings --- deepmd/common.py | 4 ++-- deepmd/model/model_stat.py | 2 ++ deepmd/op/__init__.py | 4 ++-- deepmd/utils/batch_size.py | 4 ++-- deepmd/utils/data_system.py | 7 +++++-- deepmd/utils/path.py | 6 +++--- deepmd/utils/plugin.py | 4 ++-- doc/development/type-embedding.md | 2 +- doc/model/dplr.md | 4 ++-- doc/model/overall.md | 2 +- doc/model/train-se-e2-a-tebd.md | 2 +- doc/model/train-se-e2-r.md | 2 +- doc/model/train-se-e3.md | 2 +- doc/third-party/ipi.md | 2 +- source/api_cc/include/DeepPot.h | 8 ++++---- source/api_cc/include/DeepTensor.h | 4 ++-- 16 files changed, 32 insertions(+), 27 deletions(-) diff --git a/deepmd/common.py b/deepmd/common.py index 1ac0fd19d2..0d98f500a5 100644 --- a/deepmd/common.py +++ b/deepmd/common.py @@ -456,8 +456,8 @@ def docstring_parameter(*sub: Tuple[str, ...]): sub: Tuple[str, ...] list of strings that will be inserted into prepared locations in docstring. - Note - ---- + Notes + ----- Can be used on both object and classes. """ diff --git a/deepmd/model/model_stat.py b/deepmd/model/model_stat.py index 61f151f27b..b7aa66397c 100644 --- a/deepmd/model/model_stat.py +++ b/deepmd/model/model_stat.py @@ -16,12 +16,14 @@ def _make_all_stat_ref(data, nbatches): def make_stat_input(data, nbatches, merge_sys = True): """ pack data for statistics + Parameters ---------- data: The data merge_sys: bool (True) Merge system data + Returns ------- all_stat: diff --git a/deepmd/op/__init__.py b/deepmd/op/__init__.py index 3700bf175e..aa9b309888 100644 --- a/deepmd/op/__init__.py +++ b/deepmd/op/__init__.py @@ -13,8 +13,8 @@ def import_ops(): """Import all custom TF ops that are present in this submodule. - Note - ---- + Notes + ----- Initialy this subdir is unpopulated. CMake will install all the op module python files and shared libs. """ diff --git a/deepmd/utils/batch_size.py b/deepmd/utils/batch_size.py index 435a90aa49..27b6a830a4 100644 --- a/deepmd/utils/batch_size.py +++ b/deepmd/utils/batch_size.py @@ -8,10 +8,10 @@ class AutoBatchSize: """This class allows DeePMD-kit to automatically decide the maximum batch size that will not cause an OOM error. - + Notes ----- - We assume all OOM error will raise :metd:`OutOfMemoryError`. + We assume all OOM error will raise :class:`OutOfMemoryError`. Parameters ---------- diff --git a/deepmd/utils/data_system.py b/deepmd/utils/data_system.py index 35fd862415..656a7a2e7b 100644 --- a/deepmd/utils/data_system.py +++ b/deepmd/utils/data_system.py @@ -205,14 +205,17 @@ def add_dict(self, adict: dict) -> None: """ Add items to the data system by a `dict`. `adict` should have items like - adict[key] = { + .. code-block:: python + + adict[key] = { 'ndof': ndof, 'atomic': atomic, 'must': must, 'high_prec': high_prec, 'type_sel': type_sel, 'repeat': repeat, - } + } + For the explaination of the keys see `add` """ for kk in adict : diff --git a/deepmd/utils/path.py b/deepmd/utils/path.py index b39fba7e3c..43f2e741ec 100644 --- a/deepmd/utils/path.py +++ b/deepmd/utils/path.py @@ -64,7 +64,7 @@ def glob(self, pattern: str) -> List["DPPath"]: @abstractmethod def rglob(self, pattern: str) -> List["DPPath"]: - """This is like calling :metd:`DPPath.glob()` with `**/` added in front + """This is like calling :meth:`DPPath.glob()` with `**/` added in front of the given relative pattern. Parameters @@ -161,7 +161,7 @@ def glob(self, pattern: str) -> List["DPPath"]: return list([type(self)(p) for p in self.path.glob(pattern)]) def rglob(self, pattern: str) -> List["DPPath"]: - """This is like calling :metd:`DPPath.glob()` with `**/` added in front + """This is like calling :meth:`DPPath.glob()` with `**/` added in front of the given relative pattern. Parameters @@ -277,7 +277,7 @@ def glob(self, pattern: str) -> List["DPPath"]: return list([type(self)("%s#%s"%(self.root_path, pp)) for pp in globfilter(subpaths, self._connect_path(pattern))]) def rglob(self, pattern: str) -> List["DPPath"]: - """This is like calling :metd:`DPPath.glob()` with `**/` added in front + """This is like calling :meth:`DPPath.glob()` with `**/` added in front of the given relative pattern. Parameters diff --git a/deepmd/utils/plugin.py b/deepmd/utils/plugin.py index 6a40e69fab..af28a4632d 100644 --- a/deepmd/utils/plugin.py +++ b/deepmd/utils/plugin.py @@ -32,8 +32,8 @@ def __add__(self, other) -> "Plugin": def register(self, key : str) -> Callable[[object], object]: """Register a plugin. - Parameter - --------- + Parameters + ---------- key : str key of the plugin diff --git a/doc/development/type-embedding.md b/doc/development/type-embedding.md index 2840c75ebe..8f3c3309d5 100644 --- a/doc/development/type-embedding.md +++ b/doc/development/type-embedding.md @@ -40,7 +40,7 @@ $$E = F( [ \text{Multi}( \mathcal G( [s_{ij}, A(j)] ) ), A(j)] )$$ The difference between two variants above is whether using the information of centric atom when generating the descriptor. Users can choose by modifying the `type_one_side` hyper-parameter in the input json file. ## How to use -A detailed introduction can be found at [`se_e2_a_tebd`](../train-se-e2-a-tebd.md). Looking for a fast start up, you can simply add a `type_embedding` section in the input json file as displayed in the following, and the algorithm will adopt atom type embedding algorithm automatically. +A detailed introduction can be found at [`se_e2_a_tebd`](../model/train-se-e2-a-tebd.md). Looking for a fast start up, you can simply add a `type_embedding` section in the input json file as displayed in the following, and the algorithm will adopt atom type embedding algorithm automatically. An example of `type_embedding` is like ```json "type_embedding":{ diff --git a/doc/model/dplr.md b/doc/model/dplr.md index c468069ad5..1fb34fca46 100644 --- a/doc/model/dplr.md +++ b/doc/model/dplr.md @@ -6,7 +6,7 @@ The method of DPLR is described in [this paper][1]. One is recommended to read t In the following, we take the DPLR model for example to introduce the training and LAMMPS simulation with the DPLR model. The DPLR model is training in two steps. -### Train a deep Wannier model for Wannier centroids +## Train a deep Wannier model for Wannier centroids We use the deep Wannier model (DW) to represent the relative position of the Wannier centroid (WC) with the atom to which it is associated. One may consult the introduction of the [dipole model](train-fitting-tensor.md) for a detailed introduction. An example input `wc.json` and a small dataset `data` for tutorial purposes can be found in ```bash @@ -38,7 +38,7 @@ The training and freezing can be started from the example directory by dp train dw.json && dp freeze -o dw.pb ``` -### Train the DPLR model +## Train the DPLR model The training of the DPLR model is very similar to the standard short-range DP models. An example input script can be found in the example directory. The following section is introduced to compute the long-range energy contribution of the DPLR model, and modify the short-range DP model by this part. ```json diff --git a/doc/model/overall.md b/doc/model/overall.md index cedebd1914..bd1986f2ea 100644 --- a/doc/model/overall.md +++ b/doc/model/overall.md @@ -24,6 +24,6 @@ DeePMD-kit implements the following descriptors: 5. [`hybrid`](train-hybrid.md): Concate a list of descriptors to form a new descriptor. The fitting of the following physical properties are supported -1. [`ener`](train-energy.md): Fit the energy of the system. The force (derivative with atom positions) and the virial (derivative with the box tensor) can also be trained. See [the example](train-se-e2-a.md#loss). +1. [`ener`](train-energy.md): Fit the energy of the system. The force (derivative with atom positions) and the virial (derivative with the box tensor) can also be trained. 2. [`dipole`](train-fitting-tensor.md): The dipole moment. 3. [`polar`](train-fitting-tensor.md): The polarizability. diff --git a/doc/model/train-se-e2-a-tebd.md b/doc/model/train-se-e2-a-tebd.md index 82815b6956..2132bd4df2 100644 --- a/doc/model/train-se-e2-a-tebd.md +++ b/doc/model/train-se-e2-a-tebd.md @@ -2,7 +2,7 @@ We generate specific type embedding vector for each atom type, so that we can share one descriptor embedding net and one fitting net in total, which decline training complexity largely. -The training input script is similar to that of [`se_e2_a`](train-se-e2-a.md#the-training-input-script), but different by adding the `type_embedding` section. +The training input script is similar to that of [`se_e2_a`](train-se-e2-a.md), but different by adding the `type_embedding` section. ## Type embedding net The `model` defines how the model is constructed, adding a section of type embedding net: diff --git a/doc/model/train-se-e2-r.md b/doc/model/train-se-e2-r.md index 997f32f2b9..2e0ee4a2c2 100644 --- a/doc/model/train-se-e2-r.md +++ b/doc/model/train-se-e2-r.md @@ -7,7 +7,7 @@ A complete training input script of this example can be found in the directory $deepmd_source_dir/examples/water/se_e2_r/input.json ``` -The training input script is very similar to that of [`se_e2_a`](train-se-e2-a.md#the-training-input-script). The only difference lies in the `descriptor` section +The training input script is very similar to that of [`se_e2_a`](train-se-e2-a.md). The only difference lies in the `descriptor` section ```json "descriptor": { "type": "se_e2_r", diff --git a/doc/model/train-se-e3.md b/doc/model/train-se-e3.md index 36bbd202db..a47d1680b9 100644 --- a/doc/model/train-se-e3.md +++ b/doc/model/train-se-e3.md @@ -7,7 +7,7 @@ A complete training input script of this example can be found in the directory $deepmd_source_dir/examples/water/se_e3/input.json ``` -The training input script is very similar to that of [`se_e2_a`](train-se-e2-a.md#the-training-input-script). The only difference lies in the `descriptor` section +The training input script is very similar to that of [`se_e2_a`](train-se-e2-a.md). The only difference lies in the `descriptor` section ```json "descriptor": { "type": "se_e3", diff --git a/doc/third-party/ipi.md b/doc/third-party/ipi.md index cd0448ce90..8553953627 100644 --- a/doc/third-party/ipi.md +++ b/doc/third-party/ipi.md @@ -1,4 +1,4 @@ -### Run path-integral MD with i-PI +# Run path-integral MD with i-PI The i-PI works in a client-server model. The i-PI provides the server for integrating the replica positions of atoms, while the DeePMD-kit provides a client named `dp_ipi` (or `dp_ipi_low` for low precision) that computes the interactions (including energy, force and virial). The server and client communicates via the Unix domain socket or the Internet socket. Installation instructions of i-PI can be found [here](../install/install-ipi.md). The client can be started by ```bash i-pi input.xml & diff --git a/source/api_cc/include/DeepPot.h b/source/api_cc/include/DeepPot.h index 6057cf4ab7..2b76cc4e0b 100644 --- a/source/api_cc/include/DeepPot.h +++ b/source/api_cc/include/DeepPot.h @@ -226,16 +226,16 @@ class DeepPotModelDevi ~DeepPotModelDevi() ; /** * @brief DP model deviation constructor with initialization. - * @param[in] model The names of the frozen model files. + * @param[in] models The names of the frozen model files. * @param[in] gpu_rank The GPU rank. Default is 0. - * @param[in] file_content The contents of the model files. If it is not empty, DP will read from the strings instead of the files. + * @param[in] file_contents The contents of the model files. If it is not empty, DP will read from the strings instead of the files. **/ DeepPotModelDevi (const std::vector & models, const int & gpu_rank = 0, const std::vector & file_contents = std::vector()); /** * @brief Initialize the DP model deviation contrcutor. - * @param[in] model The names of the frozen model files. + * @param[in] models The names of the frozen model files. * @param[in] gpu_rank The GPU rank. Default is 0. - * @param[in] file_content The contents of the model files. If it is not empty, DP will read from the strings instead of the files. + * @param[in] file_contents The contents of the model files. If it is not empty, DP will read from the strings instead of the files. **/ void init (const std::vector & models, const int & gpu_rank = 0, const std::vector & file_contents = std::vector()); public: diff --git a/source/api_cc/include/DeepTensor.h b/source/api_cc/include/DeepTensor.h index 4e1e47307b..2f696d5289 100644 --- a/source/api_cc/include/DeepTensor.h +++ b/source/api_cc/include/DeepTensor.h @@ -18,7 +18,7 @@ class DeepTensor * @brief Deep Tensor constructor with initialization.. * @param[in] model The name of the frozen model file. * @param[in] gpu_rank The GPU rank. Default is 0. - * @param[in] file_content The content of the model file. If it is not empty, DP will read from the string instead of the file. + * @param[in] name_scope Name scopes of operations. **/ DeepTensor(const std::string & model, const int & gpu_rank = 0, @@ -27,7 +27,7 @@ class DeepTensor * @brief Initialize the Deep Tensor. * @param[in] model The name of the frozen model file. * @param[in] gpu_rank The GPU rank. Default is 0. - * @param[in] file_content The content of the model file. If it is not empty, DP will read from the string instead of the file. + * @param[in] name_scope Name scopes of operations. **/ void init (const std::string & model, const int & gpu_rank = 0,