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

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

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

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

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

