message: Added separate function for defects parsing
  Normalization applied to the spins of every image read in
diff: #include <algorithm>
  using namespace Utility;
  +using namespace Engine;
  namespace IO
  {
  @@ -34,6 +35,27 @@ namespace IO
  return result;
  }
  + // A helper function
  + void check_defects( std::shared_ptr<Data::Spin_System> s )
  + {
  + auto& spins = *s->spins;
  + int nos = s->geometry->nos;
  +
  + // Detecet the defects
  + for (int i=0; i<nos; i++)
  + {
  + if (spins[i].norm() < 1e-5)
  + {
  + spins[i] = {0, 0, 1};
  +
  + // in case of spin vector close to zero we have a vacancy
  + #ifdef SPIRIT_ENABLE_DEFECTS
  + s->geometry->atom_types[i] = -1;
  + #endif
  + }
  + }
  + }
  +
  // Helper function to read configuration in column vector from text in file
  //// NOTE: that function assumes that the nos in the OVF file is equal to nos of the system
  void Read_ColumnVector_Configuration( Filter_File_Handle& myfile, const char delimiter,
  @@ -148,6 +170,15 @@ namespace IO
  }// endif new line (while)
  if (i < s->nos) { Log(Log_Level::Warning, Log_Sender::IO, "NOS mismatch in Read Spin Configuration"); }
  }
  +
  + #ifdef SPIRIT_ENABLE_DEFECTS
  + // assure that defects are treated right
  + check_defects(s);
  + #endif
  +
  + // normalize read in spins
  + Vectormath::normalize_vectors(*s->spins);
  +
  myfile.close();
  Log(Log_Level::Info, Log_Sender::IO, "Done");
  }
  @@ -250,8 +281,22 @@ namespace IO
  // keyword since a line like that would containi "#"
  }// endif new line (while)
  +
  + // for every image of the chain
  + for (int i=0; i<iimage; i++)
  + {
  + #ifdef SPIRIT_ENABLE_DEFECTS
  + // assure that defects are treated right
  + check_defects(c->images[iimage]);
  + #endif
  +
  + // normalize read in spins
  + Vectormath::normalize_vectors(*c->images[iimage]->spins);
  + }
  +
  if (ispin < nos) Log(Log_Level::Warning, Log_Sender::IO, fmt::format("NOS(image) = {} > NOS(file) = {} in image {}", nos, ispin+1, iimage+1));
  if (iimage < noi-1) Log(Log_Level::Warning, Log_Sender::IO, fmt::format("NOI(chain) = {} > NOI(file) = {}", noi, iimage+1));
  +
  myfile.close();
  Log(Log_Level::Info, Log_Sender::IO, std::string("Done Reading SpinChain File ").append(file));
  }
  