1
$\begingroup$

I am interested in calculating the x,y and z distance between two molecules over a given simulation time. I know how to calculate the total (r) distance between them, but I want the distance between them along all three dimensions.

For the total distance, cpptraj can be used as:

parm prmtop-file
trajin netcdf-file
distance DIST :1-4@heavy-atoms-from-molecule-1 :5-8@heavy-atoms-from-molecule-2 out dist.out
run
quit

But like I said before, I do not want the r-distance. Is there anyway to calculate the x,y and z-distances in cpptraj? If not, what other alternatives do I have?

$\endgroup$
2
  • 2
    $\begingroup$ I'm not familiar with AMBER, but in LAMMPS there is a file containing all the atom positions and a utility to convert it to a .xyz file which is just a list of all the coordinates. You might try searching for something like an .xyz file? $\endgroup$
    – ericksonla
    Jun 5, 2018 at 14:43
  • $\begingroup$ I can find the coordinates via a file in AMBER called a .pdb file, but I will have to manually calculate the distances from this, which is over 20000 frames to consider. I guess I might as well just do it. $\endgroup$ Jun 6, 2018 at 4:30

1 Answer 1

1
$\begingroup$

I ended up realizing that if you run:

parm prmtop-file
trajin netcdf-file
vector v0 :1-4@heavy-atoms-from-molecule-1 :5-8@heavy-atoms-from-molecule-2 out v0.out magnitude
run
quit

You will get the total distance as well as x, y and z distances between your two molecules. The output file will contain 8 columns. The AMBER manual states that they are identified as follows:

Frame | x-Vector-Coordinate | y-Vector-Coordinate | z-Vector-Coordinate | x-Origin-Coordinate | y-Origin-Coordinate | z-Origin-Coordinate | Magnitude

The vector coordinates are your x, y and z distances. Magnitude is the total distance.

Decided to share this as someone might run into the same problem one day.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.