How to measure dihedral angles between two vectors?

Dear all,

I am wondering how to measure the dihedral angles between an axis and a plane (normal axis).

There are two 100-mer polymer chains and a SWCNT in the MD systems. Since there are no tools to measure the dihedral angles between two vectors, I am wondering how to measure the dihedral angles between the planes of every single mer and an axis of the SWCNT. If there are any scripts or tools to measure the dihedral angles and have statistics of the trajectories. If anybody could have an idea about this it would be greatly appreciated.

Thanks,

YH