You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
or let dpdata infer the format (`vasp/poscar`) of the file from the file name extension
40
40
```python
41
-
d_poscar = dpdata.System('my.POSCAR')
41
+
d_poscar = dpdata.System("my.POSCAR")
42
42
```
43
43
The number of atoms, atom types, coordinates are loaded from the `POSCAR` and stored to a data `System` called `d_poscar`.
44
44
A data `System` (a concept used by [deepmd-kit](https://github.com/deepmodeling/deepmd-kit)) contains frames that has the same number of atoms of the same type. The order of the atoms should be consistent among the frames in one `System`.
45
45
It is noted that `POSCAR` only contains one frame.
46
46
If the multiple frames stored in, for example, a `OUTCAR` is wanted,
47
47
```python
48
-
d_outcar = dpdata.LabeledSystem('OUTCAR')
48
+
d_outcar = dpdata.LabeledSystem("OUTCAR")
49
49
```
50
50
The labels provided in the `OUTCAR`, i.e. energies, forces and virials (if any), are loaded by `LabeledSystem`. It is noted that the forces of atoms are always assumed to exist. `LabeledSystem` is a derived class of `System`.
51
51
@@ -100,51 +100,58 @@ The following commands relating to `Class dpdata.MultiSystems` may be useful.
by which only the first and last frames are dumped to `dpmd_raw`.
187
194
188
195
189
196
## replicate
190
197
dpdata will create a super cell of the current atom configuration.
191
198
```python
192
-
dpdata.System('./POSCAR').replicate((1,2,3,) )
199
+
dpdata.System("./POSCAR").replicate(
200
+
(
201
+
1,
202
+
2,
203
+
3,
204
+
)
205
+
)
193
206
```
194
207
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.
195
208
196
209
197
210
## perturb
198
211
By the following example, each frame of the original system (`dpdata.System('./POSCAR')`) is perturbed to generate three new frames. For each frame, the cell is perturbed by 5% and the atom positions are perturbed by 0.6 Angstrom. `atom_pert_style` indicates that the perturbation to the atom positions is subject to normal distribution. Other available options to `atom_pert_style` are`uniform` (uniform in a ball), and `const` (uniform on a sphere).
A new class `BondOrderSystem` which inherits from class `System` is introduced in dpdata. This new class contains information of chemical bonds and formal charges (stored in `BondOrderSystem.data['bonds']`, `BondOrderSystem.data['formal_charges']`). Now BondOrderSystem can only read from .mol/.sdf formats, because of its dependency on rdkit (which means rdkit must be installed if you want to use this function). Other formats, such as pdb, must be converted to .mol/.sdf format (maybe with software like open babel).
217
232
```python
218
233
import dpdata
219
-
system_1 = dpdata.BondOrderSystem("tests/bond_order/CH3OH.mol", fmt="mol") # read from .mol file
220
-
system_2 = dpdata.BondOrderSystem("tests/bond_order/methane.sdf", fmt="sdf") # read from .sdf file
234
+
235
+
system_1 = dpdata.BondOrderSystem(
236
+
"tests/bond_order/CH3OH.mol", fmt="mol"
237
+
) # read from .mol file
238
+
system_2 = dpdata.BondOrderSystem(
239
+
"tests/bond_order/methane.sdf", fmt="sdf"
240
+
) # read from .sdf file
221
241
```
222
242
In sdf file, all molecules must be of the same topology (i.e. conformers of the same molecular configuration).
223
243
`BondOrderSystem` also supports initialize from a `rdkit.Chem.rdchem.Mol` object directly.
@@ -244,16 +264,16 @@ According to our test, our sanitization procedure can successfully read 4852 sma
244
264
import dpdata
245
265
246
266
for sdf_file in glob.glob("bond_order/refined-set-ligands/obabel/*sdf"):
BondOrderSystem implement a method to assign formal charge for each atom based on the 8-electron rule (see below). Note that it only supports common elements in bio-system: B,C,N,O,P,S,As
print(syst.get_formal_charges()) # return the formal charge on each atom
276
+
print(syst.get_charge()) # return the total charge of the system
257
277
```
258
278
259
279
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.
0 commit comments