Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Committee-NNP #92

Draft
wants to merge 23 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a0bbeba
Added committee keywords and NN initialization
singraber Mar 7, 2021
010c65e
Fixed some bugs
singraber Mar 7, 2021
dfad319
Correctly set up NNs, added example
singraber Mar 9, 2021
48ceda7
calculateAtomicNeuralNetwors was rewritten
Mar 10, 2021
9733e80
Added averageEnergy and calcDisagreement function in Structure. calcu…
Kyvala Mar 10, 2021
f887786
Force committee implemented. Not tested.
Kyvala Mar 10, 2021
15a7548
Bug fixes for committeeMode::Disabled
Kyvala Mar 11, 2021
a4173d0
Added energy conversion. Energy tested.
Kyvala Mar 11, 2021
ad0778d
Added force conversions. Forces tested.
Kyvala Mar 11, 2021
b6d5460
Added force conversions. Forces tested.
Kyvala Mar 11, 2021
6a5ac45
Print committee values
Kyvala Mar 11, 2021
ed7f4ae
Committee file is created
Kyvala Mar 11, 2021
2bf862c
Formatting
Kyvala Mar 11, 2021
88b54c0
energyOffsed modified for committee
Kyvala Mar 11, 2021
dda1ec5
CommitteeDisagreement added to energy/nnforces.out
Kyvala Mar 17, 2021
5be30f7
nnp-train fix for committee
Kyvala Mar 26, 2021
c1a1ed7
Mostly cosmetic changes, two fixes
singraber Apr 30, 2021
21cde70
Merge branch 'master' of github.com:CompPhysVienna/n2p2 into committe…
singraber Apr 30, 2021
46323ae
Folder order fix for weights
Kyvala May 7, 2021
0ebd71f
LAMMPS force implementation. Tested.
Kyvala May 11, 2021
b5ba2fb
Lammps examples updated
Kyvala May 11, 2021
eac8b43
Energy committee disagreement for LAMMPS implemented.
Kyvala May 20, 2021
c28d29d
Major update
Kyvala Dec 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/interface-LAMMPS/H2O_RPBE-D3/md.lmp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ mass 1 ${mass_H}
mass 2 ${mass_O}
timestep ${dt}
thermo 1
thermo_modify format float %14.6f
dump 4a all custom 5 dump.myforce.* id type fx fy fz

###############################################################################
# NN
Expand Down
10 changes: 1 addition & 9 deletions examples/interface-LAMMPS/H2O_RPBE-D3/nnp-data/input.nn
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
###############################################################################
# HDNNP for water H2O
###############################################################################
# Length unit : Bohr
# Energy unit : Ha
# Reference method: RPBE-D3
###############################################################################

###############################################################################
# DATA SET NORMALIZATION
###############################################################################
Expand Down Expand Up @@ -42,7 +34,7 @@ parallel_mode 4 # Training parallelization used (
update_strategy 0 # Update strategy (0 = Combined, 1 = Per-element).
selection_mode 2 # Update candidate selection mode (0 = Random, 1 = Sort, 2 = Threshold).
memorize_symfunc_results # Keep symmetry function results in memory.
random_seed 2
random_seed 7
test_fraction 0.1 # Fraction of structures kept for testing.
use_short_forces # Use forces for training.
force_weight 10.0 # Weight of force updates relative to energy updates.
Expand Down
2,752 changes: 1,376 additions & 1,376 deletions examples/interface-LAMMPS/H2O_RPBE-D3/nnp-data/weights.001.data

Large diffs are not rendered by default.

2,902 changes: 1,451 additions & 1,451 deletions examples/interface-LAMMPS/H2O_RPBE-D3/nnp-data/weights.008.data

Large diffs are not rendered by default.

17,300 changes: 17,300 additions & 0 deletions examples/interface-LAMMPS/H2O_RPBE-D3_Committee/h2o_8640_liquid_NpT_RPBE-D3.data

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions examples/interface-LAMMPS/H2O_RPBE-D3_Committee/md.lmp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
###############################################################################
# MD simulation for NN water
###############################################################################

###############################################################################
# VARIABLES
###############################################################################
clear
# Configuration files
variable cfgFile string "h2o_8640_liquid_NpT_RPBE-D3.data"
# Timesteps
variable numSteps equal 100
variable dt equal 0.0005
# NN
variable nnpCutoff equal 6.36
variable nnpDir string "nnp-data"
# Masses
variable mass_H equal 1.00794
variable mass_O equal 15.9994

###############################################################################
# GENERAL SETUP
###############################################################################
units metal
boundary p p p
atom_style atomic
read_data ${cfgFile}
mass 1 ${mass_H}
mass 2 ${mass_O}
timestep ${dt}
thermo 1
thermo_modify format float %14.6f
dump 4a all custom 1 dump.myforce.* id type fx fy fz

###############################################################################
# NN
###############################################################################
pair_style nnp dir ${nnpDir} showew no showewsum 10 resetew no maxew 100 calcd 1 wricde 1.6 maxcde 3.0 wricdf 0.04 maxcdf 0.10 cflength 1.8897261328 cfenergy 0.0367493254 emap "1:H,2:O"
pair_coeff * * ${nnpCutoff}

###############################################################################
# INTEGRATOR
###############################################################################
fix INT all nve
dump 1 all atom 1 traj.dump

###############################################################################
# SIMULATION
###############################################################################
run ${numSteps}
169 changes: 169 additions & 0 deletions examples/interface-LAMMPS/H2O_RPBE-D3_Committee/nnp-data/input.nn
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
###############################################################################
# DATA SET NORMALIZATION
###############################################################################
# This section was automatically added by nnp-norm.
mean_energy -2.5521343547039809E+01
conv_energy 2.4265748255366972E+02
conv_length 5.8038448995319847E+00
###############################################################################

###############################################################################
# GENERAL NNP SETTINGS
###############################################################################
number_of_elements 2 # Number of elements.
elements H O # Specification of elements.
#atom_energy H -0.45890771 # Free atom reference energy (H).
#atom_energy O -74.94518524 # Free atom reference energy (O).
cutoff_type 2 # Cutoff type.
scale_symmetry_functions # Scale all symmetry functions with min/max values.
#scale_symmetry_functions_sigma # Scale all symmetry functions with sigma.
scale_min_short 0.0 # Minimum value for scaling.
scale_max_short 1.0 # Maximum value for scaling.
center_symmetry_functions # Center all symmetry functions, i.e. subtract mean value.
global_hidden_layers_short 2 # Number of hidden layers.
global_nodes_short 25 25 # Number of nodes in each hidden layer.
global_activation_short t t l # Activation function for each hidden layer and output layer.
#normalize_nodes # Normalize input of nodes.
committee_mode prediction # Enables Committee-HDNNP, possible modes = prediction, validation.
committee_data nnp-data 8 # Committee data directory prefix and committee size.

###############################################################################
# ADDITIONAL SETTINGS FOR TRAINING
###############################################################################
epochs 25 # Number of training epochs.
updater_type 1 # Weight update method (0 = Gradient Descent, 1 = Kalman filter).
parallel_mode 4 # Training parallelization used (0 = Serial, 1 = Multi-stream, 2 = MS with PMO).
update_strategy 0 # Update strategy (0 = Combined, 1 = Per-element).
selection_mode 2 # Update candidate selection mode (0 = Random, 1 = Sort, 2 = Threshold).
memorize_symfunc_results # Keep symmetry function results in memory.
random_seed 7
test_fraction 0.1 # Fraction of structures kept for testing.
use_short_forces # Use forces for training.
force_weight 10.0 # Weight of force updates relative to energy updates.
short_energy_fraction 1.000 # Fraction of energy updates per epoch.
short_force_fraction 0.041 # Fraction of force updates per epoch.
short_energy_error_threshold 1.00 # RMSE threshold for energy update candidates.
short_force_error_threshold 1.00 # RMSE threshold for force update candidates.
rmse_threshold_trials 3 # Maximum number of RMSE threshold trials.
#repeated_energy_update # After force update perform energy update for corresponding structure.
#use_old_weights_short # Restart fitting with old weight parameters.
weights_min -1.0 # Minimum value for initial random weights.
weights_max 1.0 # Maximum value for initial random weights.
#precondition_weights # Precondition weights with initial energies.
#nguyen_widrow_weights_short # Initialize neural network weights according to Nguyen-Widrow scheme.
write_trainpoints 25 # Write energy comparison.
write_trainforces 25 # Write force comparison.
write_weights_epoch # Write weights.
write_neuronstats 5 10 # Write neuron statistics.
write_trainlog # Write training log file.
####################
# GRADIENT DESCENT #
####################
gradient_type 0 # Gradient descent type (0 = Fixed step size).
gradient_eta 1.0E-4 # Gradient descent parameter eta (fixed step size).
############################
# KALMAN FILTER (STANDARD) #
############################
kalman_type 0 # Kalman filter type (0 = Standard, 1 = Fading memory).
kalman_epsilon 1.0E-2 # General Kalman filter parameter epsilon (sigmoidal: 0.01, linear: 0.001).
kalman_q0 0.01 # General Kalman filter parameter q0 ("large").
kalman_qtau 2.302 # General Kalman filter parameter qtau (2.302 => 1 order of magnitude per epoch).
kalman_qmin 1.0E-6 # General Kalman filter parameter qmin (typ. 1.0E-6).
kalman_eta 0.01 # Standard Kalman filter parameter eta (0.001-1.0).
kalman_etatau 2.302 # Standard Kalman filter parameter etatau (2.302 => 1 order of magnitude per epoch).
kalman_etamax 1.0 # Standard Kalman filter parameter etamax (1.0+).
#################################
# KALMAN FILTER (FADING MEMORY) #
#################################
#kalman_type 1 # Kalman filter type (0 = Standard, 1 = Fading memory).
#kalman_epsilon 1.0E-1 # General Kalman filter parameter epsilon (sigmoidal: 0.01, linear: 0.001).
#kalman_q0 0.00 # General Kalman filter parameter q0 ("large").
#kalman_qtau 2.302 # General Kalman filter parameter qtau (2.302 => 1 order of magnitude per epoch).
#kalman_qmin 0.0E-6 # General Kalman filter parameter qmin (typ. 1.0E-6).
#kalman_lambda_short 0.96000 # Fading memory Kalman filter parameter lambda (forgetting factor 0.95-0.99).
#kalman_nue_short 0.99950 # Fading memory Kalman filter parameter nu (0.99-0.9995).

###############################################################################
# SYMMETRY FUNCTIONS
###############################################################################

# Radial symmetry function (type 2):
#symfunction_short <element-central> 2 <element-neighbor> <eta> <rshift> <rcutoff>

# Narrow Angular symmetry function (type 3):
#symfunction_short <element-central> 3 <element-neighbor1> <element-neighbor2> <eta> <lambda> <zeta> <rcutoff>

# Wide Angular symmetry function (type 9):
#symfunction_short <element-central> 9 <element-neighbor1> <element-neighbor2> <eta> <lambda> <zeta> <rcutoff>

# radial H H
symfunction_short H 2 H 0.001 0.0 12.00
symfunction_short H 2 H 0.01 0.0 12.00
symfunction_short H 2 H 0.03 0.0 12.00
symfunction_short H 2 H 0.06 0.0 12.00
symfunction_short H 2 H 0.15 1.9 12.00
symfunction_short H 2 H 0.30 1.9 12.00
symfunction_short H 2 H 0.60 1.9 12.00
symfunction_short H 2 H 1.50 1.9 12.00

# radial H O / O H
symfunction_short H 2 O 0.001 0.0 12.00
symfunction_short H 2 O 0.01 0.0 12.00
symfunction_short H 2 O 0.03 0.0 12.00
symfunction_short H 2 O 0.06 0.0 12.00
symfunction_short H 2 O 0.15 0.9 12.00
symfunction_short H 2 O 0.30 0.9 12.00
symfunction_short H 2 O 0.60 0.9 12.00
symfunction_short H 2 O 1.50 0.9 12.00

symfunction_short O 2 H 0.001 0.0 12.00
symfunction_short O 2 H 0.01 0.0 12.00
symfunction_short O 2 H 0.03 0.0 12.00
symfunction_short O 2 H 0.06 0.0 12.00
symfunction_short O 2 H 0.15 0.9 12.00
symfunction_short O 2 H 0.30 0.9 12.00
symfunction_short O 2 H 0.60 0.9 12.00
symfunction_short O 2 H 1.50 0.9 12.00

# radial O O
symfunction_short O 2 O 0.001 0.0 12.00
symfunction_short O 2 O 0.01 0.0 12.00
symfunction_short O 2 O 0.03 0.0 12.00
symfunction_short O 2 O 0.06 0.0 12.00
symfunction_short O 2 O 0.15 4.0 12.00
symfunction_short O 2 O 0.30 4.0 12.00
symfunction_short O 2 O 0.60 4.0 12.00
symfunction_short O 2 O 1.50 4.0 12.00

# angular
symfunction_short H 3 O H 0.2 1.0 1.0 12.00000

symfunction_short O 3 H H 0.07 1.0 1.0 12.00000
symfunction_short H 3 O H 0.07 1.0 1.0 12.00000
symfunction_short O 3 H H 0.07 -1.0 1.0 12.00000
symfunction_short H 3 O H 0.07 -1.0 1.0 12.00000

symfunction_short O 3 H H 0.03 1.0 1.0 12.00000
symfunction_short H 3 O H 0.03 1.0 1.0 12.00000
symfunction_short O 3 H H 0.03 -1.0 1.0 12.00000
symfunction_short H 3 O H 0.03 -1.0 1.0 12.00000

symfunction_short O 3 H H 0.01 1.0 4.0 12.00000
symfunction_short H 3 O H 0.01 1.0 4.0 12.00000
symfunction_short O 3 H H 0.01 -1.0 4.0 12.00000
symfunction_short H 3 O H 0.01 -1.0 4.0 12.00000

symfunction_short O 3 O H 0.03 1.0 1.0 12.00000
symfunction_short O 3 O H 0.03 -1.0 1.0 12.00000
symfunction_short O 3 O H 0.001 1.0 4.0 12.00000
symfunction_short O 3 O H 0.001 -1.0 4.0 12.00000

symfunction_short H 3 O O 0.03 1.0 1.0 12.00000
symfunction_short H 3 O O 0.03 -1.0 1.0 12.00000
symfunction_short H 3 O O 0.001 1.0 4.0 12.00000
symfunction_short H 3 O O 0.001 -1.0 4.0 12.00000

symfunction_short O 3 O O 0.03 1.0 1.0 12.00000
symfunction_short O 3 O O 0.03 -1.0 1.0 12.00000
symfunction_short O 3 O O 0.001 1.0 4.0 12.00000
symfunction_short O 3 O O 0.001 -1.0 4.0 12.00000
Loading