cmake and ctest corrections for mpi and srun
[unres.git] / source / xdrfpdb / src / CMakeLists.txt
1 # Set of programs to convert UNRES xdrf format (compressed Cartesian coordinates) to PDF
2 # or raw-Cartesian format (*.x) or to extract backbone angular coordinates (*.ang)
3 # The pdb files can be constructed from canonical or MREMD trajectories.
4 #
5 # The xdrf library is required
6 #
7 # Programs
8 #
9 # xdrf2pdb   : converts a single cx trajectory file to PDB format
10 # xdrf2x     : converts a single cx trajectory file to raw-coordinate (x) format
11 # xdrf2ang   : extracts backbone angles from a cx trajectory file
12 # xdrf2pdb-m : converts a selected trajectory of a MREMD run dumpend into a cx file to PDB format
13 #
14 # xdrf2pdb1  : converts conformation(s) selected from a wham post-processing run into PDB format
15 # xdrf2x1    : converts conformation(s) selected from a wham post-processing run into raw (x) format.
16 #
17 # 9/23/2010 A. Liwo
18 #
19 # CMake file by D. JagieÅ‚a
20
21
22 set(UNRES_XDRF_XDRF2PDB_SRC
23         xdrf2pdb.F
24         geomout.F
25         misc.f
26         rescode.f
27         nazwy.f
28 )
29
30 set(UNRES_XDRF_XDRF2PDB-M_SRC
31         xdrf2pdb-m.F
32         geomout.F
33         misc.f
34         rescode.f
35         nazwy.f
36 )
37
38
39 set(UNRES_XDRF_XDRF2X_SRC
40         xdrf2x.F
41 )
42
43
44 set(UNRES_XDRF_XDRF2XANG_SRC
45         xdrf2ang.f
46         misc.f
47         rescode.f
48         nazwy.f
49         intcor.f
50         arcos.f
51 )
52
53 set(UNRES_XDRF_PP_SRC
54         geomout.F
55         xdrf2pdb.F
56         xdrf2pdb-m.F
57         xdrf2x.F        
58 )
59
60 set(CPPFLAGS "PROCOR -DUNRES -DSPLITELE -DNEWUNRES" )
61
62 #=========================================
63 # System specific flags
64 #=========================================
65 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
66   set(CPPFLAGS "${CPPFLAGS} -DLINUX")
67 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
68
69 # Apply preprocesor flags to *.F files
70 set_property(SOURCE ${UNRES_XDRF_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
71
72  
73 #=========================================
74 # Build the binaries
75 #=========================================
76 add_executable(xdrf2pdb   ${UNRES_XDRF_XDRF2PDB_SRC} )
77 set_property(TARGET xdrf2pdb PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
78 target_link_libraries( xdrf2pdb xdrf )
79
80 add_executable(xdrf2pdb-m ${UNRES_XDRF_XDRF2PDB-M_SRC} )
81 set_property(TARGET xdrf2pdb-m PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
82 target_link_libraries( xdrf2pdb-m xdrf )
83
84 add_executable(xdrf2x     ${UNRES_XDRF_XDRF2X_SRC} )
85 set_property(TARGET xdrf2x PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
86 target_link_libraries( xdrf2x xdrf )
87
88 add_executable(xdrf2ang   ${UNRES_XDRF_XDRF2XANG_SRC} )
89 set_property(TARGET xdrf2ang PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
90 target_link_libraries( xdrf2ang xdrf )
91
92
93 #=========================================
94 # Install Path
95 #=========================================
96 install(TARGETS xdrf2pdb        DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
97 install(TARGETS xdrf2pdb-m      DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
98 install(TARGETS xdrf2x          DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
99 install(TARGETS xdrf2ang        DESTINATION ${CMAKE_INSTALL_PREFIX}/xdrfpdb)
100
101
102 #=========================================
103 # TESTS
104 #=========================================
105
106   if (UNRES_SRUN)
107    set (SRUN "srun")
108   else()
109    set (SRUN "")
110   endif()
111
112
113
114 # Create files needed for tests
115
116 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/ala10one.seq
117         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
118
119 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/ala10three.seq 
120         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
121
122 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Yone.seq
123         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
124
125 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Ythree.seq
126         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
127
128 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/ala10MD.cx 
129         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
130
131 file(   COPY ${CMAKE_SOURCE_DIR}/ctest/1L2Y_MREMD_MD000.cx 
132         DESTINATION ${CMAKE_CURRENT_BINARY_DIR} )
133
134
135 # Test xdrf2pdb 
136 add_test(NAME XDRF2PDB-one   COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2pdb one ala10one.seq ala10MD.cx )
137 add_test(NAME XDRF2PDB-three COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2pdb three ala10three.seq ala10MD.cx )
138
139 # Test xdrf2pdb-m
140 add_test(NAME XDRF2PDB-M-one   COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2pdb-m one 1L2Yone.seq 1L2Y_MREMD_MD000.cx 32 30 )
141 add_test(NAME XDRF2PDB-M-three COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2pdb-m three 1L2Ythree.seq 1L2Y_MREMD_MD000.cx 32 30 )
142
143 # Test xdrf2ang
144 add_test(NAME XDRF2ANG-one   COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2ang one ala10one.seq ala10MD.cx )
145 add_test(NAME XDRF2ANG-three COMMAND ${SRUN} ${CMAKE_BINARY_DIR}/bin/xdrf2ang three ala10three.seq ala10MD.cx )
146
147
148