2 # CMake project file for WHAM multichain version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
67 set(UNRES_WHAM_M_PP_SRC
96 #================================================
97 # Set comipiler flags for different sourcefiles
98 #================================================
99 if (Fortran_COMPILER_NAME STREQUAL "ifort")
100 set(FFLAGS0 "-g -CB -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
101 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
102 set(FFLAGS0 "-std=legacy -g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
104 set(FFLAGS0 "-g -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_M_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
117 #=========================================
118 # Settings for GAB force field
119 #=========================================
120 if(UNRES_MD_FF STREQUAL "GAB" )
121 # set preprocesor flags
122 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 endif(UNRES_MD_FF STREQUAL "GAB")
133 #=========================================
135 #=========================================
136 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN")
138 #=========================================
139 # System specific flags
140 #=========================================
141 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
142 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
143 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
145 #=========================================
146 # Compiler specific flags
147 #=========================================
149 if (Fortran_COMPILER_NAME STREQUAL "ifort")
150 # Add ifort preprocessor flags
151 set(CPPFLAGS "${CPPFLAGS} -DPGI")
152 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
153 # Add new gfortran flags
154 set(CPPFLAGS "${CPPFLAGS} -DG77")
155 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
156 # Add old gfortran flags
157 set(CPPFLAGS "${CPPFLAGS} -DG77")
158 else (Fortran_COMPILER_NAME STREQUAL "ifort")
159 # Default preprocessor flags
160 set(CPPFLAGS "${CPPFLAGS} -DPGI")
161 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
163 #=========================================
164 # Add MPI preprocessor flags
165 #=========================================
166 set(CPPFLAGS "${CPPFLAGS} -DMPI")
168 #=========================================
169 # Add 64-bit specific preprocessor flags
170 #=========================================
171 if (architektura STREQUAL "64")
172 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
173 endif (architektura STREQUAL "64")
175 #=========================================
176 # Apply preprocesor flags to *.F files
177 #=========================================
178 set_property(SOURCE ${UNRES_WHAM_M_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
181 #========================================
182 # Setting binary name
183 #========================================
184 set(UNRES_WHAM_M_BIN "wham_M_${Fortran_COMPILER_NAME}_${UNRES_MD_FF}.exe")
186 #=========================================
187 # cinfo.f workaround for CMake
188 #=========================================
189 # get the current date
193 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
195 "C CMake generated file
197 include 'COMMON.IOUNITS'
198 write(iout,*)'++++ Compile info ++++'
199 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
202 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
203 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
204 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
205 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
206 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
207 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
208 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
211 " write(iout,*)'++++ End of compile info ++++'
216 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
218 #=========================================
219 # Set full unres CSA sources
220 #=========================================
221 set(UNRES_WHAM_M_SRCS ${UNRES_WHAM_M_SRC0} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f proc_proc.c)
223 #=========================================
225 #=========================================
226 add_executable(UNRES_WHAM_M_BIN ${UNRES_WHAM_M_SRCS} )
227 set_target_properties(UNRES_WHAM_M_BIN PROPERTIES OUTPUT_NAME ${UNRES_WHAM_M_BIN})
228 set_property(TARGET UNRES_WHAM_M_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
229 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
231 #=========================================
233 #=========================================
234 # link MPI library (libmpich.a)
235 target_link_libraries( UNRES_WHAM_M_BIN ${MPI_Fortran_LIBRARIES} )
237 target_link_libraries( UNRES_WHAM_M_BIN xdrf )
240 #=========================================
242 #=========================================
243 install(TARGETS UNRES_WHAM_M_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/wham)
246 #=========================================
248 #=========================================
250 #-- Copy all the data files from the test directory into the source directory
251 #SET(UNRES_TEST_FILES
255 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
256 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
257 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
258 # ADD_CUSTOM_COMMAND (
259 # TARGET ${UNRES_BIN}
261 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
263 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
265 #=========================================
266 # Generate data test files
267 #=========================================
269 #=========================================
271 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
275 #-----------------------------------------------------------------------------
276 #UNRES_BIN=./${UNRES_BIN}
277 #-----------------------------------------------------------------------------
278 #DD=${CMAKE_SOURCE_DIR}/PARAM
279 #export BONDPAR=$DD/bond.parm
280 #export THETPAR=$DD/thetaml.5parm
281 #export ROTPAR=$DD/scgauss.parm
282 #export TORPAR=$DD/torsion_631Gdp.parm
283 #export TORDPAR=$DD/torsion_double_631Gdp.parm
284 #export ELEPAR=$DD/electr_631Gdp.parm
285 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
286 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
287 #export SCPPAR=$DD/scp.parm
288 #export SCCORPAR=$DD/rotcorr_AM1.parm
289 #export PATTERN=$DD/patterns.cart
290 #-----------------------------------------------------------------------------
294 #=========================================
296 #=========================================
298 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
300 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
301 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
302 #reset_moment=1000 reset_vel=1000 MDPDB
303 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
304 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
305 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
306 #WVDWPP=0.11371 WHPB=1.00000 &
307 #CUTOFF=7.00000 WCORR4=0.00000
312 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
314 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
316 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
318 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
319 # -120.0000 -120.0000
325 #if(NOT UNRES_WITH_MPI)
327 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
329 #endif(NOT UNRES_WITH_MPI)