Hey guys,
I'm a newbie here and also to Perl.I have a similar but difficult question than a previous question here.
http://www.daniweb.com/forums/thread245502.html#
I have a output file containing atoms like this:
#F A 1 1 1 3 3 2
#C number type mass x y z vx vy vz Epot eam_rho
#E
1390 0 63.546300 1.366122 3.274510 3.959495 -0.014555 0.021480 0.011286 -3.336130 0.983624
2075 0 63.546300 0.197795 4.925601 2.678359 0.015554 0.035225 0.028217 -3.354595 0.977031
3833 0 63.546300 4.796687 5.563218 3.726159 0.010010 -0.001101 0.048472 -3.379659 0.898155
232 0 63.546300 1.785678 0.692921 3.458947 -0.010475 -0.028170 -0.039203 -3.255102 0.907376
2417 0 63.546300 1.431713 3.511336 1.161916 -0.047983
....n lines
From line4, the first column is atom ID, the 4,5,6 column is atom's coordinate x,y,z.
1.I need save it in array format.
2.Then, for atom i, calculate the distance to all other atoms by d=sqrt[ (xi-xj)^2+(yi-yj)^2+(zi-zj)^2].
3.Sort these distance in ascending order.
4.Pickup the first 12 atoms closet to atom i.
5.Pick the closet distance as d1, then search other 11 atoms find one can minimize Dj=|d1+dj|^2. Let D1=Dj.
6. Throw d1 and j atom out from 12 atoms. In remaining atoms, pick up one closet to atom i, and repeat step5 until 12 atoms are empty.
7. calculate parameter c=(D1+...+D6)/(2*(d1^2+....d12^2))
8. calculate c for atom i+1
9. at last, output all atoms with c in this format in a new file:
atom id, x, y,z, c
I ready some post but still haven't any idea. Please help me....Thanks a tonne in adv....