2 # CMake project file for UNRES with MD for single chains
5 enable_language (Fortran)
7 #================================
8 # build the xdrf library
9 #================================
10 add_subdirectory(xdrf)
12 #================================
13 # Set source file lists
14 #================================
15 set(UNRES_MD_SRC0 unres.F arcos.f cartprint.f chainbuild.F convert.f
16 initialize_p.F matmult.f readrtns.F parmread.F gen_rand_conf.F
17 printmat.f map.f pinorm.f randgens.f rescode.f intcor.f timing.F
18 misc.f intlocal.f cartder.F checkder_p.F econstr_local.F
19 minimize_p.F sumsld.f cored.f rmdd.f geomout.F readpdb.F regularize.F
20 thread.F fitsq.f mcm.F mc.F bond_move.f refsys.f check_sc_distr.f
21 check_bond.f contact.f djacob.f eigen.f blas.f add.f entmcm.F
22 minim_mcmf.F MP.F compare_s1.F prng_32.F banach.f rmsd.F elecont.f dihed_cons.F sc_move.F
23 local_move.f intcartderiv.F lagrangian_lesyng.F stochfric.F kinetic_lesyng.f MD_A-MTS.F moments.f
24 int_to_cart.f surfatom.f sort.f muca_md.f MREMD.F rattle.F gauss.f energy_split-sep.F
25 q_measure.F gnmr1.f test.F )
27 set(UNRES_MD_SRC3 energy_p_new_barrier.F energy_p_new-sep_barrier.F gradient_p.F )
29 set(UNRES_MD_PP_SRC cartder.F chainbuild.F checkder_p.F compare_s1.F dihed_cons.F econstr_local.F
30 energy_p_new_barrier.F energy_p_new-sep_barrier.F energy_split-sep.F entmcm.F gen_rand_conf.F
31 geomout.F gradient_p.F initialize_p.F intcartderiv.F lagrangian_lesyng.F mc.F mcm.F MD_A-MTS.F
32 minimize_p.F minim_mcmf.F MP.F MREMD.F parmread.F prng_32.F q_measure1.F q_measure3.F q_measure.F
33 rattle.F readpdb.F readrtns.F regularize.F rmsd.F sc_move.F stochfric.F test.F thread.F timing.F
37 #================================================
38 # Set comipiler flags for different sourcefiles
39 #================================================
40 if (Fortran_COMPILER_NAME STREQUAL "ifort")
41 set(FFLAGS0 "-c -ip -w" )
42 set(FFLAGS1 "-c -w -g -d2 -CA -CB" )
43 set(FFLAGS2 "-c -w -g -00 ")
44 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
45 set(FFLAGS3 "-c -w -ipo " )
46 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
47 set(FFLAGS0 "-c -I. " )
48 set(FFLAGS1 "-c -g -I. " )
49 set(FFLAGS2 "-c -I. ")
50 #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
51 set(FFLAGS3 "-c -I. " )
52 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
55 # Add MPI compiler flags
57 set(FFLAGS0 "${FFLAGS0} -I${MPIF_INCLUDE_DIRECTORIES}")
58 set(FFLAGS1 "${FFLAGS1} -I${MPIF_INCLUDE_DIRECTORIES}")
59 set(FFLAGS2 "${FFLAGS2} -I${MPIF_INCLUDE_DIRECTORIES}")
60 set(FFLAGS3 "${FFLAGS3} -I${MPIF_INCLUDE_DIRECTORIES}")
63 set_property(SOURCE ${UNRES_MD_SRC0} APPEND PROPERTY COMPILE_FLAGS ${FFLAGS0} )
64 #set_property(SOURCE ${UNRES_MD_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
65 #set_property(SOURCE ${UNRES_MD_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
66 set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
68 #=========================================
69 # Settings for GAB force field
70 #=========================================
71 if(UNRES_FF STREQUAL "GAB" )
72 # set preprocesor flags
73 set(CPPFLAGS "PROCOR -DLINUX -DUNRES -DISNAN -DSPLITELE -DLANGO -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
75 if (Fortran_COMPILER_NAME STREQUAL "ifort")
76 # Add ifort preprocessor flags
77 set(CPPFLAGS "${CPPFLAGS} -DPGI")
78 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
80 set(CPPFLAGS "${CPPFLAGS} -DG77")
81 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
83 set(CPPFLAGS "${CPPFLAGS} -DG77")
84 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
86 #=========================================
87 # Settings for E0LL2Y force field
88 #=========================================
89 elseif(UNRES_FF STREQUAL "E0LL2Y")
90 # set preprocesor flags
91 set(CPPFLAGS "PROCOR -DLINUX -DUNRES -DISNAN -DSPLITELE -DLANG0" )
93 if (Fortran_COMPILER_NAME STREQUAL "ifort")
94 # Add ifort preprocessor flags
95 set(CPPFLAGS "${CPPFLAGS} -DPGI")
96 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
98 endif(UNRES_FF STREQUAL "GAB")
100 # Add MPI preprocessor flags
102 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
103 endif(UNRES_WITH_MPI)
105 # Apply preprocesor flags to *.F files
106 set_property(SOURCE ${UNRES_MD_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
109 #========================================
110 # Setting binary name
111 #========================================
114 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_MPICH_${UNRES_FF}.exe")
117 set(UNRES_BIN "unres_${Fortran_COMPILER_NAME}_single_${UNRES_FF}.exe")
118 endif(UNRES_WITH_MPI)
120 #=========================================
121 # cinfo.f stupid workaround for cmake
123 #=========================================
124 set_property(SOURCE compinfo.c PROPERTY CMAKE_C_FLAGS "-c" )
125 add_executable(compinfo compinfo.c)
126 set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
127 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
128 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
129 COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/COMMON.IOUNITS ${CMAKE_CURRENT_BINARY_DIR}/COMMON.IOUNITS
130 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/compinfo | true
131 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f )
132 set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0} )
134 #=========================================
135 # Set full unres MD sources
136 #=========================================
137 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${UNRES_CINFO_DIR}/cinfo.f )
141 #=========================================
143 #=========================================
144 add_executable(${UNRES_BIN} ${UNRES_MD_SRCS} )
145 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
146 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
148 #=========================================
150 #=========================================
151 # link MPI library (libmpich.a)
153 target_link_libraries( ${UNRES_BIN} ${MPIF_LIBRARIES} )
154 endif(UNRES_WITH_MPI)
156 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
157 target_link_libraries( ${UNRES_BIN} xdrf )
159 #=========================================
161 #=========================================
163 #-- Copy all the data files from the test directory into the source directory
164 #SET(UNRES_TEST_FILES
168 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
169 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
170 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
171 # ADD_CUSTOM_COMMAND (
172 # TARGET ${UNRES_BIN}
174 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
176 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
178 #=========================================
179 # Generate data test files
180 #=========================================
182 #=========================================
184 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
188 #-----------------------------------------------------------------------------
189 UNRES_BIN=${UNRES_BIN}
190 #-----------------------------------------------------------------------------
191 DD=${CMAKE_SOURCE_DIR}/PARAM
192 export BONDPAR=$DD/bond.parm
193 export THETPAR=$DD/thetaml.5parm
194 export ROTPAR=$DD/scgauss.parm
195 export TORPAR=$DD/torsion_631Gdp.parm
196 export TORDPAR=$DD/torsion_double_631Gdp.parm
197 export ELEPAR=$DD/electr_631Gdp.parm
198 export SIDEPAR=$DD/sc_GB_opt.1gab_3S_qclass5no310-shan2-sc-16-10-8k
199 export FOURIER=$DD/fourier_opt.parm.1igd_hc_iter3_3
200 export SCPPAR=$DD/scp.parm
201 export SCCORPAR=$DD/rotcorr_AM1.parm
202 export PATTERN=$DD/patterns.cart
203 #-----------------------------------------------------------------------------
207 #=========================================
209 #=========================================
211 file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ala10.inp
213 SEED=-1111333 MD ONE_LETTER rescale_mode=2 PDBOUT
214 nstep=15000 ntwe=100 ntwx=1000 dt=0.1 lang=0 tbf t_bath=300 damax=1.0 &
215 reset_moment=1000 reset_vel=1000 MDPDB
216 WLONG=1.35279 WSCP=1.59304 WELEC=0.71534 WBOND=1.00000 WANG=1.13873 &
217 WSCLOC=0.16258 WTOR=1.98599 WTORD=1.57069 WCORRH=0.42887 WCORR5=0.00000 &
218 WCORR6=0.00000 WEL_LOC=0.16036 WTURN3=1.68722 WTURN4=0.66230 WTURN6=0.00000 &
219 WVDWPP=0.11371 WHPB=1.00000 &
220 CUTOFF=7.00000 WCORR4=0.00000
225 90.0000 90.0000 90.0000 90.000 90.000 90.000 90.000 90.000
227 180.0000 180.0000 180.0000 180.000 180.000 180.000 180.000 180.000
229 110.0000 110.0000 110.0000 100.000 110.000 100.000 110.000 110.000
231 -120.0000 -120.0000 -120.000 -120.000 -120.000 -120.000 -120.000 -120.000
238 if(NOT UNRES_WITH_MPI)
240 add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
242 endif(NOT UNRES_WITH_MPI)