Skip to content
Snippets Groups Projects
Commit 6d826e8a authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Storing gromacs 4.6.3 diff with original files

parent 278a84ca
No related branches found
No related tags found
No related merge requests found
patch -u -l -b -F 5 --suffix=.preplumed "./src/kernel/CMakeLists.txt" << \EOF_EOF
--- ./src/kernel/CMakeLists.txt.preplumed
+++ ./src/kernel/CMakeLists.txt
@@ -31,10 +31,12 @@
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
#
+include(${CMAKE_SOURCE_DIR}/Plumed.cmake)
+
set(GMXPREPROCESS_SOURCES
add_par.c
calc_verletbuf.c
compute_io.c
convparm.c
@@ -121,11 +123,11 @@
set_target_properties(${PROGRAM} PROPERTIES OUTPUT_NAME "${PROGRAM}${GMX_BINARY_SUFFIX}")
endforeach()
add_executable(mdrun ${MDRUN_SOURCES} main.c)
gmx_add_man_page(mdrun)
-target_link_libraries(mdrun gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS})
+target_link_libraries(mdrun gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS} ${PLUMED_LOAD})
set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}" COMPILE_FLAGS "${OpenMP_C_FLAGS}")
if(GMX_OPENMM)
target_link_libraries(mdrun openmm_api_wrapper)
endif()
EOF_EOF
patch -u -l -b -F 5 --suffix=.preplumed "./src/kernel/md.c" << \EOF_EOF
--- ./src/kernel/md.c.preplumed
+++ ./src/kernel/md.c
@@ -91,10 +91,16 @@
#include "membed.h"
#include "types/nlistheuristics.h"
#include "types/iteratedconstraints.h"
#include "nbnxn_cuda_data_mgmt.h"
+/* PLUMED */
+#include "../../Plumed.h"
+extern int plumedswitch;
+extern plumed plumedmain;
+/* END PLUMED */
+
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
#ifdef GMX_THREAD_MPI
#include "tmpi.h"
@@ -235,10 +241,14 @@
/* PME load balancing data for GPU kernels */
pme_load_balancing_t pme_loadbal = NULL;
double cycles_pmes;
gmx_bool bPMETuneTry = FALSE, bPMETuneRunning = FALSE;
+/* PLUMED */
+ int plumedNeedsEnergy;
+/* END PLUMED */
+
#ifdef GMX_FAHCORE
/* Temporary addition for FAHCORE checkpointing */
int chkpt_ret;
#endif
@@ -715,10 +725,50 @@
}
}
fprintf(fplog, "\n");
}
+ /* PLUMED */
+ if(plumedswitch){
+ if(cr->ms && cr->ms->nsim>1) {
+ if(MASTER(cr)) plumed_cmd(plumedmain,"GREX setMPIIntercomm",&cr->ms->mpi_comm_masters);
+ if(PAR(cr)){
+ if(DOMAINDECOMP(cr)) {
+ plumed_cmd(plumedmain,"GREX setMPIIntracomm",&cr->dd->mpi_comm_all);
+ }else{
+ plumed_cmd(plumedmain,"GREX setMPIIntracomm",&cr->mpi_comm_mysim);
+ }
+ }
+ plumed_cmd(plumedmain,"GREX init",NULL);
+ }
+ if(PAR(cr)){
+ if(DOMAINDECOMP(cr)) {
+ plumed_cmd(plumedmain,"setMPIComm",&cr->dd->mpi_comm_all);
+ }else{
+ plumed_cmd(plumedmain,"setMPIComm",&cr->mpi_comm_mysim);
+ }
+ }
+ plumed_cmd(plumedmain,"setNatoms",&top_global->natoms);
+ plumed_cmd(plumedmain,"setMDEngine","gromacs");
+ plumed_cmd(plumedmain,"setLog",fplog);
+ real real_delta_t;
+ real_delta_t=ir->delta_t;
+ plumed_cmd(plumedmain,"setTimestep",&real_delta_t);
+ plumed_cmd(plumedmain,"init",NULL);
+
+ if(PAR(cr)){
+ if(DOMAINDECOMP(cr)) {
+ plumed_cmd(plumedmain,"setAtomsNlocal",&cr->dd->nat_home);
+ plumed_cmd(plumedmain,"setAtomsGatindex",cr->dd->gatindex);
+ }else{
+ plumed_cmd(plumedmain,"setAtomsNlocal",&mdatoms->homenr);
+ plumed_cmd(plumedmain,"setAtomsContiguous",&mdatoms->start);
+ }
+ }
+ }
+ /* END PLUMED */
+
/* Set and write start time */
runtime_start(runtime);
print_date_and_time(fplog, cr->nodeid, "Started mdrun", runtime);
wallcycle_start(wcycle, ewcRUN);
if (fplog)
@@ -1031,10 +1081,17 @@
vsite, shellfc, constr,
nrnb, wcycle,
do_verbose && !bPMETuneRunning);
wallcycle_stop(wcycle, ewcDOMDEC);
/* If using an iterative integrator, reallocate space to match the decomposition */
+
+ /* PLUMED */
+ if(plumedswitch){
+ plumed_cmd(plumedmain,"setAtomsNlocal",&cr->dd->nat_home);
+ plumed_cmd(plumedmain,"setAtomsGatindex",cr->dd->gatindex);
+ }
+ /* END PLUMED */
}
}
if (MASTER(cr) && do_log && !bFFscan)
{
@@ -1176,16 +1233,39 @@
/* The coordinates (x) are shifted (to get whole molecules)
* in do_force.
* This is parallellized as well, and does communication too.
* Check comments in sim_util.c
*/
+
+ /* PLUMED */
+ plumedNeedsEnergy=0;
+ if(plumedswitch){
+ long int lstep=step; plumed_cmd(plumedmain,"setStepLong",&lstep);
+ plumed_cmd(plumedmain,"setPositions",&state->x[mdatoms->start][0]);
+ plumed_cmd(plumedmain,"setMasses",&mdatoms->massT[mdatoms->start]);
+ plumed_cmd(plumedmain,"setCharges",&mdatoms->chargeA[mdatoms->start]);
+ plumed_cmd(plumedmain,"setBox",&state->box[0][0]);
+ plumed_cmd(plumedmain,"prepareCalc",NULL);
+ plumed_cmd(plumedmain,"isEnergyNeeded",&plumedNeedsEnergy);
+ }
+ /* END PLUMED */
do_force(fplog, cr, ir, step, nrnb, wcycle, top, top_global, groups,
state->box, state->x, &state->hist,
f, force_vir, mdatoms, enerd, fcd,
state->lambda, graph,
fr, vsite, mu_tot, t, outf->fp_field, ed, bBornRadii,
- (bNS ? GMX_FORCE_NS : 0) | force_flags);
+ (plumedNeedsEnergy? GMX_FORCE_ENERGY : 0) |(bNS ? GMX_FORCE_NS : 0) | force_flags);
+ /* PLUMED */
+ if(plumedswitch){
+ if(plumedNeedsEnergy) plumed_cmd(plumedmain,"setEnergy",&enerd->term[F_EPOT]);
+ plumed_cmd(plumedmain,"setForces",&f[mdatoms->start][0]);
+ plumed_cmd(plumedmain,"setVirial",&force_vir[0][0]);
+ plumed_cmd(plumedmain,"performCalc",NULL);
+ if ((repl_ex_nst > 0) && (step > 0) && !bLastStep &&
+ do_per_step(step,repl_ex_nst)) plumed_cmd(plumedmain,"GREX savePositions",NULL);
+ }
+ /* END PLUMED */
}
GMX_BARRIER(cr->mpi_comm_mygroup);
if (bTCR)
EOF_EOF
patch -u -l -b -F 5 --suffix=.preplumed "./src/kernel/mdrun.c" << \EOF_EOF
--- ./src/kernel/mdrun.c.preplumed
+++ ./src/kernel/mdrun.c
@@ -56,10 +56,16 @@
#endif
/* afm stuf */
#include "pull.h"
+/* PLUMED */
+#include "../../Plumed.h"
+int plumedswitch;
+plumed plumedmain;
+/* END PLUMED */
+
int cmain(int argc, char *argv[])
{
const char *desc[] = {
"The [TT]mdrun[tt] program is the main computational chemistry engine",
"within GROMACS. Obviously, it performs Molecular Dynamics simulations,",
@@ -399,10 +405,11 @@
{ efLOG, "-rs", "rotslabs", ffOPTWR },
{ efLOG, "-rt", "rottorque", ffOPTWR },
{ efMTX, "-mtx", "nm", ffOPTWR },
{ efNDX, "-dn", "dipole", ffOPTWR },
{ efRND, "-multidir", NULL, ffOPTRDMULT},
+ { efDAT, "-plumed", "plumed", ffOPTRD }, /* PLUMED */
{ efDAT, "-membed", "membed", ffOPTRD },
{ efTOP, "-mp", "membed", ffOPTRD },
{ efNDX, "-mn", "membed", ffOPTRD }
};
#define NFILE asize(fnm)
@@ -731,19 +738,50 @@
}
ddxyz[XX] = (int)(realddxyz[XX] + 0.5);
ddxyz[YY] = (int)(realddxyz[YY] + 0.5);
ddxyz[ZZ] = (int)(realddxyz[ZZ] + 0.5);
+ /* PLUMED */
+ plumedswitch=0;
+ if (opt2bSet("-plumed",NFILE,fnm)) plumedswitch=1;
+ if(plumedswitch){
+ int plumed_is_there=0;
+ int real_precision=sizeof(real);
+ real energyUnits=1.0;
+ real lengthUnits=1.0;
+ real timeUnits=1.0;
+
+
+ if(!plumed_installed()){
+ gmx_fatal(FARGS,"Plumed is not available. Check your PLUMED_KERNEL variable.");
+ }
+ plumedmain=plumed_create();
+ plumed_cmd(plumedmain,"setRealPrecision",&real_precision);
+ // this is not necessary for gromacs units:
+ plumed_cmd(plumedmain,"setMDEnergyUnits",&energyUnits);
+ plumed_cmd(plumedmain,"setMDLengthUnits",&lengthUnits);
+ plumed_cmd(plumedmain,"setMDTimeUnits",&timeUnits);
+ //
+ plumed_cmd(plumedmain,"setPlumedDat",ftp2fn(efDAT,NFILE,fnm));
+ plumedswitch=1;
+ }
+ /* END PLUMED */
rc = mdrunner(&hw_opt, fplog, cr, NFILE, fnm, oenv, bVerbose, bCompact,
nstglobalcomm, ddxyz, dd_node_order, rdd, rconstr,
dddlb_opt[0], dlb_scale, ddcsx, ddcsy, ddcsz,
nbpu_opt[0],
nsteps, nstepout, resetstep,
nmultisim, repl_ex_nst, repl_ex_nex, repl_ex_seed,
pforce, cpt_period, max_hours, deviceOptions, Flags);
+ /* PLUMED */
+ if(plumedswitch){
+ plumed_finalize(plumedmain);
+ }
+ /* END PLUMED */
+
gmx_finalize_par();
if (MULTIMASTER(cr))
{
thanx(stderr);
EOF_EOF
patch -u -l -b -F 5 --suffix=.preplumed "./src/kernel/repl_ex.c" << \EOF_EOF
--- ./src/kernel/repl_ex.c.preplumed
+++ ./src/kernel/repl_ex.c
@@ -51,10 +51,16 @@
#include "names.h"
#include "mvdata.h"
#include "domdec.h"
#include "partdec.h"
+/* PLUMED */
+#include "../../Plumed.h"
+extern int plumedswitch;
+extern plumed plumedmain;
+/* END PLUMED */
+
#define PROBABILITYCUTOFF 100
/* we don't bother evaluating if events are more rare than exp(-100) = 3.7x10^-44 */
enum {
ereTEMP, ereLAMBDA, ereENDSINGLE, ereTL, ereNR
@@ -111,18 +117,20 @@
snew(qall, ms->nsim);
qall[re->repl] = q;
gmx_sum_sim(ms->nsim, qall, ms);
- bDiff = FALSE;
- for (s = 1; s < ms->nsim; s++)
- {
- if (qall[s] != qall[0])
- {
+ /* PLUMED */
+ //bDiff = FALSE;
+ //for (s = 1; s < ms->nsim; s++)
+ //{
+ // if (qall[s] != qall[0])
+ // {
bDiff = TRUE;
- }
- }
+ // }
+ //}
+ /* END PLUMED */
if (bDiff)
{
/* Set the replica exchange type and quantities */
re->type = ere;
@@ -255,10 +263,14 @@
for (i = 0; i < re->nrepl; i++)
{
re->ind[i] = i;
}
+ /* PLUMED */
+ // plumed2: check if we want alternative patterns (i.e. for bias-exchange metaD)
+ // in those cases replicas can share the same temperature.
+ /*
if (re->type < ereENDSINGLE)
{
for (i = 0; i < re->nrepl; i++)
{
@@ -275,10 +287,12 @@
gmx_fatal(FARGS, "Two replicas have identical %ss", erename[re->type]);
}
}
}
}
+ */
+ /* END PLUMED */
/* keep track of all the swaps, starting with the initial placement. */
snew(re->allswaps, re->nrepl);
for (i = 0; i < re->nrepl; i++)
{
@@ -976,10 +990,14 @@
for (i = 0; i < re->nrepl; i++)
{
pind[i] = re->ind[i];
}
+ /* PLUMED */
+ int plumed_test_exchange_pattern=0;
+ /* END PLUMED */
+
if (bMultiEx)
{
/* multiple random switch exchange */
for (i = 0; i < re->nex; i++)
{
@@ -1045,19 +1063,56 @@
}
else
{
/* standard nearest neighbor replica exchange */
m = (step / re->nst) % 2;
+ /* PLUMED */
+ if(plumedswitch){
+ int partner=re->repl;
+ plumed_cmd(plumedmain,"getExchangesFlag",&plumed_test_exchange_pattern);
+ if(plumed_test_exchange_pattern>0){
+ int *list;
+ snew(list,re->nrepl);
+ plumed_cmd(plumedmain,"setNumberOfReplicas",&(re->nrepl));
+ plumed_cmd(plumedmain,"getExchangesList",list);
+ for(i=0; i<re->nrepl; i++) re->ind[i]=list[i];
+ sfree(list);
+ }
+
+ for(i=1; i<re->nrepl; i++) {
+ if (i % 2 != m) continue;
+ a = re->ind[i-1];
+ b = re->ind[i];
+ if(re->repl==a) partner=b;
+ if(re->repl==b) partner=a;
+ }
+ plumed_cmd(plumedmain,"GREX setPartner",&partner);
+ plumed_cmd(plumedmain,"GREX calculate",NULL);
+ plumed_cmd(plumedmain,"GREX shareAllDeltaBias",NULL);
+ }
+ /* END PLUMED */
for (i = 1; i < re->nrepl; i++)
{
a = re->ind[i-1];
b = re->ind[i];
bPrint = (re->repl == a || re->repl == b);
if (i % 2 == m)
{
delta = calc_delta(fplog, bPrint, re, a, b, a, b);
+ /* PLUMED */
+ if(plumedswitch){
+ real adb,bdb,dplumed;
+ char buf[300];
+ sprintf(buf,"GREX getDeltaBias %d",a); plumed_cmd(plumedmain,buf,&adb);
+ sprintf(buf,"GREX getDeltaBias %d",b); plumed_cmd(plumedmain,buf,&bdb);
+ dplumed=adb*re->beta[a]+bdb*re->beta[b];
+ delta+=dplumed;
+ if (bPrint)
+ fprintf(fplog,"dplumed = %10.3e dE_Term = %10.3e (kT)\n",dplumed,delta);
+ }
+ /* END PLUMED */
if (delta <= 0)
{
/* accepted */
prob[i] = 1;
bEx[i] = TRUE;
@@ -1077,15 +1132,26 @@
}
re->prob_sum[i] += prob[i];
if (bEx[i])
{
+ /* PLUMED */
+ if(!plumed_test_exchange_pattern) {
+ /* standard neighbour swapping */
/* swap these two */
tmp = pind[i-1];
pind[i-1] = pind[i];
pind[i] = tmp;
re->nexchange[i]++; /* statistics for back compatibility */
+ } else {
+ /* alternative swapping patterns */
+ tmp = pind[a];
+ pind[a] = pind[b];
+ pind[b] = tmp;
+ re->nexchange[i]++; /* statistics for back compatibility */
+ }
+ /* END PLUMED */
}
}
else
{
prob[i] = -1;
@@ -1097,10 +1163,19 @@
print_prob(fplog, "pr", re->nrepl, prob);
fprintf(fplog, "\n");
re->nattempt[m]++;
}
+ /* PLUMED */
+ if(plumed_test_exchange_pattern>0) {
+ for (i = 0; i < re->nrepl; i++)
+ {
+ re->ind[i] = i;
+ }
+ }
+ /* END PLUMED */
+
/* record which moves were made and accepted */
for (i = 0; i < re->nrepl; i++)
{
re->nmoves[re->ind[i]][pind[i]] += 1;
re->nmoves[pind[i]][re->ind[i]] += 1;
@@ -1306,10 +1381,14 @@
* exchanges. */
/* Where each replica ends up after the exchange attempt(s). */
/* The order in which multiple exchanges will occur. */
gmx_bool bThisReplicaExchanged = FALSE;
+ /* PLUMED */
+ if(plumedswitch)plumed_cmd(plumedmain,"GREX prepare",NULL);
+ /* END PLUMED */
+
if (MASTER(cr))
{
replica_id = re->repl;
test_for_replica_exchange(fplog, cr->ms, re, enerd, det(state_local->box), step, time);
prepare_to_do_exchange(fplog, re->destinations, replica_id, re->nrepl, &maxswap,
@@ -1355,14 +1434,14 @@
exchange_partner = re->order[replica_id][j];
if (exchange_partner != replica_id)
{
/* Exchange the global states between the master nodes */
- if (debug)
- {
- fprintf(debug, "Exchanging %d with %d\n", replica_id, exchange_partner);
- }
+ //if (debug)
+ //{
+ fprintf(fplog, "Exchanging %d with %d\n", replica_id, exchange_partner);
+ //}
exchange_state(cr->ms, exchange_partner, state);
}
}
/* For temperature-type replica exchange, we need to scale
* the velocities. */
EOF_EOF
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright (c) 2012,2013, by the GROMACS development team, led by
# David van der Spoel, Berk Hess, Erik Lindahl, and including many
# others, as listed in the AUTHORS file in the top-level source
# directory and at http://www.gromacs.org.
#
# GROMACS is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# GROMACS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with GROMACS; if not, see
# http://www.gnu.org/licenses, or write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# If you want to redistribute modifications to GROMACS, please
# consider that scientific software is very special. Version
# control is crucial - bugs must be traceable. We will be happy to
# consider code for inclusion in the official distribution, but
# derived work must not be called official GROMACS. Details are found
# in the README & COPYING files - if they are missing, get the
# official version at http://www.gromacs.org.
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
#
include(${CMAKE_SOURCE_DIR}/Plumed.cmake)
set(GMXPREPROCESS_SOURCES
add_par.c
calc_verletbuf.c
compute_io.c
convparm.c
gen_ad.c
gen_vsite.c
genhydro.c
gpp_atomtype.c
gpp_bond_atomtype.c
h_db.c
hackblock.c
hizzie.c
nm2type.c
pdb2top.c
pgutil.c
readir.c
readpull.c
readadress.c
readrot.c
resall.c
sorting.c
specbond.c
ter_db.c
tomorse.c
topdirs.c
topexcl.c
topio.c
toppush.c
topshake.c
toputil.c
tpbcmp.c
vsite_parm.c
fflibutil.c
xlate.c)
set(MDRUN_SOURCES
gctio.c ionize.c runner.c
do_gct.c repl_ex.c xutils.c pme_loadbal.c
md.c mdrun.c genalg.c membed.c)
add_library(gmxpreprocess ${GMXPREPROCESS_SOURCES})
target_link_libraries(gmxpreprocess md)
set_target_properties(gmxpreprocess PROPERTIES OUTPUT_NAME "gmxpreprocess${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}"
COMPILE_FLAGS "${OpenMP_C_FLAGS}")
if(GMX_GPU)
include_directories(${CMAKE_SOURCE_DIR}/src/gmxlib/gpu_utils)
endif()
if(GMX_OPENMM)
# Even though the OpenMM build has "moved to contrib", many things
# have be be done from within the scope of the CMakeLists.txt that
# builds its mdrun, and that is here
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/contrib)
find_package(OpenMM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include(${CMAKE_SOURCE_DIR}/src/contrib/BuildMdrunOpenMM.cmake)
endif(GMX_OPENMM)
if(GMX_GPU OR GMX_FORCE_CXX)
set_source_files_properties(main.c PROPERTIES LANGUAGE CXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS "-x c++")
endif()
endif()
if(GMX_FAHCORE)
add_library(fahcore ${MDRUN_SOURCES})
else(GMX_FAHCORE)
set(GMX_KERNEL_PROGRAMS
grompp tpbconv pdb2gmx g_protonate gmxdump g_x2top gmxcheck)
if (NOT GMX_NO_QUOTES)
set(GMX_KERNEL_PROGRAMS ${GMX_KERNEL_PROGRAMS} g_luck)
endif (NOT GMX_NO_QUOTES)
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
add_executable(${PROGRAM} ${PROGRAM}.c main.c)
if (NOT ${PROGRAM} STREQUAL "g_luck")
gmx_add_man_page(${PROGRAM})
endif()
target_link_libraries(${PROGRAM} gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS})
set_target_properties(${PROGRAM} PROPERTIES OUTPUT_NAME "${PROGRAM}${GMX_BINARY_SUFFIX}")
endforeach()
add_executable(mdrun ${MDRUN_SOURCES} main.c)
gmx_add_man_page(mdrun)
target_link_libraries(mdrun gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS} ${PLUMED_LOAD})
set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}" COMPILE_FLAGS "${OpenMP_C_FLAGS}")
if(GMX_OPENMM)
target_link_libraries(mdrun openmm_api_wrapper)
endif()
# Construct component groups for installation; note that a component may
# belong to only one group
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
set(CPACK_COMPONENT_${PROGRAM}_GROUP tools)
endforeach()
set(CPACK_COMPONENT_MDRUN_GROUP mdrun)
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
# Manage CPack component dependencies
set(CPACK_COMPONENT_${PROGRAM}_DEPENDS libraries libraries-gmxpreprocess)
# Create custom install-xxxx target
if (BUILD_SHARED_LIBS)
# If shared libraries are used, we need to install the libraries in
# addition to the mdrun binary.
add_custom_target(install-${PROGRAM}
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries-gmxpreprocess
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMENT "Installing ${PROGRAM}")
else()
add_custom_target(install-${PROGRAM}
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMENT "Installing ${PROGRAM}")
endif()
add_dependencies(install-${PROGRAM} ${PROGRAM})
# Finally, trigger installation
install(
TARGETS ${PROGRAM}
COMPONENT ${PROGRAM}
DESTINATION ${BIN_INSTALL_DIR}
)
endforeach()
install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries-gmxpreprocess)
if (INSTALL_CUDART_LIB) #can be set manual by user
if (GMX_GPU)
foreach(CUDA_LIB ${CUDA_LIBRARIES})
string(REGEX MATCH "cudart" IS_CUDART ${CUDA_LIB})
if(IS_CUDART) #libcuda should not be installed
#install also name-links (linker uses those)
file(GLOB CUDA_LIBS ${CUDA_LIB}*)
install(FILES ${CUDA_LIBS} DESTINATION
${LIB_INSTALL_DIR} COMPONENT libraries)
endif()
endforeach()
else()
message(WARNING "INSTALL_CUDART_LIB only makes sense with GMX_GPU")
endif()
endif ()
endif(GMX_FAHCORE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxpreprocess.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
RENAME "libgmxpreprocess${GMX_LIBS_SUFFIX}.pc"
COMPONENT development)
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright (c) 2012,2013, by the GROMACS development team, led by
# David van der Spoel, Berk Hess, Erik Lindahl, and including many
# others, as listed in the AUTHORS file in the top-level source
# directory and at http://www.gromacs.org.
#
# GROMACS is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your option) any later version.
#
# GROMACS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with GROMACS; if not, see
# http://www.gnu.org/licenses, or write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# If you want to redistribute modifications to GROMACS, please
# consider that scientific software is very special. Version
# control is crucial - bugs must be traceable. We will be happy to
# consider code for inclusion in the official distribution, but
# derived work must not be called official GROMACS. Details are found
# in the README & COPYING files - if they are missing, get the
# official version at http://www.gromacs.org.
#
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
#
set(GMXPREPROCESS_SOURCES
add_par.c
calc_verletbuf.c
compute_io.c
convparm.c
gen_ad.c
gen_vsite.c
genhydro.c
gpp_atomtype.c
gpp_bond_atomtype.c
h_db.c
hackblock.c
hizzie.c
nm2type.c
pdb2top.c
pgutil.c
readir.c
readpull.c
readadress.c
readrot.c
resall.c
sorting.c
specbond.c
ter_db.c
tomorse.c
topdirs.c
topexcl.c
topio.c
toppush.c
topshake.c
toputil.c
tpbcmp.c
vsite_parm.c
fflibutil.c
xlate.c)
set(MDRUN_SOURCES
gctio.c ionize.c runner.c
do_gct.c repl_ex.c xutils.c pme_loadbal.c
md.c mdrun.c genalg.c membed.c)
add_library(gmxpreprocess ${GMXPREPROCESS_SOURCES})
target_link_libraries(gmxpreprocess md)
set_target_properties(gmxpreprocess PROPERTIES OUTPUT_NAME "gmxpreprocess${GMX_LIBS_SUFFIX}" SOVERSION ${SOVERSION} INSTALL_NAME_DIR "${LIB_INSTALL_DIR}"
COMPILE_FLAGS "${OpenMP_C_FLAGS}")
if(GMX_GPU)
include_directories(${CMAKE_SOURCE_DIR}/src/gmxlib/gpu_utils)
endif()
if(GMX_OPENMM)
# Even though the OpenMM build has "moved to contrib", many things
# have be be done from within the scope of the CMakeLists.txt that
# builds its mdrun, and that is here
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/contrib)
find_package(OpenMM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include(${CMAKE_SOURCE_DIR}/src/contrib/BuildMdrunOpenMM.cmake)
endif(GMX_OPENMM)
if(GMX_GPU OR GMX_FORCE_CXX)
set_source_files_properties(main.c PROPERTIES LANGUAGE CXX)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS "-x c++")
endif()
endif()
if(GMX_FAHCORE)
add_library(fahcore ${MDRUN_SOURCES})
else(GMX_FAHCORE)
set(GMX_KERNEL_PROGRAMS
grompp tpbconv pdb2gmx g_protonate gmxdump g_x2top gmxcheck)
if (NOT GMX_NO_QUOTES)
set(GMX_KERNEL_PROGRAMS ${GMX_KERNEL_PROGRAMS} g_luck)
endif (NOT GMX_NO_QUOTES)
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
add_executable(${PROGRAM} ${PROGRAM}.c main.c)
if (NOT ${PROGRAM} STREQUAL "g_luck")
gmx_add_man_page(${PROGRAM})
endif()
target_link_libraries(${PROGRAM} gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS})
set_target_properties(${PROGRAM} PROPERTIES OUTPUT_NAME "${PROGRAM}${GMX_BINARY_SUFFIX}")
endforeach()
add_executable(mdrun ${MDRUN_SOURCES} main.c)
gmx_add_man_page(mdrun)
target_link_libraries(mdrun gmxpreprocess md gmx ${OpenMP_LINKER_FLAGS})
set_target_properties(mdrun PROPERTIES OUTPUT_NAME "mdrun${GMX_BINARY_SUFFIX}" COMPILE_FLAGS "${OpenMP_C_FLAGS}")
if(GMX_OPENMM)
target_link_libraries(mdrun openmm_api_wrapper)
endif()
# Construct component groups for installation; note that a component may
# belong to only one group
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS})
set(CPACK_COMPONENT_${PROGRAM}_GROUP tools)
endforeach()
set(CPACK_COMPONENT_MDRUN_GROUP mdrun)
foreach(PROGRAM ${GMX_KERNEL_PROGRAMS} mdrun)
# Manage CPack component dependencies
set(CPACK_COMPONENT_${PROGRAM}_DEPENDS libraries libraries-gmxpreprocess)
# Create custom install-xxxx target
if (BUILD_SHARED_LIBS)
# If shared libraries are used, we need to install the libraries in
# addition to the mdrun binary.
add_custom_target(install-${PROGRAM}
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=libraries-gmxpreprocess
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMENT "Installing ${PROGRAM}")
else()
add_custom_target(install-${PROGRAM}
COMMAND ${CMAKE_COMMAND} -DCOMPONENT=${PROGRAM}
-P ${CMAKE_BINARY_DIR}/cmake_install.cmake
COMMENT "Installing ${PROGRAM}")
endif()
add_dependencies(install-${PROGRAM} ${PROGRAM})
# Finally, trigger installation
install(
TARGETS ${PROGRAM}
COMPONENT ${PROGRAM}
DESTINATION ${BIN_INSTALL_DIR}
)
endforeach()
install(TARGETS gmxpreprocess DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries-gmxpreprocess)
if (INSTALL_CUDART_LIB) #can be set manual by user
if (GMX_GPU)
foreach(CUDA_LIB ${CUDA_LIBRARIES})
string(REGEX MATCH "cudart" IS_CUDART ${CUDA_LIB})
if(IS_CUDART) #libcuda should not be installed
#install also name-links (linker uses those)
file(GLOB CUDA_LIBS ${CUDA_LIB}*)
install(FILES ${CUDA_LIBS} DESTINATION
${LIB_INSTALL_DIR} COMPONENT libraries)
endif()
endforeach()
else()
message(WARNING "INSTALL_CUDART_LIB only makes sense with GMX_GPU")
endif()
endif ()
endif(GMX_FAHCORE)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgmxpreprocess.pc.cmakein ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgmxpreprocess.pc
DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
RENAME "libgmxpreprocess${GMX_LIBS_SUFFIX}.pc"
COMPONENT development)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment