Skip to content
Snippets Groups Projects
Commit ec43b0af authored by Martin Beseda's avatar Martin Beseda
Browse files

[FIX] Fixed DataSet creation from .xyz input files.

parent bd127a4e
No related branches found
No related tags found
No related merge requests found
...@@ -376,7 +376,6 @@ namespace lib4neuro { ...@@ -376,7 +376,6 @@ namespace lib4neuro {
*/ */
LIB4NEURO_API void MPI_gather_data_on_master( ); LIB4NEURO_API void MPI_gather_data_on_master( );
[[nodiscard]] LIB4NEURO_API arma::Mat<double>* get_inputs_matrix(); [[nodiscard]] LIB4NEURO_API arma::Mat<double>* get_inputs_matrix();
[[nodiscard]] LIB4NEURO_API arma::Mat<double>* get_outputs_matrix(); [[nodiscard]] LIB4NEURO_API arma::Mat<double>* get_outputs_matrix();
......
...@@ -208,34 +208,27 @@ void lib4neuro::XYZReader::transform_input_to_acsf(std::unordered_map<ELEMENT_SY ...@@ -208,34 +208,27 @@ void lib4neuro::XYZReader::transform_input_to_acsf(std::unordered_map<ELEMENT_SY
/* Save Cartesian coordinates into the vector */ /* Save Cartesian coordinates into the vector */
for(auto el : *this->element_list) { /* Iterate over particles */ for(auto el : *this->element_list) { /* Iterate over particles */
for(unsigned int i = 0; i < n_coords_per_particle; i++) { /* Iterate over all coordinates of a single particle */ for(unsigned int i = 0; i < n_coords_per_particle; i++) { /* Iterate over all coordinates of a single particle */
if(this->ignore_charge && i < 3) { /* Skip charge */ cartesian_coords.at(i) = configuration.first.at(idx);
cartesian_coords.at(i) = configuration.first.at(idx);
}
idx++; idx++;
} }
if(this->ignore_charge) {
idx++; //skips charge - TODO add support for charge!
}
particles.emplace_back(std::make_pair(el, cartesian_coords)); particles.emplace_back(std::make_pair(el, cartesian_coords));
} }
// std::vector<std::vector<double>> coords_check;
// std::vector<double> single_coords_check;
/* Transform Cartesian coordinates into ACSFs */ /* Transform Cartesian coordinates into ACSFs */
std::vector<double> single_particle_coords; std::vector<double> single_particle_coords;
// double coord_val;
std::vector<std::pair<ELEMENT_SYMBOL, std::vector<double>>> acsf_coords_prep; std::vector<std::pair<ELEMENT_SYMBOL, std::vector<double>>> acsf_coords_prep;
for(size_t i = 0; i < particles.size(); i++) { /* Iterate over all the particles */ for(size_t i = 0; i < particles.size(); i++) { /* Iterate over all the particles */
// single_coords_check.clear();
single_particle_coords.clear(); single_particle_coords.clear();
/* Compute vector of ACSF coordinates for a single particle */ /* Compute vector of ACSF coordinates for a single particle */
for (auto sym_func : *element_description[particles.at(i).first]->getSymmetryFunctions()) { for (auto sym_func : *element_description[particles.at(i).first]->getSymmetryFunctions()) {
// coord_val = sym_func->eval(i, particles);
// acsf_coords.emplace_back(coord_val);
// single_coords_check.emplace_back(coord_val);
single_particle_coords.emplace_back(sym_func->eval(i, particles)); single_particle_coords.emplace_back(sym_func->eval(i, particles));
} }
// coords_check.emplace_back(single_coords_check);
/* Store coordinates in a canonic order */ /* Store coordinates in a canonic order */
unsigned int element_ind = 0; unsigned int element_ind = 0;
...@@ -256,9 +249,6 @@ void lib4neuro::XYZReader::transform_input_to_acsf(std::unordered_map<ELEMENT_SY ...@@ -256,9 +249,6 @@ void lib4neuro::XYZReader::transform_input_to_acsf(std::unordered_map<ELEMENT_SY
break; break;
} }
// std::cout << arma::norm(arma::conv_to<arma::Col<double>>::from(single_particle_coords)) << " "
// << arma::norm(arma::conv_to<arma::Col<double>>::from(acsf_coords_prep.at(element_ind-1).second)) << std::endl;
if(arma::norm(arma::conv_to<arma::Col<double>>::from(single_particle_coords)) > if(arma::norm(arma::conv_to<arma::Col<double>>::from(single_particle_coords)) >
arma::norm(arma::conv_to<arma::Col<double>>::from(acsf_coords_prep.at(element_ind-1).second))) { arma::norm(arma::conv_to<arma::Col<double>>::from(acsf_coords_prep.at(element_ind-1).second))) {
break; break;
...@@ -317,9 +307,7 @@ lib4neuro::ELEMENT_SYMBOL lib4neuro::XYZReader::get_element_symbol(std::string s ...@@ -317,9 +307,7 @@ lib4neuro::ELEMENT_SYMBOL lib4neuro::XYZReader::get_element_symbol(std::string s
std::shared_ptr<lib4neuro::DataSet> std::shared_ptr<lib4neuro::DataSet>
lib4neuro::XYZReader::get_acsf_data_set(std::unordered_map<ELEMENT_SYMBOL, Element*>& element_description) { lib4neuro::XYZReader::get_acsf_data_set(std::unordered_map<ELEMENT_SYMBOL, Element*>& element_description) {
// if(acsf_data_set == nullptr) { this->transform_input_to_acsf(element_description);
this->transform_input_to_acsf(element_description);
// }
return this->acsf_data_set; return this->acsf_data_set;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment