Conversation
wanghan-iapcm
left a comment
There was a problem hiding this comment.
Could you please provide UT for the atomic model?
- check the output energy is as expected. e.g. in the case you have a few atoms in the system you can manually calculate the energy and check if it is consistent with your code.
- check if you code is jitable. see for example
deepmd-pytorch/tests/test_se_e2_a.py
Line 142 in 05c3f9d
optimized the for loop implementation, checked the calculation locally, going to figure out jit and unittests tomorrow. |
I tested jit with the following code, no error msg |
wanghan-iapcm
left a comment
There was a problem hiding this comment.
What would be the behavior of your model
- if the r-range of the input table is smaller than the cut-off distance? is the interaction between the pairs beyond upper bound of the table and smaller than rcut zero?
- if the r-range of the input table is larger than the cut-off distance?
|
|
||
| atomic_energy = 0.5 * torch.sum(torch.where(nlist != -1, raw_atomic_energy, torch.zeros_like(raw_atomic_energy)) ,dim=-1) | ||
|
|
||
| return {"atomic_energy": atomic_energy} |
There was a problem hiding this comment.
the key should be "energy", please check your output def.
you may want to use this decorator to ensure the correctness of your atomic model output
There was a problem hiding this comment.
Updated the key. Not sure about the decorator, this atomic model has no Fitting
|
Migrated from this [PR](dptech-corp/deepmd-pytorch#174). This is to reimplement the PairTab Model in Pytorch. Notes: 1. Different from the tensorflow version, the pytorch version abstracts away all the post energy conversion operations (force, virial). 2. Added extrapolation when `rcut` > `rmax`. The pytorch version overwrite energy beyond extrapolation endpoint to `0`. These features are not available in the tensorflow version. The extrapolation uses a cubic spline form, the 1st order derivation for the starting point is estimated using the last two rows in the user defined table. See example below:     --------- Co-authored-by: Anyang Peng <aisi_ap@Anyangs-Laptop.local> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The goal of this PR is to migrate the PairTabModel from TF to PT:
input.jsonNotes: