2 # CMake project file for cluster analysis from WHAM for oligomeric proteins
5 enable_language (Fortran C)
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CLUSTER_WHAM_M_SRC0
47 set(UNRES_CLUSTER_WHAM_M_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 "-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_M_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")
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_M_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
140 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )
142 #========================================
143 # Setting binary name
144 #========================================
145 set(UNRES_CLUSTER_WHAM_M_BIN "cluster_wham-mult_${Fortran_COMPILER_NAME}_MPI_${UNRES_MD_FF}.exe")
147 #=========================================
148 # cinfo.f workaround for CMake
149 #=========================================
150 # get the current date
154 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
156 "C CMake generated file
158 include 'COMMON.IOUNITS'
159 write(iout,*)'++++ Compile info ++++'
160 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
163 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
164 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
165 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
166 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
167 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
168 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
169 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
172 " write(iout,*)'++++ End of compile info ++++'
177 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
180 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )
183 #=========================================
184 # Set full unres CLUSTER sources
185 #=========================================
186 set(UNRES_CLUSTER_WHAM_M_SRCS ${UNRES_CLUSTER_WHAM_M_SRC0} proc_proc.c)
188 #=========================================
190 #=========================================
191 add_executable(UNRES_CLUSTER_WHAM_M_BIN ${UNRES_CLUSTER_WHAM_M_SRCS} )
192 set_target_properties(UNRES_CLUSTER_WHAM_M_BIN PROPERTIES OUTPUT_NAME ${UNRES_CLUSTER_WHAM_M_BIN})
193 set_property(TARGET UNRES_CLUSTER_WHAM_M_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
195 #=========================================
197 #=========================================
200 target_link_libraries( UNRES_CLUSTER_WHAM_M_BIN ${MPI_Fortran_LIBRARIES} )
201 endif(UNRES_WITH_MPI)
203 target_link_libraries( UNRES_CLUSTER_WHAM_M_BIN xdrf )
206 #=========================================
208 #=========================================
209 install(TARGETS UNRES_CLUSTER_WHAM_M_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/cluster)
212 #=========================================
214 #=========================================
216 # MESSAGE (STATUS "${MPI_Fortran_LIBRARIES}")
217 if ("${MPI_Fortran_LIBRARIES}" MATCHES "lam")
218 MESSAGE (STATUS "LAM MPI library detected")
219 set (boot_lam "-boot")
229 set (mpiexec "mpirun")
232 set (mpiexec "mpiexec")
236 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scripts/cluster_wham_mpi_E0LL2Y.sh
240 export INTIN=1L2Y_wham
241 export OUTPUT=1L2Y_clust
244 export PRINTCOOR=PRINT_PDB
245 #-----------------------------------------------------------------------------
246 CLUSTER_WHAM_BIN=${CMAKE_BINARY_DIR}/bin/${UNRES_CLUSTER_WHAM_M_BIN}
247 #-----------------------------------------------------------------------------
248 DD=${CMAKE_SOURCE_DIR}/PARAM
249 export BONDPAR=$DD/bond_AM1.parm
250 export THETPAR=$DD/theta_abinitio.parm
251 export ROTPAR=$DD/rotamers_AM1_aura.10022007.parm
252 export TORPAR=$DD/torsion_631Gdp.parm
253 export TORDPAR=$DD/torsion_double_631Gdp.parm
254 export ELEPAR=$DD/electr_631Gdp.parm
255 export SIDEPAR=$DD/scinter_$POT.parm
256 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
257 export SCPPAR=$DD/scp.parm
258 export SCCORPAR=$DD/sccor_am1_pawel.dat
259 export THETPARPDB=$DD/thetaml.5parm
260 export ROTPARPDB=$DD/scgauss.parm
261 export PATTERN=$DD/patterns.cart
263 export SIDEP=$DD/contact.3.parm
265 #-----------------------------------------------------------------------------
266 echo CTEST_FULL_OUTPUT
267 ${mpiexec} ${boot_lam} ${np} $2 $CLUSTER_WHAM_BIN
268 ./cluster_wham_check.sh $1
272 # File permissions workaround
274 FILE( COPY ${CMAKE_CURRENT_BINARY_DIR}/scripts/cluster_wham_mpi_E0LL2Y.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/cluster_wham_check.sh
280 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
281 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
284 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_clust.inp
285 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
287 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_wham.cx
288 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
290 FILE(COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y.pdb
291 DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
294 if(UNRES_MD_FF STREQUAL "E0LL2Y")
295 # add_test(NAME CLUSTER_WHAM_M_remd COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/cluster_wham_mpi_E0LL2Y.sh 1L2Y_clust 2 )
296 endif(UNRES_MD_FF STREQUAL "E0LL2Y")