From e6b6dfab9cd7519abf7cc232ab04d0321ec1ea6c Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Sat, 15 Dec 2018 00:19:25 +0000
Subject: [PATCH] Added functionality to check spellings in changelog

---
 user-doc/go-spelling         |  27 ++-
 user-doc/spelling_words.dict | 318 +++++++++++++++++++++++++++++++++++
 2 files changed, 331 insertions(+), 14 deletions(-)

diff --git a/user-doc/go-spelling b/user-doc/go-spelling
index 3f5c47447..8138d521c 100755
--- a/user-doc/go-spelling
+++ b/user-doc/go-spelling
@@ -2,7 +2,6 @@
 
 rm -rf spelling
 mkdir spelling
-mkdir spelling/automatic
 # Get names of all actions and command line tools
 ../src/lib/plumed --no-mpi manual --action=ABMD > /dev/null 2> spelling/keywords
 cat spelling/keywords | grep -v "LIST OF" | awk '{if(NF>0) print $1}' > spelling/pkeys
@@ -19,34 +18,34 @@ echo personal_ws-1.1 en $nsafewords > ./spelling/allwords.dict
 cat spelling/keywords spelling/allkeys spelling_words.dict >> spelling/allwords.dict
 
 # This is everything we have done thus far
-for file in *PP.md automatic/*.txt ; do
+for file in *PP.md automatic/*.txt ../CHANGES/*.md tutorials/*.txt tutorials/*.site tutorials/others/*.txt ; do
     echo Checking spelling for file $file
+    splits=`echo $file | sed -e 's/\// /g'`
+    nf=`echo $splits | awk '{print NF}'`
+    fname=`echo $splits | awk -v n=$nf '{print $n}'` 
     # This is some stuff to get rid of stuff that trips up the spell checker: the equations and the plumed examples 
-    cat $file | sed -e 's/psi-1//' | sed -e 's/-#//' | sed -e 's/@//' | sed -e 's/&//' | sed -e 's/\vdots//' | 
+    cat $file | grep -v "\\image" | grep -v "anchor" | sed -e 's/psi-1//' | sed -e 's/-#//' | sed -e 's/@//' | sed -e 's/&//' | sed -e 's/\vdots//' | 
     awk 'BEGIN{inp=0}{
-          if($1=="\\endplumedfile" || $1=="\\f]" || $1=="\\f}" || $1=="\\endverbatim"){inp=0;}
-          else if($1=="\\plumedfile" || $1=="\\f[" || $1=="\\f{eqnarray*}{" || $1=="\\verbatim"){inp=1;}
+          if($1=="\\endplumedfile" || $1=="\\f]" || $1=="\\f}" || $1=="\\endverbatim" || $1=="\\endcode"){inp=0;}
+          else if($1=="\\plumedfile" || $1=="\\f[" || $1=="\\f{eqnarray*}{" || $1=="\\verbatim" || index($1,"\\code{")!=0 ){inp=1;}
           else if(inp==0){
             skip=0;
             for(i=1;i<=NF;++i){ 
                 if(skip==1){ skip=0; }
-                else if($i=="\\cite" || $i=="\\ref" || $i=="\\page" || $i=="subpage" || $i=="\\subpage" || $i=="\\section" || $i=="\\subsection" || $i=="\\link" ){ skip=1; }
-                else if(index($i, "\\f$")==0 && index($i,"http")==0 ) { printf(" %s",$i); }
+                else if($i=="\\subsubsection" || $i=="\\cite" || $i=="\\ref" || $i=="\\page" || $i=="subpage" || $i=="\\subpage" || $i=="\\section" || $i=="\\subsection" || $i=="\\link" ){ skip=1; }
+                else if(index($i, "\\f$")==0 && index($i,"http")==0 && index($i,".py")==0 ) { printf(" %s",$i); }
             }
             printf("\n");
           }
-          }' > spelling/$file.md
+          }' > spelling/$fname.md
 
     # Check for spelling mistakes
-    tail -n +2 spelling/$file.md | grep -v "*/" | aspell pipe -H --dont-suggest --personal=./spelling/allwords.dict | grep -v '*' | grep -v "International Ispell" | awk '{if(NF>0) print $0}' > spelling/$file.err
-    nerrors=`wc -l spelling/$file.err | awk '{print $1}'`
+    tail -n +2 spelling/$fname.md | grep -v "*/" | aspell pipe -H --dont-suggest --personal=./spelling/allwords.dict | grep -v '*' | grep -v "International Ispell" | awk '{if(NF>0) print $0}' > spelling/$fname.err
+    nerrors=`wc -l spelling/$fname.err | awk '{print $1}'`
     # Crash out if there are spelling mistakes
     if [ $nerrors -gt 0 ] ; then 
        echo "Found spelling mistakes in documentation file $file" 
-       cat spelling/$file.err
+       cat spelling/$fname.err
        exit 1
     fi
 done
-
-# These are other files we want to check
-# ls tutorials/*.txt tutorials/others/*.txt ../CHANGES/*.md 
diff --git a/user-doc/spelling_words.dict b/user-doc/spelling_words.dict
index e40c7d996..ceaa584fd 100644
--- a/user-doc/spelling_words.dict
+++ b/user-doc/spelling_words.dict
@@ -143,6 +143,7 @@ Trp
 Valsson
 Variationally
 variationally
+variational
 vatom
 ves
 VES
@@ -575,3 +576,320 @@ DBUILD
 DGMX
 mdrun
 Ralf
+NPT
+setMPIFIntercomm
+setMPIFIntracomm
+cmd
+setStopFlag
+GPUs
+Giorgino
+symlink
+CMAP
+getBias
+BiasValue
+plumednotmaintained
+Hamiltonians
+dfc
+Abhi
+argname
+setmintozero
+PLMD
+CoordinationBase
+GPL
+BG
+gettimeofday
+LAMMPS
+Swails
+CFLAGS
+cppcheck
+lbz
+LIBSUFFIX
+bluegene
+linux
+molinfo
+readdir
+argnumber
+Parrinello
+Tiwary
+vesselbase
+MultiValue
+lapack
+DESTDIR
+num
+autotools
+cpt
+parallelization
+UNNORMALIZED
+AtomValuePack
+CP
+Ley
+endline
+crystallisation
+performTask
+crystallisation
+VectorMultiColvar
+ifdef
+ActionWithVessel
+NaN
+IMD
+Piaggi
+Domanski
+mpirun
+checkpointing
+componentWithDerivatives
+setBias
+setMDMassUnits
+setMDChargeUnits
+readInputLine
+performCalcNoUpdate
+doCheckPoint
+const
+Doxygen
+NaNs
+LatticeReduction
+Massimiliano
+Capitan
+Portfiles
+ccache
+xdr
+astyle
+exitcode
+DYLD
+Culpo
+plumedcheck
+El
+ASYNC
+conda
+symmetrize
+Nava
+Dama
+Pazurikova
+gettimeofdate
+gettime
+chrono
+changelog
+LDSO
+LDSHARED
+libplumedWrapper
+pkgconfig
+makefile
+MPIEXEC
+installcheck
+SIMD
+glycine
+LDSHARED
+PDB
+SCEXP
+MAXFACTOR
+pABF
+Marquardt
+Hozzova
+atan
+ptr
+cxx
+namespace
+Bsymbolic
+PWD
+rdynamic
+vmd
+solvated
+endhidden
+trieste
+glycosidic
+NVT
+autocorrelation
+monte
+carlo
+rangle
+langle
+Alanine
+dipeptide
+alanine
+wdimer
+mdp
+vacuo
+diala
+von
+Ramachandran
+munster
+equilibrate
+ILDN
+ala
+binless
+demuxed
+demuxing
+trajout
+xvg
+ALLBIAS
+fulltraj
+analine
+discretize
+cmyc
+Cmyc
+BRCA
+edist
+comdist
+inhomogeneous
+Arieh
+Warshel
+ActionWithArguments
+MSD
+rama
+commmittor
+gplt
+SMD
+Nucleophillic
+HETATM
+trjcat
+rototranslations
+GISMO
+vmdrc
+grompp
+nsteps
+plotme
+Verlet
+Jarzyinsi
+integrators
+JARZ
+equilibrated
+thermalization
+sigmoid
+TOPO
+PTMetaD
+WTE
+configurational
+BEMETA
+METAGUI
+metagui
+Microstates
+microstate
+Gervasio
+Laio
+Raiteri
+Micheletti
+Marinelli
+et
+al
+cv
+Biarnes
+Teq
+Ttot
+rotameric
+microstates
+Vendruscolo
+Baftizadeh
+Piana
+Leu
+WTBX
+Kullback
+Lieber
+Symmetrized
+Cossio
+Proc
+Acad
+Comun
+Comput
+PLOS
+Ile
+VIL
+zwitterionic
+replex
+NBIASEDCV
+BIASEDCV
+PLoS
+Commun
+gnp
+TRP
+Ubiquitin
+Cavalli
+JCTC
+Weare
+Boomsma
+Lindorff
+Ferkinghoff
+Lectner
+FCC
+Ceriotti
+Cheng
+Simul
+Trudu
+Donadio
+Quigley
+Lett
+judgement
+cambridge
+Chignolin
+MPhil
+WTMetaD
+sb
+di
+CINECA
+cineca
+topolA
+topolB
+uncompressing
+cmap
+Topologies
+topologies
+nstlist
+Julich
+doxygen
+Valgrind
+polymorphism
+biomolecular
+isocommittor
+pca
+Crumlin
+biomolecule
+biomolecules
+Francesco
+NOHILLS
+BIASXMD
+STEERPLAN
+UWALL
+LWALL
+WATERBRIDGE
+RGYR
+ELSTPOT
+RDF
+ADF
+Bussi
+Cunha
+topolAwat
+topolBwat
+charmm
+eef
+impl
+pbmetad
+univocally
+deconvolve
+EGAAWAASS
+jcouplings
+ReweightDistance
+ReweightBoth
+gpi
+sed
+metad
+targetdistribution
+plotCoeffs
+plotFes
+plotTargetDistrib
+BiasedDistribution
+runRestart
+coeff
+Kolmogorov
+Smirnov
+airebo
+scipy
+statsmodels
+AIREBO
+newmovie
+DynamicBonds
+VDW
+hyperdynamics
+MANYBODY
+RW
+fullerene
+fpt
+ECDF
+CDF
-- 
GitLab