distance in the periodic unit cell
zdcao121 opened this issue · comments
Hi, it's a nice project. While searching the proper generator in the pyxtal, the distance in the periodic unit cell is calculated as the follows:
Line 127 in 344bb64
But the maximum effective distance between any two points is L/2
in a system with a periodic length L
in one dimension. Based on this, maybe it should be replaced by the diff -= np.floor(diff+0.5)
or diff -= np.rint(diff)
. I wonder if my understanding is correct.
@zdcao121 Thanks for your comments. You are right, np.rint or np.round should be used for distance check. I just fixed it in a recent commit with the following actions
- fixed the incorrect use of np.floor for distance check in several places
- replace np.round with np.rint according to a stack overflow discussion (though there seems to be no difference) https://stackoverflow.com/questions/56750927/difference-between-numpy-rint-and-numpy-round
- Cleaned up the function of search_position
- Add a test function for atom_site class
Thanks for your reply!