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

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

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

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

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

