deepmd-kit icon indicating copy to clipboard operation
deepmd-kit copied to clipboard

DP Mask Model

Open dingye18 opened this issue 2 years ago • 3 comments

I implement a DP Mask Model with self-defined se_a_mask op and EnerForcesMaskLoss. The main contribution comes from two points.

  1. Add the argument for mask_matrix.npy (shape [num_frames, num_tot_atoms]), used in se_a_mask. User can specific on which atom is real or virtual. So that we can concatenate the frames which have different elements and atoms into one numpy file.
  2. Add the argument mask_matrix4force.npy (shape [ num_frames, num_tot_atoms * 3 ]). Actually, this is a coefficient matrix which used in the module EnerForcesMaskLoss. The forces losses on each atom will be multiplied by this matrix. User can specify the forces on which atom should be included in the training process. This would be benefit to the DP/MM hybrid potential.

Besides, I did implement DeepPotMaskModel for running of se_a_mask op in the C API interface. Integration of this model with OpenMM will be done in future. atom_num4element.npy and atom_num4frame.npy are needed for loss normalization on each element and each frame in printing.

dingye18 avatar Jun 29 '22 03:06 dingye18

Codecov Report

Merging #1798 (f99c0f2) into devel (bfd40b7) will decrease coverage by 1.98%. The diff coverage is 17.62%.

@@            Coverage Diff             @@
##            devel    #1798      +/-   ##
==========================================
- Coverage   77.06%   75.08%   -1.99%     
==========================================
  Files         118      120       +2     
  Lines        9411     9722     +311     
==========================================
+ Hits         7253     7300      +47     
- Misses       2158     2422     +264     
Impacted Files Coverage Δ
source/api_cc/include/DeepPot.h 66.66% <ø> (ø)
deepmd/loss/ener.py 34.31% <3.80%> (-13.58%) :arrow_down:
deepmd/descriptor/se_a_mask.py 14.03% <14.03%> (ø)
deepmd/train/trainer.py 78.69% <55.55%> (-0.53%) :arrow_down:
deepmd/model/ener.py 87.02% <66.66%> (-1.78%) :arrow_down:
source/op/_prod_force_se_a_mask_grad.py 71.42% <71.42%> (ø)
deepmd/descriptor/__init__.py 100.00% <100.00%> (ø)
deepmd/loss/__init__.py 100.00% <100.00%> (ø)
deepmd/utils/argcheck.py 89.81% <100.00%> (+0.29%) :arrow_up:
deepmd/common.py 79.35% <0.00%> (-4.20%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update bfd40b7...f99c0f2. Read the comment docs.

codecov-commenter avatar Jun 29 '22 03:06 codecov-commenter

Could you provide an unittest to ensure it can work?

njzjz avatar Jul 01 '22 21:07 njzjz

Could you provide an unittest to ensure it can work?

Of course. But it may take a few days. Since I'm a little busy today......

dingye18 avatar Jul 02 '22 00:07 dingye18

Many works are required for the consistent of dp_mask and DP 2.x version. Refactor of dp_mask implementation is needed. I will post a new PR and unit test cases later.

dingye18 avatar Feb 05 '23 08:02 dingye18

Refactor of dp_mask implementation is needed.

@dingye18 @wanghan-iapcm @iProzd We can schedule a short meeting before refactoring.

njzjz avatar Feb 05 '23 19:02 njzjz

Sure, @njzjz please help arranging the meeting, thanks!

wanghan-iapcm avatar Feb 06 '23 01:02 wanghan-iapcm