MUEXLY / pbc_distance_calculator

MIT License
0 stars 0 forks source link

Only 0 values returned for serial implementation #4

Closed lmyhill closed 5 months ago

lmyhill commented 6 months ago

Using the function get_pairwise_distances within looping structure for individual piece-wise distances, the returned value is always 0.

LINES FROM IMPLEMENTATION

        first_postion=np.ndarray((1,3),buffer=np.array([refAtomPosX,refAtomPosY,refAtomPosZ]))
        second_position=np.ndarray((1,3),buffer=np.array([atomPosX,atomPosY,atomPosZ]))
        cellMat=np.diag([16,16,16])
        print(first_postion-second_position)
        dist=float()
        dist=get_pairwise_distances(first_postion-second_position,cellMat)
        print(dist)

TERMINAL OUTPUT

[[3.2 3.2 0. ]] <---- print(first_postion-second_position) [[0.]] <----print(dist) [[4.8 1.6 1.6]] [[0.]] [[3.2 0. 0. ]] [[0.]] [[1.6 1.6 1.6]] [[0.]] ...

INCLUDED FILE Results of analysis where the first column is the piece-wise distance reported between atoms and the other columns contain computed stress correlations correlationData.txt

jwjeffr commented 5 months ago

@lmyhill @hlclemson

You should be calling get_pairwise_distance(), not get_pairwise_distances().

Calling the second leads to calculating all pairwise distances for a group of positions of size 1, and the distance between that singleton position and itself is 0.

Calling this function on an array (or tensor if using torch) with length 1 now warns a custom WasteWarning telling the user to call get_pairwise_distance() instead (commit 7b83c3a).