#!/bin/csh
#
# This UCSF Generation and Cleanup script was created by AGNuS 2.1.
#


# Testing to delete ./pipe_conversion/
if (-e ./pipe_conversion/) then
	echo "Deleteing ./pipe_conversion/"
	rm -fr ./pipe_conversion/ 
endif

# Testing to delete ./pipe_processing/
if (-e ./pipe_processing/) then
	echo "Deleteing ./pipe_processing/"
	rm -fr ./pipe_processing/ 
endif

# Testing to delete ./pipe_rephasing/
if (-e ./pipe_rephasing/) then
	echo "Deleteing ./pipe_rephasing/"
	rm -fr ./pipe_rephasing/ 
endif

# Testing to delete ./pipe_rebasing/
if (-e ./pipe_rebasing/) then
	echo "Deleteing ./pipe_rebasing/"
	rm -fr ./pipe_rebasing/ 
endif

# Testing to delete ./HNcoCACB.rephase.pipe
if (-e ./HNcoCACB.rephase.pipe) then
	echo "Deleteing ./HNcoCACB.rephase.pipe"
	rm -fr ./HNcoCACB.rephase.pipe 
endif

# Testing to delete ./HNcoCACB.rebase.pipe
if (-e ./HNcoCACB.rebase.pipe) then
	echo "Deleteing ./HNcoCACB.rebase.pipe"
	rm -fr ./HNcoCACB.rebase.pipe 
endif

# Testing to delete ./HNcoCACB_xy.pipe
if (-e ./HNcoCACB_xy.pipe) then
	echo "Deleteing ./HNcoCACB_xy.pipe"
	rm -fr ./HNcoCACB_xy.pipe 
endif

# Testing to delete ./HNcoCACB_xz.pipe
if (-e ./HNcoCACB_xz.pipe) then
	echo "Deleteing ./HNcoCACB_xz.pipe"
	rm -fr ./HNcoCACB_xz.pipe 
endif

# Generate UCSF if ./HNcoCACB.pipe exists
if (-e ./HNcoCACB.pipe) then
	echo "Attempting to generate UCSF file ./HNcoCACB.ucsf"
	if ( { pipe2ucsf  ./HNcoCACB.pipe ./HNcoCACB.ucsf } ) then 
		if (-e ./Convert_HNcoCACB.csh ) then
			echo "ZZZZZZZZZZConversion_script_begin" >> ./HNcoCACB.ucsf
			cat ./Convert_HNcoCACB.csh >> ./HNcoCACB.ucsf
			echo "ZZZZZZZZZZConversion_script_end" >> ./HNcoCACB.ucsf
		endif
		if (-e ./Process_HNcoCACB.csh ) then
			echo "ZZZZZZZZZZProcessing_script_begin" >> ./HNcoCACB.ucsf
			cat ./Process_HNcoCACB.csh >> ./HNcoCACB.ucsf
			echo "ZZZZZZZZZZProcessing_script_end" >> ./HNcoCACB.ucsf
		endif
		echo "Deleteing ./HNcoCACB.pipe"
		rm -f ./HNcoCACB.pipe 
	endif
endif

