2 # CMake project file for UNRES CSA DiL version
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CSA_DiL_SRC0
28 energy_p_new_barrier.F
69 set(UNRES_CSA_DiL_SRC3 energy_p_new_barrier.F gradient_p.F )
71 set(UNRES_CSA_DiL_PP_SRC
78 energy_p_new_barrier.F
103 #================================================
104 # Set comipiler flags for different sourcefiles
105 #================================================
106 if (Fortran_COMPILER_NAME STREQUAL "ifort")
107 set(FFLAGS0 "-c -ip -w" )
108 set(FFLAGS1 "-c -w -g -d2 -CA -CB" )
109 set(FFLAGS2 "-c -w -g -00 ")
110 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
111 set(FFLAGS3 "-c -w -ipo " )
112 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
113 set(FFLAGS0 "-std=legacy -cpp -c -I. ")
114 set(FFLAGS1 "-std=legacy -cpp -c -g -I. " )
115 set(FFLAGS2 "-std=legacy -cpp -c -I. ")
116 set(FFLAGS3 "-std=legacy -cpp -c -I. " )
117 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
120 # Add MPI compiler flags
122 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
123 set(FFLAGS1 "${FFLAGS1} -I${MPI_Fortran_INCLUDE_PATH}")
124 set(FFLAGS2 "${FFLAGS2} -I${MPI_Fortran_INCLUDE_PATH}")
125 set(FFLAGS3 "${FFLAGS3} -I${MPI_Fortran_INCLUDE_PATH}")
126 endif(UNRES_WITH_MPI)
128 set_property(SOURCE ${UNRES_CSA_DiL_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
129 set_property(SOURCE ${UNRES_CSA_DiL_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
130 set_property(SOURCE ${UNRES_CSA_DiL_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
131 set_property(SOURCE ${UNRES_CSA_DiL_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
133 #=========================================
134 # Settings for CSA force fields
135 #=========================================
137 if(UNRES_CSA_FF STREQUAL "CASP3" )
138 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_TOR -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DMOMENT" )
139 elseif(UNRES_CSA_FF STREQUAL "ALPHA")
140 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
141 elseif(UNRES_CSA_FF STREQUAL "BETA")
142 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
143 elseif(UNRES_CSA_FF STREQUAL "ALPHABETA")
144 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
145 elseif(UNRES_CSA_FF STREQUAL "CASP5")
146 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
147 elseif(UNRES_CSA_FF STREQUAL "3P")
148 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
149 elseif(UNRES_CSA_FF STREQUAL "4P")
150 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
151 endif(UNRES_CSA_FF STREQUAL "CASP3")
153 #=========================================
154 # System specific flags
155 #=========================================
156 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
157 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
158 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
160 #=========================================
161 # Compiler specific flags
162 #=========================================
164 if (Fortran_COMPILER_NAME STREQUAL "ifort")
165 # Add ifort preprocessor flags
166 set(CPPFLAGS "${CPPFLAGS} -DPGI")
167 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
168 # Add new gfortran flags
169 set(CPPFLAGS "${CPPFLAGS} -DG77")
170 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
171 # Add old gfortran flags
172 set(CPPFLAGS "${CPPFLAGS} -DG77")
173 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
175 #=========================================
176 # Add MPI preprocessor flags
177 #=========================================
178 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
180 #=========================================
181 # add 64-bit specific preprocessor flags
182 #=========================================
183 if (architektura STREQUAL "64")
184 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
185 endif (architektura STREQUAL "64")
188 #=========================================
189 # Apply preprocesor flags to *.F files
190 #=========================================
191 set_property(SOURCE ${UNRES_CSA_DiL_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
194 #========================================
195 # Setting binary name
196 #========================================
197 set(UNRES_BIN "unresCSA_DiL_${Fortran_COMPILER_NAME}_${UNRES_CSA_FF}.exe")
199 #=========================================
200 # cinfo.f workaround for CMake
201 #=========================================
202 # get the current date
206 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
208 "C CMake generated file
210 include 'COMMON.IOUNITS'
211 write(iout,*)'++++ Compile info ++++'
212 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
215 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
216 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
217 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
218 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
219 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
220 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
221 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
224 " write(iout,*)'++++ End of compile info ++++'
229 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
231 #=========================================
232 # Set full unres CSA sources
233 #=========================================
234 set(UNRES_CSA_DiL_SRCS ${UNRES_CSA_DiL_SRC0} ${UNRES_CSA_DiL_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
236 #=========================================
238 #=========================================
239 add_executable(UNRES_BIN-CSA-DIL ${UNRES_CSA_DiL_SRCS} )
240 set_target_properties(UNRES_BIN-CSA-DIL PROPERTIES OUTPUT_NAME ${UNRES_BIN})
241 set_property(TARGET UNRES_BIN-CSA-DIL PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
243 #=========================================
245 #=========================================
247 target_link_libraries( UNRES_BIN-CSA-DIL ${MPI_Fortran_LIBRARIES} )
249 #=========================================
251 #=========================================
252 install(TARGETS UNRES_BIN-CSA-DIL DESTINATION ${CMAKE_INSTALL_PREFIX})
255 #=========================================
257 #=========================================
259 #-- Copy all the data files from the test directory into the source directory
260 #SET(UNRES_TEST_FILES
264 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
265 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
266 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
267 # ADD_CUSTOM_COMMAND (
268 # TARGET ${UNRES_BIN}
270 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
272 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
274 #=========================================
275 # Generate data test files
276 #=========================================
278 #=========================================
280 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
284 #-----------------------------------------------------------------------------
285 #UNRES_BIN=./${UNRES_BIN}
286 #-----------------------------------------------------------------------------
287 #DD=${CMAKE_SOURCE_DIR}/PARAM
288 #export BONDPAR=$DD/bond.parm
289 #export THETPAR=$DD/thetaml.5parm
290 #export ROTPAR=$DD/scgauss.parm
291 #export TORPAR=$DD/torsion_631Gdp.parm
292 #export TORDPAR=$DD/torsion_double_631Gdp.parm
293 #export ELEPAR=$DD/electr_631Gdp.parm
294 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
295 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
296 #export SCPPAR=$DD/scp.parm
297 #export SCCORPAR=$DD/rotcorr_AM1.parm
298 #export PATTERN=$DD/patterns.cart
299 #-----------------------------------------------------------------------------
303 #=========================================
305 #=========================================
307 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
309 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
310 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
311 #reset_moment=1000 reset_vel=1000 MDPDB
312 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
313 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
314 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
315 #WVDWPP=0.11371 WHPB=1.00000 &
316 #CUTOFF=7.00000 WCORR4=0.00000
321 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
323 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
325 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
327 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
328 # -120.0000 -120.0000
334 #if(NOT UNRES_WITH_MPI)
336 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
338 #endif(NOT UNRES_WITH_MPI)