Skip to content

Commit

Permalink
Add docs in README for deepmd/npy/mixed
Browse files Browse the repository at this point in the history
  • Loading branch information
iProzd committed Feb 23, 2023
1 parent b4aab8a commit a0951a0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ The `System` or `LabeledSystem` can be constructed from the following file forma
| deepmd | npy | True | False | System | 'deepmd/npy' |
| deepmd | raw | True | True | LabeledSystem | 'deepmd/raw' |
| deepmd | npy | True | True | LabeledSystem | 'deepmd/npy' |
| deepmd | npy | True | True | MultiSystems | 'deepmd/npy/mixed' |
| deepmd | npy | True | False | MultiSystems | 'deepmd/npy/mixed' |
| gaussian| log | False | True | LabeledSystem | 'gaussian/log'|
| gaussian| log | True | True | LabeledSystem | 'gaussian/md' |
| siesta | output | False | True | LabeledSystem | 'siesta/output'|
Expand Down Expand Up @@ -278,6 +280,28 @@ 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.

## Mixed Type Format
The format `deepmd/npy/mixed` is the mixed type numpy format for DeePMD-kit, and can be loaded or dumped through class `dpdata.MultiSystems`.

Under this format, systems with the same number of atoms but different formula can be put together
for a larger system, especially when the frame numbers in systems are sparse.

This also helps to mixture the type information together for model training with type embedding network.

Here are examples using `deepmd/npy/mixed` format:

- Dump a MultiSystems into a mixed type numpy directory:
```python
import dpdata
dpdata.MultiSystems(*systems).to_deepmd_npy_mixed("mixed_dir")
```

- Load a mixed type data into a MultiSystems:
```python
import dpdata
dpdata.MultiSystems().load_systems_from_file("mixed_dir", fmt="deepmd/npy/mixed")
```

# Plugins

One can follow [a simple example](plugin_example/) to add their own format by creating and installing plugins. It's critical to add the [Format](dpdata/format.py) class to `entry_points['dpdata.plugins']` in [`pyproject.toml`](plugin_example/pyproject.toml):
Expand Down

0 comments on commit a0951a0

Please sign in to comment.