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 -g -CB -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
99 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
100 set(FFLAGS0 "-std=legacy -g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
102 set(FFLAGS0 "-g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
103 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
106 #=========================================
107 # Add MPI compiler flags
108 #=========================================
110 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
111 endif(UNRES_WITH_MPI)
113 set_property(SOURCE ${UNRES_WHAM_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
115 #=========================================
116 # Settings for GAB force field
117 #=========================================
119 if(UNRES_MD_FF STREQUAL "GAB" )
120 # set preprocesor flags
121 set(CPPFLAGS "PROCOR -DSPLITELE -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
123 #=========================================
124 # Settings for E0LL2Y force field
125 #=========================================
126 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
127 # set preprocesor flags
128 set(CPPFLAGS "PROCOR -DSPLITELE -DSCCORPDB" )
129 endif(UNRES_MD_FF STREQUAL "GAB")
132 #=========================================
134 #=========================================
135 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN -DWHAM ")
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 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
160 #=========================================
161 # Add MPI preprocessor flags
162 #=========================================
163 set(CPPFLAGS "${CPPFLAGS} -DMPI")
165 #=========================================
166 # Add 64-bit specific preprocessor flags
167 #=========================================
168 if (architektura STREQUAL "64")
169 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
170 endif (architektura STREQUAL "64")
172 #=========================================
173 # Apply preprocesor flags to *.F files
174 #=========================================
175 set_property(SOURCE ${UNRES_WHAM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
178 #========================================
179 # Setting binary name
180 #========================================
181 set(UNRES_WHAM_BIN "wham_${Fortran_COMPILER_NAME}.exe")
183 #=========================================
184 # cinfo.f workaround for CMake
185 #=========================================
186 # get the current date
190 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
192 "C CMake generated file
194 include 'COMMON.IOUNITS'
195 write(iout,*)'++++ Compile info ++++'
196 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
199 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
200 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
201 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
202 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
203 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
204 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
205 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
208 " write(iout,*)'++++ End of compile info ++++'
213 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
215 #=========================================
216 # Set full unres CSA sources
217 #=========================================
218 set(UNRES_WHAM_SRCS ${UNRES_WHAM_SRC0} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f proc_proc.c)
220 #=========================================
222 #=========================================
223 add_executable(UNRES_WHAM_BIN ${UNRES_WHAM_SRCS} )
224 set_target_properties(UNRES_WHAM_BIN PROPERTIES OUTPUT_NAME ${UNRES_WHAM_BIN})
226 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
227 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
229 #=========================================
231 #=========================================
232 # link MPI library (libmpich.a)
233 target_link_libraries( UNRES_WHAM_BIN ${MPIF_LIBRARIES} )
235 target_link_libraries( UNRES_WHAM_BIN xdrf )
237 #=========================================
239 #=========================================
241 #-- Copy all the data files from the test directory into the source directory
242 #SET(UNRES_TEST_FILES
246 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
247 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
248 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
249 # ADD_CUSTOM_COMMAND (
250 # TARGET ${UNRES_BIN}
252 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
254 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
256 #=========================================
257 # Generate data test files
258 #=========================================
260 #=========================================
262 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
266 #-----------------------------------------------------------------------------
267 #UNRES_BIN=./${UNRES_BIN}
268 #-----------------------------------------------------------------------------
269 #DD=${CMAKE_SOURCE_DIR}/PARAM
270 #export BONDPAR=$DD/bond.parm
271 #export THETPAR=$DD/thetaml.5parm
272 #export ROTPAR=$DD/scgauss.parm
273 #export TORPAR=$DD/torsion_631Gdp.parm
274 #export TORDPAR=$DD/torsion_double_631Gdp.parm
275 #export ELEPAR=$DD/electr_631Gdp.parm
276 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
277 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
278 #export SCPPAR=$DD/scp.parm
279 #export SCCORPAR=$DD/rotcorr_AM1.parm
280 #export PATTERN=$DD/patterns.cart
281 #-----------------------------------------------------------------------------
285 #=========================================
287 #=========================================
289 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
291 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
292 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
293 #reset_moment=1000 reset_vel=1000 MDPDB
294 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
295 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
296 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
297 #WVDWPP=0.11371 WHPB=1.00000 &
298 #CUTOFF=7.00000 WCORR4=0.00000
303 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
305 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
307 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
309 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
310 # -120.0000 -120.0000
316 #if(NOT UNRES_WITH_MPI)
318 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
320 #endif(NOT UNRES_WITH_MPI)