From 7580f994060b11ce327bb33e60ea2c272c75dad4 Mon Sep 17 00:00:00 2001 From: Marcello Sega Date: Tue, 6 Oct 2015 09:37:36 +0200 Subject: [PATCH] fixed histogram output names --- CMakeLists.txt | 22 +++++++++++++++------- examples/ccl4-h2o/RUN.sh | 16 ++++------------ gmx_density.cpp | 18 +++++++++--------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69d0098..71cf121 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ INCLUDE (CheckIncludeFiles) set_source_files_properties(g_density.cpp PROPERTIES LANGUAGE CXX ) set_source_files_properties(gmx_density.cpp PROPERTIES LANGUAGE CXX ) list( APPEND CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS}" ) -if (NOT MYGMX_SRC OR NOT MYGMX_BUILD) -MESSAGE(FATAL_ERROR "MISSING MYGMX_SRC or MYGMX_BUILD options to specify the path of the gromacs source base directory (e.g. ~/gromacs-5.0/) and build directory (e.g. ~/gromacs-5.0/build/) . Pass them to cmake with -DMYGMX_SRC=..., etc. Note that if you compiled gromacs in the source directory, the two variable should point to the same directory.)") -ENDIF(NOT MYGMX_SRC OR NOT MYGMX_BUILD) +if (NOT MYGMX_TREE OR NOT MYGMX_BUILD) +MESSAGE(FATAL_ERROR "MISSING MYGMX_TREE or MYGMX_BUILD options to specify the path of the gromacs source base directory (e.g. ~/gromacs-5.0/) and build directory (e.g. ~/gromacs-5.0/build/) . Pass them to cmake with -DMYGMX_TREE=..., etc. Note that if you compiled gromacs in the source directory, the two variable should point to the same directory.)") +ENDIF(NOT MYGMX_TREE OR NOT MYGMX_BUILD) IF(GITIM_LR) ADD_DEFINITIONS(-DGITIM_LR) @@ -23,7 +23,7 @@ ENDIF(${UNIX}) # these are possible locatsions of gromacs' distribution source / headers / libraries SET( GMX "${MYGMX_BUILD}/" -"${MYGMX_SRC}/" +"${MYGMX_TREE}/" "/usr/include/" "/usr/lib/" "/usr/local/include/" @@ -142,13 +142,21 @@ MESSAGE(STATUS "") # Let's tell cmake to check parameters for the examples -ADD_SUBDIRECTORY(examples/ccl4-h2o) -GET_DIRECTORY_PROPERTY(GROMACS_TOP_DIR DIRECTORY examples/ccl4-h2o DEFINITION GROMACS_TOP_DIR) -GET_DIRECTORY_PROPERTY(GROMACS_KERNEL_DIR DIRECTORY examples/ccl4-h2o DEFINITION GROMACS_KERNEL_DIR) +#ADD_SUBDIRECTORY(examples/ccl4-h2o) +#GET_DIRECTORY_PROPERTY(GROMACS_TOP_DIR DIRECTORY examples/ccl4-h2o DEFINITION GROMACS_TOP_DIR) +#GET_DIRECTORY_PROPERTY(GROMACS_KERNEL_DIR DIRECTORY examples/ccl4-h2o DEFINITION GROMACS_KERNEL_DIR) ADD_DEFINITIONS( -O3 -Wall -pedantic -Wno-unused -Wuninitialized -ffast-math ) ADD_EXECUTABLE(g_density g_density.cpp gmx_density.cpp) MESSAGE(STATUS "GMX LIB: ${GROMACS_LIBGMX}") TARGET_LINK_LIBRARIES(g_density pthread ${GROMACS_LIBGMX} m dl ) +IF(${GMX_VERSION} VERSION_LESS 50000) +# todo +ELSE(${GMX_VERSION} VERSION_LESS 50000) + FILE (WRITE ${CMAKE_SOURCE_DIR}/examples/ccl4-h2o/include.sh "GROMPP='${MYGMX_BUILD}/bin/gmx grompp'\nGDENS=../../g_density\nTOPOL=topol-5.0.top\nexport GMXLIB=${MYGMX_TREE}/share/top/\n" ) +ENDIF(${GMX_VERSION} VERSION_LESS 50000) + +add_custom_command(TARGET g_density PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/ccl4-h2o $/examples/ccl4-h2o) + diff --git a/examples/ccl4-h2o/RUN.sh b/examples/ccl4-h2o/RUN.sh index be93602..97e24c1 100755 --- a/examples/ccl4-h2o/RUN.sh +++ b/examples/ccl4-h2o/RUN.sh @@ -1,20 +1,12 @@ #!/bin/bash -GROMPP=`which grompp` -GDENS=../../g_density -# the file included.sh is generated by cmake and contains -# some environment variables to be used in this script - -if [ -z $GROMPP ] ; then - echo "could not find grompp, cannot continue." ; exit -fi +source include.sh -if [ -z $GDENS ] ; then - echo "could not find g_density, cannot continue." ; exit -fi +# the file include.sh is generated by cmake and contains +# some environment variables to be used in this script echo "g_density needs a .tpr file, let's create it now...." -$GROMPP -f grompp.mdp -p topol.top -c ccl4-h2o.gro -maxwarn 10 -o ccl4-h2o.tpr> grompp.log 2>&1 +eval $GROMPP -f grompp.mdp -p $TOPOL -c ccl4-h2o.gro -maxwarn 10 -o ccl4-h2o.tpr> grompp.log 2>&1 echo "0 4 5" > masscom.dat echo "Using $GDENS ..." if [ -a ccl4-h2o.tpr ] ; then diff --git a/gmx_density.cpp b/gmx_density.cpp index 2e6dfcc..720491a 100644 --- a/gmx_density.cpp +++ b/gmx_density.cpp @@ -1192,11 +1192,11 @@ int GET_HISTO_INDEX(HISTO_TYPE TYPE,int phase, int layer, int molecular, int lin } } } - for(n=SUPPORT_PHASE+1;nnphases;n++){ // one (intrinsic) histogram for each of the other phases - if(molecular == ATOMIC && phase==n && TYPE==INTRINSIC_DENSITY) return index; - index++; + for(n=SUPPORT_PHASE+1;nnphases;n++){ // two (nonintrinsic + intrinsic) histogram for each of the other phases if(molecular == ATOMIC && phase==n && TYPE==LAYER_DISTRIBUTION) return index; index++; + if(molecular == ATOMIC && phase==n && TYPE==INTRINSIC_DENSITY) return index; + index++; } if (TYPE==INTRINSIC_ORDER) { exit(printf("Internal error: order profiles to be checked\n")); @@ -1226,22 +1226,22 @@ void plot_intrinsic_density(Histogram * histo,char **grpmname, const char * fn, fprintf(cid,"#column %d : position \n",column); column++; for (moltype=0;moltype<=MOLECULAR-ATOMIC;moltype++){ for(i=1;imaxlayers+1;i++){ - fprintf(cid,"#column %d : %s distribution %s layer %d\n",column,modif[moltype],grpmname[0],i); column++; - fprintf(cid,"#column %d : %s density %s layer %d\n",column,modif[moltype],grpmname[0],i); column++; + fprintf(cid,"#column %d : %s nonintr. dens. %s layer %d\n",column,modif[moltype],grpmname[0],i); column++; + fprintf(cid,"#column %d : %s intrins. dens. %s layer %d\n",column,modif[moltype],grpmname[0],i); column++; } } for(int add=0;addnadd_index;add++){ for (moltype=0;moltype<=MOLECULAR-ATOMIC;moltype++){ for(i=1;imaxlayers+1;i++){ - fprintf(cid,"#column %d : %s distribution %s layer %d\n",column,modif[moltype],grpmname[itim->ngmxphases+add],i); column++; - fprintf(cid,"#column %d : %s density %s layer %d\n",column,modif[moltype],grpmname[itim->ngmxphases+add],i); column++; + fprintf(cid,"#column %d : %s nonintr. dens. %s layer %d\n",column,modif[moltype],grpmname[itim->ngmxphases+add],i); column++; + fprintf(cid,"#column %d : %s intrins. dens. %s layer %d\n",column,modif[moltype],grpmname[itim->ngmxphases+add],i); column++; } } } for(n=SUPPORT_PHASE+1;nnbins;j++) {