2 # CMake project file for UNRES with MD for single chains
5 enable_language (Fortran)
8 #================================
9 # Set source file lists
10 #================================
83 if(Fortran_COMPILER_NAME STREQUAL "ifort")
84 set(UNRES_MD_SRC0 ${UNRES_MD_SRC0} prng.f )
86 set(UNRES_MD_SRC0 ${UNRES_MD_SRC0} prng_32.F )
87 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
91 energy_p_new_barrier.F
92 energy_p_new-sep_barrier.F
102 energy_p_new_barrier.F
103 energy_p_new-sep_barrier.F
138 if(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
139 set(UNRES_MD_PP_SRC ${UNRES_MD_PP_SRC} prng_32.F)
140 endif(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
142 #================================================
143 # Set comipiler flags for different sourcefiles
144 #================================================
145 if (Fortran_COMPILER_NAME STREQUAL "ifort")
146 set(FFLAGS0 "-ip -w" )
147 set(FFLAGS1 "-w -g -d2 -CA -CB" )
148 set(FFLAGS2 "-w -g -00 ")
149 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
150 set(FFLAGS3 "-w -ipo " )
151 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
153 set(FFLAGS1 "-g -I. " )
155 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
157 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
160 # Add MPI compiler flags
162 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
163 set(FFLAGS1 "${FFLAGS1} -I${MPIF_INCLUDE_DIRECTORIES}")
164 set(FFLAGS2 "${FFLAGS2} -I${MPIF_INCLUDE_DIRECTORIES}")
165 set(FFLAGS3 "${FFLAGS3} -I${MPIF_INCLUDE_DIRECTORIES}")
166 endif(UNRES_WITH_MPI)
168 set_property(SOURCE ${UNRES_MD_SRC0} APPEND PROPERTY COMPILE_FLAGS ${FFLAGS0} )
169 #set_property(SOURCE ${UNRES_MD_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
170 #set_property(SOURCE ${UNRES_MD_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
171 set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
173 #=========================================
174 # Settings for GAB force field
175 #=========================================
176 if(UNRES_MD_FF STREQUAL "GAB" )
177 # set preprocesor flags
178 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
180 #=========================================
181 # Settings for E0LL2Y force field
182 #=========================================
183 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
184 # set preprocesor flags
185 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0" )
186 endif(UNRES_MD_FF STREQUAL "GAB")
188 #=========================================
189 # System specific flags
190 #=========================================
191 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
192 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
193 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
195 #=========================================
196 # Compiler specific flags
197 #=========================================
199 if (Fortran_COMPILER_NAME STREQUAL "ifort")
200 # Add ifort preprocessor flags
201 set(CPPFLAGS "${CPPFLAGS} -DPGI")
202 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
203 # Add new gfortran flags
204 set(CPPFLAGS "${CPPFLAGS} -DG77")
205 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
206 # Add old gfortran flags
207 set(CPPFLAGS "${CPPFLAGS} -DG77")
208 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
210 #=========================================
211 # Add MPI preprocessor flags
212 #=========================================
214 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
215 endif(UNRES_WITH_MPI)
217 #=========================================
218 # Apply preprocesor flags to *.F files
219 #=========================================
220 set_property(SOURCE ${UNRES_MD_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
223 #========================================
224 # Setting binary name
225 #========================================
228 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_MPICH_${UNRES_MD_FF}.exe")
231 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_single_${UNRES_MD_FF}.exe")
232 endif(UNRES_WITH_MPI)
234 #=========================================
235 # cinfo.f stupid workaround for cmake
237 #=========================================
238 set_property(SOURCE compinfo.c PROPERTY CMAKE_C_FLAGS "-c" )
239 add_executable(compinfo-md compinfo.c)
240 set_target_properties(compinfo-md PROPERTIES OUTPUT_NAME compinfo)
242 set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
243 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
244 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
245 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/COMMON.IOUNITS ${CMAKE_CURRENT_BINARY_DIR}/COMMON.IOUNITS
246 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/compinfo | true
247 DEPENDS compinfo-md )
248 set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0} )
250 #=========================================
251 # Set full unres MD sources
252 #=========================================
253 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${UNRES_CINFO_DIR}/cinfo.f )
256 #=========================================
258 #=========================================
259 add_executable(UNRES_BIN-MD ${UNRES_MD_SRCS} )
260 set_target_properties(UNRES_BIN-MD PROPERTIES OUTPUT_NAME ${UNRES_BIN})
261 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
262 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
265 #=========================================
267 #=========================================
268 # link MPI library (libmpich.a)
270 target_link_libraries( UNRES_BIN-MD ${MPIF_LIBRARIES} )
271 endif(UNRES_WITH_MPI)
273 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
274 target_link_libraries( UNRES_BIN-MD xdrf )
276 #=========================================
278 #=========================================
280 #-- Copy all the data files from the test directory into the source directory
281 #SET(UNRES_TEST_FILES
285 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
286 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
287 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
288 # ADD_CUSTOM_COMMAND (
289 # TARGET ${UNRES_BIN}
291 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
293 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
295 #=========================================
296 # Generate data test files
297 #=========================================
299 #=========================================
301 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
305 #-----------------------------------------------------------------------------
306 UNRES_BIN=./${UNRES_BIN}
307 #-----------------------------------------------------------------------------
308 DD=${CMAKE_SOURCE_DIR}/PARAM
309 export BONDPAR=$DD/bond.parm
310 export THETPAR=$DD/thetaml.5parm
311 export ROTPAR=$DD/scgauss.parm
312 export TORPAR=$DD/torsion_631Gdp.parm
313 export TORDPAR=$DD/torsion_double_631Gdp.parm
314 export ELEPAR=$DD/electr_631Gdp.parm
315 export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
316 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
317 export SCPPAR=$DD/scp.parm
318 export SCCORPAR=$DD/rotcorr_AM1.parm
319 export PATTERN=$DD/patterns.cart
320 #-----------------------------------------------------------------------------
325 # File permissions workaround
327 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
328 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
329 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
334 #=========================================
336 #=========================================
338 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
340 SEED=-1111333 MD ONE_LETTER rescale_mode=2
341 nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
342 reset_moment=1000 reset_vel=1000
343 WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
344 WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
345 WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
346 WVDWPP=0.11371 WHPB=1.00000 &
347 CUTOFF=7.00000 WCORR4=0.00000
352 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
354 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
356 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
358 -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
365 if(NOT UNRES_WITH_MPI)
367 add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
369 else(NOT UNRES_WITH_MPI)
372 add_test(NAME UNRES_MD_MPI_Ala10 COMMAND mpiexec -boot ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
374 endif(NOT UNRES_WITH_MPI)