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
90 set(UNRES_MD_DFA_PP_SRC
98 energy_p_new_barrier.F
99 energy_p_new-sep_barrier.F
134 if(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
135 set(UNRES_MD_PP_SRC ${UNRES_MD_PP_SRC} prng_32.F)
136 endif(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
138 #================================================
139 # Set comipiler flags for different sourcefiles
140 #================================================
141 if (Fortran_COMPILER_NAME STREQUAL "ifort")
142 set(FFLAGS0 "-ip -w" )
143 set(FFLAGS1 "-w -g -d2 -CA -CB" )
144 set(FFLAGS2 "-w -g -00 ")
145 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
146 set(FFLAGS3 "-w -ipo " )
147 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
148 set(FFLAGS0 "-std=legacy -I. " )
149 set(FFLAGS1 "-std=legacy -g -I. " )
150 set(FFLAGS2 "-std=legacy -I. ")
151 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
152 set(FFLAGS3 "-std=legacy -I. " )
153 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
156 # Add MPI compiler flags
158 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
159 set(FFLAGS1 "${FFLAGS1} -I${MPI_Fortran_INCLUDE_PATH}")
160 set(FFLAGS2 "${FFLAGS2} -I${MPI_Fortran_INCLUDE_PATH}")
161 set(FFLAGS3 "${FFLAGS3} -I${MPI_Fortran_INCLUDE_PATH}")
162 endif(UNRES_WITH_MPI)
164 set_property(SOURCE ${UNRES_MD_DFA_SRC0} APPEND PROPERTY COMPILE_FLAGS ${FFLAGS0} )
165 #set_property(SOURCE ${UNRES_MD_DFA_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
166 #set_property(SOURCE ${UNRES_MD_DFA_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
167 set_property(SOURCE ${UNRES_MD_DFA_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
169 #=========================================
170 # Settings for GAB force field
171 #=========================================
172 if(UNRES_MD_FF STREQUAL "GAB" )
173 # set preprocesor flags
174 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
176 #=========================================
177 # Settings for E0LL2Y force field
178 #=========================================
179 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
180 # set preprocesor flags
181 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0" )
182 endif(UNRES_MD_FF STREQUAL "GAB")
184 #=========================================
185 # System specific flags
186 #=========================================
187 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
188 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
189 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
191 #=========================================
192 # Compiler specific flags
193 #=========================================
195 if (Fortran_COMPILER_NAME STREQUAL "ifort")
196 # Add ifort preprocessor flags
197 set(CPPFLAGS "${CPPFLAGS} -DPGI")
198 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
199 # Add new gfortran flags
200 set(CPPFLAGS "${CPPFLAGS} -DG77")
201 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
202 # Add old gfortran flags
203 set(CPPFLAGS "${CPPFLAGS} -DG77")
204 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
206 #=========================================
207 # Add MPI preprocessor flags
208 #=========================================
210 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
211 endif(UNRES_WITH_MPI)
213 #=========================================
214 # add 64-bit specific preprocessor flags
215 #=========================================
216 if (architektura STREQUAL "64")
217 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
218 endif (architektura STREQUAL "64")
220 #=========================================
221 # Apply preprocesor flags to *.F files
222 #=========================================
223 set_property(SOURCE ${UNRES_MD_DFA_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
226 #========================================
227 # Setting binary name
228 #========================================
231 set(UNRES_BIN "unresMD-DFA_${Fortran_COMPILER_NAME}_MPICH_${UNRES_MD_FF}.exe")
234 set(UNRES_BIN "unresMD-DFA_${Fortran_COMPILER_NAME}_single_${UNRES_MD_FF}.exe")
235 endif(UNRES_WITH_MPI)
237 #=========================================
238 # cinfo.f workaround for cmake
239 #=========================================
240 # get the current date
244 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
246 "C CMake generated file
248 include 'COMMON.IOUNITS'
249 write(iout,*)'++++ Compile info ++++'
250 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
253 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
254 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
255 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
256 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
257 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
258 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
259 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
262 " write(iout,*)'++++ End of compile info ++++'
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_DFA_SRCS ${UNRES_MD_DFA_SRC0} ${UNRES_MD_DFA_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
275 #=========================================
277 #=========================================
278 add_executable(UNRES_BIN-MD-DFA ${UNRES_MD_DFA_SRCS} )
279 set_target_properties(UNRES_BIN-MD-DFA PROPERTIES OUTPUT_NAME ${UNRES_BIN})
280 set_property(TARGET UNRES_BIN-MD-DFA PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
281 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
284 #=========================================
286 #=========================================
287 # link MPI library (libmpich.a)
289 target_link_libraries( UNRES_BIN-MD-DFA ${MPI_Fortran_LIBRARIES} )
290 endif(UNRES_WITH_MPI)
292 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
293 target_link_libraries( UNRES_BIN-MD-DFA 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 # Set parmaeters depending on force field
321 if(UNRES_MD_FF STREQUAL "GAB")
322 set(UNRES_BONDPAR "bond.parm")
323 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
324 set(UNRES_BONDPAR "bond_AM1.parm")
325 endif(UNRES_MD_FF STREQUAL "GAB")
327 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
331 #-----------------------------------------------------------------------------
332 UNRES_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_BIN}
333 #-----------------------------------------------------------------------------
334 DD=${CMAKE_SOURCE_DIR}/PARAM
335 export BONDPAR=$DD/${UNRES_BONDPAR}
336 export THETPAR=$DD/thetaml.5parm
337 export ROTPAR=$DD/scgauss.parm
338 export TORPAR=$DD/torsion_631Gdp.parm
339 export TORDPAR=$DD/torsion_double_631Gdp.parm
340 export ELEPAR=$DD/electr_631Gdp.parm
341 export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
342 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
343 export SCPPAR=$DD/scp.parm
344 export SCCORPAR=$DD/rotcorr_AM1.parm
345 export PATTERN=$DD/patterns.cart
346 #-----------------------------------------------------------------------------
351 # File permissions workaround
353 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/test_single_ala.sh
354 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
355 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
360 #=========================================
362 #=========================================
364 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
366 SEED=-1111333 MD ONE_LETTER rescale_mode=2
367 nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
368 reset_moment=1000 reset_vel=1000
369 WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
370 WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
371 WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
372 WVDWPP=0.11371 WHPB=1.00000 &
373 CUTOFF=7.00000 WCORR4=0.00000
378 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
380 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
382 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
384 -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
391 if(NOT UNRES_WITH_MPI)
393 add_test(NAME UNRES_MD_DFA_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
395 else(NOT UNRES_WITH_MPI)
398 add_test(NAME UNRES_MD_DFA_MPI_Ala10 COMMAND mpiexec -boot ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
400 endif(NOT UNRES_WITH_MPI)