Closed xinglunju closed 6 years ago
Good catch. There was a missing 'tolerance' value. I had never set the tolerance to be nonzero before, apparently
I used hub
to turn this issue into a pull request, so now it looks like I wrote the issue, but it was actually submitted by Xing Lu.... unfortunately it also erased his username...
Hi Adam, I am trying to use your code to generate cluster masses, but sometimes it falls into an infinite loop, because nsamp happens to be intialized as 0, or has an error like "ValueError: negative dimensions are not allowed", because nsamp is intialized as a negative number. This could happen if mtot is very close to mcluster, or mtot > mcluster but mtot < mcluster + tolerance. I tried the following parameters and about 5 in 10 times the above issue occurs: imf.make_cluster(400.,tolerance = 5., verbose = True, stop_criterion='nearest', mmax = 150.)