Dear Lily
Thank you very much for your reply and the explanations.
Actually, as it is written in the link you have sent, the coordinates are not read from the TPR file. So I am wondering how one can use it in the universe.
So I did this:
u = mda.Universe(gro_file.gro, traj_file.xtc, guess_bonds=True, vdwradii={'W':0.263, 'G':0.263, 'D':0.263, 'R':0.263 ...}
I had to give the vdwradii flag, since it was complaining. Of course I am not sure if I did it correctly.
And then gave the pbc=True for center of geometry. This is what I should do, right?
dist_com = distance_array(sel1.center_of_geometry(pbc=True), sel2.center_of_geometry(pbc=True),box=box)
The result is however the same as before.
Perhaps the bonds are not properly considered since when I gave the unwrap=True in the above command, the error was as follows. I am actually doing a coarse-grain simulation. Perhaps the only way is to transform the trajectory via gromacs...
dist_com = distance_array(sel1.center_of_geometry(unwrap=True), sel2.center_of_geometry(unwrap=True),box=box)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/lib/util.py", line 1825, in wrapper
return groupmethod(group, *args, **kwargs)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/core/groups.py", line 360, in wrapped
return function(group, *args, **kwargs)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/core/groups.py", line 880, in center_of_geometry
return self.center(None, pbc=pbc, compound=compound, unwrap=unwrap)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/lib/util.py", line 1825, in wrapper
return groupmethod(group, *args, **kwargs)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/core/groups.py", line 360, in wrapped
return function(group, *args, **kwargs)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/core/groups.py", line 756, in center
coords = atoms.unwrap(compound=comp, reference=None, inplace=False)
File "/home/aalaviza/.local/lib64/python3.6/site-packages/MDAnalysis/core/groups.py", line 1615, in unwrap
positions = mdamath.make_whole(unique_atoms, inplace=False)
File "MDAnalysis/lib/_cutil.pyx", line 310, in MDAnalysis.lib._cutil.make_whole
ValueError: AtomGroup was not contiguous from bonds, process failed
Thanks a lot.
Best,
Azadeh