2 # CMake project file for UNRES with MD for single chains
5 enable_language (Fortran)
8 #================================
9 # Set source file lists
10 #================================
86 energy_p_new_barrier.F
87 energy_p_new-sep_barrier.F
97 energy_p_new_barrier.F
98 energy_p_new-sep_barrier.F
133 #================================================
134 # Set comipiler flags for different sourcefiles
135 #================================================
136 if (Fortran_COMPILER_NAME STREQUAL "ifort")
137 set(FFLAGS0 "-ip -w" )
138 set(FFLAGS1 "-w -g -d2 -CA -CB" )
139 set(FFLAGS2 "-w -g -00 ")
140 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
141 set(FFLAGS3 "-w -ipo " )
142 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
143 set(FFLAGS0 "-std=legacy -I. " )
144 set(FFLAGS1 "-std=legacy -g -I. " )
145 set(FFLAGS2 "-std=legacy -I. ")
146 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
147 set(FFLAGS3 "-std=legacy -I. " )
148 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
151 # Add MPI compiler flags
153 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
154 set(FFLAGS1 "${FFLAGS1} -I${MPI_Fortran_INCLUDE_PATH}")
155 set(FFLAGS2 "${FFLAGS2} -I${MPI_Fortran_INCLUDE_PATH}")
156 set(FFLAGS3 "${FFLAGS3} -I${MPI_Fortran_INCLUDE_PATH}")
157 endif(UNRES_WITH_MPI)
159 set_property(SOURCE ${UNRES_MD_SRC0} APPEND PROPERTY COMPILE_FLAGS ${FFLAGS0} )
160 #set_property(SOURCE ${UNRES_MD_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
161 #set_property(SOURCE ${UNRES_MD_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
162 set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
164 #=========================================
165 # Settings for GAB force field
166 #=========================================
167 if(UNRES_MD_FF STREQUAL "GAB" )
168 # set preprocesor flags
169 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
171 #=========================================
172 # Settings for E0LL2Y force field
173 #=========================================
174 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
175 # set preprocesor flags
176 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0" )
177 endif(UNRES_MD_FF STREQUAL "GAB")
179 #=========================================
180 # System specific flags
181 #=========================================
182 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
183 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
184 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
186 #=========================================
187 # Compiler specific flags
188 #=========================================
190 if (Fortran_COMPILER_NAME STREQUAL "ifort")
191 # Add ifort preprocessor flags
192 set(CPPFLAGS "${CPPFLAGS} -DPGI")
193 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
194 # Add new gfortran flags
195 set(CPPFLAGS "${CPPFLAGS} -DG77")
196 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
197 # Add old gfortran flags
198 set(CPPFLAGS "${CPPFLAGS} -DG77")
199 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
201 #=========================================
202 # Add MPI preprocessor flags
203 #=========================================
205 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
206 endif(UNRES_WITH_MPI)
208 #=========================================
209 # Add 64-bit specific preprocessor flags
210 #=========================================
211 if (architektura STREQUAL "64")
212 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
213 endif (architektura STREQUAL "64")
215 #=========================================
216 # Apply preprocesor flags to *.F files
217 #=========================================
218 set_property(SOURCE ${UNRES_MD_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
221 #========================================
222 # Setting binary name
223 #========================================
226 set(UNRES_BIN "unresMD_${Fortran_COMPILER_NAME}_MPICH_${UNRES_MD_FF}.exe")
229 set(UNRES_BIN "unresMD_${Fortran_COMPILER_NAME}_single_${UNRES_MD_FF}.exe")
230 endif(UNRES_WITH_MPI)
232 #=========================================
233 # cinfo.f workaround for cmake
234 #=========================================
235 # get the current date
239 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
241 "C CMake generated file
243 include 'COMMON.IOUNITS'
244 write(iout,*)'++++ Compile info ++++'
245 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
248 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
249 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
250 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
251 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
252 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
253 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
254 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
257 " write(iout,*)'++++ End of compile info ++++'
262 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
264 #=========================================
265 # Set full unres MD sources
266 #=========================================
267 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
270 #=========================================
272 #=========================================
273 add_executable(UNRES_BIN-MD ${UNRES_MD_SRCS} )
274 set_target_properties(UNRES_BIN-MD PROPERTIES OUTPUT_NAME ${UNRES_BIN})
275 set_property(TARGET UNRES_BIN-MD PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
276 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
279 #=========================================
281 #=========================================
282 # link MPI library (libmpich.a)
284 target_link_libraries( UNRES_BIN-MD ${MPI_Fortran_LIBRARIES} )
285 endif(UNRES_WITH_MPI)
287 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
288 target_link_libraries( UNRES_BIN-MD xdrf )
290 #=========================================
292 #=========================================
293 install(TARGETS UNRES_BIN-MD DESTINATION ${CMAKE_INSTALL_PREFIX})
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=${CMAKE_BINARY_DIR}/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/sccor_pdb_shelly.dat
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)