2 # CMake project file for WHAM single chain version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
91 #================================================
92 # Set comipiler flags for different sourcefiles
93 #================================================
94 if (Fortran_COMPILER_NAME STREQUAL "ifort")
95 set(FFLAGS0 "-mcmodel=medium -g -CB -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
96 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
97 set(FFLAGS0 "-g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
98 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
101 #=========================================
102 # Add MPI compiler flags
103 #=========================================
105 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
106 endif(UNRES_WITH_MPI)
108 set_property(SOURCE ${UNRES_WHAM_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
110 #=========================================
111 # WHAM preprocesor flags
112 #=========================================
114 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
116 #=========================================
117 # System specific flags
118 #=========================================
119 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
120 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
121 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
123 #=========================================
124 # Compiler specific flags
125 #=========================================
127 if (Fortran_COMPILER_NAME STREQUAL "ifort")
128 # Add ifort preprocessor flags
129 set(CPPFLAGS "${CPPFLAGS} -DPGI")
130 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
131 # Add new gfortran flags
132 set(CPPFLAGS "${CPPFLAGS} -DG77")
133 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
134 # Add old gfortran flags
135 set(CPPFLAGS "${CPPFLAGS} -DG77")
136 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
138 #=========================================
139 # Add MPI preprocessor flags
140 #=========================================
141 set(CPPFLAGS "${CPPFLAGS} -DMPI")
143 #=========================================
144 # Add 64-bit specific preprocessor flags
145 #=========================================
146 if (architektura STREQUAL "64")
147 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
148 endif (architektura STREQUAL "64")
150 #=========================================
151 # Apply preprocesor flags to *.F files
152 #=========================================
153 set_property(SOURCE ${UNRES_WHAM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
156 #========================================
157 # Setting binary name
158 #========================================
159 set(UNRES_WHAM_BIN "wham_${Fortran_COMPILER_NAME}.exe")
161 #=========================================
162 # cinfo.f stupid workaround for cmake
164 #=========================================
165 set_property(SOURCE compinfo.c PROPERTY CMAKE_C_FLAGS "-c" )
166 add_executable(compinfo-wham compinfo.c)
167 set_target_properties(compinfo-wham PROPERTIES OUTPUT_NAME compinfo)
169 set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
170 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
171 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
172 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/COMMON.IOUNITS ${CMAKE_CURRENT_BINARY_DIR}/COMMON.IOUNITS
173 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/compinfo | true
174 DEPENDS compinfo-wham )
175 set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0} )
177 #=========================================
178 # Set full unres CSA sources
179 #=========================================
180 set(UNRES_WHAM_SRCS ${UNRES_WHAM_SRC0} ${UNRES_CINFO_DIR}/cinfo.f proc_proc.c)
182 #=========================================
184 #=========================================
185 add_executable(UNRES_WHAM_BIN ${UNRES_WHAM_SRCS} )
186 set_target_properties(UNRES_WHAM_BIN PROPERTIES OUTPUT_NAME ${UNRES_WHAM_BIN})
188 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
189 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
191 #=========================================
193 #=========================================
194 # link MPI library (libmpich.a)
195 target_link_libraries( UNRES_WHAM_BIN ${MPIF_LIBRARIES} )
197 target_link_libraries( UNRES_WHAM_BIN xdrf )
199 #=========================================
201 #=========================================
203 #-- Copy all the data files from the test directory into the source directory
204 #SET(UNRES_TEST_FILES
208 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
209 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
210 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
211 # ADD_CUSTOM_COMMAND (
212 # TARGET ${UNRES_BIN}
214 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
216 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
218 #=========================================
219 # Generate data test files
220 #=========================================
222 #=========================================
224 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
228 #-----------------------------------------------------------------------------
229 #UNRES_BIN=./${UNRES_BIN}
230 #-----------------------------------------------------------------------------
231 #DD=${CMAKE_SOURCE_DIR}/PARAM
232 #export BONDPAR=$DD/bond.parm
233 #export THETPAR=$DD/thetaml.5parm
234 #export ROTPAR=$DD/scgauss.parm
235 #export TORPAR=$DD/torsion_631Gdp.parm
236 #export TORDPAR=$DD/torsion_double_631Gdp.parm
237 #export ELEPAR=$DD/electr_631Gdp.parm
238 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
239 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
240 #export SCPPAR=$DD/scp.parm
241 #export SCCORPAR=$DD/rotcorr_AM1.parm
242 #export PATTERN=$DD/patterns.cart
243 #-----------------------------------------------------------------------------
247 #=========================================
249 #=========================================
251 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
253 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
254 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
255 #reset_moment=1000 reset_vel=1000 MDPDB
256 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
257 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
258 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
259 #WVDWPP=0.11371 WHPB=1.00000 &
260 #CUTOFF=7.00000 WCORR4=0.00000
265 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
267 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
269 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
271 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
272 # -120.0000 -120.0000
278 #if(NOT UNRES_WITH_MPI)
280 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
282 #endif(NOT UNRES_WITH_MPI)