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


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

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

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

