ML MODE: Difference between revisions

From VASP Wiki
mNo edit summary
No edit summary
Line 2: Line 2:
{{TAGDEF|ML_MODE|[string]|NONE}}
{{TAGDEF|ML_MODE|[string]|NONE}}


Description: String based tag selecting operation mode for machine learning force fields.
Description: String-based tag selecting operation mode for machine learning force fields.
{{NB|warning|The description of this tag is currently under construction!}}
{{NB|mind|This tag is only available as of VASP.6.4.0.}}
{{NB|mind|This tag is only available as of VASP.6.4.0.}}
----
----
This tag acts as a "supertag" and selects the operation mode by selecting the defaults for all other tags. Every tag that is affected by this "supertag" can be overwritten by the user by simply specifying the value for that tag.
This tag acts as a "super tag" and selects the operation mode by selecting the defaults for all other tags. Every tag that is affected by this "super tag" can be overwritten by the user by simply specifying the value for that tag.
The following options are available for this tag:
The following options are available for this tag:
*{{TAG|ML_MODE}} = TRAIN or train: On-the-fly training is executed. If no {{TAG|ML_AB}} file is detected in the calculation folder the training is executed from scratch ({{TAG|ML_ISTART}}=0). Otherwise if an {{TAG|ML_AB}} exists a continuation run is executed ({{TAG|ML_ISTART}}=1).
*{{TAG|ML_MODE}} = TRAIN or train: There are two possible cases depending on, whether an {{TAG|ML_AB}} is present in the calculation folder or not:
*{{TAG|ML_MODE}} = SELECT or select: Reselection of the local reference configurations is done for an existing {{TAG|ML_AB}} file ({{TAG|ML_ISTART}}=3). Furthermore the following tags are set: {{TAG|NSW}}=1 ; '''{{TAG|ML_CDOUB}} = 4'''
**No {{TAG|ML_AB}} file:  On-the-fly training is executed from scratch. The following tag is set: {{TAG|ML_ISTART}} = 0. Force predictions from the machine learning force field are used to drive the molecular dynamics (MD) simulation. However, if the error estimation performed in each time step indicates a high force error an ab initio calculation is performed instead and the collected energy, forces, and stress are used to improve the machine learning force field. At the beginning of the MD run, there is no force field available and ab-initio calculations will happen frequently.
*{{TAG|ML_MODE}} = REFIT or refit: Refitting of the force field from an existing {{TAG|ML_AB}} file using the fast version ({{TAG|ML_ISTART}}=4 together with {{TAG|ML_LFAST}}=.TRUE.). Furthermore the following tags are set: {{TAG|NSW}}=1 ; {{TAG|ML_IALGO_LINREG}}=4 ; {{TAG|ML_SIGW0}} = 1E-7 ; {{TAG|ML_SIGV0}} = 1 ; '''{{TAG|ML_EPS_LOW}} = 1E-11'''.
**{{TAG|ML_AB}} file present: On-the-fly training is executed but taking into account pre-existing ab initio data. The following tag is set: {{TAG|ML_ISTART}} = 1. This is the usual choice for continuing a previous MD simulation with activated machine learning. Before the MD run starts the {{FILE|ML_AB}} file, copied from {{FILE|ML_ABN}} from a previous run, is read and the contained ab initio energies, forces, and stresses are used to generate an initial force field. Note that this preparative learning step adopts the previous choice of local reference configurations, i.e. the reference atomic environments entering the kernel are taken from a list in the {{FILE|ML_AB}} file. Then, the MD simulation is started with on-the-fly learning enabled. The {{FILE|ML_AB}} file does not necessarily need to contain structures matching the current starting configuration in the {{FILE|POSCAR}} file in terms of the simulation box, present elements, or the number of atoms. However, if the same elements appear the initial force field is of course used for predictions. In any case, the provided training data is included in the finally generated machine learning force field, i.e. the {{FILE|ML_FFN}} file will define a force field applicable to both, the structures in the {{FILE|ML_AB}} file and the current MD simulation. By restarting repeatedly with {{TAG|ML_MODE}}=''TRAIN'' while providing an {{FILE|ML_AB}} file from the last run it is possible to iteratively extend the applicability of the resulting machine learning force field, e.g. by exploring different temperature ranges or element compositions.
*{{TAG|ML_MODE}} = REFITBAYESIAN or refitbayesian (deprecated); Refitting of the force field from an existing {{TAG|ML_AB}} file using the Bayesian regression ({{TAG|ML_ISTART}}=4). Furthermore the following tags are set: {{TAG|NSW}}=1 ; {{TAG|ML_IALGO_LINREG}}=1 ; {{TAG|ML_LFAST}}=.FALSE. . This results in lower accuracy and much slower force fields then using {{TAG|ML_MODE}} = REFIT  and should be used with caution. On the other hand, this mode allows to generate ML_FFN files that can calculate Bayesian error estimates.
*{{TAG|ML_MODE}} = SELECT or select: Reselection of the local reference configurations is done for an existing {{TAG|ML_AB}} file. This tag sets the following tags: {{TAG|ML_ISTART}} = 3; {{TAG|NSW}} = 1 ; {{TAG|ML_CDOUB}} = 4. In this operation mode, a new machine learning force field is generated from ab initio data provided in the {{FILE|ML_AB}} file. The structures are read in and processed one by one as if harvested via an MD simulation. In other words, the same steps are performed as in on-the-fly training but the source of data is not an MD run but the series of structures available in {{FILE|ML_AB}}. This mode will ignore the list of local reference configurations in the {{FILE|ML_AB}} file and instead will determine a new collection which is written to the resulting {{FILE|ML_ABN}} file. A new iteration through the training structures can lead to a frequent update of the force field. This is quite time-consuming. Increasing {{TAG|ML_CDOUB}} from 2 to 4 for this mode will result in a much less frequent update of the force field. This leads to much more efficient calculations while practically not changing the results. The {{TAG|ML_AB}} file may contain values for ''CTIFOR'' for each training structure. These are the thresholds used to sample that structure from the previous training. If a value for {{TAG|ML_CTIFOR}} is specified in the {{TAG|INCAR}} file, that value is then used and the thresholds from the {{TAG|ML_AB}} are ignored. Otherwise: 1) If thresholds exist in the {{TAG|ML_AB}} they are used. 2) If no thresholds are specified the default value for {{TAG|ML_CTIFOR}} is used.
*{{TAG|ML_MODE}} = RUN or run: Force field only mode is executed ({{TAG|ML_ISTART}}=2). This mode requires an {{TAG|ML_FF}} file.
{{NB|tip|If calculations for {{TAG|ML_MODE}} {{=}} SELECT are too time-consuming, it is useful to increase {{TAG|ML_MCONF_NEW}} to values around 10-16. Together with {{TAG|ML_CDOUB}} {{=}} 4, this often accelerates the calculations by a factor of 2-4.}}
{{NB|mind|This operation mode needs to be used to generate {{VASP}} machine learning force fields from pre-computed or external ab initio data sets.}}
*{{TAG|ML_MODE}} = REFIT or refit: Refitting of the force field from an existing {{TAG|ML_AB}} file using the fast version. The following tags are set: {{TAG|ML_ISTART}}=4 ; {{TAG|ML_LFAST}}=.TRUE. ; {{TAG|NSW}}=1 ; {{TAG|ML_IALGO_LINREG}}=4 ; {{TAG|ML_SIGW0}} = 1E-7 ; {{TAG|ML_SIGV0}} = 1 ; {{TAG|ML_EPS_LOW}} = 1E-11. Similar to {{TAG|ML_MODE}} = ''SELECT'' refitting is done based on an existing {{TAG|ML_AB}} file, but the number of local reference configurations for each species is taken from the {{TAG|ML_AB}} file. Sparsification is performed on the local reference configurations, so the resulting {{TAG|ML_ABN}} might contain the same number or fewer local reference configurations than the {{TAG|ML_AB}} file. 
{{NB|warning|We strongly advise to use {{TAG|ML_MODE}} {{=}} ''REFIT'' if no error estimates are required during production runs.}}
*{{TAG|ML_MODE}} = REFITBAYESIAN or refitbayesian (deprecated); Same as {{TAG|ML_MODE}} = ''REFIT'' but Bayesian regression is employed. The following tags are set: {{TAG|ML_ISTART}}=4 ; {{TAG|NSW}}=1 ; {{TAG|ML_IALGO_LINREG}}=1 ; {{TAG|ML_LFAST}}=.FALSE.. This results in lower accuracy and much slower force fields than using {{TAG|ML_MODE}} = REFIT  and should be used with caution. On the other hand, this mode allows the generation of {{TAG|ML_FFN}} files that can calculate Bayesian error estimates.
*{{TAG|ML_MODE}} = RUN or run: Force field only mode is executed ({{TAG|ML_ISTART}}=2). This mode requires an {{TAG|ML_FF}} file. In this mode, the previously trained machine learning force field is read from the {{FILE|ML_FF}} file. The MD simulation is driven with predictions from the force field only, no ab initio calculations are performed and no learning is executed. This setting is typically used when the machine learning force field is considered mature and ready for production runs. Optionally if the force field was refitted using {{TAG|ML_MODE}}=''REFITBAYESIAN'', the Bayesian error estimate of the energies, forces, and stress can be computed and logged in the {{FILE|ML_LOGFILE}} by setting the output frequency of the Bayesian errors {{TAG|ML_IERR}}. The default is {{TAG|ML_IERR}}=0.
*{{TAG|ML_MODE}} = NONE or none: This tag is not used.
*{{TAG|ML_MODE}} = NONE or none: This tag is not used.


If any option other than the above is chosen or any of them is misspelled (be careful to write everything in upper case or lower case letters) the code will exit with an error.
If any option other than the above is chosen or any of them is misspelled (be careful to write everything in upper case or lower case letters) the code will exit with an error.


T'''he user may overwrite the default by specifying any of the machine learning tags in the INCAR file.'''
{{NB|tip|The user may overwrite the default by specifying any of the machine learning tags in the INCAR file.}}


== Related tags and articles ==
== Related tags and articles ==
{{TAG|ML_LMLFF}}, {{TAG|ML_ISTART}}, {{TAG|ML_LFAST}}, {{TAG|ML_IERR}}, {{TAG|ML_OUTBLOCK}}, {{TAG|ML_OUTPUT_MODE}}, {{TAG|ML_IALGO_LINREG}}, {{TAG|ML_MCONF_NEW}}, {{TAG|ML_CDOUB}}
{{TAG|ML_LMLFF}}, {{TAG|ML_ISTART}}, {{TAG|ML_LFAST}}, {{TAG|ML_IERR}}, {{TAG|ML_OUTBLOCK}}, {{TAG|ML_OUTPUT_MODE}}, {{TAG|ML_IALGO_LINREG}}, {{TAG|ML_MCONF_NEW}}, {{TAG|ML_CDOUB}}, {{TAG|ML_CTIFOR}}, {{TAG|ML_IERR}}
----
----


[[Category:INCAR tag]][[Category:Machine-learned force fields]]
[[Category:INCAR tag]][[Category:Machine-learned force fields]]

Revision as of 09:12, 14 April 2023

ML_MODE = [string]
Default: ML_MODE = NONE 

Description: String-based tag selecting operation mode for machine learning force fields.

Mind: This tag is only available as of VASP.6.4.0.

This tag acts as a "super tag" and selects the operation mode by selecting the defaults for all other tags. Every tag that is affected by this "super tag" can be overwritten by the user by simply specifying the value for that tag. The following options are available for this tag:

  • ML_MODE = TRAIN or train: There are two possible cases depending on, whether an ML_AB is present in the calculation folder or not:
    • No ML_AB file: On-the-fly training is executed from scratch. The following tag is set: ML_ISTART = 0. Force predictions from the machine learning force field are used to drive the molecular dynamics (MD) simulation. However, if the error estimation performed in each time step indicates a high force error an ab initio calculation is performed instead and the collected energy, forces, and stress are used to improve the machine learning force field. At the beginning of the MD run, there is no force field available and ab-initio calculations will happen frequently.
    • ML_AB file present: On-the-fly training is executed but taking into account pre-existing ab initio data. The following tag is set: ML_ISTART = 1. This is the usual choice for continuing a previous MD simulation with activated machine learning. Before the MD run starts the ML_AB file, copied from ML_ABN from a previous run, is read and the contained ab initio energies, forces, and stresses are used to generate an initial force field. Note that this preparative learning step adopts the previous choice of local reference configurations, i.e. the reference atomic environments entering the kernel are taken from a list in the ML_AB file. Then, the MD simulation is started with on-the-fly learning enabled. The ML_AB file does not necessarily need to contain structures matching the current starting configuration in the POSCAR file in terms of the simulation box, present elements, or the number of atoms. However, if the same elements appear the initial force field is of course used for predictions. In any case, the provided training data is included in the finally generated machine learning force field, i.e. the ML_FFN file will define a force field applicable to both, the structures in the ML_AB file and the current MD simulation. By restarting repeatedly with ML_MODE=TRAIN while providing an ML_AB file from the last run it is possible to iteratively extend the applicability of the resulting machine learning force field, e.g. by exploring different temperature ranges or element compositions.
  • ML_MODE = SELECT or select: Reselection of the local reference configurations is done for an existing ML_AB file. This tag sets the following tags: ML_ISTART = 3; NSW = 1 ; ML_CDOUB = 4. In this operation mode, a new machine learning force field is generated from ab initio data provided in the ML_AB file. The structures are read in and processed one by one as if harvested via an MD simulation. In other words, the same steps are performed as in on-the-fly training but the source of data is not an MD run but the series of structures available in ML_AB. This mode will ignore the list of local reference configurations in the ML_AB file and instead will determine a new collection which is written to the resulting ML_ABN file. A new iteration through the training structures can lead to a frequent update of the force field. This is quite time-consuming. Increasing ML_CDOUB from 2 to 4 for this mode will result in a much less frequent update of the force field. This leads to much more efficient calculations while practically not changing the results. The ML_AB file may contain values for CTIFOR for each training structure. These are the thresholds used to sample that structure from the previous training. If a value for ML_CTIFOR is specified in the INCAR file, that value is then used and the thresholds from the ML_AB are ignored. Otherwise: 1) If thresholds exist in the ML_AB they are used. 2) If no thresholds are specified the default value for ML_CTIFOR is used.
Tip: If calculations for ML_MODE = SELECT are too time-consuming, it is useful to increase ML_MCONF_NEW to values around 10-16. Together with ML_CDOUB = 4, this often accelerates the calculations by a factor of 2-4.
Mind: This operation mode needs to be used to generate VASP machine learning force fields from pre-computed or external ab initio data sets.
  • ML_MODE = REFIT or refit: Refitting of the force field from an existing ML_AB file using the fast version. The following tags are set: ML_ISTART=4 ; ML_LFAST=.TRUE. ; NSW=1 ; ML_IALGO_LINREG=4 ; ML_SIGW0 = 1E-7 ; ML_SIGV0 = 1 ; ML_EPS_LOW = 1E-11. Similar to ML_MODE = SELECT refitting is done based on an existing ML_AB file, but the number of local reference configurations for each species is taken from the ML_AB file. Sparsification is performed on the local reference configurations, so the resulting ML_ABN might contain the same number or fewer local reference configurations than the ML_AB file.
Warning: We strongly advise to use ML_MODE = REFIT if no error estimates are required during production runs.
  • ML_MODE = REFITBAYESIAN or refitbayesian (deprecated); Same as ML_MODE = REFIT but Bayesian regression is employed. The following tags are set: ML_ISTART=4 ; NSW=1 ; ML_IALGO_LINREG=1 ; ML_LFAST=.FALSE.. This results in lower accuracy and much slower force fields than using ML_MODE = REFIT and should be used with caution. On the other hand, this mode allows the generation of ML_FFN files that can calculate Bayesian error estimates.
  • ML_MODE = RUN or run: Force field only mode is executed (ML_ISTART=2). This mode requires an ML_FF file. In this mode, the previously trained machine learning force field is read from the ML_FF file. The MD simulation is driven with predictions from the force field only, no ab initio calculations are performed and no learning is executed. This setting is typically used when the machine learning force field is considered mature and ready for production runs. Optionally if the force field was refitted using ML_MODE=REFITBAYESIAN, the Bayesian error estimate of the energies, forces, and stress can be computed and logged in the ML_LOGFILE by setting the output frequency of the Bayesian errors ML_IERR. The default is ML_IERR=0.
  • ML_MODE = NONE or none: This tag is not used.

If any option other than the above is chosen or any of them is misspelled (be careful to write everything in upper case or lower case letters) the code will exit with an error.


Tip: The user may overwrite the default by specifying any of the machine learning tags in the INCAR file.

Related tags and articles

ML_LMLFF, ML_ISTART, ML_LFAST, ML_IERR, ML_OUTBLOCK, ML_OUTPUT_MODE, ML_IALGO_LINREG, ML_MCONF_NEW, ML_CDOUB, ML_CTIFOR, ML_IERR