2 # CMake project file for UNRES CSA version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
29 energy_p_new_barrier.F
69 set(UNRES_CSA_SRC3 energy_p_new_barrier.F gradient_p.F )
78 energy_p_new_barrier.F
103 #================================================
104 # Set comipiler flags for different sourcefiles
105 #================================================
106 if (Fortran_COMPILER_NAME STREQUAL "ifort")
107 set(FFLAGS0 "-c -ip -w" )
108 set(FFLAGS1 "-c -w -g -d2 -CA -CB" )
109 set(FFLAGS2 "-c -w -g -00 ")
110 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
111 set(FFLAGS3 "-c -w -ipo " )
112 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
113 set(FFLAGS0 "-c -I. " )
114 set(FFLAGS1 "-c -g -I. " )
115 set(FFLAGS2 "-c -I. ")
116 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
117 set(FFLAGS3 "-c -I. " )
118 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
121 # Add MPI compiler flags
123 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
124 set(FFLAGS1 "${FFLAGS1} -I${MPIF_INCLUDE_DIRECTORIES}")
125 set(FFLAGS2 "${FFLAGS2} -I${MPIF_INCLUDE_DIRECTORIES}")
126 set(FFLAGS3 "${FFLAGS3} -I${MPIF_INCLUDE_DIRECTORIES}")
127 endif(UNRES_WITH_MPI)
129 set_property(SOURCE ${UNRES_CSA_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
130 set_property(SOURCE ${UNRES_CSA_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
131 set_property(SOURCE ${UNRES_CSA_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
132 set_property(SOURCE ${UNRES_CSA_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
134 #=========================================
135 # Settings for CSA force fields
136 #=========================================
138 if(UNRES_CSA_FF STREQUAL "CASP3" )
139 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_TOR -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DMOMENT" )
140 elseif(UNRES_CSA_FF STREQUAL "ALPHA")
141 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
142 elseif(UNRES_CSA_FF STREQUAL "BETA")
143 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
144 elseif(UNRES_CSA_FF STREQUAL "ALPHABETA")
145 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
146 elseif(UNRES_CSA_FF STREQUAL "CASP5")
147 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
148 elseif(UNRES_CSA_FF STREQUAL "3P")
149 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
150 elseif(UNRES_CSA_FF STREQUAL "4P")
151 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
152 endif(UNRES_CSA_FF STREQUAL "CASP3")
154 #=========================================
155 # System specific flags
156 #=========================================
157 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
158 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
159 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
161 #=========================================
162 # Compiler specific flags
163 #=========================================
165 if (Fortran_COMPILER_NAME STREQUAL "ifort")
166 # Add ifort preprocessor flags
167 set(CPPFLAGS "${CPPFLAGS} -DPGI")
168 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
169 # Add new gfortran flags
170 set(CPPFLAGS "${CPPFLAGS} -DG77")
171 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
172 # Add old gfortran flags
173 set(CPPFLAGS "${CPPFLAGS} -DG77")
174 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
176 #=========================================
177 # Add MPI preprocessor flags
178 #=========================================
179 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
181 # Apply preprocesor flags to *.F files
182 set_property(SOURCE ${UNRES_CSA_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
185 #========================================
186 # Setting binary name
187 #========================================
188 set(UNRES_BIN "unresCSA_${Fortran_COMPILER_NAME}_${UNRES_CSA_FF}.exe")
190 #=========================================
191 # cinfo.f stupid workaround for cmake
193 #=========================================
194 set_property(SOURCE compinfo.c PROPERTY CMAKE_C_FLAGS "-c" )
195 add_executable(compinfo-csa compinfo.c)
196 set_target_properties(compinfo-csa PROPERTIES OUTPUT_NAME compinfo)
198 set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
199 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
200 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
201 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/COMMON.IOUNITS ${CMAKE_CURRENT_BINARY_DIR}/COMMON.IOUNITS
202 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/compinfo | true
203 DEPENDS compinfo-csa )
204 set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0} )
206 #=========================================
207 # Set full unres CSA sources
208 #=========================================
209 set(UNRES_CSA_SRCS ${UNRES_CSA_SRC0} ${UNRES_CSA_SRC3} ${UNRES_CINFO_DIR}/cinfo.f )
211 #=========================================
213 #=========================================
214 add_executable(UNRES_BIN-CSA ${UNRES_CSA_SRCS} )
215 set_target_properties(UNRES_BIN-CSA PROPERTIES OUTPUT_NAME ${UNRES_BIN})
217 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
218 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
220 #=========================================
222 #=========================================
223 # link MPI library (libmpich.a)
224 target_link_libraries( UNRES_BIN-CSA ${MPIF_LIBRARIES} )
226 #target_link_libraries( ${UNRES_BIN} xdrf )
228 #=========================================
230 #=========================================
232 #-- Copy all the data files from the test directory into the source directory
233 #SET(UNRES_TEST_FILES
237 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
238 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
239 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
240 # ADD_CUSTOM_COMMAND (
241 # TARGET ${UNRES_BIN}
243 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
245 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
247 #=========================================
248 # Generate data test files
249 #=========================================
251 #=========================================
253 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
257 #-----------------------------------------------------------------------------
258 #UNRES_BIN=./${UNRES_BIN}
259 #-----------------------------------------------------------------------------
260 #DD=${CMAKE_SOURCE_DIR}/PARAM
261 #export BONDPAR=$DD/bond.parm
262 #export THETPAR=$DD/thetaml.5parm
263 #export ROTPAR=$DD/scgauss.parm
264 #export TORPAR=$DD/torsion_631Gdp.parm
265 #export TORDPAR=$DD/torsion_double_631Gdp.parm
266 #export ELEPAR=$DD/electr_631Gdp.parm
267 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
268 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
269 #export SCPPAR=$DD/scp.parm
270 #export SCCORPAR=$DD/rotcorr_AM1.parm
271 #export PATTERN=$DD/patterns.cart
272 #-----------------------------------------------------------------------------
276 #=========================================
278 #=========================================
280 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
282 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
283 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
284 #reset_moment=1000 reset_vel=1000 MDPDB
285 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
286 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
287 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
288 #WVDWPP=0.11371 WHPB=1.00000 &
289 #CUTOFF=7.00000 WCORR4=0.00000
294 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
296 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
298 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
300 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
301 # -120.0000 -120.0000
307 #if(NOT UNRES_WITH_MPI)
309 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
311 #endif(NOT UNRES_WITH_MPI)