#!/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 ./HBHAcoNH.rephase.pipe
if (-e ./HBHAcoNH.rephase.pipe) then
	echo "Deleteing ./HBHAcoNH.rephase.pipe"
	rm -fr ./HBHAcoNH.rephase.pipe 
endif

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

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

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

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

