Skip to content

Commit

Permalink
Check if nan in translational no neighbor test and try without complex?
Browse files Browse the repository at this point in the history
  • Loading branch information
klywang committed Dec 14, 2021
1 parent 1f762ba commit 4ef5742
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cpp/order/HexaticTranslational.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void HexaticTranslational<T>::computeGeneral(Func func, const freud::locality::N
{
if (total_weight == 0.)
{
m_psi_array[i] = std::complex<float>(std::nanf);
m_psi_array[i] = std::nanf;
}
else
{
Expand Down
5 changes: 4 additions & 1 deletion tests/test_order_Translational.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,7 @@ def test_no_neighbors(self):
box = freud.box.Box.square(10)
positions = [(0, 0, 0)]
trans = freud.order.Translational(4)
trans.compute((box, positions), neighbors={"r_max": 1.25})
trans.compute((box, positions), neighbors={"r_max": 0.25})

assert np.all(np.isnan(trans.particle_order))
npt.assert_allclose(np.nan_to_num(trans.particle_order), 0)

0 comments on commit 4ef5742

Please sign in to comment.