Dear friend,
I know for a single case, this could be finished quickly with Excel. But if we have hundreds of files, we definitely want to do it with a script or a FORTRAN code. Since I have no knowledge of FORTRAN, I tried to work out a script to do it. The math is very simple. we chose one atom (in x, y, z, Cartesian coordinate), and we calculate the distance from other atom to the reference atom with the simple math sqrt((x(i)-x(1))^2+(y(i)-y(1))^2+(z(i)-z(1))^2)
Problem explanation: we have a list of numbers
P 1.219142 0.637315 -0.824280
N -0.265369 0.551699 -1.665314
P -1.232957 -0.291982 -0.536350
C 1.550001 2.370502 -0.242803
C 0.756639 2.983923 0.747041
C 1.003518 4.293274 1.173466
C 2.045233 5.026004 0.616725
C 2.835510 4.452541 -0.372444
C 2.587869 3.143957 -0.800209
C 2.645951 0.045340 -1.859172
assume we set the P1 as the center atom, now we need to calculate all the distance of other atoms from P, respectively.
and we print out the results as follows,
N2-P1 P3-P1 C4-P1 C5-P1 C6-P1 C7-P1 C8-P1 C9-P1 C10-P1
1.708 2.638 1.858 2.862 4.172 4.692 4.168 2.856 1.859
Thank you very much in advance!
Zhen