Skip to content

Commit

Permalink
fixed histogram output names
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcello-Sega committed Oct 6, 2015
1 parent ed55d61 commit 7580f99
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
22 changes: 15 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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/"
Expand Down Expand Up @@ -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 $<TARGET_FILE_DIR:g_density>/examples/ccl4-h2o)


16 changes: 4 additions & 12 deletions examples/ccl4-h2o/RUN.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 9 additions & 9 deletions gmx_density.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,11 +1192,11 @@ int GET_HISTO_INDEX(HISTO_TYPE TYPE,int phase, int layer, int molecular, int lin
}
}
}
for(n=SUPPORT_PHASE+1;n<itim->nphases;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;n<itim->nphases;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"));
Expand Down Expand Up @@ -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;i<itim->maxlayers+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;add<itim->nadd_index;add++){
for (moltype=0;moltype<=MOLECULAR-ATOMIC;moltype++){
for(i=1;i<itim->maxlayers+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;n<nphases;n++){
fprintf(cid,"#column %d : %s distribution %s\n",column,modif[ATOMIC],grpmname[n]); column++;
fprintf(cid,"#column %d : %s density %s\n",column,modif[ATOMIC],grpmname[n]); column++;
fprintf(cid,"#column %d : %s nonintr. dens. %s\n",column,modif[ATOMIC],grpmname[n]); column++;
fprintf(cid,"#column %d : %s intrins. dens. %s\n",column,modif[ATOMIC],grpmname[n]); column++;
fflush(cid);
}
for(j=0;j<histo->nbins;j++) {
Expand Down

0 comments on commit 7580f99

Please sign in to comment.