howto:pao-ml
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:pao-ml [2018/01/25 00:23] – [Tuning the PAO Optimization] oschuett | howto:pao-ml [2024/01/03 13:19] (current) – oschuett | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== How to run simulations with PAO-ML ====== | + | This page has been moved to: https://manual.cp2k.org/trunk/ |
- | + | ||
- | PAO-ML stands for Polarized Atomic Orbitals from Machine Learning. It uses machine learning to generate geometry adopted small basis sets. It also provides exact ionic forces. The scheme can serve as an almost drop-in replacement for conventional | + | |
- | basis sets to speedup otherwise standard DFT calculations. The method is similar to semi-empirical models based on minimal basis sets, but offers improved accuracy and quasi-automatic parameterization. However, the method is still in an early stage - so use with caution. For more information see: [[doi> | + | |
- | + | ||
- | ===== Step 1: Obtain training structures ===== | + | |
- | + | ||
- | The PAO-ML scheme takes a set of training structures as input. For each of these structures, the variational PAO basis is determined via an explicit optimization. The training structures should be much smaller than the target system, but large enough to contain all the //motifs// of the larger system. For liquids a good way to obtain structures is to run an MD of a smaller box. | + | |
- | + | ||
- | ===== Step 2: Calculate reference data in primary basis ===== | + | |
- | + | ||
- | Choose a primary basis set, e.g. '' | + | |
- | + | ||
- | ===== Step 3: Optimize PAO basis for training structures ===== | + | |
- | + | ||
- | Choose a [[inp> | + | |
- | + | ||
- | Most of the PAO settings are in the [[inp> | + | |
- | < | + | |
- | &PAO | + | |
- | EPS_PAO | + | |
- | MAX_PAO | + | |
- | + | ||
- | MAX_CYCLES 500 ! tunning parameter for PAO optimization scheme | + | |
- | MIXING | + | |
- | PREOPT_DM_FILE primay_basis.dm | + | |
- | + | ||
- | LINPOT_REGULARIZATION_DELTA 1E-6 !!!! Critical parameter for accuracy vs learnability trade-off !!!! | + | |
- | + | ||
- | LINPOT_REGULARIZATION_STRENGTH 1E-3 ! rather insensitive parameter, 1e-3 works usually | + | |
- | REGULARIZATION 1.0E-3 | + | |
- | + | ||
- | PRECONDITION YES ! not important, don't touch | + | |
- | LINPOT_PRECONDITION_DELTA 0.01 ! not important, don't touch | + | |
- | LINPOT_INITGUESS_DELTA 1E+10 ! not important, don't touch | + | |
- | + | ||
- | & | + | |
- | & | + | |
- | BACKUP_COPIES 1 ! write restart files, just in case | + | |
- | &END RESTART | + | |
- | &END PRINT | + | |
- | &END PAO | + | |
- | </ | + | |
- | + | ||
- | Settings for individual atomic kinds are in the [[inp> | + | |
- | < | + | |
- | &KIND H | + | |
- | PAO_BASIS_SIZE 1 ! set this to at least the minimal basis size | + | |
- | & | + | |
- | MAXL 4 ! 4 works usually | + | |
- | BETA 2.0 ! 2 work usually, but is worth exploring in case of accuracy or learnability issues. | + | |
- | &END PAO_POTENTIAL | + | |
- | &END KIND | + | |
- | </ | + | |
- | + | ||
- | ==== Tuning the PAO Optimization ===== | + | |
- | Find the optimal PAO basis poses an intricate minimization problem, because the rotation matrix U and the Kohn-Sham | + | |
- | matrix H have to be optimized in a self-consistent manner. In order to speedup the optimization, | + | |
- | * The frequency with which H is recalculated is determined by [[inp> | + | |
- | * Overshooting during the U optimization is damped via [[inp> | + | |
- | + | ||
- | The progress of the PAO optimization can be tracked from lines that start with '' | + | |
- | < | + | |
- | | + | |
- | PAO| step | + | |
- | </ | + | |
- | + | ||
- | * The step number counts the number of energy evaluation, ie. the number of U matrices probed. It can increase with different intervals, when the [[inp> | + | |
- | * The energy is the quantity that is optimized. It contains **only the first order term** of the total energy, ie. Tr[HP], but shares the same variational minima. It furthermore contains the contributions from the various regularization terms. | + | |
- | * The convergence criterion is the norm of the gradient normalized by system size. It is compared against [[inp> | + | |
- | * The step length is the outcome of the line search. It should be of order 1. If it starts | + | |
- | * The time is the time spend on this optimization step in seconds. This number can varry accordingly to the number of performed lines search steps. | + | |
- | + | ||
- | ===== Step 4: Optimize machine learning hyper-parameters ===== | + | |
- | + | ||
- | For the simulation of larger systems the PAO-ML scheme infers new PAO basis sets from the training data. For this two heuristics are employed: A [[https://en.wikipedia.org/wiki/Feature_(machine_learning) | descriptor ]] and an inference algorithm. Currently, only one simple descriptor and [[https:// | + | |
- | + | ||
- | In order to obtain good results from the learning machinery a small number of so-called [[https:// | + | |
- | + | ||
- | For the optimization of the hyper-parameter exists no gradient, hence one has to use a derivative-free method like the one by [[https:// | + | |
- | + | ||
- | ===== Step 5: Run simulation with PAO-ML ==== | + | |
- | + | ||
- | Most of the PAO-ML settings are in the [[inp> | + | |
- | < | + | |
- | &PAO | + | |
- | MAX_PAO 0 ! use PAO basis as predicted by ML, required for correct forces | + | |
- | PENALTY_STRENGTH 0.0 ! disable penalty, required for correct forces | + | |
- | + | ||
- | & | + | |
- | GP_SCALE 0.46 !!! critical tuning parameter - depends also on descriptor settings !!! | + | |
- | GP_NOISE_VAR 0.0001 | + | |
- | + | ||
- | + | ||
- | METHOD GAUSSIAN_PROCESS | + | |
- | DESCRIPTOR OVERLAP | + | |
- | PRIOR MEAN ! try once ZERO - makes usually no difference | + | |
- | TOLERANCE 1000.0 | + | |
- | + | ||
- | & | + | |
- | ../ | + | |
- | ../ | + | |
- | ../ | + | |
- | ! add more ... | + | |
- | &END TRAINING_SET | + | |
- | &END MACHINE_LEARNING | + | |
- | &END PAO | + | |
- | </ | + | |
- | + | ||
- | Settings for individual atomic kinds are again in the [[inp> | + | |
- | < | + | |
- | &KIND H | + | |
- | PAO_BASIS_SIZE 1 ! use same settings as for training | + | |
- | & | + | |
- | MAXL 4 ! use same settings as for training | + | |
- | BETA 2.0 ! use same settings as for training | + | |
- | &END PAO_POTENTIAL | + | |
- | + | ||
- | & | + | |
- | | + | |
- | | + | |
- | | + | |
- | &END PAO_DESCRIPTOR | + | |
- | &END KIND | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | + | ||
- | ===== Debugging accuracy vs learnability trade-off ===== | + | |
- | + | ||
- | When optimizing the PAO reference data in Step 3 one has to make a trade-off between accuracy and learnability. Good learnability means that similar structures leads to similar PAO parameters. In other words the PAO parameters should depend smoothly on the atomic positions. In general, the settings presented above should yield good results. However, if problems arise in the later machine learning steps, this might be the culprit. | + | |
- | + | ||
- | Unfortunately, | + | |
- | + | ||
- | The most critical parameters for learnability are [[inp> | + |
howto/pao-ml.1516839793.txt.gz · Last modified: 2020/08/21 10:15 (external edit)