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
68 set(UNRES_CSA_SRC3 energy_p_new_barrier.F gradient_p.F )
77 energy_p_new_barrier.F
102 #================================================
103 # Set comipiler flags for different sourcefiles
104 #================================================
105 if (Fortran_COMPILER_NAME STREQUAL "ifort")
106 set(FFLAGS0 "-c -ip -w" )
107 set(FFLAGS1 "-c -w -g -d2 -CA -CB" )
108 set(FFLAGS2 "-c -w -g -00 ")
109 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
110 set(FFLAGS3 "-c -w -ipo " )
111 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
112 set(FFLAGS0 "-std=legacy -cpp -c -I. ")
113 set(FFLAGS1 "-std=legacy -cpp -c -g -I. " )
114 set(FFLAGS2 "-std=legacy -cpp -c -I. ")
115 set(FFLAGS3 "-cpp -c -I. " )
116 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
119 # Add MPI compiler flags
121 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
122 set(FFLAGS1 "${FFLAGS1} -I${MPIF_INCLUDE_DIRECTORIES}")
123 set(FFLAGS2 "${FFLAGS2} -I${MPIF_INCLUDE_DIRECTORIES}")
124 set(FFLAGS3 "${FFLAGS3} -I${MPIF_INCLUDE_DIRECTORIES}")
125 endif(UNRES_WITH_MPI)
127 set_property(SOURCE ${UNRES_CSA_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
128 set_property(SOURCE ${UNRES_CSA_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
129 set_property(SOURCE ${UNRES_CSA_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
130 set_property(SOURCE ${UNRES_CSA_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
132 #=========================================
133 # Settings for CSA force fields
134 #=========================================
136 if(UNRES_CSA_FF STREQUAL "CASP3" )
137 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_TOR -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DMOMENT" )
138 elseif(UNRES_CSA_FF STREQUAL "ALPHA")
139 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
140 elseif(UNRES_CSA_FF STREQUAL "BETA")
141 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
142 elseif(UNRES_CSA_FF STREQUAL "ALPHABETA")
143 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DMOMENT -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
144 elseif(UNRES_CSA_FF STREQUAL "CASP5")
145 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
146 elseif(UNRES_CSA_FF STREQUAL "3P")
147 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
148 elseif(UNRES_CSA_FF STREQUAL "4P")
149 set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
150 endif(UNRES_CSA_FF STREQUAL "CASP3")
152 #=========================================
153 # System specific flags
154 #=========================================
155 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
156 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
157 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
159 #=========================================
160 # Compiler specific flags
161 #=========================================
163 if (Fortran_COMPILER_NAME STREQUAL "ifort")
164 # Add ifort preprocessor flags
165 set(CPPFLAGS "${CPPFLAGS} -DPGI")
166 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
167 # Add new gfortran flags
168 set(CPPFLAGS "${CPPFLAGS} -DG77")
169 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
170 # Add old gfortran flags
171 set(CPPFLAGS "${CPPFLAGS} -DG77")
172 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
174 #=========================================
175 # Add MPI preprocessor flags
176 #=========================================
177 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
179 # Apply preprocesor flags to *.F files
180 set_property(SOURCE ${UNRES_CSA_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
183 #========================================
184 # Setting binary name
185 #========================================
186 set(UNRES_BIN "unresCSA_${Fortran_COMPILER_NAME}_${UNRES_CSA_FF}.exe")
188 #=========================================
189 # cinfo.f workaround for CMake
190 #=========================================
191 # get the current date
195 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
197 "C CMake generated file
199 include 'COMMON.IOUNITS'
200 write(iout,*)'++++ Compile info ++++'
201 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
204 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
205 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
206 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
207 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
208 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
209 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
210 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
213 " write(iout,*)'++++ End of compile info ++++'
218 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
220 #=========================================
221 # Set full unres CSA sources
222 #=========================================
223 set(UNRES_CSA_SRCS ${UNRES_CSA_SRC0} ${UNRES_CSA_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
225 #=========================================
227 #=========================================
228 add_executable(UNRES_BIN-CSA ${UNRES_CSA_SRCS} )
229 set_target_properties(UNRES_BIN-CSA PROPERTIES OUTPUT_NAME ${UNRES_BIN})
231 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
232 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
234 #=========================================
236 #=========================================
237 # link MPI library (libmpich.a)
238 target_link_libraries( UNRES_BIN-CSA ${MPIF_LIBRARIES} )
240 #target_link_libraries( ${UNRES_BIN} xdrf )
242 #=========================================
244 #=========================================
246 #-- Copy all the data files from the test directory into the source directory
247 #SET(UNRES_TEST_FILES
251 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
252 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
253 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
254 # ADD_CUSTOM_COMMAND (
255 # TARGET ${UNRES_BIN}
257 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
259 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
261 #=========================================
262 # Generate data test files
263 #=========================================
265 #=========================================
267 #FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
271 #-----------------------------------------------------------------------------
272 #UNRES_BIN=./${UNRES_BIN}
273 #-----------------------------------------------------------------------------
274 #DD=${CMAKE_SOURCE_DIR}/PARAM
275 #export BONDPAR=$DD/bond.parm
276 #export THETPAR=$DD/thetaml.5parm
277 #export ROTPAR=$DD/scgauss.parm
278 #export TORPAR=$DD/torsion_631Gdp.parm
279 #export TORDPAR=$DD/torsion_double_631Gdp.parm
280 #export ELEPAR=$DD/electr_631Gdp.parm
281 #export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
282 #export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
283 #export SCPPAR=$DD/scp.parm
284 #export SCCORPAR=$DD/rotcorr_AM1.parm
285 #export PATTERN=$DD/patterns.cart
286 #-----------------------------------------------------------------------------
290 #=========================================
292 #=========================================
294 #file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
296 #SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
297 #nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
298 #reset_moment=1000 reset_vel=1000 MDPDB
299 #WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
300 #WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
301 #WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
302 #WVDWPP=0.11371 WHPB=1.00000 &
303 #CUTOFF=7.00000 WCORR4=0.00000
308 # 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
310 # 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
312 # 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
314 # -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
315 # -120.0000 -120.0000
321 #if(NOT UNRES_WITH_MPI)
323 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
325 #endif(NOT UNRES_WITH_MPI)