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

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

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

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

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

