+#=========================================
+# TESTS
+#=========================================
+
+#=========================================
+# Generate data test files
+#=========================================
+# test_single_ala.sh
+#=========================================
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
+"#!/bin/sh
+export POT=GB
+export PREFIX=ala10
+#-----------------------------------------------------------------------------
+UNRES_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_BIN}
+#-----------------------------------------------------------------------------
+DD=${CMAKE_SOURCE_DIR}/PARAM
+export BONDPAR=$DD/bond.parm
+export THETPAR=$DD/thetaml.5parm
+export ROTPAR=$DD/scgauss.parm
+export TORPAR=$DD/torsion_631Gdp.parm
+export TORDPAR=$DD/torsion_double_631Gdp.parm
+export ELEPAR=$DD/electr_631Gdp.parm
+export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
+export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
+export SCPPAR=$DD/scp.parm
+export SCCORPAR=$DD/sccor_pdb_shelly.dat
+export PATTERN=$DD/patterns.cart
+#-----------------------------------------------------------------------------
+$UNRES_BIN
+")
+
+#
+# File permissions workaround
+#
+FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+
+
+#=========================================
+# ala10.inp
+#=========================================
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
+"ala10 unblocked
+SEED=-1111333 MD ONE_LETTER rescale_mode=2
+nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
+reset_moment=1000 reset_vel=1000
+WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
+WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
+WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
+WVDWPP=0.11371 WHPB=1.00000 &
+CUTOFF=7.00000 WCORR4=0.00000
+12
+XAAAAAAAAAAX
+ 0
+ 0
+ 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
+ 90.0000 90.0000
+ 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
+ 180.0000
+ 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
+ 110.0000 110.0000
+ -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
+ -120.0000 -120.0000
+")
+
+if(UNRES_MD_FF STREQUAL "E0LL2Y")
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/prota.pdb
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/prota_ENE.inp
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/prota_MIN_CART.inp
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1l2y_MIN_INT.inp
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y.pdb
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
+
+FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/prota_unres_energy_check.sh
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+
+#=========================================
+# test_prota_E0LL2Y.sh
+#=========================================
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_prota_E0LL2Y.sh
+"#!/bin/sh
+export POT=GB
+export FGPROCS=$2
+export PREFIX=$1
+#-----------------------------------------------------------------------------
+UNRES_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_BIN}
+#-----------------------------------------------------------------------------
+DD=${CMAKE_SOURCE_DIR}/PARAM
+export BONDPAR=$DD/bond_AM1.parm
+export THETPAR=$DD/theta_abinitio.parm
+export ROTPAR=$DD/rotamers_AM1_aura.10022007.parm
+export TORPAR=$DD/torsion_631Gdp.parm
+export TORDPAR=$DD/torsion_double_631Gdp.parm
+export ELEPAR=$DD/electr_631Gdp.parm
+export SIDEPAR=$DD/scinter_$POT.parm
+export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
+export SCPPAR=$DD/scp.parm
+export SCCORPAR=$DD/sccor_am1_pawel.dat
+export THETPARPDB=$DD/thetaml.5parm
+export ROTPARPDB=$DD/scgauss.parm
+export PATTERN=$DD/patterns.cart
+#-----------------------------------------------------------------------------
+echo CTEST_FULL_OUTPUT
+$UNRES_BIN
+./prota_unres_energy_check.sh $1 ${UNRES_BIN}
+")
+
+#
+# File permissions workaround
+#
+FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_prota_E0LL2Y.sh
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+)
+
+endif(UNRES_MD_FF STREQUAL "E0LL2Y")
+
+
+
+# Add tests
+
+ if(UNRES_MD_FF STREQUAL "GAB")
+ add_test(NAME UNRES-MIN_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
+ endif(UNRES_MD_FF STREQUAL "GAB")
+
+ if(UNRES_MD_FF STREQUAL "E0LL2Y")
+ add_test(NAME UNRES-MIN_ENE_prota COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_prota_E0LL2Y.sh prota_ENE 1 )
+ add_test(NAME UNRES-MIN_MIN_prota COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_prota_E0LL2Y.sh prota_MIN_CART 1 )
+ add_test(NAME UNRES-MIN_MIN_INT COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_prota_E0LL2Y.sh 1l2y_MIN_INT 1 )
+ endif(UNRES_MD_FF STREQUAL "E0LL2Y")
+
+