More fixes for lammps writer

merged dihedral and improper functions.
returned the dihedral test to original complexity.
Eliminated a few bugs on write.