2 # CMake project file for UNRES CSA version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
28 energy_p_new_barrier.F
69 set(UNRES_CSA_SRC3 energy_p_new_barrier.F gradient_p.F )
79 energy_p_new_barrier.F
104 #================================================
105 # Set comipiler flags for different sourcefiles
106 #================================================
107 if (Fortran_COMPILER_NAME STREQUAL "ifort")
108 set(FFLAGS0 "-c -ip -w" )
109 set(FFLAGS1 "-c -w -g -d2 -CA -CB" )
110 set(FFLAGS2 "-c -w -g -00 ")
111 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
112 set(FFLAGS3 "-c -w -ipo " )
113 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
114 set(FFLAGS0 "-std=legacy -cpp -c -I. ")
115 set(FFLAGS1 "-std=legacy -cpp -c -g -I. " )
116 set(FFLAGS2 "-std=legacy -cpp -c -I. ")
117 set(FFLAGS3 "-cpp -c -I. " )
118 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
121 # Add MPI compiler flags
123 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
124 set(FFLAGS1 "${FFLAGS1} -I${MPI_Fortran_INCLUDE_PATH}")
125 set(FFLAGS2 "${FFLAGS2} -I${MPI_Fortran_INCLUDE_PATH}")
126 set(FFLAGS3 "${FFLAGS3} -I${MPI_Fortran_INCLUDE_PATH}")
127 endif(UNRES_WITH_MPI)
129 set_property(SOURCE ${UNRES_CSA_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
130 set_property(SOURCE ${UNRES_CSA_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
131 set_property(SOURCE ${UNRES_CSA_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
132 set_property(SOURCE ${UNRES_CSA_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
134 #=========================================
135 # Settings for CSA force fields
136 #=========================================
138 if(UNRES_CSA_FF STREQUAL "CASP3" )
139 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DCRYST_TOR" )
140 elseif(UNRES_CSA_FF STREQUAL "ALPHA")
141 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
142 elseif(UNRES_CSA_FF STREQUAL "BETA")
143 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
144 elseif(UNRES_CSA_FF STREQUAL "ALPHABETA")
145 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
146 elseif(UNRES_CSA_FF STREQUAL "CASP5")
147 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
148 elseif(UNRES_CSA_FF STREQUAL "3P")
149 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
150 elseif(UNRES_CSA_FF STREQUAL "4P")
151 set(CPPFLAGS "UNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
152 endif(UNRES_CSA_FF STREQUAL "CASP3")
154 #=========================================
155 # System specific flags
156 #=========================================
157 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
158 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
159 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
161 #=========================================
162 # Compiler specific flags
163 #=========================================
165 if (Fortran_COMPILER_NAME STREQUAL "ifort")
166 # Add ifort preprocessor flags
167 set(CPPFLAGS "${CPPFLAGS} -DPGI")
168 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
169 # Add new gfortran flags
170 set(CPPFLAGS "${CPPFLAGS} -DG77")
171 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
172 # Add old gfortran flags
173 set(CPPFLAGS "${CPPFLAGS} -DG77")
174 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
176 #=========================================
177 # Add MPI preprocessor flags
178 #=========================================
179 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
181 #=========================================
182 # add 64-bit specific preprocessor flags
183 #=========================================
184 if (architektura STREQUAL "64")
185 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
186 endif (architektura STREQUAL "64")
188 # Apply preprocesor flags to *.F files
189 set_property(SOURCE ${UNRES_CSA_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
192 #========================================
193 # Setting binary name
194 #========================================
195 set(UNRES_BIN "unresCSA_${Fortran_COMPILER_NAME}_${UNRES_CSA_FF}.exe")
197 #=========================================
198 # cinfo.f workaround for CMake
199 #=========================================
200 # get the current date
204 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
206 "C CMake generated file
208 include 'COMMON.IOUNITS'
209 write(iout,*)'++++ Compile info ++++'
210 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
213 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
214 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
215 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
216 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
217 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
218 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
219 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
222 " write(iout,*)'++++ End of compile info ++++'
227 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
229 #=========================================
230 # Set full unres CSA sources
231 #=========================================
232 set(UNRES_CSA_SRCS ${UNRES_CSA_SRC0} ${UNRES_CSA_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
234 #=========================================
236 #=========================================
237 add_executable(UNRES_BIN-CSA ${UNRES_CSA_SRCS} )
238 set_target_properties(UNRES_BIN-CSA PROPERTIES OUTPUT_NAME ${UNRES_BIN})
239 set_property(TARGET UNRES_BIN-CSA PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
240 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
242 #=========================================
244 #=========================================
245 # link MPI library (libmpich.a)
246 target_link_libraries( UNRES_BIN-CSA ${MPI_Fortran_LIBRARIES} )
248 #target_link_libraries( ${UNRES_BIN} xdrf )
250 #=========================================
252 #=========================================
253 install(TARGETS UNRES_BIN-CSA DESTINATION ${CMAKE_INSTALL_PREFIX}/unres/CSA)
256 #=========================================
258 #=========================================
260 #-- Copy all the data files from the test directory into the source directory
261 #SET(UNRES_TEST_FILES
265 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
266 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
267 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
268 # ADD_CUSTOM_COMMAND (
269 # TARGET ${UNRES_BIN}
271 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
273 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
275 #=========================================
276 # Generate data test files
277 #=========================================
279 #=========================================
281 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
285 #-----------------------------------------------------------------------------
286 #UNRES_BIN=./${UNRES_BIN}
287 #-----------------------------------------------------------------------------
288 #DD=${CMAKE_SOURCE_DIR}/PARAM
289 #export BONDPAR=$DD/bond.parm
290 #export THETPAR=$DD/thetaml.5parm
291 #export ROTPAR=$DD/scgauss.parm
292 #export TORPAR=$DD/torsion_631Gdp.parm
293 #export TORDPAR=$DD/torsion_double_631Gdp.parm
294 #export ELEPAR=$DD/electr_631Gdp.parm
295 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
296 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
297 #export SCPPAR=$DD/scp.parm
298 #export SCCORPAR=$DD/rotcorr_AM1.parm
299 #export PATTERN=$DD/patterns.cart
300 #-----------------------------------------------------------------------------
304 #=========================================
306 #=========================================
308 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
310 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
311 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
312 #reset_moment=1000 reset_vel=1000 MDPDB
313 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
314 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
315 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
316 #WVDWPP=0.11371 WHPB=1.00000 &
317 #CUTOFF=7.00000 WCORR4=0.00000
322 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
324 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
326 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
328 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
329 # -120.0000 -120.0000
335 #if(NOT UNRES_WITH_MPI)
337 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
339 #endif(NOT UNRES_WITH_MPI)