richard-evans / vampire

Atomistic simulator for magnetic materials
GNU General Public License v2.0
122 stars 94 forks source link

Conversion to VTK file using vdc not working. #114

Open ViK0s opened 1 month ago

ViK0s commented 1 month ago

Hello, I have an issue with converting the data files into vtk files. The conversion is resolved sucessfully but the resulting file has most of it data being set to the same values. After further snooping and testing I have found that the variable atom on line 72 in vtk.cpp is not changing value and then after a while starts working as it should. https://github.com/richard-evans/vampire/blob/4c9651daecc86c3e6b6df0c8055fcd9e89fd900c/util/vdc/vtk.cpp#L69-L75 Is there a fix for this?

ViK0s commented 1 month ago

I have found an easy fix, namely, just change the for loop and the int atom to loop over vdc::spliced_atoms_list.size() like so:

for(size_t i=0; i < vdc::sliced_atoms_list.size(); i++){

    // get atom ID
    unsigned int atom = vdc::sliced_atoms_list[i];

      vtkfile << spins[3*atom+0] << " " << spins[3*atom+1] << " " << spins[3*atom+2] << " ";
}

This let's me visualize the data using pyvista but, there is one weird thing that I now noticed - the ID section from the .vtu file has all ID data listed as 0, this happened also before the fix.