Hello Oliver, thank you for your answer, and sorry for the delay, I did not receive any email warning me about your answer.
About my problem :
- it is a cubic box
- it is a NVT run, box size is conserved
- I am using KDTree from scipy
- scipy KDTree only use cubic boxes to handle PBC, and take an array of shape (3,)
Additional infos :
- it is a dcd lammps trajectory.
Here is a minimal example :
```
# NUMERICAL LIBRARIES
from scipy.spatial import KDTree
# LAMMPS SPECIFIC
from MDAnalysis import transformations
import MDAnalysis as mda
# INIT ARGS
data = "./structure.data"
dump = "./dump.dcd"
dt = 200
###########
# ---------------------------------------- #
# ------------- LOAD DUMP ---------------- #
# ---------------------------------------- #
u = mda.Universe(data, dump, format="dcd", lammps_coordinate_convention="unwrapped", dt=dt, timeunit="fs")
###########
# ---------------------------------------- #
# -------------- ANALYSIS ---------------- #
# ---------------------------------------- #
# Wrap coord
ag = u.atoms
transform = transformations.wrap(ag)
u.trajectory.add_transformations(transform)
for ts in u.trajectory:
print(ts)
boxsize = ts.dimensions
positions = ts.positions
# boxsize = ts.dimensions.astype(np.float64)
# positions = ts.positions.astype(np.float64)
tree = KDTree(positions, boxsize=boxsize[:3])
```
I am sure that it is a "problem" with wrap function, as when I get a "ValueError: Some input data are greater than the size of the periodic box.", the maximum position is beyond the box limit (positions[:,2].max() > box size[0]). I tried to play with precisions without success. Maybe I should add a translation to push everything in the box ? However, I would like to be sure that wrap function is reliable.
I can share dump.dcd and structure.data files, but I am not sure how dcd files are portables.