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

Better user interface and consistency check through out env/gp/kernel modules #184

Merged
merged 255 commits into from
Jun 18, 2020
Merged
Show file tree
Hide file tree
Changes from 242 commits
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
4763bdd
change to logger, change init arguments
nw13slx May 20, 2020
81680a9
revise the whole hyps structure
nw13slx May 20, 2020
d5dd2f7
update cutoff to dictionary for AtomicEnvironment
nw13slx May 20, 2020
babe7f2
simplify from mask to args
nw13slx May 20, 2020
a6a7e88
fix bugs for kernels
nw13slx May 20, 2020
ed5277a
ase logger changed to inherit from Output module
YuuuXie May 20, 2020
640bfdb
fix mc_sephyps_test and autopep8
nw13slx May 20, 2020
2fcfa32
upgrade unittest and fix backward compatability
nw13slx May 20, 2020
133cabb
fix module import err
YuuuXie May 20, 2020
83e623a
add option 'rank' for predict
YuuuXie May 20, 2020
7abe7d5
fix numba type error
nw13slx May 20, 2020
0094c21
change to verbose name
nw13slx May 20, 2020
ecb02a4
switch back to hyps_mask
nw13slx May 21, 2020
97c87af
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx May 21, 2020
24a320d
try logging
nw13slx May 21, 2020
76ab4b1
try to patch the typint glitch
nw13slx May 21, 2020
2743868
Merge branch 'feature/lixin/multiple-cutoff' of github.com:mir-group/…
nw13slx May 21, 2020
8b81729
fix merge error with the autosweep
nw13slx May 21, 2020
87a003b
swap the order of converting array to dict
nw13slx May 21, 2020
b551995
fix flush
nw13slx May 21, 2020
ff16224
fix multihyps and supercount merge error
nw13slx May 21, 2020
b18d453
remove mgp_en
YuuuXie May 21, 2020
a61f8a8
fix bug in hyps_mask update
nw13slx May 22, 2020
c84b86b
fix numba error & separate get_*_array into utils
YuuuXie May 22, 2020
ae9ba34
update arguments of str_to_kernel_set
nw13slx May 22, 2020
7eb7df8
fix backward compatability
nw13slx May 22, 2020
6b9bfbd
update tests
nw13slx May 22, 2020
a4f3208
update otf and parser
nw13slx May 22, 2020
0843dba
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx May 22, 2020
33fc68b
fix missing return
nw13slx May 22, 2020
e24f058
fix make_gp and make it easier to sync with gp definition
nw13slx May 22, 2020
8be9a3e
wind back to hyps_mask arguments...
nw13slx May 23, 2020
8e81fc4
rename to kernels
nw13slx May 23, 2020
16d56a0
reverse the change to from_grad_to_mask
nw13slx May 23, 2020
785d38d
remove debug print
nw13slx May 23, 2020
80d2994
add var to predict
YuuuXie May 23, 2020
74f23c0
wrap up mgp interface
YuuuXie May 24, 2020
699e5e1
change mgp interface
YuuuXie May 24, 2020
e402b1e
change mgp interface
YuuuXie May 24, 2020
f427fbc
changed singlemapxbody for map2b & map3b
YuuuXie May 25, 2020
b8eea0a
Merge branch 'master' of github.com:mir-group/flare into user_interfa…
nw13slx May 25, 2020
7137375
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx May 25, 2020
9c358b3
Merge branch 'development' of github.com:mir-group/flare into user_in…
nw13slx May 25, 2020
6a250d5
fix merging error and bugs in check_instanization
nw13slx May 25, 2020
9f40e38
fix minor bug in output
nw13slx May 25, 2020
77afec8
replace more print with logging
nw13slx May 25, 2020
5bd2c8d
revise print to logging in gp_algebra, gpfa and gp
nw13slx May 25, 2020
ed87e23
fix bugs trigger by logger.info
nw13slx May 25, 2020
d868cc3
update arguments for check_instanization in test_parameters
nw13slx May 25, 2020
6cdc545
fix no kernel_start bug
nw13slx May 25, 2020
d4b5f3d
fix gpaimd error
nw13slx May 27, 2020
c9c6de6
add map_3b_kernel_new to do matrix calculation
YuuuXie May 27, 2020
020bd12
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx May 28, 2020
eaf601f
finish 'write' funcs & cleanup input args
YuuuXie May 29, 2020
a383e2b
remove rank in predict
YuuuXie May 29, 2020
164100c
change cutoff
YuuuXie May 29, 2020
98504a9
add screen print stream to loggers
nw13slx May 29, 2020
3047f16
fix key error
nw13slx May 29, 2020
797bebc
remove .keys()
nw13slx May 29, 2020
00d6290
upgrade interface
nw13slx May 29, 2020
6b9a7a9
enable parallelization with gengrid_numba
nw13slx May 29, 2020
6cfee98
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx May 29, 2020
c571548
add back numba for get_triplets_for_kern & fix args err in mapxb
YuuuXie May 29, 2020
a38868f
change ASE OTF interface completely to inherit from OTF
YuuuXie May 31, 2020
3593aed
wrap up functions to get general interface for inheritance
YuuuXie May 31, 2020
7fb2d26
add dft interface for ASE OTF
YuuuXie May 31, 2020
dd0ef72
wrap ase otf as inheriting from OTF
YuuuXie May 31, 2020
4ea52de
tested mgp to the ase otf
YuuuXie May 31, 2020
3df5e2c
rm ase logger & add ase tutorial
YuuuXie Jun 1, 2020
86b923e
add ase ipynb
YuuuXie Jun 2, 2020
1bbc55e
add ase ipynb & rm useless docs of ase and mgp
YuuuXie Jun 2, 2020
e26875c
update docs
YuuuXie Jun 2, 2020
2c6f996
remove cp2k to run unit tests
jonpvandermause Jun 3, 2020
4af6550
fix test_ase import
jonpvandermause Jun 3, 2020
e2e4455
reverse commit (wrong branch)
jonpvandermause Jun 3, 2020
8bc2485
fix test_ase import
jonpvandermause Jun 3, 2020
94c451b
GPFA flowchart added to docs files
stevetorr Jun 4, 2020
5814aaf
Include flowchart in GPFA tutorial
stevetorr Jun 4, 2020
ec5562b
Resize figure
stevetorr Jun 4, 2020
d54eb6b
clean up the global_training list syncing
nw13slx Jun 4, 2020
866179a
add check in SingleMapXbody build_map
YuuuXie Jun 4, 2020
f0edaf0
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 4, 2020
062e4e6
fix logger error in serialization methods
nw13slx Jun 4, 2020
7fb6e0f
sync cutoffs and mask from GP to MGP
nw13slx Jun 4, 2020
9ff83d4
change logger set up
nw13slx Jun 4, 2020
447c99e
update mgp initialization in test_gp_from_aimd
nw13slx Jun 4, 2020
160a94c
remove duplicated screen print by logger
nw13slx Jun 4, 2020
d587e9c
remove the default file handler
nw13slx Jun 4, 2020
e4ce447
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 4, 2020
67e76ee
Predict.py now has 100% coverage
stevetorr Jun 4, 2020
b99ede2
Fixed pep8 errors
stevetorr Jun 4, 2020
03b5150
fix picke with logger
nw13slx Jun 4, 2020
5bc8484
Merge branch 'test/steven/enhanced_predict_tests' of github.com:mir-g…
nw13slx Jun 4, 2020
0f4c03a
Merge branch 'development' of github.com:mir-group/flare into user_in…
nw13slx Jun 4, 2020
bb19e7e
add logger attribute to backward_attributes
nw13slx Jun 4, 2020
c70027e
update cp2k wget
nw13slx Jun 4, 2020
8844345
fix rename function
nw13slx Jun 4, 2020
ff2b828
fix newline error in travis setting
nw13slx Jun 4, 2020
561ffb4
update init arguments
nw13slx Jun 4, 2020
5ca7b75
update logger and fix output bug in otf
nw13slx Jun 4, 2020
3b2c484
back up duplicated files
nw13slx Jun 4, 2020
94ec351
fix vasp_util unit test
nw13slx Jun 4, 2020
2751d9f
fix vasp_util unit test
nw13slx Jun 4, 2020
85c01bd
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 4, 2020
038504f
mv map_3b_kern to mgp/utils.py. TODO: write numba version for 2b & en…
YuuuXie Jun 4, 2020
05df5c5
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 4, 2020
5889d27
some kernel cleanup
jonpvandermause Jun 5, 2020
46a9a73
try addressing circular imports
jonpvandermause Jun 5, 2020
696011c
split utils_3b
nw13slx Jun 5, 2020
8a4f1a9
try disabling vasp and vasp_util tests
jonpvandermause Jun 5, 2020
783877d
reinstate vasp tests; add print statements to test_otf
jonpvandermause Jun 5, 2020
5c14669
disable test_lmp
jonpvandermause Jun 5, 2020
84f6b32
clean up grid kernel functions
YuuuXie Jun 5, 2020
61e5a1c
remove circular imports
nw13slx Jun 5, 2020
bf200bd
Merge branch 'refactory_travis-debug' into user_interface_refactory
nw13slx Jun 5, 2020
eeddc3c
add condition for OTF vasp test
nw13slx Jun 5, 2020
3bb5af8
clean up grid kernels
YuuuXie Jun 6, 2020
8dcf411
change mgp.mgp to mgp
YuuuXie Jun 6, 2020
0bced7a
debugged grid_kernels
YuuuXie Jun 7, 2020
1dc2c40
auto search lower & upper bound
YuuuXie Jun 7, 2020
34a4754
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 7, 2020
13b8235
fix 2b bug
YuuuXie Jun 7, 2020
a2e0a96
change some grid params default to 'auto'
YuuuXie Jun 7, 2020
4070fb5
add custom lower bound relaxation
YuuuXie Jun 7, 2020
83b1c7d
fix imports
nw13slx Jun 8, 2020
327db1e
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 8, 2020
ec31a8e
fix otf unit test
nw13slx Jun 8, 2020
2ac8a4c
fix array type to be int
nw13slx Jun 8, 2020
1ba4fa1
change way of looping grid_kernels for numba compatability
nw13slx Jun 8, 2020
3d66efc
clean up imports
nw13slx Jun 8, 2020
2eab4b8
fix cp2k binary mod
nw13slx Jun 8, 2020
3b3a90e
add skip condition for vasp run
nw13slx Jun 8, 2020
a7b4961
fix bug of write_to_structure
nw13slx Jun 8, 2020
7b21ebd
change str_to_mapped_kernel return value
nw13slx Jun 8, 2020
8977c42
fix test_lmp chdir problem
nw13slx Jun 8, 2020
15496fb
fix serial version condition
nw13slx Jun 8, 2020
029b957
revise the np.abs to np.isclose
nw13slx Jun 8, 2020
f508dda
revise the np.abs to np.isclose and gengrid boundary cases
nw13slx Jun 8, 2020
3c93b8c
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 8, 2020
bdb3ec5
TODO: add force-force for grid_kernel
YuuuXie Jun 8, 2020
1af695f
resolve conflict
YuuuXie Jun 8, 2020
c64bfea
disable the force-force in grid_kernel
YuuuXie Jun 8, 2020
355e157
move logger out of the class member. only store the name
nw13slx Jun 8, 2020
07c495a
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 8, 2020
6defa73
remove kernel_name in _gengrid_par
YuuuXie Jun 9, 2020
8ba63d9
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 9, 2020
afba0fd
Add, test method to remove data from a gp
stevetorr Jun 9, 2020
624e564
rm replicated predict
YuuuXie Jun 9, 2020
39ce119
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 9, 2020
966b377
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 9, 2020
0b5140b
Update requirements to try to fix bug with pymatgen
stevetorr Jun 9, 2020
5c280fb
rm 'update'. change cos to bond. fixed force map, don't know why
YuuuXie Jun 10, 2020
67cefd4
get_gp merged with get_force_gp
YuuuXie Jun 10, 2020
dfa6f10
add docs, disabled energy-block & multihyps
YuuuXie Jun 10, 2020
2448cbd
fix compare_dict
YuuuXie Jun 10, 2020
2d68363
fix test_ase_otf & skip 3b multihyps in test_mgp
YuuuXie Jun 10, 2020
1820646
sort imports and remove .keys()
nw13slx Jun 10, 2020
5adf8a4
change back to pos 1
YuuuXie Jun 10, 2020
468b674
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 10, 2020
9e0ba98
change import to acommondate new file names
nw13slx Jun 10, 2020
c56ecb6
merge the use_grid_kern with str_to_mapped kernel lines
nw13slx Jun 10, 2020
883efb1
rm replicated gengrid
YuuuXie Jun 11, 2020
1b63984
simplify lines in structure generation
nw13slx Jun 11, 2020
093e2b0
add z_to_mass
nw13slx Jun 11, 2020
3d82d67
add virtual functions in the parent class
nw13slx Jun 11, 2020
de6aef8
revise for better lammps interface
nw13slx Jun 11, 2020
fb44955
increase number of atoms but decrease unit cell size. set lower_bound…
nw13slx Jun 11, 2020
a0371b6
move the random seed setting outside of get_gp and get_tstp
nw13slx Jun 11, 2020
05713a7
fix the index problem in cubic spline
nw13slx Jun 11, 2020
0e01c00
merge with steven's branch
nw13slx Jun 11, 2020
cc307ad
fix segmentation fault
nw13slx Jun 11, 2020
3eb34d4
remove print lines
nw13slx Jun 11, 2020
5dcadeb
change the cell size and cutoff
nw13slx Jun 11, 2020
70591e8
fixed permutation err & negative lower bound
YuuuXie Jun 11, 2020
f1344c1
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 11, 2020
b7ee4ea
fix conflicting atomic species list and solve chdir problem
nw13slx Jun 11, 2020
8f9cdb1
fix wrong bracket
nw13slx Jun 11, 2020
b5b8b96
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 11, 2020
c91b2dc
Predict.py now has 100% coverage (#182)
stevetorr Jun 11, 2020
ecd7713
simplify test_lmp
nw13slx Jun 12, 2020
a63344b
add coded_species & species_labels
YuuuXie Jun 12, 2020
1378015
Add back a bit flexibility to take different kernels and different sp…
nw13slx Jun 12, 2020
bdf7399
add test_mgp_simple
YuuuXie Jun 12, 2020
473808d
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 12, 2020
e9ea032
add grid_kernel tests
nw13slx Jun 12, 2020
be7c057
Add, test method to remove force data from a gp (#183)
stevetorr Jun 12, 2020
27ed268
merge with master
nw13slx Jun 12, 2020
2562a7d
update pytest
jonpvandermause Jun 12, 2020
fcf9c11
fix gp dim err
YuuuXie Jun 12, 2020
440d054
rename the label to prevent deleting itself
YuuuXie Jun 12, 2020
5577855
fix construct_grid (meshgrid) issue & rm perm_list in grid_kernel
YuuuXie Jun 12, 2020
f2946c6
TODO: change lmp mgpf to bond length; test energy block; solve lower …
YuuuXie Jun 12, 2020
704a302
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
YuuuXie Jun 12, 2020
90461c7
fix import
YuuuXie Jun 12, 2020
6efb018
fix mgp args
YuuuXie Jun 13, 2020
6386b08
add energy
YuuuXie Jun 13, 2020
048ce05
rm redundant predict
YuuuXie Jun 13, 2020
2533077
rm get_triplets_en
YuuuXie Jun 13, 2020
398157a
add force lmp in mgp
YuuuXie Jun 13, 2020
0c27a0b
rm ase_parser & change arg
YuuuXie Jun 13, 2020
bf4515f
rm useless test file & update docs
YuuuXie Jun 13, 2020
5e5f266
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 13, 2020
7a996de
add back as_dict, from_dict etc.
YuuuXie Jun 13, 2020
a2e8315
TODO: add back. skip 3b force lammps unit test
YuuuXie Jun 13, 2020
37e4be4
fix import err
YuuuXie Jun 14, 2020
2ff034c
fix import err
YuuuXie Jun 14, 2020
439d18e
add tutorial
YuuuXie Jun 15, 2020
0b81816
correct parameter helper print statement
jonpvandermause Jun 15, 2020
b3ab918
Update requirements.txt
jonpvandermause Jun 15, 2020
f5b6a75
fix species bug
nw13slx Jun 15, 2020
b86d286
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 15, 2020
d301031
correct parameter helper print statement
jonpvandermause Jun 15, 2020
b72e205
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
jonpvandermause Jun 15, 2020
1c1cf74
update tutorials
nw13slx Jun 15, 2020
0063c96
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 15, 2020
bc4f971
update docstring
nw13slx Jun 15, 2020
cc3e7df
sort utils doc
nw13slx Jun 15, 2020
a8d8a27
shift module description up
nw13slx Jun 15, 2020
dd1df3b
add docs
YuuuXie Jun 15, 2020
67e63c6
change init
nw13slx Jun 15, 2020
a27c7a0
change args to kwargs in singlexbody
YuuuXie Jun 15, 2020
8640d3a
debug for json print
nw13slx Jun 15, 2020
5e7668b
use get_kernel_term func in from_dict
YuuuXie Jun 15, 2020
806ec6b
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 15, 2020
cf81f41
change grid sava path to mgp_grids folder
YuuuXie Jun 15, 2020
bea3e8e
fix lower bound bug and init args in unit tests
nw13slx Jun 15, 2020
96997f5
fix output level
nw13slx Jun 15, 2020
b8a31bc
change kernel_info & wrap gengrid in Gengrid
YuuuXie Jun 15, 2020
9bffe1c
revise docstring
nw13slx Jun 15, 2020
9f5f537
change kernel_info & wrap up mapped kernel
YuuuXie Jun 16, 2020
592c422
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 16, 2020
4b1dc77
try to fix unit test
YuuuXie Jun 16, 2020
74dcaf6
fix unit test
YuuuXie Jun 16, 2020
c5f95f8
add prefix in test_lmp_predict
YuuuXie Jun 16, 2020
4d52dec
Update docstring
nw13slx Jun 16, 2020
941afad
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 16, 2020
43dc506
add cell to struc (from_ase_atoms) & fix load_grid bug in mgp & repla…
YuuuXie Jun 16, 2020
8544b9f
fix otf logic
jonpvandermause Jun 16, 2020
125c08f
remove second md step from otf loop
jonpvandermause Jun 16, 2020
1829b0c
quick fix for changing structure positions
jonpvandermause Jun 16, 2020
a2a785a
have md.step return a copy of atom positions
jonpvandermause Jun 16, 2020
a53d3db
fix one mistake in docs
YuuuXie Jun 17, 2020
1ed4f69
change default value
YuuuXie Jun 17, 2020
4511a32
Merge branch 'user_interface_refactory' of https://github.com/mir-gro…
YuuuXie Jun 17, 2020
3af518b
sort test_gp_algebra
nw13slx Jun 17, 2020
3b1d347
Merge branch 'user_interface_refactory' of github.com:mir-group/flare…
nw13slx Jun 17, 2020
ed5bc7e
fix bug in test_force that skipped all tests
nw13slx Jun 17, 2020
0d087fc
Fix minor typo in docstring
stevetorr Jun 18, 2020
8411d30
rm comment lines
YuuuXie Jun 18, 2020
62f98ea
rm comment lines
YuuuXie Jun 18, 2020
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ pwscf.save/
/tests/test_ase/__pycache__/
/tests/test_outputs/*
test_files/qe_output_*.out
/tests/*log*
/tests/*.pickle
/tests/*.npy
/tests/*.xyz
/tests/*.gp
/tests/*-bak
Expand Down
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ before_install:
- pwd
- wget http://folk.uio.no/anjohan/lmp
- "wget https://github.com/cp2k/cp2k/releases/download/\
v6.1.0/cp2k-6.1-Linux-x86_64.sopt"
v7.1.0/cp2k-7.1-Linux-x86_64.sopt"
- chmod u+x lmp
- chmod u+x cp2k-6.1-Linux-x86_64.sopt
- chmod u+x cp2k-7.1-Linux-x86_64.sopt
- pip install -r requirements.txt

script:
- pwd
- cd tests
- PWSCF_COMMAND=pw.x CP2K_COMMAND=../cp2k-6.1-Linux-x86_64.sopt
- ls test_files
- PWSCF_COMMAND=pw.x
lmp=$(pwd)/../lmp
pytest --show-capture=all -vv --durations=0 --cov=../flare/
CP2K_COMMAND=../cp2k-7.1-Linux-x86_64.sopt
pytest -vv --durations=0 --cov=../flare/
- coverage xml

after_success:
Expand Down
Binary file added docs/images/GPFA_tutorial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
'sphinx.ext.autodoc',
'sphinx.ext.imgmath',
'sphinx_rtd_theme',
'sphinx.ext.napoleon'
'sphinx.ext.napoleon',
'nbsphinx'
]
napoleon_use_param = False
# Add any paths that contain templates here, relative to this directory.
Expand Down
2 changes: 0 additions & 2 deletions docs/source/flare/ase/ase.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ ASE Interface

We provide an interface to do the OTF training coupling with ASE.
Including wrapping the FLARE's GaussianProcess and MappedGaussianProcess into an ASE calculator: :class:`FLARE_Calculator`,
the on-the-fly training module coupled with ASE molecular dynamics engines :module:`otf_md.py`

.. toctree::
:maxdepth: 2

calculator
otf
otf_md
5 changes: 0 additions & 5 deletions docs/source/flare/ase/otf_md.rst

This file was deleted.

5 changes: 5 additions & 0 deletions docs/source/flare/utils/env_getarray.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Construct Atomic Environment
===================

.. automodule:: flare.utils.env_getarray
:members:
6 changes: 6 additions & 0 deletions docs/source/flare/utils/flare_io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
I/O for trajectories
===================

.. automodule:: flare.utils.flare_io
:members:

2 changes: 1 addition & 1 deletion docs/source/flare/utils/mask_helper.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Advanced Hyperparameters Set Up
===================

.. automodule:: flare.utils.mask_helper
.. automodule:: flare.utils.parameter_helper
:members:
3 changes: 3 additions & 0 deletions docs/source/flare/utils/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ Utility
element_coder
learner
mask_helper
env_getarray
md_helper
flare_io
265 changes: 265 additions & 0 deletions docs/source/tutorials/after_training.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# After Training\n",
"\n",
"After the on-the-fly training is complete, we can play with the force field we obtained. \n",
"We are going to do the following things:\n",
"\n",
"1. Parse the on-the-fly training trajectory to collect training data\n",
"2. Reconstruct the GP model from the training trajectory\n",
"3. Build up Mapped GP (MGP) for accelerated force field, and save coefficient file for LAMMPS\n",
"4. Use LAMMPS to run fast simulation using MGP pair style\n",
"\n",
"## Parse OTF log file\n",
"\n",
"After the on-the-fly training is complete, we have a log file and can use the `otf_parser` module to parse the trajectory. "
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from flare import otf_parser\n",
"\n",
"logdir = '../../../tests/test_files'\n",
"file_name = f'{logdir}/AgI_snippet.out'\n",
"hyp_no = 2 # use the hyperparameters from the 2nd training step\n",
"otf_object = otf_parser.OtfAnalysis(file_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Construct GP model from log file\n",
"\n",
"We can reconstruct GP model from the parsed log file (the on-the-fly training trajectory). Here we build up the GP model with 2+3 body kernel from the on-the-fly log file. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Final name of the gp instance is default_gp_2\n"
]
}
],
"source": [
"gp_model = otf_object.make_gp(hyp_no=hyp_no)\n",
"gp_model.parallel = True\n",
"gp_model.hyp_labels = ['sig2', 'ls2', 'sig3', 'ls3', 'noise']\n",
"\n",
"# write model to a binary file\n",
"gp_model.write_model('AgI.gp', format='pickle')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The last step `write_model` is to write this GP model into a binary file, \n",
"so next time we can directly load the model from the pickle file as"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Final name of the gp instance is default_gp_2_2\n"
]
}
],
"source": [
"from flare.gp import GaussianProcess\n",
"\n",
"gp_model = GaussianProcess.from_file('AgI.gp.pickle')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Map the GP force field & Dump LAMMPS coefficient file\n",
"\n",
"To use the trained force field with accelerated version MGP, or in LAMMPS, we need to build MGP from GP model. \n",
"Since 2-body and 3-body are both included, we need to set up the number of grid points for 2-body and 3-body in `grid_params`.\n",
"We build up energy mapping, thus set `map_force=False`.\n",
"See [MGP tutorial](https://flare.readthedocs.io/en/latest/tutorials/mgp.html) for more explanation of the MGP settings."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"from flare.mgp import MappedGaussianProcess\n",
"\n",
"grid_params = {'twobody': {'grid_num': [64]}, \n",
" 'threebody': {'grid_num': [20, 20, 20]}}\n",
"\n",
"data = gp_model.training_statistics\n",
"lammps_location = 'AgI_Molten_15.txt'\n",
"\n",
"mgp_model = MappedGaussianProcess(grid_params, data['species'], \n",
" map_force=False, lmp_file_name='AgI_Molten_15.txt', n_cpus=1)\n",
"mgp_model.build_map(gp_model)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The coefficient file for LAMMPS mgp pair_style is automatically saved once the mapping is done. \n",
"Saved as `lmp_file_name`. \n",
"\n",
"## Run LAMMPS with MGP pair style\n",
"\n",
"With the above coefficient file, we can run LAMMPS simulation with the mgp pair style. \n",
"First download our mgp pair style files, compile your lammps executable with mgp pair style following our [instruction](https://flare.readthedocs.io/en/latest/tutorials/lammps.html).\n",
"\n",
"1. One way to use it is running `lmp_executable < in.lammps > log.lammps` \n",
"with the executable provided in our repository. \n",
"When creating the input file, please note to set\n",
"\n",
"```\n",
"newton off\n",
"pair_style mgp\n",
"pair_coeff * * <lmp_file_name> <chemical_symbols> yes/no yes/no\n",
"```\n",
"\n",
"An example is using coefficient file `AgI_Molten_15.txt` for AgI system, \n",
"with two-body (the 1st `yes`) together with three-body (the 2nd `yes`).\n",
"\n",
"```\n",
"pair_coeff * * AgI_Molten_15.txt Ag I yes yes\n",
"```\n",
"\n",
"**Note**: if you build force mapping (`map_force=True`) instead of energy mapping, please use\n",
"```\n",
"pair_style mgpf\n",
"```\n",
"\n",
"2. The third way is to use the ASE LAMMPS interface"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from flare.ase.calculator import FLARE_Calculator\n",
"\n",
"# get chemical symbols, masses etc.\n",
"species = gp_model.training_statistics['species']\n",
"specie_symbol_list = \" \".join(species)\n",
"masses=[f\"{i} {_Z_to_mass[_element_to_Z[species[i]]]}\" for i in range(len(species))]\n",
"\n",
"# set up input params\n",
"parameters = {'command': os.environ.get('lmp'), # set up executable for ASE\n",
" 'newton': 'off',\n",
" 'pair_style': 'mgp',\n",
" 'pair_coeff': [f'* * {lammps_location} {specie_symbol_list} yes yes'],\n",
" 'mass': masses}\n",
"files = [lammps_location]\n",
"\n",
"# create ASE calc\n",
"lmp_calc = LAMMPS(label=f'tmp_AgI', keep_tmp_files=True, tmp_dir='./tmp/',\n",
" parameters=parameters, files=files, specorder=species)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3. The second way to run LAMMPS is using our LAMMPS interface, please set the\n",
"environment variable `$lmp` to the executable."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from flare import struc\n",
"from flare.lammps import lammps_calculator\n",
"\n",
"# lmp coef file is automatically written now every time MGP is constructed\n",
"\n",
"# create test structure\n",
"species = otf_object.gp_species_list[-1]\n",
"positions = otf_object.position_list[-1]\n",
"forces = otf_object.force_list[-1]\n",
"otf_cell = otf_object.header['cell']\n",
"structure = struc.Structure(otf_cell, species, positions)\n",
"\n",
"atom_types = [1, 2]\n",
"atom_masses = [108, 127]\n",
"atom_species = [1, 2] * 27\n",
"\n",
"# create data file\n",
"data_file_name = 'tmp.data'\n",
"data_text = lammps_calculator.lammps_dat(structure, atom_types,\n",
" atom_masses, atom_species)\n",
"lammps_calculator.write_text(data_file_name, data_text)\n",
"\n",
"# create lammps input\n",
"style_string = 'mgp'\n",
"coeff_string = '* * {} Ag I yes yes'.format(lammps_location)\n",
"lammps_executable = '$lmp'\n",
"dump_file_name = 'tmp.dump'\n",
"input_file_name = 'tmp.in'\n",
"output_file_name = 'tmp.out'\n",
"input_text = \\\n",
" lammps_calculator.generic_lammps_input(data_file_name, style_string,\n",
" coeff_string, dump_file_name)\n",
"lammps_calculator.write_text(input_file_name, input_text)\n",
"\n",
"lammps_calculator.run_lammps(lammps_executable, input_file_name,\n",
" output_file_name)\n",
"\n",
"lammps_forces = lammps_calculator.lammps_parser(dump_file_name)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading