2 # CMake project file for cluster analysis from WHAM for single-chain proteins
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CLUSTER_WHAM_SRC0
47 set(UNRES_CLUSTER_WHAM_PP_SRC
63 #================================================
64 # Set comipiler flags for different sourcefiles
65 #================================================
66 if (Fortran_COMPILER_NAME STREQUAL "ifort")
67 set(FFLAGS0 "-mcmodel=medium -shared-intel -ip -w -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres " )
68 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
69 set(FFLAGS0 "-std=legacy -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres " )
71 set(FFLAGS0 "-g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
72 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
74 #=========================================
75 # Add MPI compiler flags
76 #=========================================
78 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
81 set_property(SOURCE ${UNRES_CLUSTER_WHAM_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
83 #=========================================
84 # Settings for GAB force field
85 #=========================================
86 if(UNRES_MD_FF STREQUAL "GAB" )
87 # set preprocesor flags
88 set(CPPFLAGS "PROCOR -DSPLITELE -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
90 #=========================================
91 # Settings for E0LL2Y force field
92 #=========================================
93 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
94 # set preprocesor flags
95 set(CPPFLAGS "PROCOR -DSPLITELE -DSCCORPDB" )
96 elseif(UNRES_MD_FF STREQUAL "4P")
97 set(CPPFLAGS "SPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
98 endif(UNRES_MD_FF STREQUAL "GAB")
100 #=========================================
102 #=========================================
103 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN -DCLUST" )
105 #=========================================
106 # Compiler specific flags
107 #=========================================
108 if (Fortran_COMPILER_NAME STREQUAL "ifort")
109 # Add ifort preprocessor flags
110 set(CPPFLAGS "${CPPFLAGS} -DPGI")
111 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
112 # Add new gfortran flags
113 set(CPPFLAGS "${CPPFLAGS} -DG77")
114 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
115 # Add old gfortran flags
116 set(CPPFLAGS "${CPPFLAGS} -DG77")
117 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
120 #=========================================
121 # System specific flags
122 #=========================================
123 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
124 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
125 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
127 #=========================================
128 # Add MPI preprocessor flags
129 #=========================================
131 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
132 endif(UNRES_WITH_MPI)
135 #=========================================
136 # Apply preprocesor flags to *.F files
137 #=========================================
138 set_property(SOURCE ${UNRES_CLUSTER_WHAM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
141 #========================================
142 # Setting binary name
143 #========================================
144 set(UNRES_CLUSTER_WHAM_BIN "cluster_wham_${Fortran_COMPILER_NAME}_MPI_${UNRES_MD_FF}.exe")
146 #=========================================
147 # cinfo.f workaround for CMake
148 #=========================================
149 # get the current date
153 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
155 "C CMake generated file
157 include 'COMMON.IOUNITS'
158 write(iout,*)'++++ Compile info ++++'
159 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
162 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
163 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
164 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
165 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
166 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
167 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
168 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
171 " write(iout,*)'++++ End of compile info ++++'
176 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
179 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )
181 #=========================================
182 # Set full unres CLUSTER sources
183 #=========================================
184 set(UNRES_CLUSTER_WHAM_SRCS ${UNRES_CLUSTER_WHAM_SRC0} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f proc_proc.c)
188 #=========================================
190 #=========================================
191 add_executable(UNRES_CLUSTER_WHAM_BIN ${UNRES_CLUSTER_WHAM_SRCS} )
192 set_target_properties(UNRES_CLUSTER_WHAM_BIN PROPERTIES OUTPUT_NAME ${UNRES_CLUSTER_WHAM_BIN})
193 set_property(TARGET UNRES_CLUSTER_WHAM_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
195 #=========================================
197 #=========================================
200 target_link_libraries( UNRES_CLUSTER_WHAM_BIN ${MPI_Fortran_LIBRARIES} )
201 endif(UNRES_WITH_MPI)
203 target_link_libraries( UNRES_CLUSTER_WHAM_BIN xdrf )
205 #=========================================
207 #=========================================
208 install(TARGETS UNRES_CLUSTER_WHAM_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/cluster)
211 #=========================================
213 #=========================================
215 # MESSAGE (STATUS "${MPI_Fortran_LIBRARIES}")
216 if ("${MPI_Fortran_LIBRARIES}" MATCHES "lam")
217 MESSAGE (STATUS "LAM MPI library detected")
218 set (boot_lam "-boot")
228 set (mpiexec "mpiexec")
231 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/cluster_wham_mpi_E0LL2Y.sh
235 export INTIN=1L2Y_wham
236 export OUTPUT=1L2Y_clust
239 export PRINTCOOR=PRINT_PDB
240 #-----------------------------------------------------------------------------
241 CLUSTER_WHAM_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_CLUSTER_WHAM_BIN}
242 #-----------------------------------------------------------------------------
243 DD=${CMAKE_SOURCE_DIR}/PARAM
244 export BONDPAR=$DD/bond_AM1.parm
245 export THETPAR=$DD/theta_abinitio.parm
246 export ROTPAR=$DD/rotamers_AM1_aura.10022007.parm
247 export TORPAR=$DD/torsion_631Gdp.parm
248 export TORDPAR=$DD/torsion_double_631Gdp.parm
249 export ELEPAR=$DD/electr_631Gdp.parm
250 export SIDEPAR=$DD/scinter_$POT.parm
251 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
252 export SCPPAR=$DD/scp.parm
253 export SCCORPAR=$DD/sccor_am1_pawel.dat
254 export THETPARPDB=$DD/thetaml.5parm
255 export ROTPARPDB=$DD/scgauss.parm
256 export PATTERN=$DD/patterns.cart
258 export SIDEP=$DD/contact.3.parm
260 #-----------------------------------------------------------------------------
261 echo CTEST_FULL_OUTPUT
262 ${mpiexec} ${boot_lam} ${np} $2 $CLUSTER_WHAM_BIN
263 ./cluster_wham_check.sh $1
267 # File permissions workaround
269 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/cluster_wham_mpi_E0LL2Y.sh
270 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
271 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
274 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/cluster_wham_check.sh
275 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
276 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
279 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_clust.inp
280 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
282 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_wham.cx
283 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
285 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y.pdb
286 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
289 if(UNRES_MD_FF STREQUAL "E0LL2Y")
290 add_test(NAME CLUSTER_WHAM_remd COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/cluster_wham_mpi_E0LL2Y.sh 1L2Y_clust 2 )
291 endif(UNRES_MD_FF STREQUAL "E0LL2Y")