#!/bin/bash

if [ -e new_input.dat ]
then
	rm new_input.dat
else
	touch new_input.dat
fi

for i in $(seq -w 000001 010000)
	do

	cd ${i}

	if [ -e EW.txt ]
	then

	outcome=$(cat outcome)
if [[ "$outcome" == *"UNCLEAR"* ]]; then
		cat states.xyz >> ../new_input.dat
		tail -n1 analysis_rcom.dat
fi
	fi

	cd ..

done
