fixed typo
[unres.git] / source / unres / src_MD / CMakeLists.txt
index ecc2d6c..86c61fe 100644 (file)
 
 enable_language (Fortran)
 
-#================================
-# build the xdrf library 
-#================================ 
-add_subdirectory(xdrf)
 
 #================================
 # Set source file lists
 #================================
-set(UNRES_MD_SRC0 unres.F arcos.f cartprint.f chainbuild.F convert.f 
-       initialize_p.F matmult.f readrtns.F parmread.F gen_rand_conf.F
-       printmat.f map.f pinorm.f randgens.f rescode.f intcor.f timing.F
-       misc.f intlocal.f cartder.F checkder_p.F econstr_local.F
-       minimize_p.F sumsld.f cored.f rmdd.f geomout.F readpdb.F regularize.F
-       thread.F fitsq.f mcm.F mc.F bond_move.f refsys.f check_sc_distr.f
-       check_bond.f contact.f djacob.f eigen.f blas.f add.f entmcm.F
-       minim_mcmf.F MP.F compare_s1.F prng_32.F banach.f rmsd.F elecont.f dihed_cons.F sc_move.F 
-       local_move.f intcartderiv.F lagrangian_lesyng.F stochfric.F kinetic_lesyng.f MD_A-MTS.F moments.f
-       int_to_cart.f surfatom.f sort.f muca_md.f MREMD.F rattle.F gauss.f energy_split-sep.F 
-       q_measure.F gnmr1.f test.F )
-
-set(UNRES_MD_SRC3 energy_p_new_barrier.F energy_p_new-sep_barrier.F gradient_p.F )
-
-set(UNRES_MD_PP_SRC cartder.F chainbuild.F checkder_p.F compare_s1.F dihed_cons.F econstr_local.F 
-       energy_p_new_barrier.F energy_p_new-sep_barrier.F energy_split-sep.F entmcm.F gen_rand_conf.F
-       geomout.F gradient_p.F initialize_p.F intcartderiv.F lagrangian_lesyng.F mc.F mcm.F MD_A-MTS.F
-       minimize_p.F minim_mcmf.F MP.F MREMD.F parmread.F prng_32.F q_measure1.F q_measure3.F q_measure.F
-       rattle.F readpdb.F readrtns.F regularize.F rmsd.F sc_move.F stochfric.F test.F thread.F timing.F
-       unres.F ) 
+set(UNRES_MD_SRC0 
+       add.f 
+       arcos.f
+       banach.f 
+       blas.f 
+       bond_move.f 
+       cartder.F 
+       cartprint.f 
+       check_sc_distr.f
+       check_bond.f 
+       chainbuild.F 
+       checkder_p.F 
+       compare_s1.F 
+       contact.f 
+       convert.f 
+       cored.f 
+       dihed_cons.F 
+       djacob.f 
+       econstr_local.F
+       eigen.f 
+       elecont.f 
+       energy_split-sep.F 
+       entmcm.F
+       fitsq.f 
+       gauss.f 
+       gen_rand_conf.F
+       geomout.F 
+       gnmr1.f 
+       intcartderiv.F 
+       initialize_p.F 
+       int_to_cart.f 
+       intcor.f 
+       intlocal.f 
+       kinetic_lesyng.f 
+       lagrangian_lesyng.F 
+       local_move.f 
+       map.f 
+       matmult.f 
+       mc.F 
+       mcm.F 
+       MD_A-MTS.F 
+       minimize_p.F 
+       minim_mcmf.F 
+       misc.f 
+       moments.f
+       MP.F 
+       MREMD.F 
+       muca_md.f 
+       parmread.F 
+       pinorm.f 
+       printmat.f 
+       prng_32.F 
+       q_measure.F 
+       randgens.f 
+       rattle.F 
+       readpdb.F 
+       readrtns.F 
+       refsys.f 
+       regularize.F
+       rescode.f 
+       rmdd.f 
+       rmsd.F 
+       sc_move.F 
+       sort.f 
+       stochfric.F 
+       sumsld.f 
+       surfatom.f 
+       test.F
+       timing.F
+       thread.F 
+       unres.F
+)
+
+if (Fortran_COMPILER_NAME STREQUAL "ifort")
+  set(UNRES_MD_SRC0 "${UNRES_MDM_SRC0} prng.f") 
+else
+  set(UNRES_MD_SRC0 "${UNRES_MDM_SRC0} prng_32.F")
+endif (Fortran_COMPILER_NAME STREQUAL "ifort")
+
 
+set(UNRES_MD_SRC3 
+       energy_p_new_barrier.F 
+       energy_p_new-sep_barrier.F 
+       gradient_p.F )
+
+set(UNRES_MD_PP_SRC
+       cartder.F
+       chainbuild.F 
+       checkder_p.F 
+       compare_s1.F 
+       dihed_cons.F 
+       econstr_local.F 
+       energy_p_new_barrier.F 
+       energy_p_new-sep_barrier.F 
+       energy_split-sep.F 
+       entmcm.F 
+       gen_rand_conf.F
+       geomout.F 
+       gradient_p.F 
+       initialize_p.F 
+       intcartderiv.F 
+       lagrangian_lesyng.F 
+       mc.F 
+       mcm.F 
+       MD_A-MTS.F
+       minimize_p.F 
+       minim_mcmf.F 
+       MP.F 
+       MREMD.F 
+       parmread.F 
+       prng_32.F 
+       q_measure1.F 
+       q_measure3.F 
+       q_measure.F
+       rattle.F 
+       readpdb.F 
+       readrtns.F 
+       regularize.F 
+       rmsd.F 
+       sc_move.F 
+       stochfric.F 
+       test.F 
+       thread.F 
+       timing.F
+       unres.F 
+       proc_proc.c 
+) 
+
+
+if(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
+  set(UNRES_MD_PP_SRC "${UNRES_MDM_PP_SRC} prng_32.F") 
+endif(NOT Fortran_COMPILER_NAME STREQUAL "ifort")
 
 #================================================
 # Set comipiler flags for different sourcefiles  
 #================================================
 if (Fortran_COMPILER_NAME STREQUAL "ifort")
-  set(FFLAGS0 "-c -ip -w" ) 
-  set(FFLAGS1 "-c -w -g -d2 -CA -CB" ) 
-  set(FFLAGS2 "-c -w -g -00 ")
+  set(FFLAGS0 "-ip -w" ) 
+  set(FFLAGS1 "-w -g -d2 -CA -CB" ) 
+  set(FFLAGS2 "-w -g -00 ")
   #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
-  set(FFLAGS3 "-c -w -ipo " )
+  set(FFLAGS3 "-w -ipo " )
 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
-  set(FFLAGS0 "-c -I. " ) 
-  set(FFLAGS1 "-c -g -I. " ) 
-  set(FFLAGS2 "-c -I. ")
+  set(FFLAGS0 "-I. " ) 
+  set(FFLAGS1 "-g -I. " ) 
+  set(FFLAGS2 "-I. ")
   #set(FFLAGS3 "-c -w -O3 -ipo -ipo_obj -opt_report" )
-  set(FFLAGS3 "-c -I. " )
+  set(FFLAGS3 "-I. " )
 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
 
 
@@ -68,36 +175,43 @@ set_property(SOURCE ${UNRES_MD_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
 #=========================================
 # Settings for GAB force field 
 #=========================================
-if(UNRES_FF STREQUAL "GAB" )
+if(UNRES_MD_FF STREQUAL "GAB" )
   # set preprocesor flags   
-  set(CPPFLAGS "PROCOR -DLINUX -DUNRES -DISNAN -DSPLITELE -DLANGO -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
-
-  if (Fortran_COMPILER_NAME STREQUAL "ifort")
-    # Add ifort preprocessor flags
-    set(CPPFLAGS "${CPPFLAGS} -DPGI") 
-  elseif (Fortran_COMPILER_NAME STREQUAL "f95")
-    # Add gfortran flags
-    set(CPPFLAGS "${CPPFLAGS} -DG77") 
-  elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
-    # Add gfortran flags
-    set(CPPFLAGS "${CPPFLAGS} -DG77") 
-  endif (Fortran_COMPILER_NAME STREQUAL "ifort")
+  set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
 
 #=========================================
 #  Settings for E0LL2Y force field
 #=========================================
-elseif(UNRES_FF STREQUAL "E0LL2Y")
+elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
   # set preprocesor flags   
-  set(CPPFLAGS "PROCOR -DLINUX -DUNRES -DISNAN -DSPLITELE -DLANG0" )
+  set(CPPFLAGS "PROCOR -DUNRES -DISNAN -DSPLITELE -DLANG0" )
+endif(UNRES_MD_FF STREQUAL "GAB")
 
-  if (Fortran_COMPILER_NAME STREQUAL "ifort")
-    # Add ifort preprocessor flags
-    set(CPPFLAGS "${CPPFLAGS} -DPGI")
-  endif (Fortran_COMPILER_NAME STREQUAL "ifort")
+#=========================================
+# System specific flags
+#=========================================
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  set(CPPFLAGS "${CPPFLAGS} -DLINUX") 
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+#=========================================
+# Compiler specific flags
+#=========================================
 
-endif(UNRES_FF STREQUAL "GAB")
+if (Fortran_COMPILER_NAME STREQUAL "ifort")
+  # Add ifort preprocessor flags
+  set(CPPFLAGS "${CPPFLAGS} -DPGI") 
+elseif (Fortran_COMPILER_NAME STREQUAL "f95")
+  # Add new gfortran flags
+  set(CPPFLAGS "${CPPFLAGS} -DG77") 
+elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
+  # Add old gfortran flags
+  set(CPPFLAGS "${CPPFLAGS} -DG77") 
+endif (Fortran_COMPILER_NAME STREQUAL "ifort")
 
+#=========================================
 # Add MPI preprocessor flags
+#=========================================
 if (UNRES_WITH_MPI)
   set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI") 
 endif(UNRES_WITH_MPI)
@@ -122,13 +236,15 @@ endif(UNRES_WITH_MPI)
 #  - shame on me ]:)
 #=========================================
 set_property(SOURCE compinfo.c PROPERTY CMAKE_C_FLAGS "-c" )
-add_executable(compinfo compinfo.c)
+add_executable(compinfo-md compinfo.c)
+set_target_properties(compinfo-md PROPERTIES OUTPUT_NAME compinfo)
+
 set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f 
        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
        COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/COMMON.IOUNITS ${CMAKE_CURRENT_BINARY_DIR}/COMMON.IOUNITS 
        COMMAND ${CMAKE_CURRENT_BINARY_DIR}/compinfo | true     
-       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cinfo.f )
+       DEPENDS compinfo-md )
 set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0} )
 
 #=========================================
@@ -137,24 +253,25 @@ set_property(SOURCE ${UNRES_CINFO_DIR}/cinfo.f PROPERTY COMPILE_FLAGS ${FFLAGS0}
 set(UNRES_MD_SRCS ${UNRES_MD_SRC0} ${UNRES_MD_SRC3} ${UNRES_CINFO_DIR}/cinfo.f )
 
 
-
 #=========================================
 # Build the binary
 #=========================================
-add_executable(${UNRES_BIN} ${UNRES_MD_SRCS} )
+add_executable(UNRES_BIN-MD ${UNRES_MD_SRCS} )
+set_target_properties(UNRES_BIN-MD PROPERTIES OUTPUT_NAME ${UNRES_BIN})
 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
 #add_dependencies (${UNRES_BIN} ${UNRES_XDRFLIB})
 
+
 #=========================================
 # Link libraries
 #=========================================
 # link MPI library (libmpich.a)  
 if(UNRES_WITH_MPI)
-  target_link_libraries( ${UNRES_BIN} ${MPIF_LIBRARIES} )
+  target_link_libraries( UNRES_BIN-MD ${MPIF_LIBRARIES} )
 endif(UNRES_WITH_MPI)
 # link libxdrf.a 
 #message("UNRES_XDRFLIB=${UNRES_XDRFLIB}")
-target_link_libraries( ${UNRES_BIN} xdrf )
+target_link_libraries( UNRES_BIN-MD xdrf )
 
 #=========================================
 # TESTS 
@@ -186,7 +303,7 @@ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh
 export POT=GB
 export PREFIX=ala10
 #-----------------------------------------------------------------------------
-UNRES_BIN=${UNRES_BIN}
+UNRES_BIN=./${UNRES_BIN}
 #-----------------------------------------------------------------------------
 DD=${CMAKE_SOURCE_DIR}/PARAM
 export BONDPAR=$DD/bond.parm
@@ -239,5 +356,6 @@ if(NOT UNRES_WITH_MPI)
 
   add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
 
+
 endif(NOT UNRES_WITH_MPI)