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 )
85 elseif(Fortran_COMPILER_NAME STREQUAL "mpif90")
86 set(UNRES_MD_SRC0 ${UNRES_MD_SRC0} prng.f )
88 set(UNRES_MD_SRC0 ${UNRES_MD_SRC0} prng_32.F )
89 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
93 energy_p_new_barrier.F
94 energy_p_new-sep_barrier.F
104 energy_p_new_barrier.F
105 energy_p_new-sep_barrier.F
140 if(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
141 set(UNRES_MD_PP_SRC ${UNRES_MD_PP_SRC} prng_32.F)
142 endif(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
144 #================================================
145 # Set comipiler flags for different sourcefiles
146 #================================================
147 if (Fortran_COMPILER_NAME STREQUAL "ifort")
148 set(FFLAGS0 "-ip -w" )
149 set(FFLAGS1 "-w -g -d2 -CA -CB" )
150 set(FFLAGS2 "-w -g -00 ")
151 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
152 set(FFLAGS3 "-w -ipo " )
153 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
154 set(FFLAGS0 "-std=legacy -I. " )
155 set(FFLAGS1 "-std=legacy -g -I. " )
156 set(FFLAGS2 "-std=legacy -I. ")
157 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
158 set(FFLAGS3 "-std=legacy -I. " )
159 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
162 # Add MPI compiler flags
164 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
165 set(FFLAGS1 "${FFLAGS1} -I${MPIF_INCLUDE_DIRECTORIES}")
166 set(FFLAGS2 "${FFLAGS2} -I${MPIF_INCLUDE_DIRECTORIES}")
167 set(FFLAGS3 "${FFLAGS3} -I${MPIF_INCLUDE_DIRECTORIES}")
168 endif(UNRES_WITH_MPI)
170 set_property(SOURCE ${UNRES_MD_SRC0} APPEND PROPERTY COMPILE_FLAGS ${FFLAGS0} )
171 #set_property(SOURCE ${UNRES_MD_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
172 #set_property(SOURCE ${UNRES_MD_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
173 set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
175 #=========================================
176 # Settings for GAB force field
177 #=========================================
178 if(UNRES_MD_FF STREQUAL "GAB" )
179 # set preprocesor flags
180 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
182 #=========================================
183 # Settings for E0LL2Y force field
184 #=========================================
185 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
186 # set preprocesor flags
187 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0" )
188 endif(UNRES_MD_FF STREQUAL "GAB")
190 #=========================================
191 # System specific flags
192 #=========================================
193 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
194 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
195 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
197 #=========================================
198 # Compiler specific flags
199 #=========================================
201 if (Fortran_COMPILER_NAME STREQUAL "ifort")
202 # Add ifort preprocessor flags
203 set(CPPFLAGS "${CPPFLAGS} -DPGI")
204 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
205 # Add new gfortran flags
206 set(CPPFLAGS "${CPPFLAGS} -DG77")
207 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
208 # Add old gfortran flags
209 set(CPPFLAGS "${CPPFLAGS} -DG77")
210 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
212 #=========================================
213 # Add MPI preprocessor flags
214 #=========================================
216 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
217 endif(UNRES_WITH_MPI)
219 #=========================================
220 # Apply preprocesor flags to *.F files
221 #=========================================
222 set_property(SOURCE ${UNRES_MD_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
225 #========================================
226 # Setting binary name
227 #========================================
230 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_MPICH_${UNRES_MD_FF}.exe")
233 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_single_${UNRES_MD_FF}.exe")
234 endif(UNRES_WITH_MPI)
236 #=========================================
237 # cinfo.f workaround for cmake
238 #=========================================
239 # get the current date
243 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
245 "C CMake generated file
247 include 'COMMON.IOUNITS'
248 write(iout,*)'++++ Compile info ++++'
249 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
252 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
253 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
254 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
255 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
256 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
257 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
258 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
261 " write(iout,*)'++++ End of compile info ++++'
266 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
268 #=========================================
269 # Set full unres MD sources
270 #=========================================
271 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
274 #=========================================
276 #=========================================
277 add_executable(UNRES_BIN-MD ${UNRES_MD_SRCS} )
278 set_target_properties(UNRES_BIN-MD PROPERTIES OUTPUT_NAME ${UNRES_BIN})
279 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
280 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
283 #=========================================
285 #=========================================
286 # link MPI library (libmpich.a)
288 target_link_libraries( UNRES_BIN-MD ${MPIF_LIBRARIES} )
289 endif(UNRES_WITH_MPI)
291 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
292 target_link_libraries( UNRES_BIN-MD xdrf )
294 #=========================================
296 #=========================================
298 #-- Copy all the data files from the test directory into the source directory
299 #SET(UNRES_TEST_FILES
303 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
304 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
305 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
306 # ADD_CUSTOM_COMMAND (
307 # TARGET ${UNRES_BIN}
309 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
311 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
313 #=========================================
314 # Generate data test files
315 #=========================================
317 #=========================================
319 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
323 #-----------------------------------------------------------------------------
324 UNRES_BIN=./${UNRES_BIN}
325 #-----------------------------------------------------------------------------
326 DD=${CMAKE_SOURCE_DIR}/PARAM
327 export BONDPAR=$DD/bond.parm
328 export THETPAR=$DD/thetaml.5parm
329 export ROTPAR=$DD/scgauss.parm
330 export TORPAR=$DD/torsion_631Gdp.parm
331 export TORDPAR=$DD/torsion_double_631Gdp.parm
332 export ELEPAR=$DD/electr_631Gdp.parm
333 export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
334 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
335 export SCPPAR=$DD/scp.parm
336 export SCCORPAR=$DD/rotcorr_AM1.parm
337 export PATTERN=$DD/patterns.cart
338 #-----------------------------------------------------------------------------
343 # File permissions workaround
345 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
346 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
347 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
352 #=========================================
354 #=========================================
356 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
358 SEED=-1111333 MD ONE_LETTER rescale_mode=2
359 nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
360 reset_moment=1000 reset_vel=1000
361 WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
362 WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
363 WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
364 WVDWPP=0.11371 WHPB=1.00000 &
365 CUTOFF=7.00000 WCORR4=0.00000
370 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
372 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
374 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
376 -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
383 if(NOT UNRES_WITH_MPI)
385 add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
387 else(NOT UNRES_WITH_MPI)
390 add_test(NAME UNRES_MD_MPI_Ala10 COMMAND mpiexec -boot ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
392 endif(NOT UNRES_WITH_MPI)