CompPhysVienna / n2p2

n2p2 - A Neural Network Potential Package
https://compphysvienna.github.io/n2p2/
GNU General Public License v3.0
223 stars 83 forks source link

Improving the force RMSE #67

Closed moabe84 closed 3 years ago

moabe84 commented 4 years ago

Hi Andreas, I wonder how I can improve the force RMSE. I need to know which parameter(s) I should play with. I would guess one of them should be "short_force_fraction". I greatly appropriate it if you could share your experiences in this case with me.
Here is my input file. input.nn.txt

Many thanks. Mostafa

singraber commented 3 years ago

Hi Mostafa,

I am sorry for this late reply, unfortunately I had some important stuff to do... actually there is not too much to play with.. as you have already guessed the short_force_fraction influences the force RMSE. This keyword determines which fraction of the amount of all available forces are used in an epoch for training. For example, if you set short_force_fraction to 0.2 then about 20% of all forces will be used for updating the weights. Usually, I set short_energy_fraction to 1.0, i.e. in each epoch (on average) all energies are trained once and short_force_fraction in such way that there is a 1:10 ratio between energy and force updates. Have a look at the nnp-train.log file, there the actual ratio will be reported.

The other variable which influences the force RMSE is the force_weight keyword. This corresponds to the factor beta in eq. 22 in this publication. Basically, it increases/decreases the strength of force updates with respect to energy updates. Unfortunately, there is no simple recipe how to set this but I found that a value of 10.0 works well when normalization is enabled. You can try to increase this but at some point it may break down and you don't get good fitting at all.

Finally, I have to mention that the number of cores (i.e. Kalman filter multi-streams) used for training also influences the quality of the training. Unfortunately, high parallelization leads to more unstable training, I suggest to use a moderate number of cores, e.g. 16 up to 32.

Hope this helps a bit...

Best,

Andreas

moabe84 commented 3 years ago

Dear Andreas,

Many thanks for your helpful suggestions. I will try them and see if the force RMSE can get improved. And thanks for the suggestion regarding the number of cores for the training. I will try not to exceed 24 cores.

Best, Mostafa