vsangelidakis / CLUMP

Code Library to generate Universal Multi-sphere Particles
18 stars 12 forks source link

GenerateClump_Euclidean_3D.py only prints but doesn't break when rMin is reached. #3

Closed JWBisschop closed 3 months ago

JWBisschop commented 3 months ago

Shouldn't the code break from the loop in the following line? Also I think it should be k spheres, not k-1 (iterator starts from 0, not from 1 like in Matlab).

if radius < rMin: print(f"The mimimum radius rMin={rMin} has been met using {k - 1} spheres")

Also as noted in the Matlab version, comparing should be done with the radii in the correct units: % Note: rMin is given in Cartesian units, not in voxel units, hence the % multiplication with the voxel size below if radius*voxel_size(:)<rMin % Break the loop if the minimum radius has been met using less than N spheres warning(['The mimimum radius rMin=',num2str(rMin),' has been met using ', num2str(k-1),' spheres']) break end

utkucanbolat commented 3 months ago

Thank you for highlighting the issues. You are right, the loop should break after the if condition. I have also corrected the distance calculation and the indexing accordingly.

JWBisschop commented 3 months ago

Thank you very much for the quick update. All works now :)