diff --git a/scripts/vim2html.sh b/scripts/vim2html.sh index e8e891bf2a0d0f9cf8010be40db67135a94008c6..d39c2c23aec3a8e5d909e4cf2c474158e26dd290 100755 --- a/scripts/vim2html.sh +++ b/scripts/vim2html.sh @@ -18,7 +18,10 @@ Usage: Options can be: --annotate-syntax Reports annotated syntax on output. Also reports non-annotated regions on stderr - +--pdf To produce a pdf file with syntax highlighting. +--crop Crop the pdf file to the only written part. Usefull to insert the pdf in a LaTex file as image. +--fs Specify the fontsize of the pdf output. +--colors Specify the color palette. Allowed values are: default/ac EOF exit 0 fi @@ -31,12 +34,30 @@ fi annotate_syntax=no inputfile="" outputfile="" - +pdf=no +crop=no +fontsize=7.5 +prefix="" +colors="" for opt do - case "$opt" in + prefixopt="$prefix$opt" + prefix="" + case "$prefixopt" in (--annotate-syntax) annotate_syntax=yes ;; + (--pdf) + pdf=yes;; + (--crop) + crop=yes;; + (--fs) + prefix="--fs=";; + (--fs=*) + fontsize="${prefixopt#--fs=}";; + (--colors) + prefix="--colors=";; + (--colors=*) + colors="${prefixopt#--colors=}";; (-*) echo "ERROR: Unknown option $opt. Use -h for help." exit 1 ;; @@ -51,7 +72,6 @@ do fi esac done - temp="$( mktemp -dt plumed.XXXXX)" { @@ -64,45 +84,95 @@ fi | tr '\r' ' ' } | { cd $temp { -if [ "$annotate_syntax" = "yes" ]; then -vim - -c ":syntax off" \ +case "$colors" in +(ac) + cat > $temp/colors.vim << EOF +: set bg=dark +: hi Statement ctermfg=5 cterm=bold guifg=#ffff60 gui=none +: highlight Type ctermfg=2 cterm=bold +: hi Comment guifg=#80a0ff ctermfg=darkblue +: hi Constant ctermfg=red guifg=#ffa0a0 cterm=bold +EOF +;; +(*) + echo > $temp/colors.vim +;; +esac + +if [ "$pdf" = "yes" ]; then + +# this is a workaround for a bug in TOhtml +# that does not color properly when there are empty lines + sed "s/^$/ /" | + vim - -c ":syntax off" \ + -c ":source $VIMFILE" \ + -c ":source $temp/colors.vim" \ + -c ":set printoptions=header:0" \ + -c ":set printfont=courier:h$fontsize" \ + -c ":hardcopy > out.ps" \ + -c ":q!" 1> /dev/null 2> /dev/null +else + if [ "$annotate_syntax" = "yes" ]; then + + vim - -c ":syntax off" \ -c ":source $VIMFILE" \ -c ":call PlumedAnnotateSyntax()" \ -c ":wq! syntax.log" -c ":q!" 1> /dev/null 2> /dev/null -else -# this is a workaround for a bug in TOhtml -# that does not color properly when there are empty lines -sed "s/^$/ /" | -vim - -c ":syntax off" \ + else + # this is a workaround for a bug in TOhtml + # that does not color properly when there are empty lines + sed "s/^$/ /" | + vim - -c ":syntax off" \ -c ":source $VIMFILE" \ + -c ":source $temp/colors.vim" \ -c ":let g:html_use_css = 0" \ -c ":let g:html_no_progress" \ -c ":let g:html_number_lines = 1" \ -c ":TOhtml" \ -c ":wq! out.html" -c ":q!" 1> /dev/null 2> /dev/null + fi fi + + } } -if [ "$annotate_syntax" = "yes" ] ; then +if [ "$pdf" = "yes" ]; then + ps2pdf $temp/out.ps $temp/out.pdf + output="$temp/out.pdf" + if [ "$crop" = "yes" ]; then + pdfcrop $output $temp/outcrop.pdf + output="$temp/outcrop.pdf" + fi +else + if [ "$annotate_syntax" = "yes" ] ; then + output="$(awk '{if($1=="ANNOTATION") print}' $temp/syntax.log 2>/dev/null)" + error="$(awk '{if($1=="ERROR") print}' $temp/syntax.log >&2 2>/dev/null)" + else + output="$(cat $temp/out.html | sed 's|^<title>.*</title>$||' | sed 's|^<meta.*$||')" + fi +fi -output="$(awk '{if($1=="ANNOTATION") print}' $temp/syntax.log 2>/dev/null)" -error="$(awk '{if($1=="ERROR") print}' $temp/syntax.log >&2 2>/dev/null)" +if [ "$pdf" = "yes" ]; then + if [ -n "$outputfile" ] ; then + cp $output $outputfile + else + echo "You should specify an output file if using pdf opton!" + exit 1; + fi else -output="$(cat $temp/out.html | sed 's|^<title>.*</title>$||' | sed 's|^<meta.*$||')" + if [ -n "$outputfile" ] ; then + echo "$output" > "$outputfile" + else + echo "$output" + fi fi -if [ -n "$outputfile" ] ; then - echo "$output" > "$outputfile" -else - echo "$output" -fi - echo "$error" >&2 if [ -n "$error" ] ; then diff --git a/src/reference/DRMSD.h b/src/reference/DRMSD.h index 1747369bcf4d9da3589909d82d0809a008a287c6..f041a47cf638e6ef3f8d38a4d1a34f780e9524bb 100644 --- a/src/reference/DRMSD.h +++ b/src/reference/DRMSD.h @@ -31,18 +31,19 @@ namespace PLMD { class DRMSD : public SingleDomainRMSD { private: - bool bounds_were_set; bool nopbc; +protected: + bool bounds_were_set; double lower, upper; std::map< std::pair <unsigned,unsigned> , double> targets; - void setup_targets(); public: explicit DRMSD( const ReferenceConfigurationOptions& ro ); /// This sets upper and lower bounds on distances to be used in DRMSD void setBoundsOnDistances( bool dopbc, double lbound=0.0, double ubound=std::numeric_limits<double>::max( ) ); /// Check that similar comparisons are being performed - perhaps this is needed ask Davide? GAT // void check( ReferenceConfiguration* , ReferenceConfiguration* ); - void read( const PDB& ); + virtual void read( const PDB& ); + virtual void setup_targets(); void setReferenceAtoms( const std::vector<Vector>& conf, const std::vector<double>& align_in, const std::vector<double>& displace_in ); double calc( const std::vector<Vector>& pos, const Pbc& pbc, ReferenceValuePack& myder, const bool& squared ) const ; }; diff --git a/user-doc/Installation.txt b/user-doc/Installation.txt index a63b893481ef78cbacac65a13d571912ec01657e..6b52fde41a58d315f0b603ca900bfb81d8a4315a 100644 --- a/user-doc/Installation.txt +++ b/user-doc/Installation.txt @@ -504,6 +504,62 @@ Once ALMOST is installed, PLUMED 2 can then be configured with ALMOST enabled: \endverbatim with ALMOST_INSTALL_PATH set to the full path to the ALMOST installation folder. +\section installingonacluster Installing PLUMED on a cluster + +If you are installing PLUMED on a cluster and you want several users to take advantage of it +consider the following suggestions. + +First of all, we highly recommend using the module file that PLUMED provides to set up the environment. +Just edit it as necessary to make it suitable for your environment. + +Notice that PLUMED can take advantage of many additionaly features if specific libraries are available upon +compiling it. Install libmatheval first and check if PLUMED `./configure` is detecting it. Libmatheval is a must have with PLUMED. +If someone uses gromacs, install libxdrfile first and check if PLUMED `./configure` is detecting it. +PLUMED will be able to write trr/xtc file, simplifying analysis. + +Try to patch all MD codes with the `--runtime` option. This will allow independent update of PLUMED and MD codes. + Users will be able to combine any of the installed gromacs/amber/etc versions with any of the installed PLUMED versions. +Notice that it is sometime claimed that statically linked codes are faster. In our experience, this is not true. +In case you absolutely need a static executable, be ready to face non trivial linking issues. PLUMED is written in C++, +thus required the appropriate C++ library to be linked, and might require additional libraries (e.g. libmatheval). + +Sometime we make small fixes on the patches. For this reason, keep track of which version of PLUMED you used +to patch each of the MD code. Perhaps you can call the MD code modules with names such as `gromacs/4.6.7p1`, +`gromacs/4.6.7p2` and write somewhere in the module file which version of PLUMED you used. Alternatively, call them +something like `gromacs/4.6.7p2.2.0`. In this way, when we report a bug on the mailing list, users will know if the version +they are using is affected by it. + +Usually it is not necessary to install both a MPI and a non-MPI PLUMED version. PLUMED library only calls MPI functions +when the MD code is compiled with MPI. PLUMED executable calls MPI functions only when it is invoked without `--no-mpi`. +In many machines it is thus sufficient to run the plumed executable on the login node as +\verbatim +> plumed --no-mpi +\endverbatim +even though PLUMED was compiled with MPI and the login node does not support MPI. +The only case where you might need two different PLUMED installation for compute +and login node is when you are cross compiling. + +PLUMED needs to be well optimized to run efficiently. +If you need a single PLUMED binary to run efficiency on machines with different levels of hardware (e.g.: some +of your workstations support AVX and some do not), with intel compiler you can use something like +\verbatim +./configure CXX=mpicxx CXXFLAGS="-O3 -axSSE2,AVX" +\endverbatim +It will take more time to compile but it will allow you to use a single module. Otherwise, you should install two +PLUMED version with different optimization levels. + +Using modules, it is not necessary to make the PLUMED module explicitly dependent on the used library. Imagine a +scenario where you first installed a module `libmatheval`, then load it while you compile PLUMED. If you +provide the following option to configure `LDFLAGS="-Wl,-rpath,$LD_LIBRARY_PATH"`, the PLUMED executable and +library will remember where libmatheval is, without the need to load libmatheval module at runtime. +Notice that this trick often does not work for fundamental libraries such as C++ and MPI library. As a consequence, +usually the PLUMED module should load the compiler and MPI modules. + +\attention +In case you found out how to compile PLUMED on some fancy architecture please share your tricks! You can +either post it in your blog, send it to the mailing list, or ask as to update this paragraph in the manual, we will +be happy to do so. + \section installinghints Other hints We here collect a list of suggestions that might be useful on particular diff --git a/vim/vimsyntax.sh b/vim/vimsyntax.sh index 4b6d0b4922f56775701cf8d324e3027e8bc5703b..b0d04cf26bf63d2c4b68a742bcaa30bfb8d0501b 100755 --- a/vim/vimsyntax.sh +++ b/vim/vimsyntax.sh @@ -26,8 +26,8 @@ endif let b:current_syntax="plumedf" if exists("g:plumed_shortcuts") - map <F3> :PMinus<CR> - map <F4> :PPlus<CR> + noremap <buffer> <F3> :PMinus<CR> + noremap <buffer> <F4> :PPlus<CR> endif command! -nargs=0 -count=1 PPlus call PlumedMove(<count>) @@ -145,15 +145,15 @@ endif let b:current_syntax="plumed" if exists("g:plumed_shortcuts") - noremap <F2> <Esc>:PHelp<CR> - inoremap <F2> <C-o>:PHelp<CR> + noremap <buffer> <F2> :PHelp<CR> + inoremap <buffer> <F2> <Esc>:PHelp<CR> endif " path for plumed plugin let s:path=expand('<sfile>:p:h:h') " All except space and hash are in word -set iskeyword=33,34,36-126 +setlocal iskeyword=33,34,36-126 " Matching dots, possibly followed by a comment " Only dots are part of the match @@ -329,6 +329,10 @@ fun! PlumedContextManual() execute 'rightbelow split | view ' name endif let b:plumed_helpfile=1 +" this is to allow closing the window with F2 + if exists("g:plumed_shortcuts") + noremap <buffer> <F2> :PHelp<CR> + endif endif endfunction