Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions docs/systems/bond_order_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ system = dpdata.BondOrderSystem(rdkit_mol=mol)
The {class}`BondOrderSystem <dpdata.BondOrderSystem>` implements a more robust sanitize procedure for rdkit Mol, as defined in {class}`dpdata.rdkit.santizie.Sanitizer`. This class defines 3 level of sanitization process by: low, medium and high. (default is medium).

- low: use `rdkit.Chem.SanitizeMol()` function to sanitize molecule.
- medium: before using rdkit, the programm will first assign formal charge of each atom to avoid inappropriate valence exceptions. However, this mode requires the rightness of the bond order information in the given molecule.
- high: the program will try to fix inappropriate bond orders in aromatic hetreocycles, phosphate, sulfate, carboxyl, nitro, nitrine, guanidine groups. If this procedure fails to sanitize the given molecule, the program will then try to call `obabel` to pre-process the mol and repeat the sanitization procedure. **That is to say, if you wan't to use this level of sanitization, please ensure `obabel` is installed in the environment.**
- medium: before using rdkit, the program will first assign formal charge of each atom to avoid inappropriate valence exceptions. However, this mode requires the rightness of the bond order information in the given molecule.
- high: the program will try to fix inappropriate bond orders in aromatic heterocycles, phosphate, sulfate, carboxyl, nitro, nitrine, guanidine groups. If this procedure fails to sanitize the given molecule, the program will then try to call `obabel` to pre-process the mol and repeat the sanitization procedure. **That is to say, if you want to use this level of sanitization, please ensure `obabel` is installed in the environment.**
According to our test, our sanitization procedure can successfully read 4852 small molecules in the PDBBind-refined-set. It is necessary to point out that the in the molecule file (mol/sdf), the number of explicit hydrogens has to be correct. Thus, we recommend to use
`obabel xxx -O xxx -h` to pre-process the file. The reason why we do not implement this hydrogen-adding procedure in dpdata is that we can not ensure its correctness.

Expand All @@ -56,4 +56,4 @@ print(syst.get_formal_charges()) # return the formal charge on each atom
print(syst.get_charge()) # return the total charge of the system
```

If a valence of 3 is detected on carbon, the formal charge will be assigned to -1. Because for most cases (in alkynyl anion, isonitrile, cyclopentadienyl anion), the formal charge on 3-valence carbon is -1, and this is also consisent with the 8-electron rule.
If a valence of 3 is detected on carbon, the formal charge will be assigned to -1. Because for most cases (in alkynyl anion, isonitrile, cyclopentadienyl anion), the formal charge on 3-valence carbon is -1, and this is also consistent with the 8-electron rule.
10 changes: 5 additions & 5 deletions docs/systems/multi.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `MultiSystems`

The Class {class}`dpdata.MultiSystems` can read data from a dir which may contains many files of different systems, or from single xyz file which contains different systems.
The Class {class}`dpdata.MultiSystems` can read data from a dir which may contains many files of different systems, or from a single xyz file that contains different systems.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix subject-verb agreement in the opening sentence.

Use “may contain” instead of “may contains”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/systems/multi.md` at line 3, The sentence describing the Class
dpdata.MultiSystems has incorrect subject-verb agreement; change "may contains"
to "may contain" in the opening sentence that mentions reading data from a dir
which may contains many files of different systems, or from a single xyz file
that contains different systems (ref: Class dpdata.MultiSystems).


Use {meth}`dpdata.MultiSystems.from_dir` to read from a directory, {class}`dpdata.MultiSystems` will walk in the directory
Recursively and find all file with specific file_name. Supports all the file formats that {class}`dpdata.LabeledSystem` supports.
Expand All @@ -26,11 +26,11 @@ vasp_multi_systems = dpdata.MultiSystems.from_dir(
dir_name="./mgal_outcar", file_name="*OUTCAR", fmt="vasp/outcar"
)

# print the multi_system infomation
# print the multi_system information
print(xyz_multi_systems)
print(xyz_multi_systems.systems) # return a dictionaries

# print the system infomation
# print the system information
print(xyz_multi_systems.systems["B1C9"].data)

# dump a system's data to ./my_work_dir/B1C9_raw folder
Expand All @@ -40,7 +40,7 @@ xyz_multi_systems.systems["B1C9"].to_deepmd_raw("./my_work_dir/B1C9_raw")
xyz_multi_systems.to_deepmd_raw("./my_deepmd_data/")
```

You may also use the following code to parse muti-system:
You may also use the following code to parse multi-system:

```python
from dpdata import LabeledSystem, MultiSystems
Expand All @@ -49,7 +49,7 @@ from glob import glob
"""
process multi systems
"""
fs = glob("./*/OUTCAR") # remeber to change here !!!
fs = glob("./*/OUTCAR") # remember to change here !!!
ms = MultiSystems()
for f in fs:
try:
Expand Down
6 changes: 3 additions & 3 deletions docs/systems/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This section gives some examples on how dpdata works. Firstly one needs to impor
import dpdata
```

The typicall workflow of `dpdata` is
The typical workflow of `dpdata` is

1. Load data from vasp or lammps or deepmd-kit data files.
1. Manipulate data
Expand Down Expand Up @@ -108,7 +108,7 @@ dpdata.System("./POSCAR").replicate(
)
```

tuple(1,2,3) means don't copy atom configuration in x direction, make 2 copys in y direction, make 3 copys in z direction.
tuple(1,2,3) means don't copy atom configuration in x direction, make 2 copies in y direction, make 3 copies in z direction.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In Python, is tuple(1,2,3) valid syntax? What is the correct way to represent a tuple with values 1, 2, and 3?

💡 Result:

No. tuple(1,2,3) is not valid because the tuple() constructor takes at most one positional argument (an iterable), not three separate values. [1]

Correct ways to represent a tuple containing 1, 2, 3:

  • Tuple literal: t = (1, 2, 3) (also valid: t = 1, 2, 3) [2]
  • Using the constructor with an iterable: t = tuple([1, 2, 3]) (or tuple((1, 2, 3))) [1]

Sources:
[1] Purpose of tuple constructor in python - Stack Overflow (stackoverflow.com)
[2] TupleSyntax - Python Wiki (wiki.python.org)

Citations:


Fix tuple notation in prose to avoid misleading users.

tuple(1,2,3) is not valid Python syntax. Use (1, 2, 3) or tuple([1, 2, 3]) instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/systems/system.md` at line 111, The prose uses the invalid Python
expression tuple(1,2,3); update the sentence to show valid tuple notation by
replacing tuple(1,2,3) with either (1, 2, 3) or tuple([1, 2, 3]) so readers see
correct examples (reference the original token tuple(1,2,3) and the replacements
(1, 2, 3) or tuple([1, 2, 3])).


### perturb

Expand All @@ -126,7 +126,7 @@ print(perturbed_system.data)

### replace

By the following example, Random 8 Hf atoms in the system will be replaced by Zr atoms with the atom postion unchanged.
By the following example, Random 8 Hf atoms in the system will be replaced by Zr atoms with the atom position unchanged.

```python
s = dpdata.System("tests/poscars/POSCAR.P42nmc", fmt="vasp/poscar")
Expand Down