I got stuck a little bit, and I'm not sure how to proceed...
First, I sorted all atom coordinates in increasing Z,Y,X. I just used Excel.
Then, I developed some scripts for aligning the geometry such that 3 atoms are in a plane. The point would be to take 3 atoms which form a "ring", so they should have the same Z coordinate, and place them in the XY plane. This worked, but the other atoms that are supposed to be part of the same "ring", do not end up with the same Z coordinates. And in general, the rest of the structure is now very slightly off axis, still.
A bit hard to explain...
The problem might be that there are too few decimals in the original coordinates.
One solution could to place a perfect ATK CNT as the end, but then the "screening part" of the junction will be non-perfect and cause scattering, so we end up with a very long system because we have to pad the system with several periods of perfect CNTs. Would be ok for the semi-empirical model though.
I attach my 2 custom builders (all this is done in VNL 2010.02), so you can play around with it a bit yourself... One aligns 2 atoms on an axis (I thought this would be enough first, and in some sense it should be, if we use the Z axis), the second aligns 3 atoms in a plane.