Commit 6f991dff authored by Marvin Poul's avatar Marvin Poul
Browse files

Add RuNNer notebook

parent 79353fd9
%% Cell type:code id:extended-alliance tags:
``` python
from pyiron import Project
```
%% Cell type:code id:heard-leone tags:
``` python
pr = Project('md_run')
```
%% Cell type:code id:boolean-grammar tags:
``` python
import pandas as pd
```
%% Cell type:code id:civilian-trigger tags:
``` python
import os
```
%% Cell type:code id:hungry-invite tags:
``` python
!ls fit
```
%%%% Output: stream
input.nn scaling.data weights.029.data weights.029.out
%% Cell type:code id:animal-elite tags:
``` python
custom_potential = pd.DataFrame({
'Name': ['Cu'],
'Filename': [[f'{os.getcwd()}/fit/input.nn', f'{os.getcwd()}/fit/weights.029.data', f'{os.getcwd()}/fit/scaling.data']],
'Model': ['Custom'],
'Species': [['Cu']],
'Config': [['pair_style nnp dir "./" showew no showewsum 0 resetew no maxew 100 cflength 1.8897261328 cfenergy 0.0367493254 emap "1:Cu"\n',
'pair_coeff * * 12\n'
]]
})
```
%% Cell type:code id:chemical-jungle tags:
``` python
j = pr.create.job.Lammps("md", delete_existing_job=True)
```
%% Cell type:code id:interior-advancement tags:
``` python
j.potential = custom_potential
```
%% Cell type:code id:loved-fiber tags:
``` python
j.structure = pr.create.structure.ase_bulk('Cu', cubic=True).repeat(3)
```
%% Cell type:code id:prerequisite-membrane tags:
``` python
j.structure
```
%%%% Output: execute_result
Cu: [0. 0. 0.]
Cu: [0. 1.805 1.805]
Cu: [1.805 0. 1.805]
Cu: [1.805 1.805 0. ]
Cu: [0. 3.61 0. ]
Cu: [0. 5.415 1.805]
Cu: [1.805 3.61 1.805]
Cu: [1.805 5.415 0. ]
Cu: [0. 7.22 0. ]
Cu: [0. 9.025 1.805]
Cu: [1.805 7.22 1.805]
Cu: [1.805 9.025 0. ]
Cu: [3.61 0. 0. ]
Cu: [3.61 1.805 1.805]
Cu: [5.415 0. 1.805]
Cu: [5.415 1.805 0. ]
Cu: [3.61 3.61 0. ]
Cu: [3.61 5.415 1.805]
Cu: [5.415 3.61 1.805]
Cu: [5.415 5.415 0. ]
Cu: [3.61 7.22 0. ]
Cu: [3.61 9.025 1.805]
Cu: [5.415 7.22 1.805]
Cu: [5.415 9.025 0. ]
Cu: [7.22 0. 0. ]
Cu: [7.22 1.805 1.805]
Cu: [9.025 0. 1.805]
Cu: [9.025 1.805 0. ]
Cu: [7.22 3.61 0. ]
Cu: [7.22 5.415 1.805]
Cu: [9.025 3.61 1.805]
Cu: [9.025 5.415 0. ]
Cu: [7.22 7.22 0. ]
Cu: [7.22 9.025 1.805]
Cu: [9.025 7.22 1.805]
Cu: [9.025 9.025 0. ]
Cu: [0. 0. 3.61]
Cu: [0. 1.805 5.415]
Cu: [1.805 0. 5.415]
Cu: [1.805 1.805 3.61 ]
Cu: [0. 3.61 3.61]
Cu: [0. 5.415 5.415]
Cu: [1.805 3.61 5.415]
Cu: [1.805 5.415 3.61 ]
Cu: [0. 7.22 3.61]
Cu: [0. 9.025 5.415]
Cu: [1.805 7.22 5.415]
Cu: [1.805 9.025 3.61 ]
Cu: [3.61 0. 3.61]
Cu: [3.61 1.805 5.415]
Cu: [5.415 0. 5.415]
Cu: [5.415 1.805 3.61 ]
Cu: [3.61 3.61 3.61]
Cu: [3.61 5.415 5.415]
Cu: [5.415 3.61 5.415]
Cu: [5.415 5.415 3.61 ]
Cu: [3.61 7.22 3.61]
Cu: [3.61 9.025 5.415]
Cu: [5.415 7.22 5.415]
Cu: [5.415 9.025 3.61 ]
Cu: [7.22 0. 3.61]
Cu: [7.22 1.805 5.415]
Cu: [9.025 0. 5.415]
Cu: [9.025 1.805 3.61 ]
Cu: [7.22 3.61 3.61]
Cu: [7.22 5.415 5.415]
Cu: [9.025 3.61 5.415]
Cu: [9.025 5.415 3.61 ]
Cu: [7.22 7.22 3.61]
Cu: [7.22 9.025 5.415]
Cu: [9.025 7.22 5.415]
Cu: [9.025 9.025 3.61 ]
Cu: [0. 0. 7.22]
Cu: [0. 1.805 9.025]
Cu: [1.805 0. 9.025]
Cu: [1.805 1.805 7.22 ]
Cu: [0. 3.61 7.22]
Cu: [0. 5.415 9.025]
Cu: [1.805 3.61 9.025]
Cu: [1.805 5.415 7.22 ]
Cu: [0. 7.22 7.22]
Cu: [0. 9.025 9.025]
Cu: [1.805 7.22 9.025]
Cu: [1.805 9.025 7.22 ]
Cu: [3.61 0. 7.22]
Cu: [3.61 1.805 9.025]
Cu: [5.415 0. 9.025]
Cu: [5.415 1.805 7.22 ]
Cu: [3.61 3.61 7.22]
Cu: [3.61 5.415 9.025]
Cu: [5.415 3.61 9.025]
Cu: [5.415 5.415 7.22 ]
Cu: [3.61 7.22 7.22]
Cu: [3.61 9.025 9.025]
Cu: [5.415 7.22 9.025]
Cu: [5.415 9.025 7.22 ]
Cu: [7.22 0. 7.22]
Cu: [7.22 1.805 9.025]
Cu: [9.025 0. 9.025]
Cu: [9.025 1.805 7.22 ]
Cu: [7.22 3.61 7.22]
Cu: [7.22 5.415 9.025]
Cu: [9.025 3.61 9.025]
Cu: [9.025 5.415 7.22 ]
Cu: [7.22 7.22 7.22]
Cu: [7.22 9.025 9.025]
Cu: [9.025 7.22 9.025]
Cu: [9.025 9.025 7.22 ]
pbc: [ True True True]
cell:
Cell([10.83, 10.83, 10.83])
%% Cell type:code id:removable-place tags:
``` python
j.calc_md(n_ionic_steps=1000, temperature=500)
```
%% Cell type:code id:patent-translation tags:
``` python
j.run()
```
%%%% Output: stream
The job md was saved and received the ID: 13491011
%% Cell type:code id:conventional-dayton tags:
``` python
j.animate_structure()
```
%%%% Output: display_data
%% Cell type:code id:intimate-retail tags:
``` python
s = j.structure
```
%% Cell type:code id:hearing-negative tags:
``` python
e = s.elements[0]
```
%% Cell type:code id:compressed-texture tags:
``` python
e.Abbreviation
```
%%%% Output: execute_result
'Cu'
%% Cell type:code id:coral-concentrate tags:
``` python
```
### ####################################################################################################################
### This is the input file for the RuNNer tutorial (POTENTIALS WORKSHOP 2021-03-10)
### This input file is intended for release version 1.2
### RuNNer is hosted at www.gitlab.com. The most recent version can only be found in this repository.
### For access please contact Prof. Jörg Behler, joerg.behler@uni-goettingen.de
###
### ####################################################################################################################
### General remarks:
### - commands can be switched off by using the # character at the BEGINNING of the line
### - the input file can be structured by blank lines and comment lines
### - the order of the keywords is arbitrary
### - if keywords are missing, default values will be used and written to runner.out
### - if mandatory keywords or keyword options are missing, RuNNer will stop with an error message
###
########################################################################################################################
########################################################################################################################
### The following keywords just represent a subset of the keywords offered by RuNNer
########################################################################################################################
########################################################################################################################
########################################################################################################################
### general keywords
########################################################################################################################
nn_type_short 1 # 1=Behler-Parrinello
runner_mode 3 # 1=calculate symmetry functions, 2=fitting mode, 3=predicition mode
number_of_elements 1 # number of elements
elements Cu # specification of elements
random_seed 10 # integer seed for random number generator
random_number_type 6 # 6 recommended
########################################################################################################################
### NN structure of the short-range NN
########################################################################################################################
use_short_nn # use NN for short range interactions
global_hidden_layers_short 2 # number of hidden layers
global_nodes_short 15 15 # number of nodes in hidden layers
global_activation_short t t l # activation functions (t = hyperbolic tangent, l = linear)
########################################################################################################################
### symmetry function generation ( mode 1):
########################################################################################################################
test_fraction 0.10000 # threshold for splitting between fitting and test set
########################################################################################################################
### symmetry function definitions (all modes):
########################################################################################################################
cutoff_type 1
symfunction_short Cu 2 Cu 0.000000 0.000000 12.000000
symfunction_short Cu 2 Cu 0.006000 0.000000 12.000000
symfunction_short Cu 2 Cu 0.016000 0.000000 12.000000
symfunction_short Cu 2 Cu 0.040000 0.000000 12.000000
symfunction_short Cu 2 Cu 0.109000 0.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 1.000000 1.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 1.000000 2.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 1.000000 4.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 1.000000 16.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 -1.000000 1.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 -1.000000 2.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 -1.000000 4.000000 12.000000
symfunction_short Cu 3 Cu Cu 0.00000 -1.000000 16.000000 12.000000
########################################################################################################################
### fitting (mode 2):general inputs for short range AND electrostatic part:
########################################################################################################################
epochs 20 # number of epochs
fitting_unit eV # unit for error output in mode 2 (eV or Ha)
precondition_weights # optional precondition initial weights
########################################################################################################################
### fitting options ( mode 2): short range part only:
########################################################################################################################
short_energy_error_threshold 0.10000 # threshold of adaptive Kalman filter short E
short_force_error_threshold 1.00000 # threshold of adaptive Kalman filter short F
kalman_lambda_short 0.98000 # Kalman parameter short E/F, do not change
kalman_nue_short 0.99870 # Kalman parameter short E/F, do not change
use_short_forces # use forces for fitting
repeated_energy_update # optional: repeat energy update for each force update
mix_all_points # do not change
scale_symmetry_functions # optional
center_symmetry_functions # optional
short_force_fraction 0.01 #
force_update_scaling -1.0 #
########################################################################################################################
### output options for mode 2 (fitting):
########################################################################################################################
write_trainpoints # write trainpoints.out and testpoints.out files
write_trainforces # write trainforces.out and testforces.out files
########################################################################################################################
### output options for mode 3 (prediction):
########################################################################################################################
calculate_forces # calculate forces
calculate_stress # calculate stress tensor
1 1 14.256833324 19.604083786 16.584187995
1 2 10.772870436 14.917517522 12.575789477
1 3 7.067719199 9.940850811 8.325756144
1 4 3.063546892 4.514143322 3.699677080
1 5 0.443438674 0.840539370 0.611310762
1 6 11.372207256 23.338043099 16.099109800
1 7 30.908289966 62.610854904 43.470717798
1 8 4.747847116 10.201151151 6.890568480
1 9 24.299123692 49.473962957 34.262176478
1 10 1.690730707 3.912715044 2.559298728
1 11 16.549052901 34.322241783 23.555567314
1 12 0.252821214 0.820637834 0.460356083
1 13 4.065311900 9.687837138 6.245172716
-0.1359667057 -0.1284178204
0.0002929493
-0.6941954269
0.9059192336
-0.8539511180
0.6945597416
0.4158165063
-0.2203285181
-0.0468139145
0.4464672024
0.4146182872
-0.3380150711
0.1823814447
-0.3850976121
-0.6451795801
0.9100222759
0.1695670863
0.9610743963
-0.2710738436
-0.9187189953
-0.4209941537
0.3159901450
-0.5807968432
0.4037838756
-0.5755611410
0.0345929391
-1.0071075870
0.7881655380
-0.7353635404
-0.4519726848
-0.6846120126
-0.7739950144
0.6002150253
0.2877713394
-0.2472311317
-0.2638354273
-0.6882121053
0.7952962249
-0.2141858580
-0.2974177905
-0.8296260827
0.4039482533
0.8696835843
-0.5217230117
0.0610884548
-0.9143406316
-0.4548159822
-0.9098044897
0.1667283484
0.5111021091
0.7800678888
0.5494692376
-0.1488447687
-0.7703471814
-0.6034894622
-0.5957722003
-0.7020765696
-0.8808562031
0.6261094787
0.0724453439
0.6966501850
0.5010789743
-0.5777489975
-0.7439796706
0.8992219609
-0.6188936696
0.5704951193
0.0728913441
-0.7426060445
-0.8518844455
-0.4982094540
0.5946172110
-0.7218163160
0.1059872864
-0.5632129515
-0.4148453495
0.7770094203
0.3602930701
0.6914548497
0.7941781697
0.3868139218
-0.4315836970
-0.4347805324
-0.1596146352
-0.7872242593
-0.8954315132
-0.2058487886
0.4396848316
-0.9319795259
-0.4665903490
0.3735280586
0.5450969436
0.7004912972
-0.2913033525
-0.8192143373
0.8846068333
-0.8808933936
-0.3056738316
-0.2205490670
-0.2672502593
-0.3916647774
0.4481317701
0.5323756071
-0.8624885823
-0.2318618712
0.3939941528
-0.0050523244
0.7052520989
-0.3702774623
0.9363049639
0.1938345938
-0.3185875658
-0.8627965597
-0.4077709333
-0.8100009375
-0.1691273365
0.5383150063
-0.3040638758
-0.4737331548
0.4368445537
-0.4487063679
-0.4138616683
0.1365425907
-0.3131705916
0.6909707194
-0.7880995621
-0.6655887733
-0.6559684658
-0.3737506063
0.5987536276
0.9381084453
-0.7133843856
0.5989822098
-0.1561354605
0.4343418492
-0.7113947415
0.5250037367
-0.2404617681
-0.3598481441
0.5945116987
0.6137976152
-0.9715999056
-0.7762722471
-0.3305256376
0.3243180764
0.7949128926
-0.4904954486
-0.5831967142
1.0098935062
0.6502527286
-0.1411291290
0.3427817337
-0.9527665919
0.5146245674
0.7545799475
0.9735449358
-0.3511311644
0.5589951590
0.1040609640
0.9506646223
0.9253322336
0.2143226936
0.8616358146
0.4483927002
0.0899337251
0.2439686584
-0.9246864711
0.4814409855
0.7831052384
0.1116751404
-0.9560204725
-0.9129860888
0.8141850777
0.0599082352
-0.2736940346
-0.9550494978
-0.8196441234
0.8041853275
-0.3328550941
-0.5203514048
0.4648398466
0.4104627230
0.0778814132
-0.1480556077
0.1001068352
-0.7511645069
-0.2191604786
-0.8276402617
0.5717905882
0.4349693837
-0.9213283753
-0.3737653539
-0.7078750772
0.0441186396
-0.3107826649
0.3658392949
0.0560152067
-0.5993348094
-0.5984861277
-0.0378637725
0.2005431973
0.7836874376
0.3932740110
-0.6851599625
-0.8221892402
0.8312019078
0.8339919672
0.9343698067
-0.0663059898
-0.0812427427
-0.3146477528
-0.6392762316
0.3042994778
-0.1864662467
0.4638519905
0.2495251781
-0.5152221831
0.7628953151
-0.6503225958
0.5424588304
0.5711400245
0.5057551315
0.1463752788
-0.0951984440
0.4374671545
-0.9180474098
-0.1706592551
0.0074009449
-0.7921400726
-0.0794679078
-0.3619436686
-0.6265527922
0.0762093965
0.2770997643
-0.9287290869
-0.9207827784
-0.3332776362
-0.3306061401
-0.5799834635
-0.5365289251
0.5097002225
0.1267708491
-0.6137532817
0.7942590246
0.9238827624
-0.2933988359
0.5488073470
-0.4912019343
0.8696346299
-0.8888078328
0.6338067545
-0.2256789657
-0.9539387792
-0.2664270276
0.8311963505
-0.9369498823
0.1123082990
-0.3620094923
0.7320263800
-0.4534040835
0.5822665569
-0.7280786925
-0.2330917013
-0.6691638575
-0.2194349975
0.7516219461
0.7907011445
-0.0190759598
0.5768253541
-0.0879369628
0.0120313810
-0.1573347210
-0.3761259132
0.5346998374
0.1535414765
0.0519041488
0.9551599890
0.1538822614
-0.0163951003
0.6079396376
-0.1809966775
0.9717523305
0.8086106893
0.3254134502
0.0156976780
-0.5165294818
-0.7282391422
-0.6397284634
-0.9790829033
-0.0690347986
-0.9547439132
0.0521741528
0.6945341987
-0.1169916040
-0.8420942920
0.3921711618
0.1751054133
0.9021039467
-0.5344639711
0.3287415367
0.1482830674
0.9718909074
0.8491160268
0.8683778325