Hi
I have two separate data files (.xyz) type and I want to see distances between the coordinates of atoms of the two files. For example:-
My first files contains
1 1 1 11.50910000 5.17730000 16.49360000
3 1 2 11.21790000 6.36062000 15.60660000
6 1 2 11.43950000 7.66053000 16.07200000
2 1 3 11.87750000 7.81529000 17.04670000
where the last three columns are the coordinates, 1st column is Atom ID, 2nd column is Molecule ID and 3rd column is Atom type. I have another file that has coordinates of different atoms like
14 1 7 9.22151000 9.21624000 11.08350000
21 1 8 8.24299000 10.25310000 11.12120000
7 1 6 9.68004000 8.92467000 9.65365000
22 1 2 11.06970000 3.75903000 16.75830000
I want to make an awk code where AWK will read both files and find distance between atom ID 1 and atom ID 14 and will show the output with the atom IDs and the distance like
1 14 7.1284841 where 7.1284841 is the distance between coordinates of atom ID 1 and atom ID 14. The distance calculating formula is
SQRT ((X1-X2)^2 + (Y1-Y2)^2 + (Z1-Z2)^2)
I want the code to check distance between each single atom in file 1 and all the atoms in file 2. Like, it should give outputs of distances between atom id1 from file 1 and atom IDs 14, 21 7 and 22 from file 2 and then do the same for atom IDs 3, 6 and 2 from file 1. I do not know how to proceed with writing a code for this. I am new to awk.
Please suggest.....