|
|
|
@ -188,7 +188,7 @@ void FitPOD::read_data_file(double *fitting_weights, std::string &file_format,
|
|
|
|
|
|
|
|
|
|
|
|
if (keywd == "fitting_weight_energy") fitting_weights[0] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fitting_weight_energy") fitting_weights[0] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fitting_weight_force") fitting_weights[1] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fitting_weight_force") fitting_weights[1] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fitting_weight_stress") fitting_weights[2] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fitting_weight_stress") fitting_weights[2] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "error_analysis_for_training_data_set") fitting_weights[3] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "error_analysis_for_training_data_set") fitting_weights[3] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "error_analysis_for_test_data_set") fitting_weights[4] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "error_analysis_for_test_data_set") fitting_weights[4] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "energy_force_calculation_for_training_data_set") fitting_weights[5] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "energy_force_calculation_for_training_data_set") fitting_weights[5] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
@ -197,7 +197,8 @@ void FitPOD::read_data_file(double *fitting_weights, std::string &file_format,
|
|
|
|
if (keywd == "fraction_test_data_set") fitting_weights[8] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "fraction_test_data_set") fitting_weights[8] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "randomize_training_data_set") fitting_weights[9] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "randomize_training_data_set") fitting_weights[9] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "randomize_test_data_set") fitting_weights[10] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
if (keywd == "randomize_test_data_set") fitting_weights[10] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
|
|
|
|
if (keywd == "fitting_regularization_parameter") fitting_weights[11] = utils::numeric(FLERR,words[1],false,lmp);
|
|
|
|
|
|
|
|
|
|
|
|
// other settings
|
|
|
|
// other settings
|
|
|
|
|
|
|
|
|
|
|
|
if (keywd == "file_format") file_format = words[1];
|
|
|
|
if (keywd == "file_format") file_format = words[1];
|
|
|
|
@ -223,6 +224,7 @@ void FitPOD::read_data_file(double *fitting_weights, std::string &file_format,
|
|
|
|
utils::logmesg(lmp, "fitting weight for energy: {}\n", fitting_weights[0]);
|
|
|
|
utils::logmesg(lmp, "fitting weight for energy: {}\n", fitting_weights[0]);
|
|
|
|
utils::logmesg(lmp, "fitting weight for force: {}\n", fitting_weights[1]);
|
|
|
|
utils::logmesg(lmp, "fitting weight for force: {}\n", fitting_weights[1]);
|
|
|
|
utils::logmesg(lmp, "fitting weight for stress: {}\n", fitting_weights[2]);
|
|
|
|
utils::logmesg(lmp, "fitting weight for stress: {}\n", fitting_weights[2]);
|
|
|
|
|
|
|
|
utils::logmesg(lmp, "fitting regularization parameter: {}\n", fitting_weights[11]);
|
|
|
|
utils::logmesg(lmp, "**************** End of Data File ****************\n");
|
|
|
|
utils::logmesg(lmp, "**************** End of Data File ****************\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -1269,10 +1271,12 @@ void FitPOD::least_squares_fit(datastruct data)
|
|
|
|
for (int i = 0; i<nd*nd; i++)
|
|
|
|
for (int i = 0; i<nd*nd; i++)
|
|
|
|
desc.A[i] = desc.A[i]*maxb;
|
|
|
|
desc.A[i] = desc.A[i]*maxb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double regularizing_parameter = data.fitting_weights[11];
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i<nd; i++) {
|
|
|
|
for (int i = 0; i<nd; i++) {
|
|
|
|
desc.c[i] = desc.b[i];
|
|
|
|
desc.c[i] = desc.b[i];
|
|
|
|
desc.A[i + nd*i] = desc.A[i + nd*i]*(1.0 + SMALL);
|
|
|
|
desc.A[i + nd*i] = desc.A[i + nd*i]*(1.0 + regularizing_parameter);
|
|
|
|
if (desc.A[i + nd*i] < SMALL) desc.A[i + nd*i] = SMALL;
|
|
|
|
if (desc.A[i + nd*i] < regularizing_parameter) desc.A[i + nd*i] = regularizing_parameter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// solving the linear system A * c = b
|
|
|
|
// solving the linear system A * c = b
|
|
|
|
|