Skip to content

Commit 1415d11

Browse files
committed
fix tf model for virial and update UT results.
1 parent ea76ad6 commit 1415d11

File tree

12 files changed

+40169
-5399
lines changed

12 files changed

+40169
-5399
lines changed

doc/model/train-energy-spin.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@ $$L = p_e L_e + p_{fr} L_{fr} + p_{fm} L_{fm} + p_v L_v$$
8888

8989
where $L_e$, $L_{fr}$, $L_{fm}$ and $L_v$ denote the loss in energy, atomic force, magnatic force and virial, respectively. $p_e$, $p_{fr}$, $p_{fm}$ and $p_v$ give the prefactors of the energy, atomic force, magnatic force and virial losses.
9090

91-
:::{note}
92-
Please note that the virial and atomic virial are not currently supported in spin models.
93-
:::
94-
9591
The prefectors may not be a constant, rather it changes linearly with the learning rate. Taking the atomic force prefactor for example, at training step $t$, it is given by
9692

9793
$$p_{fr}(t) = p_{fr}^0 \frac{ \alpha(t) }{ \alpha(0) } + p_{fr}^\infty ( 1 - \frac{ \alpha(t) }{ \alpha(0) })$$
@@ -138,6 +134,7 @@ set.*/box.npy
138134
set.*/coord.npy
139135
set.*/energy.npy
140136
set.*/force.npy
137+
set.*/virial.npy
141138
```
142139

143140
This system contains `Nframes` frames with the same atom number `Natoms` and magnetic atom number `Nspins`, the total number of element and virtual types contained in all frames is `Ntypes`. The `box` and `energy` files are the same as those in [standard formats](../data/system.md). The `type` file contains the types of both real atoms and virtual atoms. In `coord` and `force` files, virtual atomic coordinates are integrated with real atomic coordinates, and magnetic forces are combined with atomic forces. Specifically, magnetic forces are obtained from [DeltaSpin](https://github.com/caizefeng/DeltaSpin) and virtual atomic coordinates are given by:
@@ -148,13 +145,14 @@ where $\bm{R}_{i^p}$, $\bm{R}_i$, and $\bm{S}_i$ denote the virtual atomic coord
148145

149146
We list the details about spin system data format in TensorFlow backend:
150147

151-
| ID | Property | Raw file | Unit | Shape | Description |
152-
| ------ | -------------------------- | ---------- | ---- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
153-
| type | Atom type indexes | type.raw | \\ | Natoms + Nspins | Integers that start with 0. The first `Natoms` entries represent real atom types, followed by `Nspins` entries representing virtual atom types. |
154-
| coord | Coordinates | coord.raw | Å | Nframes * (Natoms + Nspins) * 3 | The first `3 \* Natoms` columns represent the coordinates of real atoms, followed by `3 \* Nspins` columns representing the coordinates of virtual atoms. |
155-
| box | Boxes | box.raw | Å | Nframes * 3 * 3 | in the order `XX XY XZ YX YY YZ ZX ZY ZZ` |
156-
| energy | Frame energies | energy.raw | eV | Nframes | |
157-
| force | Atomic and magnetic forces | force.raw | eV/Å | Nframes * (Natoms + Nspins) * 3 | The first `3 \* Natoms` columns represent atomic forces, followed by `3 \* Nspins` columns representing magnetic forces. |
148+
| ID | Property | Raw file | Unit | Shape | Description |
149+
| ------ | -------------------------- | ---------- | ---- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
150+
| type | Atom type indexes | type.raw | \ | Natoms + Nspins | Integers that start with 0. The first `Natoms` entries represent real atom types, followed by `Nspins` entries representing virtual atom types. |
151+
| coord | Coordinates | coord.raw | Å | Nframes \* (Natoms + Nspins) \* 3 | The first `3 \* Natoms` columns represent the coordinates of real atoms, followed by `3 \* Nspins` columns representing the coordinates of virtual atoms. |
152+
| box | Boxes | box.raw | Å | Nframes \* 3 \* 3 | in the order `XX XY XZ YX YY YZ ZX ZY ZZ` |
153+
| energy | Frame energies | energy.raw | eV | Nframes |
154+
| force | Atomic and magnetic forces | force.raw | eV/Å | Nframes \* (Natoms + Nspins) \* 3 | The first `3 \* Natoms` columns represent atomic forces, followed by `3 \* Nspins` columns representing magnetic forces. |
155+
| virial | Frame virial | virial.raw | eV | Nframes \* 9 | in the order `XX XY XZ YX YY YZ ZX ZY ZZ` |
158156

159157
### Spin data format in PyTorch/DP
160158

@@ -168,6 +166,7 @@ set.*/spin.npy
168166
set.*/energy.npy
169167
set.*/force.npy
170168
set.*/force_mag.npy
169+
set.*/virial.npy
171170
```
172171

173172
This system contains `Nframes` frames with the same atom number `Natoms`, the total number of element contained in all frames is `Ntypes`. Most files are the same as those in [standard formats](../data/system.md), here we only list the distinct ones:

log.lammps

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
LAMMPS (22 Jul 2025 - Update 2)
2+
using 1 OpenMP thread(s) per MPI task
3+
Loaded 0 plugins from
4+
units metal
5+
boundary p p p
6+
atom_style atomic
7+
neighbor 2.0 bin
8+
neigh_modify every 10 delay 0 check no
9+
read_data /home/outisli/Research/dpmd/source/lmp/tests/data.lmp
10+
Reading data file ...
11+
triclinic box = (0 0 0) to (13 13 13) with tilt (0 0 0)
12+
1 by 1 by 1 MPI processor grid
13+
reading atoms ...
14+
6 atoms
15+
read_data CPU = 0.000 seconds
16+
mass 1 16
17+
mass 2 2
18+
timestep 0.0005
19+
fix 1 all nve
20+
pair_style deepmd /home/outisli/Research/dpmd/source/tests/infer/deeppot_sea.pth
21+
ERROR: Unrecognized pair style 'deepmd' (src/src/force.cpp:275)
22+
Last input line: pair_style deepmd /home/outisli/Research/dpmd/source/tests/infer/deeppot_sea.pth
23+
Total wall time: 0:00:00

0 commit comments

Comments
 (0)