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 workaround for cmake
236 #=========================================
237 # get the current date
241 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
243 "C CMake generated file
245 include 'COMMON.IOUNITS'
246 write(iout,*)'++++ Compile info ++++'
247 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
250 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
251 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
252 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
253 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
254 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
255 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
256 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
259 " write(iout,*)'++++ End of compile info ++++'
263 #FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
264 # CINFO_FORMAT(CPPFLAGS)
267 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
269 #=========================================
270 # Set full unres MD sources
271 #=========================================
272 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
275 #=========================================
277 #=========================================
278 add_executable(UNRES_BIN-MD ${UNRES_MD_SRCS} )
279 set_target_properties(UNRES_BIN-MD PROPERTIES OUTPUT_NAME ${UNRES_BIN})
280 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
281 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
284 #=========================================
286 #=========================================
287 # link MPI library (libmpich.a)
289 target_link_libraries( UNRES_BIN-MD ${MPIF_LIBRARIES} )
290 endif(UNRES_WITH_MPI)
292 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
293 target_link_libraries( UNRES_BIN-MD xdrf )
295 #=========================================
297 #=========================================
299 #-- Copy all the data files from the test directory into the source directory
300 #SET(UNRES_TEST_FILES
304 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
305 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
306 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
307 # ADD_CUSTOM_COMMAND (
308 # TARGET ${UNRES_BIN}
310 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
312 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
314 #=========================================
315 # Generate data test files
316 #=========================================
318 #=========================================
320 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
324 #-----------------------------------------------------------------------------
325 UNRES_BIN=./${UNRES_BIN}
326 #-----------------------------------------------------------------------------
327 DD=${CMAKE_SOURCE_DIR}/PARAM
328 export BONDPAR=$DD/bond.parm
329 export THETPAR=$DD/thetaml.5parm
330 export ROTPAR=$DD/scgauss.parm
331 export TORPAR=$DD/torsion_631Gdp.parm
332 export TORDPAR=$DD/torsion_double_631Gdp.parm
333 export ELEPAR=$DD/electr_631Gdp.parm
334 export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
335 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
336 export SCPPAR=$DD/scp.parm
337 export SCCORPAR=$DD/rotcorr_AM1.parm
338 export PATTERN=$DD/patterns.cart
339 #-----------------------------------------------------------------------------
344 # File permissions workaround
346 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
347 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
348 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
353 #=========================================
355 #=========================================
357 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
359 SEED=-1111333 MD ONE_LETTER rescale_mode=2
360 nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
361 reset_moment=1000 reset_vel=1000
362 WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
363 WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
364 WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
365 WVDWPP=0.11371 WHPB=1.00000 &
366 CUTOFF=7.00000 WCORR4=0.00000
371 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
373 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
375 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
377 -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
384 if(NOT UNRES_WITH_MPI)
386 add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
388 else(NOT UNRES_WITH_MPI)
391 add_test(NAME UNRES_MD_MPI_Ala10 COMMAND mpiexec -boot ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
393 endif(NOT UNRES_WITH_MPI)