mirror of https://github.com/lammps/lammps.git
Merge branch 'pod' of https://github.com/cesmix-mit/lammps into pod
This commit is contained in:
commit
db8b4af924
|
@ -27,54 +27,145 @@ Description
|
|||
|
||||
Fit a machine-learning interatomic potential (ML-IAP) based on proper
|
||||
orthogonal descriptors (POD). Two input files are required for this
|
||||
command. The first input file describes a POD potential, while the
|
||||
second input file specifies the DFT data.
|
||||
command. The first input file describes a POD potential parameter
|
||||
settings, while the second input file specifies the DFT data used for
|
||||
the fitting procedure.
|
||||
|
||||
Below is a one-line description of all the keywords that can be assigned
|
||||
in the first input file (``Ta_param.pod``):
|
||||
The table below has one-line descriptions of all the keywords that can
|
||||
be used in the first input file (i.e. ``Ta_param.pod`` in the example
|
||||
above):
|
||||
|
||||
* species (STRING): Chemical symbols for all elements in the system and have to match XYZ training files.
|
||||
* pbc 1 1 1 (INT): three integer constants specify boundary conditions
|
||||
* rin 1.0 (REAL): a real number specifies the inner cut-off radius
|
||||
* rcut 5.0 (REAL): a real number specifies the outer cut-off radius
|
||||
* bessel_polynomial_degree 3 (INT): the maximum degree of Bessel polynomials
|
||||
* inverse_polynomial_degree 6 (INT): the maximum degree of inverse radial basis functions
|
||||
* onebody 1 (BOOL): turns on/off one-body potential
|
||||
* twobody_number_radial_basis_functions 6 (INT): number of radial basis functions for two-body potential
|
||||
* threebody_number_radial_basis_functions 5 (INT): number of radial basis functions for three-body potential
|
||||
* threebody_number_angular_basis_functions 5 (INT): number of angular basis functions for three-body potential
|
||||
* fourbody_snap_twojmax 0 (INT): band limit for SNAP bispectrum components (0,2,4,6,8... allowed)
|
||||
* fourbody_snap_chemflag 0 (BOOL): turns on/off the explicit multi-element variant of the SNAP bispectrum components
|
||||
* quadratic_pod_potential 0 (BOOL): turns on/off quadratic POD potential
|
||||
* basename_for_output_files pod (STRING): a basename string added to the output files
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
All keywords except species have default values. If keywords are not set
|
||||
in the input file, their defaults are used. Next, we describe all the
|
||||
keywords that can be assigned in the second input file (``Ta_data.pod``):
|
||||
* - Keyword
|
||||
- Default
|
||||
- Type
|
||||
- Description
|
||||
* - species
|
||||
- (none)
|
||||
- STRING
|
||||
- Chemical symbols for all elements in the system and have to match XYZ training files.
|
||||
* - pbc
|
||||
- 1 1 1
|
||||
- INT
|
||||
- three integer constants specify boundary conditions
|
||||
* - rin
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real number specifies the inner cut-off radius
|
||||
* - rcut
|
||||
- 5.0
|
||||
- REAL
|
||||
- a real number specifies the outer cut-off radius
|
||||
* - bessel_polynomial_degree
|
||||
- 3
|
||||
- INT
|
||||
- the maximum degree of Bessel polynomials
|
||||
* - inverse_polynomial_degree
|
||||
- 6
|
||||
- INT
|
||||
- the maximum degree of inverse radial basis functions
|
||||
* - onebody
|
||||
- 1
|
||||
- BOOL
|
||||
- turns on/off one-body potential
|
||||
* - twobody_number_radial_basis_functions
|
||||
- 6
|
||||
- INT
|
||||
- number of radial basis functions for two-body potential
|
||||
* - threebody_number_radial_basis_functions
|
||||
- 5
|
||||
- INT
|
||||
- number of radial basis functions for three-body potential
|
||||
* - threebody_number_angular_basis_functions
|
||||
- 5
|
||||
- INT
|
||||
- number of angular basis functions for three-body potential
|
||||
* - fourbody_snap_twojmax
|
||||
- 0
|
||||
- INT
|
||||
- band limit for SNAP bispectrum components (0,2,4,6,8... allowed)
|
||||
* - fourbody_snap_chemflag
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off the explicit multi-element variant of the SNAP bispectrum components
|
||||
* - quadratic_pod_potential
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off quadratic POD potential
|
||||
* - basename_for_output_files
|
||||
- pod
|
||||
- STRING
|
||||
- a basename string added to the output files
|
||||
|
||||
* file_format extxyz (STRING): only extended xyz format is currently supported
|
||||
* file_extension xyz (STRING): extension of the data files
|
||||
* path_to_training_data_set (STRING): specifies the path to training data files in double quotes
|
||||
* path_to_test_data_set "" (STRING): specifies the path to test data files in double quotes
|
||||
* fraction_training_data_set 1.0 (REAL): a real number (<= 1.0) specifies the fraction of the training set used to fit POD
|
||||
* randomize_training_data_set 0 (BOOL): turns on/off randomization of the training set
|
||||
* fitting_weight_energy 100.0 (REAL): a real constant specifies the weight for energy in the least-squares fit
|
||||
* fitting_weight_force 1.0 (REAL): a real constant specifies the weight for force in the least-squares fit
|
||||
* error_analysis_for_training_data_set 0 (BOOL): turns on/off error analysis for the training data set
|
||||
* error_analysis_for_test_data_set 0 (BOOL): turns on/off error analysis for the test data set
|
||||
All keywords except *species* have default values. If a keyword is not
|
||||
set in the input file, its default value is used. The next table
|
||||
describes all keywords that can be used in the second input file
|
||||
(i.e. ``Ta_data.pod`` in the example above):
|
||||
|
||||
All keywords except path_to_training_data_set have default values. If
|
||||
keywords are not set in the input file, their defaults are used. On
|
||||
successful training, it produces a number of output files:
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
:widths: auto
|
||||
|
||||
* ``basename_training_errors.pod`` reports the errors in energy and forces for the training data set
|
||||
* ``basename_training_analysis.pod`` reports detailed errors for all training configurations
|
||||
* ``basename_test_errors.pod`` reports errors for the test data set
|
||||
* ``basename_test_analysis.pod`` reports detailed errors for all test configurations
|
||||
* ``basename_coefficients.pod`` contains the coefficients of the POD potential
|
||||
* - Keyword
|
||||
- Default
|
||||
- Type
|
||||
- Description
|
||||
* - file_format
|
||||
- extxyz
|
||||
- STRING
|
||||
- only the extended xyz format (extxyz) is currently supported
|
||||
* - file_extension
|
||||
- xyz
|
||||
- STRING
|
||||
- extension of the data files
|
||||
* - path_to_training_data_set
|
||||
- (none)
|
||||
- STRING
|
||||
- specifies the path to training data files in double quotes
|
||||
* - path_to_test_data_set
|
||||
- ""
|
||||
- STRING
|
||||
- specifies the path to test data files in double quotes
|
||||
* - fraction_training_data_set
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real number (<= 1.0) specifies the fraction of the training set used to fit POD
|
||||
* - randomize_training_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off randomization of the training set
|
||||
* - fitting_weight_energy
|
||||
- 100.0
|
||||
- REAL
|
||||
- a real constant specifies the weight for energy in the least-squares fit
|
||||
* - fitting_weight_force
|
||||
- 1.0
|
||||
- REAL
|
||||
- a real constant specifies the weight for force in the least-squares fit
|
||||
* - error_analysis_for_training_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off error analysis for the training data set
|
||||
* - error_analysis_for_test_data_set
|
||||
- 0
|
||||
- BOOL
|
||||
- turns on/off error analysis for the test data set
|
||||
|
||||
After training the POD potential, ``Ta_param.pod`` and ``basename_coefficients.pod``
|
||||
are two files needed to use the POD potential in LAMMPS. See
|
||||
All keywords except *path_to_training_data_set* have default values. If
|
||||
a keyword is not set in the input file, its default value is used. After
|
||||
successful training, a number of output files are produced, if enabled:
|
||||
|
||||
* ``<basename>_training_errors.pod`` reports the errors in energy and forces for the training data set
|
||||
* ``<basename>_training_analysis.pod`` reports detailed errors for all training configurations
|
||||
* ``<basename>_test_errors.pod`` reports errors for the test data set
|
||||
* ``<basename>_test_analysis.pod`` reports detailed errors for all test configurations
|
||||
* ``<basename>_coefficients.pod`` contains the coefficients of the POD potential
|
||||
|
||||
After training the POD potential, ``Ta_param.pod`` and ``<basename>_coefficients.pod``
|
||||
are the two files needed to use the POD potential in LAMMPS. See
|
||||
:doc:`pair_style pod <pair_pod>` for using the POD potential. Examples
|
||||
about training and using POD potentials are found in the directory
|
||||
lammps/examples/PACKAGES/pod.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
**************** Begin of Error Analysis for the Training Data Set ****************
|
||||
----------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force |
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Displaced_A15.xyz 9 576 0.011326 0.011373 0.113223 0.141496
|
||||
Displaced_BCC.xyz 9 486 0.012158 0.013983 0.240350 0.311834
|
||||
Displaced_FCC.xyz 9 432 0.001459 0.001605 0.082874 0.104038
|
||||
|
@ -14,7 +14,7 @@ Surface.xyz 7 236 0.025392 0.037556 0.096037
|
|||
Volume_A15.xyz 30 240 0.039262 0.048655 0.000000 0.000000
|
||||
Volume_BCC.xyz 21 42 0.049805 0.067608 0.000000 0.000000
|
||||
Volume_FCC.xyz 31 124 0.030071 0.041758 0.000000 0.000000
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
All files 363 4224 0.012915 0.025804 0.122413 0.259832
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
**************** End of Error Analysis for the Training Data Set ****************
|
||||
|
|
|
@ -50,7 +50,7 @@ fitting weight for stress: 0
|
|||
**************** Begin of Training Data Set ****************
|
||||
---------------------------------------------------------------
|
||||
data file | number of configurations | number of atoms
|
||||
===============================================================
|
||||
---------------------------------------------------------------
|
||||
Displaced_A15.xyz | 9 | 576
|
||||
Displaced_BCC.xyz | 9 | 486
|
||||
Displaced_FCC.xyz | 9 | 432
|
||||
|
@ -91,9 +91,9 @@ Configuration: # 201
|
|||
Configuration: # 301
|
||||
**************** End of Error Calculation ****************
|
||||
**************** Begin of Error Analysis for the Training Data Set ****************
|
||||
----------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force |
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Displaced_A15.xyz 9 576 0.011326 0.011373 0.113223 0.141496
|
||||
Displaced_BCC.xyz 9 486 0.012158 0.013983 0.240350 0.311834
|
||||
Displaced_FCC.xyz 9 432 0.001459 0.001605 0.082874 0.104038
|
||||
|
@ -106,9 +106,9 @@ Surface.xyz 7 236 0.025392 0.037556 0.096037
|
|||
Volume_A15.xyz 30 240 0.039262 0.048655 0.000000 0.000000
|
||||
Volume_BCC.xyz 21 42 0.049805 0.067608 0.000000 0.000000
|
||||
Volume_FCC.xyz 31 124 0.030071 0.041758 0.000000 0.000000
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
All files 363 4224 0.012915 0.025804 0.122413 0.259832
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
**************** End of Error Analysis for the Training Data Set ****************
|
||||
|
||||
Total wall time: 0:00:01
|
||||
|
|
|
@ -50,7 +50,7 @@ fitting weight for stress: 0
|
|||
**************** Begin of Training Data Set ****************
|
||||
---------------------------------------------------------------
|
||||
data file | number of configurations | number of atoms
|
||||
===============================================================
|
||||
---------------------------------------------------------------
|
||||
Displaced_A15.xyz | 9 | 576
|
||||
Displaced_BCC.xyz | 9 | 486
|
||||
Displaced_FCC.xyz | 9 | 432
|
||||
|
@ -91,9 +91,9 @@ Configuration: # 201
|
|||
Configuration: # 301
|
||||
**************** End of Error Calculation ****************
|
||||
**************** Begin of Error Analysis for the Training Data Set ****************
|
||||
----------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force |
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Displaced_A15.xyz 9 576 0.011326 0.011373 0.113223 0.141496
|
||||
Displaced_BCC.xyz 9 486 0.012158 0.013983 0.240350 0.311834
|
||||
Displaced_FCC.xyz 9 432 0.001459 0.001605 0.082874 0.104038
|
||||
|
@ -106,9 +106,9 @@ Surface.xyz 7 236 0.025392 0.037556 0.096037
|
|||
Volume_A15.xyz 30 240 0.039262 0.048655 0.000000 0.000000
|
||||
Volume_BCC.xyz 21 42 0.049805 0.067608 0.000000 0.000000
|
||||
Volume_FCC.xyz 31 124 0.030071 0.041758 0.000000 0.000000
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
All files 363 4224 0.012915 0.025804 0.122413 0.259832
|
||||
----------------------------------------------------------------------------------------
|
||||
---------------------------------------------------------------------------------------------------
|
||||
**************** End of Error Analysis for the Training Data Set ****************
|
||||
|
||||
Total wall time: 0:00:00
|
||||
|
|
|
@ -99,31 +99,31 @@ Neighbor list info ...
|
|||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 3.082 | 3.082 | 3.082 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 300 -11.841653 0 -11.803178 -15932.81
|
||||
10 296.91627 -11.841257 0 -11.803178 -15691.292
|
||||
20 287.83193 -11.840092 0 -11.803178 -14982.943
|
||||
30 273.2481 -11.838222 0 -11.803177 -13854.289
|
||||
40 253.97579 -11.83575 0 -11.803177 -12377.385
|
||||
50 231.08941 -11.832815 0 -11.803177 -10642.841
|
||||
60 205.86307 -11.829579 0 -11.803177 -8751.3479
|
||||
70 179.69197 -11.826223 0 -11.803177 -6804.808
|
||||
80 154.00241 -11.822928 0 -11.803177 -4898.2688
|
||||
90 130.15527 -11.819869 0 -11.803177 -3113.7145
|
||||
100 109.34992 -11.817201 0 -11.803177 -1516.1852
|
||||
Loop time of 2.33037 on 1 procs for 100 steps with 128 atoms
|
||||
0 300 -11.841652 0 -11.803177 -15932.736
|
||||
10 296.91627 -11.841257 0 -11.803177 -15691.219
|
||||
20 287.83193 -11.840092 0 -11.803177 -14982.869
|
||||
30 273.2481 -11.838221 0 -11.803177 -13854.215
|
||||
40 253.97579 -11.835749 0 -11.803177 -12377.312
|
||||
50 231.08941 -11.832814 0 -11.803177 -10642.767
|
||||
60 205.86306 -11.829579 0 -11.803177 -8751.2744
|
||||
70 179.69196 -11.826222 0 -11.803177 -6804.7346
|
||||
80 154.0024 -11.822927 0 -11.803177 -4898.1954
|
||||
90 130.15526 -11.819869 0 -11.803176 -3113.6412
|
||||
100 109.34991 -11.8172 0 -11.803176 -1516.1119
|
||||
Loop time of 2.21891 on 1 procs for 100 steps with 128 atoms
|
||||
|
||||
Performance: 1.854 ns/day, 12.947 hours/ns, 42.912 timesteps/s, 5.493 katom-step/s
|
||||
99.8% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
Performance: 1.947 ns/day, 12.327 hours/ns, 45.067 timesteps/s, 5.769 katom-step/s
|
||||
99.9% CPU use with 1 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 2.3293 | 2.3293 | 2.3293 | 0.0 | 99.95
|
||||
Pair | 2.2179 | 2.2179 | 2.2179 | 0.0 | 99.95
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0.00039757 | 0.00039757 | 0.00039757 | 0.0 | 0.02
|
||||
Output | 0.00023376 | 0.00023376 | 0.00023376 | 0.0 | 0.01
|
||||
Modify | 0.00017018 | 0.00017018 | 0.00017018 | 0.0 | 0.01
|
||||
Other | | 0.0003112 | | | 0.01
|
||||
Comm | 0.00038894 | 0.00038894 | 0.00038894 | 0.0 | 0.02
|
||||
Output | 0.00020551 | 0.00020551 | 0.00020551 | 0.0 | 0.01
|
||||
Modify | 0.00016188 | 0.00016188 | 0.00016188 | 0.0 | 0.01
|
||||
Other | | 0.0002651 | | | 0.01
|
||||
|
||||
Nlocal: 128 ave 128 max 128 min
|
||||
Histogram: 1 0 0 0 0 0 0 0 0 0
|
||||
|
|
|
@ -99,31 +99,31 @@ Neighbor list info ...
|
|||
bin: standard
|
||||
Per MPI rank memory allocation (min/avg/max) = 3.062 | 3.062 | 3.062 Mbytes
|
||||
Step Temp E_pair E_mol TotEng Press
|
||||
0 300 -11.841653 0 -11.803178 -15932.81
|
||||
10 296.91627 -11.841257 0 -11.803178 -15691.292
|
||||
20 287.83193 -11.840092 0 -11.803178 -14982.943
|
||||
30 273.2481 -11.838222 0 -11.803177 -13854.289
|
||||
40 253.97579 -11.83575 0 -11.803177 -12377.385
|
||||
50 231.08941 -11.832815 0 -11.803177 -10642.841
|
||||
60 205.86307 -11.829579 0 -11.803177 -8751.3479
|
||||
70 179.69197 -11.826223 0 -11.803177 -6804.808
|
||||
80 154.00241 -11.822928 0 -11.803177 -4898.2688
|
||||
90 130.15527 -11.819869 0 -11.803177 -3113.7145
|
||||
100 109.34992 -11.817201 0 -11.803177 -1516.1852
|
||||
Loop time of 0.615992 on 4 procs for 100 steps with 128 atoms
|
||||
0 300 -11.841652 0 -11.803177 -15932.736
|
||||
10 296.91627 -11.841257 0 -11.803177 -15691.219
|
||||
20 287.83193 -11.840092 0 -11.803177 -14982.869
|
||||
30 273.2481 -11.838221 0 -11.803177 -13854.215
|
||||
40 253.97579 -11.835749 0 -11.803177 -12377.312
|
||||
50 231.08941 -11.832814 0 -11.803177 -10642.767
|
||||
60 205.86306 -11.829579 0 -11.803177 -8751.2744
|
||||
70 179.69196 -11.826222 0 -11.803177 -6804.7346
|
||||
80 154.0024 -11.822927 0 -11.803177 -4898.1954
|
||||
90 130.15526 -11.819869 0 -11.803176 -3113.6412
|
||||
100 109.34991 -11.8172 0 -11.803176 -1516.1119
|
||||
Loop time of 0.593779 on 4 procs for 100 steps with 128 atoms
|
||||
|
||||
Performance: 7.013 ns/day, 3.422 hours/ns, 162.340 timesteps/s, 20.779 katom-step/s
|
||||
Performance: 7.275 ns/day, 3.299 hours/ns, 168.413 timesteps/s, 21.557 katom-step/s
|
||||
99.6% CPU use with 4 MPI tasks x 1 OpenMP threads
|
||||
|
||||
MPI task timing breakdown:
|
||||
Section | min time | avg time | max time |%varavg| %total
|
||||
---------------------------------------------------------------
|
||||
Pair | 0.59266 | 0.5987 | 0.60449 | 0.6 | 97.19
|
||||
Pair | 0.57816 | 0.58286 | 0.58797 | 0.5 | 98.16
|
||||
Neigh | 0 | 0 | 0 | 0.0 | 0.00
|
||||
Comm | 0.010733 | 0.016433 | 0.022459 | 3.7 | 2.67
|
||||
Output | 0.00020418 | 0.00021619 | 0.00025121 | 0.0 | 0.04
|
||||
Modify | 9.9553e-05 | 0.00010738 | 0.0001217 | 0.0 | 0.02
|
||||
Other | | 0.000532 | | | 0.09
|
||||
Comm | 0.0049949 | 0.010104 | 0.01481 | 3.5 | 1.70
|
||||
Output | 0.00018367 | 0.00020879 | 0.00024911 | 0.0 | 0.04
|
||||
Modify | 9.0609e-05 | 0.00010382 | 0.00012125 | 0.0 | 0.02
|
||||
Other | | 0.0005076 | | | 0.09
|
||||
|
||||
Nlocal: 32 ave 32 max 32 min
|
||||
Histogram: 4 0 0 0 0 0 0 0 0 0
|
||||
|
|
|
@ -453,9 +453,10 @@ void FitPOD::get_data(datastruct &data, std::vector<std::string> species)
|
|||
size_t maxname = 9;
|
||||
for (auto fname : data.data_files) maxname = MAX(maxname,fname.size());
|
||||
maxname -= data.data_path.size()+1;
|
||||
const std::string sepline(maxname+46, '-');
|
||||
if (comm->me == 0)
|
||||
utils::logmesg(lmp, "{:-<{}}\n {:^{}} | number of configurations | number of atoms\n{:=<{}}\n",
|
||||
"", maxname+46, "data file", maxname, "", maxname+46);
|
||||
utils::logmesg(lmp, "{}\n {:^{}} | number of configurations | number of atoms\n{}\n",
|
||||
sepline, "data file", maxname, sepline);
|
||||
int i = 0;
|
||||
for (auto fname : data.data_files) {
|
||||
std::string filename = fname.substr(data.data_path.size()+1);
|
||||
|
@ -466,7 +467,7 @@ void FitPOD::get_data(datastruct &data, std::vector<std::string> species)
|
|||
++i;
|
||||
}
|
||||
if (comm->me == 0) {
|
||||
utils::logmesg(lmp, "{:-<{}}\n", "", maxname+46);
|
||||
utils::logmesg(lmp, "{}\n", sepline);
|
||||
utils::logmesg(lmp, "number of files: {}\n", data.data_files.size());
|
||||
utils::logmesg(lmp, "number of configurations in all files: {}\n", data.num_config_sum);
|
||||
utils::logmesg(lmp, "number of atoms in all files: {}\n", data.num_atom_sum);
|
||||
|
@ -1316,54 +1317,46 @@ double FitPOD::energyforce_calculation(double *force, double *coeff, datastruct
|
|||
|
||||
void FitPOD::print_analysis(datastruct data, double *outarray, double *errors)
|
||||
{
|
||||
std::string s = "All files";
|
||||
int nfiles = data.data_files.size(); // number of files
|
||||
int lm = s.size();
|
||||
int lm = 10;
|
||||
for (int i = 0; i < nfiles; i++)
|
||||
lm = MAX(lm, (int) data.filenames[i].size());
|
||||
lm = lm + 2;
|
||||
|
||||
std::string filename_errors = (data.training ? "training_errors" : "test_errors");
|
||||
std::string filename_analysis = (data.training ? "training_analysis" : "test_analysis");
|
||||
|
||||
filename_errors = podptr->pod.filenametag + "_" + filename_errors + ".pod";
|
||||
filename_analysis = podptr->pod.filenametag + "_" + filename_analysis + ".pod";
|
||||
std::string filename_errors = fmt::format("{}_{}_errors.pod", podptr->pod.filenametag, data.training ? "training" : "test");
|
||||
std::string filename_analysis = fmt::format("{}_{}_analysis.pod", podptr->pod.filenametag, data.training ? "training" : "test");
|
||||
|
||||
FILE *fp_errors = nullptr;
|
||||
FILE *fp_analysis = nullptr;
|
||||
fp_errors = fopen(filename_errors.c_str(), "w");
|
||||
fp_analysis = fopen(filename_analysis.c_str(), "w");
|
||||
|
||||
std::string sa = "**************** Begin of Error Analysis for the Training Data Set ****************";
|
||||
std::string sb = "**************** Begin of Error Analysis for the Test Data Set ****************";
|
||||
std::string mystr = (data.training) ? sa : sb;
|
||||
std::string mystr = fmt::format("**************** Begin of Error Analysis for the {} Data Set ****************\n",
|
||||
data.training ? "Training" : "Test");
|
||||
|
||||
utils::logmesg(lmp, "{}\n", mystr);
|
||||
fmt::print(fp_errors, mystr + "\n");
|
||||
utils::logmesg(lmp, mystr);
|
||||
fmt::print(fp_errors, mystr);
|
||||
|
||||
sa = "----------------------------------------------------------------------------------------\n";
|
||||
sb = " File | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force |\n";
|
||||
|
||||
utils::logmesg(lmp, "{}", sa);
|
||||
utils::logmesg(lmp, "{}", sb);
|
||||
utils::logmesg(lmp, "{}", sa);
|
||||
fmt::print(fp_errors, sa);
|
||||
fmt::print(fp_errors, sb);
|
||||
fmt::print(fp_errors, sa);
|
||||
std::string sa(lm+80,'-');
|
||||
sa += '\n';
|
||||
std::string sb = fmt::format(" {:^{}} | # configs | # atoms | MAE energy | RMSE energy | MAE force | RMSE force\n",
|
||||
"File", lm);
|
||||
utils::logmesg(lmp, sa + sb + sa);
|
||||
fmt::print(fp_errors, sa + sb + sa);
|
||||
|
||||
int ci=0, m=8, nc=0, nf=0;
|
||||
for (int file = 0; file < nfiles; file++) {
|
||||
fmt::print(fp_analysis, "# {}\n", data.filenames[file]);
|
||||
sb = "| config | # atoms | energy | DFT energy | energy error | force | DFT force | force error |\n";
|
||||
fmt::print(fp_analysis, sb);
|
||||
fmt::print(fp_analysis, " config # atoms energy DFT energy energy error "
|
||||
" force DFT force force error\n");
|
||||
|
||||
int nforceall = 0;
|
||||
int nconfigs = data.num_config[file];
|
||||
nc += nconfigs;
|
||||
for (int ii=0; ii < nconfigs; ii++) { // loop over each configuration in a file
|
||||
fmt::print(fp_analysis, " ");
|
||||
for(int count = 0; count < m; count ++)
|
||||
fmt::print(fp_analysis, "{} ", outarray[count + m*ci]);
|
||||
fmt::print(fp_analysis, "{:6} {:8} ", outarray[m*ci], outarray[1 + m*ci]);
|
||||
for(int count = 2; count < m; count ++)
|
||||
fmt::print(fp_analysis, "{:<15.10} ", outarray[count + m*ci]);
|
||||
fmt::print(fp_analysis, "\n");
|
||||
|
||||
nforceall += 3*data.num_atom[ci];
|
||||
|
@ -1372,63 +1365,25 @@ void FitPOD::print_analysis(datastruct data, double *outarray, double *errors)
|
|||
nf += nforceall;
|
||||
|
||||
int q = file+1;
|
||||
std::string s = data.filenames[file];
|
||||
s = s + std::string(lm-s.size(), ' ');
|
||||
std::string s1 = std::to_string(nconfigs);
|
||||
s1 = s1 + std::string(MAX(6- (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(nforceall/3);
|
||||
s1 = s1 + std::string(MAX(7 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[0 + 4*q]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[1 + 4*q]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[2 + 4*q]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[3 + 4*q]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1 + "\n";
|
||||
utils::logmesg(lmp, "{}", s);
|
||||
fmt::print(fp_errors, "{}", s);
|
||||
auto s = fmt::format("{:<{}} {:>10} {:>11} {:<10.6f} {:<10.6f} {:<10.6f} {:<10.6f}\n",
|
||||
data.filenames[file], lm, nconfigs, nforceall/3,
|
||||
errors[0 + 4*q], errors[1 + 4*q], errors[2 + 4*q], errors[3 + 4*q]);
|
||||
utils::logmesg(lmp, s);
|
||||
fmt::print(fp_errors, s);
|
||||
}
|
||||
utils::logmesg(lmp, sa);
|
||||
fmt::print(fp_errors, sa);
|
||||
|
||||
utils::logmesg(lmp, "{}", sa);
|
||||
fmt::print(fp_errors, "{}", sa);
|
||||
auto s = fmt::format("{:<{}} {:>10} {:>11} {:<10.6f} {:<10.6f} {:<10.6f} {:<10.6f}\n",
|
||||
"All files", lm, nc, nf/3, errors[0], errors[1], errors[2], errors[3]);
|
||||
utils::logmesg(lmp, s + sa);
|
||||
fmt::print(fp_errors, "{}", s + sa);
|
||||
|
||||
s = s + std::string(MAX(lm - (int) s.size(),1), ' ');
|
||||
std::string s1 = std::to_string(nc);
|
||||
s1 = s1 + std::string(MAX(6- (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(nf/3);
|
||||
s1 = s1 + std::string(MAX(7 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[0]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[1]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[2]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1;
|
||||
s1 = std::to_string(errors[3]);
|
||||
s1 = s1 + std::string(MAX(10 - (int) s1.size(),1), ' ');
|
||||
s = s + " " + s1 + "\n";
|
||||
utils::logmesg(lmp, "{}", s);
|
||||
utils::logmesg(lmp, "{}", sa);
|
||||
fmt::print(fp_errors, "{}", s);
|
||||
fmt::print(fp_errors, "{}", sa);
|
||||
mystr = fmt::format("**************** End of Error Analysis for the {} Data Set ****************\n",
|
||||
data.training ? "Training" : "Test");
|
||||
|
||||
sa = "**************** End of Error Analysis for the Training Data Set ****************";
|
||||
sb = "**************** End of Error Analysis for the Test Data Set ****************";
|
||||
mystr = (data.training) ? sa : sb;
|
||||
|
||||
utils::logmesg(lmp, "{}\n", mystr);
|
||||
fmt::print(fp_errors, "{}\n", mystr);
|
||||
utils::logmesg(lmp, mystr);
|
||||
fmt::print(fp_errors, mystr);
|
||||
|
||||
fclose(fp_errors);
|
||||
fclose(fp_analysis);
|
||||
|
|
|
@ -86,7 +86,7 @@ void PairPOD::compute(int eflag, int vflag)
|
|||
if (peratom_warn && (vflag_atom || eflag_atom)) {
|
||||
peratom_warn = false;
|
||||
if (comm->me == 0)
|
||||
error->warning(FLERR, "Pair style mlpod does not support per-atom energies or stresses");
|
||||
error->warning(FLERR, "Pair style pod does not support per-atom energies or stresses");
|
||||
}
|
||||
|
||||
double **x = atom->x;
|
||||
|
@ -122,8 +122,8 @@ void PairPOD::compute(int eflag, int vflag)
|
|||
|
||||
// compute global POD descriptors for atom i
|
||||
|
||||
podptr->linear_descriptors_ij(gd, tmpmem, rij, &tmpmem[nd1234], numneighsum,
|
||||
typeai, idxi, ti, tj, 1, nij);
|
||||
podptr->linear_descriptors_ij(gd, tmpmem, rij, &tmpmem[nd1234], numneighsum, typeai, idxi, ti,
|
||||
tj, 1, nij);
|
||||
}
|
||||
|
||||
int nd22 = podptr->pod.nd22;
|
||||
|
@ -153,12 +153,11 @@ void PairPOD::compute(int eflag, int vflag)
|
|||
|
||||
// compute atomic force for atom i
|
||||
|
||||
podptr->calculate_force(f, forcecoeff, rij, tmpmem, numneighsum,
|
||||
typeai, idxi, ai, aj, ti, tj, 1, nij);
|
||||
podptr->calculate_force(f, forcecoeff, rij, tmpmem, numneighsum, typeai, idxi, ai, aj, ti, tj,
|
||||
1, nij);
|
||||
}
|
||||
|
||||
if (vflag_fdotr) virial_fdotr_compute();
|
||||
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -167,7 +166,7 @@ void PairPOD::compute(int eflag, int vflag)
|
|||
|
||||
void PairPOD::settings(int narg, char ** /* arg */)
|
||||
{
|
||||
if (narg > 0) error->all(FLERR,"Pair style mlpod accepts no arguments");
|
||||
if (narg > 0) error->all(FLERR, "Pair style pod accepts no arguments");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -176,17 +175,16 @@ void PairPOD::settings(int narg, char ** /* arg */)
|
|||
|
||||
void PairPOD::coeff(int narg, char **arg)
|
||||
{
|
||||
int n = atom->ntypes;
|
||||
const int np1 = atom->ntypes + 1;
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
memory->create(setflag,n+1,n+1,"pair:setflag");
|
||||
memory->create(cutsq,n+1,n+1,"pair:cutsq");
|
||||
memory->create(setflag, np1, np1, "pair:setflag");
|
||||
memory->create(cutsq, np1, np1, "pair:cutsq");
|
||||
delete[] map;
|
||||
map = new int[n+1];
|
||||
map = new int[np1];
|
||||
allocated = 1;
|
||||
|
||||
if (narg != 4 + atom->ntypes) error->all(FLERR,"Incorrect args for pair coefficients");
|
||||
|
||||
if (narg < 4) utils::missing_cmd_args(FLERR, "pair_coeff", error);
|
||||
map_element2type(narg - 4, arg + 4);
|
||||
|
||||
std::string pod_file = std::string(arg[2]); // pod input file
|
||||
|
@ -212,9 +210,8 @@ void PairPOD::coeff(int narg, char **arg)
|
|||
podptr->podArrayCopy(newpodcoeff, podptr->pod.coeff, podptr->pod.nd);
|
||||
}
|
||||
|
||||
for (int ii = 0; ii < n+1; ii++)
|
||||
for (int jj = 0; jj < n+1; jj++)
|
||||
cutsq[ii][jj] = podptr->pod.rcut*podptr->pod.rcut;
|
||||
for (int ii = 0; ii < np1; ii++)
|
||||
for (int jj = 0; jj < np1; jj++) cutsq[ii][jj] = podptr->pod.rcut * podptr->pod.rcut;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -223,7 +220,7 @@ void PairPOD::coeff(int narg, char **arg)
|
|||
|
||||
void PairPOD::init_style()
|
||||
{
|
||||
if (force->newton_pair == 0) error->all(FLERR,"Pair style mlpod requires newton pair on");
|
||||
if (force->newton_pair == 0) error->all(FLERR, "Pair style pod requires newton pair on");
|
||||
|
||||
// need a full neighbor list
|
||||
|
||||
|
@ -291,16 +288,21 @@ void PairPOD::estimate_tempmemory()
|
|||
int szsnap = 0;
|
||||
if (podptr->sna.twojmax > 0) {
|
||||
szsnap += nijmax * dim;
|
||||
szsnap += MAX(2*podptr->sna.idxu_max*nijmax, 2*podptr->sna.idxz_max*podptr->sna.ndoubles*nablockmax); // (Ur, Ui) and (Zr, Zi)
|
||||
szsnap += MAX(2 * podptr->sna.idxu_max * nijmax,
|
||||
2 * podptr->sna.idxz_max * podptr->sna.ndoubles *
|
||||
nablockmax); // (Ur, Ui) and (Zr, Zi)
|
||||
szsnap += 2 * podptr->sna.idxu_max * dim * nijmax; // dUr, dUi
|
||||
szsnap += MAX(podptr->sna.idxb_max*podptr->sna.ntriples*dim*nijmax, 2*podptr->sna.idxu_max*podptr->sna.nelements*nablockmax); // dblist and (Utotr, Utoti)
|
||||
szsnap += MAX(podptr->sna.idxb_max * podptr->sna.ntriples * dim * nijmax,
|
||||
2 * podptr->sna.idxu_max * podptr->sna.nelements *
|
||||
nablockmax); // dblist and (Utotr, Utoti)
|
||||
}
|
||||
|
||||
szd = MAX(szsnap, szd);
|
||||
szd = nablockmax * (podptr->pod.nd1234) + szd;
|
||||
}
|
||||
|
||||
void PairPOD::lammpsNeighPairs(double **x, int **firstneigh, int *atomtypes, int *map, int *numneigh, int gi)
|
||||
void PairPOD::lammpsNeighPairs(double **x, int **firstneigh, int *atomtypes, int *map,
|
||||
int *numneigh, int gi)
|
||||
{
|
||||
|
||||
double rcutsq = podptr->pod.rcut * podptr->pod.rcut;
|
||||
|
|
Loading…
Reference in New Issue