#! /bin/sh
#
# diana2habas diana.aco >diana.phi.aco
#
# this script takes a disgeo dihedral angle constraint file and 
# puts it into habas dihedral angle output format (.aco).
#
nawk '

$3=="PHI" {
	angle=1
	lowbound=$4
	highbound=$5
	printf("%5s %4s %7.1f %7.1f \n", $1, angle, lowbound, highbound)
	}

$3=="PSI" {
	angle=2
	lowbound=$4
	highbound=$5
	printf("%5s %4s %7.1f %7.1f \n", $1, angle, lowbound, highbound)
	}

$3=="CHI1" {
	angle=4
	lowbound=$4
	highbound=$5
	printf("%5s %4s %7.1f %7.1f \n", $1, angle, lowbound, highbound)
	}
' $1
