
foreach i (s3 txt wyn) 
	foreach chg (J K L M N O P Q R)
		foreach z (H17 H18 H19 H20 H21 H22 H23 H24 H25) 

			# 17-25 lead-like, logP < 3.499
			cat dirs/?/${chg}-M-${z}.?.${i} dirs/?/${chg}-P012-${z}.?.${i}  dirs/?/${chg}-P304-${z}.?.${i} > ${chg}-${z}.lead-like.${i}
			if (-z ${chg}-${z}.lead-like.${i}) then
				/bin/rm -f ${chg}-${z}.lead-like.${i}
			endif

			# logP 3.5-4.0
			cat dirs/?/${chg}-P359-${z}.?.${i} > ${chg}-${z}.big-greasy.${i}
			if (-z ${chg}-${z}.big-greasy.${i}) then
				/bin/rm -f ${chg}-${z}.big-greasy.${i}
			endif

			# log 4.0-5.0
			cat  dirs/?/${chg}-P4-${z}.?.${i} > ${chg}-${z}.greasy-leads.${i}
			if (-z ${chg}-${z}.greasy-leads.${i}) then
				/bin/rm -f ${chg}-${z}.greasy-leads.${i}
			endif
		end

		# frags
		foreach z (H04 H05 H06 H07 H08 H09 H10 H11 H12 H13 H14 H15 H16)
			cat dirs/?/${chg}-M-${z}.?.${i} dirs/?/${chg}-P012-${z}.?.${i} > ${chg}-${z}.frag-like.${i}
			if (-z ${chg}-${z}.frag-like.${i}) then
				/bin/rm -f ${chg}-${z}.frag-like.${i}
			endif
		end

		# big
		foreach z (H26 H27 H28 H29)
			cat dirs/?/${chg}-M-${z}.?.${i} dirs/?/${chg}-P012-${z}.?.${i} dirs/?/${chg}-P304-${z}.?.${i} > ${chg}-${z}.big.${i}
			if (-z ${chg}-${z}.big.${i}) then
				/bin/rm -f ${chg}-${z}.big.${i}
			endif
		end

		#macro
		foreach z (H30 H31 H32 H33 H34 H35 H36 H37 H38 H39)
		cat dirs/?/${chg}-M-${z}.?.${i} dirs/?/${chg}-P012-${z}.?.${i} dirs/?/${chg}-P304-${z}.?.${i} > ${chg}-${z}.macro.${i}
		if (-z ${chg}-${z}.macro.${i}) then
			/bin/rm -f ${chg}-${z}.macro.${i}
		endif
		end
	end
end
