2 # CMake project file for WHAM single chain version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
94 #================================================
95 # Set comipiler flags for different sourcefiles
96 #================================================
97 if (Fortran_COMPILER_NAME STREQUAL "ifort")
98 set(FFLAGS0 "-mcmodel=medium -shared-intel -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
99 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
100 set(FFLAGS0 "-std=legacy -mcmodel=medium -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
101 elseif (Fortran_COMPILER_NAME STREQUAL "pgf90")
102 set(FFLAGS0 "-mcmodel=medium -Mlarge_arrays -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
104 set(FFLAGS0 " -mcmodel=medium -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
105 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
108 #=========================================
109 # Add MPI compiler flags
110 #=========================================
112 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
113 endif(UNRES_WITH_MPI)
115 set_property(SOURCE ${UNRES_WHAM_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
117 #=========================================
118 # Settings for GAB force field
119 #=========================================
121 if(UNRES_MD_FF STREQUAL "GAB" )
122 # set preprocesor flags
123 set(CPPFLAGS "PROCOR -DSPLITELE -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
125 #=========================================
126 # Settings for E0LL2Y force field
127 #=========================================
128 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
129 # set preprocesor flags
130 set(CPPFLAGS "PROCOR -DSPLITELE -DSCCORPDB" )
131 elseif(UNRES_MD_FF STREQUAL "4P")
132 set(CPPFLAGS "SPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
133 endif(UNRES_MD_FF STREQUAL "GAB")
136 #=========================================
138 #=========================================
139 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN -DWHAM ")
142 #=========================================
143 # System specific flags
144 #=========================================
145 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
146 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
147 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
149 #=========================================
150 # Compiler specific flags
151 #=========================================
153 if (Fortran_COMPILER_NAME STREQUAL "ifort")
154 # Add ifort preprocessor flags
155 set(CPPFLAGS "${CPPFLAGS} -DPGI")
156 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
157 # Add new gfortran flags
158 set(CPPFLAGS "${CPPFLAGS} -DG77")
159 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
160 # Add old gfortran flags
161 set(CPPFLAGS "${CPPFLAGS} -DG77")
162 elseif (Fortran_COMPILER_NAME STREQUAL "pgf90")
163 set(CPPFLAGS "${CPPFLAGS} -DPGI")
164 FILE(COPY ${CMAKE_SOURCE_DIR}/source/lib/isnan_pgi.f DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
165 list(APPEND UNRES_WHAM_SRC0 ${CMAKE_CURRENT_BINARY_DIR}/isnan_pgi.f)
166 set(CMAKE_EXE_LINKER_FLAGS "-Bdynamic")
167 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
169 #=========================================
170 # Add MPI preprocessor flags
171 #=========================================
172 set(CPPFLAGS "${CPPFLAGS} -DMPI")
174 #=========================================
175 # Add 64-bit specific preprocessor flags
176 #=========================================
177 if (architektura STREQUAL "64")
178 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
179 endif (architektura STREQUAL "64")
181 #=========================================
182 # Apply preprocesor flags to *.F files
183 #=========================================
184 set_property(SOURCE ${UNRES_WHAM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
187 #========================================
188 # Setting binary name
189 #========================================
190 set(UNRES_WHAM_BIN "wham_${Fortran_COMPILER_NAME}_MPI_${UNRES_MD_FF}.exe")
192 #=========================================
193 # cinfo.f workaround for CMake
194 #=========================================
195 # get the current date
199 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
201 "C CMake generated file
203 include 'COMMON.IOUNITS'
204 write(iout,*)'++++ Compile info ++++'
205 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
208 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
209 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
210 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
211 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
212 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
213 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
214 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
217 " write(iout,*)'++++ End of compile info ++++'
222 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
224 #=========================================
225 # Set full unres CSA sources
226 #=========================================
227 set(UNRES_WHAM_SRCS ${UNRES_WHAM_SRC0} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f proc_proc.c)
229 #=========================================
231 #=========================================
232 add_executable(UNRES_WHAM_BIN ${UNRES_WHAM_SRCS} )
233 set_target_properties(UNRES_WHAM_BIN PROPERTIES OUTPUT_NAME ${UNRES_WHAM_BIN})
234 set_property(TARGET UNRES_WHAM_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
235 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
237 #=========================================
239 #=========================================
241 target_link_libraries( UNRES_WHAM_BIN ${MPI_Fortran_LIBRARIES} )
243 target_link_libraries( UNRES_WHAM_BIN xdrf )
245 #=========================================
247 #=========================================
248 install(TARGETS UNRES_WHAM_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/wham)
251 #=========================================
253 #=========================================
255 # MESSAGE (STATUS "${MPI_Fortran_LIBRARIES}")
256 if ("${MPI_Fortran_LIBRARIES}" MATCHES "lam")
257 MESSAGE (STATUS "LAM MPI library detected")
258 set (boot_lam "-boot")
268 set (mpiexec "mpirun")
271 set (mpiexec "mpiexec")
275 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/wham_mpi_E0LL2Y.sh
279 #-----------------------------------------------------------------------------
280 WHAM_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_WHAM_BIN}
281 #-----------------------------------------------------------------------------
282 DD=${CMAKE_SOURCE_DIR}/PARAM
283 export BONDPAR=$DD/bond_AM1.parm
284 export THETPAR=$DD/theta_abinitio.parm
285 export ROTPAR=$DD/rotamers_AM1_aura.10022007.parm
286 export TORPAR=$DD/torsion_631Gdp.parm
287 export TORDPAR=$DD/torsion_double_631Gdp.parm
288 export ELEPAR=$DD/electr_631Gdp.parm
289 export SIDEPAR=$DD/scinter_$POT.parm
290 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
291 export SCPPAR=$DD/scp.parm
292 export SCCORPAR=$DD/sccor_am1_pawel.dat
293 export THETPARPDB=$DD/thetaml.5parm
294 export ROTPARPDB=$DD/scgauss.parm
295 export PATTERN=$DD/patterns.cart
297 export SIDEP=$DD/contact.3.parm
299 #-----------------------------------------------------------------------------
300 echo CTEST_FULL_OUTPUT
301 ${mpiexec} ${boot_lam} ${np} $2 $WHAM_BIN
306 # File permissions workaround
308 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/wham_mpi_E0LL2Y.sh
309 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
310 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
313 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/wham_check.sh
314 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
315 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
318 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_wham.inp
319 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
321 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_remd_MD000.cx
322 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
324 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y.pdb
325 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
328 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/dfa
329 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
331 FILE(COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/wham_mpi_E0LL2Y.sh
332 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/dfa
333 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
341 if(UNRES_MD_FF STREQUAL "E0LL2Y")
342 add_test(NAME WHAM_remd COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/wham_mpi_E0LL2Y.sh 1L2Y_wham 2 )
344 add_test(NAME WHAM_remd_dfa COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/dfa/wham_mpi_E0LL2Y.sh dfa_wham 2 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dfa )
348 endif(UNRES_MD_FF STREQUAL "E0LL2Y")