diff --git a/.travis/pushdoc b/.travis/pushdoc index 504e580bade827b40ebd52baccc2e18676f00d07..712107e7b4012ca3f8f9983004a06f7844d21d3e 100755 --- a/.travis/pushdoc +++ b/.travis/pushdoc @@ -3,16 +3,23 @@ set -e set -x -if [[ "$TRAVIS_BRANCH" =~ ^v2\.[0-9]+$ ]] ; then -# TODO: this should be made automatic by reading the CHANGES/*.txt files: - if [ "$TRAVIS_BRANCH" = v2.0 ] || [ "$TRAVIS_BRANCH" = v2.1 ] || [ "$TRAVIS_BRANCH" = v2.2 ] ; then - branchtype=unsupported +GIT_OWNER=$( echo $TRAVIS_REPO_SLUG | sed "s/\/.*$//" ) +GIT_REPO=$( echo $TRAVIS_REPO_SLUG | sed "s/^.*\///" ) + +if [ "$GIT_OWNER" = plumed ] ; then + if [[ "$TRAVIS_BRANCH" =~ ^v2\.[0-9]+$ ]] ; then + # TODO: this should be made automatic by reading the CHANGES/*.txt files: + if [ "$TRAVIS_BRANCH" = v2.0 ] || [ "$TRAVIS_BRANCH" = v2.1 ] || [ "$TRAVIS_BRANCH" = v2.2 ] ; then + branchtype=unsupported + else + branchtype=official + fi + elif [ "$TRAVIS_BRANCH" = master ] ; then + branchtype=master else - branchtype=official + branchtype=unofficial fi -elif [ "$TRAVIS_BRANCH" = master ] ; then - branchtype=master -else +else branchtype=unofficial fi @@ -47,27 +54,37 @@ This is an auto redirect page. </html> EOF +if test -z "${GIT_BOT}" +then + export GIT_BOT=plumedbot +fi + +if test -z "${GIT_BOT_EMAIL}" +then + export GIT_BOT_EMAIL=giovanni.bussi+plumedbot@gmail.com +fi + git init -git config user.email "giovanni.bussi+plumedbot@gmail.com" -git config user.name "plumedbot" +git config user.email "${GIT_BOT_EMAIL}" +git config user.name "${GIT_BOT}" git checkout -b gh-pages # this is not to show the GIT_TOKEN on Travis log set +x -git remote add doc https://plumedbot:$GIT_TOKEN@github.com/plumed/doc-${TRAVIS_BRANCH}.git +git remote add doc https://${GIT_BOT}:$GIT_TOKEN@github.com/$GIT_OWNER/doc-${TRAVIS_BRANCH}.git set -x cat > README.md << EOF Precompiled manual for PLUMED ${TRAVIS_BRANCH} ----------------------------- This repository hosts a precompiled manual for [PLUMED](http://www.plumed.org) ${TRAVIS_BRANCH}, -git revision [$hash](https://github.com/plumed/plumed2/commit/$hash). +git revision [$hash](https://github.com/${GIT_OWNER}/${GIT_REPO}/commit/$hash). -This manual has been compiled on [travis](http://travis-ci.org/plumed/plumed2) on $(date). +This manual has been compiled on [travis](http://travis-ci.org/${GIT_OWNER}/${GIT_REPO}) on $(date). -To browse the manual you should go [here](http://plumed.github.io/doc-${TRAVIS_BRANCH}). +To browse the manual you should go [here](http://${GIT_OWNER}.github.io/doc-${TRAVIS_BRANCH}). You can also download a full copy of the manual for offline access -at [this link](http://github.com/plumed/doc-${TRAVIS_BRANCH}/archive/gh-pages.zip). +at [this link](http://github.com/${GIT_OWNER}/doc-${TRAVIS_BRANCH}/archive/gh-pages.zip). EOF @@ -99,6 +116,6 @@ set -x esac git add --all . -git commit -m "Update to plumed/plumed2@$hash" +git commit -m "Update to ${GIT_OWNER}/${GIT_REPO}@$hash" # -q and 2> is not to show the GIT_TOKEN on Travis log git push -q -f doc gh-pages 2> /dev/null diff --git a/developer-doc/usingDoxygen.md b/developer-doc/usingDoxygen.md index b5df9683204c730c4df5d143b6feaf2625b7fdee..0708548f1102a21fb3bb493e22009d67ea2e8e26 100644 --- a/developer-doc/usingDoxygen.md +++ b/developer-doc/usingDoxygen.md @@ -501,5 +501,21 @@ unofficial or unsupported branch (see .travis/pushdoc script). Bottom line: when you make a commit where you modified the manual and you want the online manual to be updated, add [makedoc] in the commit log. After ten minutes or so the manual should be up to date, remember to double check on the web -and to revert the commit if there are errors! - +and to revert the commit if there are errors! + +It is possible to generate PLUMED manuals for your own personal forks +using a similar procedure as described above. +For this to work you need to enable Travis CI for your forked repository +and define appropriately the environment variables on Travis CI. +The github account used to automatically push the generated manuals +should be defined using the GIT_BOT variable, +preferably this should be a dummy account. A github token +enabling html access for that account should be defined using the GIT_TOKEN variable. +Furthermore, you need to define an email address associated to the account using the GIT_BOT_EMAIL variable. +It is better to make all these environment variable hidden such that they are +not shown in the public logs on travis-ci.org. +To generate a manual for a specific branch you need to create a repository +USERNAME/doc-NAMEOFTHEBRANCH and give write access to the account given in +GIT_BOT. The generated manuals will be accessible on +https://USERNAME.github.io/doc-NAMEOFTHEBRANCH. Note that manuals generated in +this way will always be labeled as unofficial and not shown in search engine results. diff --git a/regtest/basic/rt-dimer-1/plumed.dat b/regtest/basic/rt-dimer-1/plumed.dat index 10dce80499b695a07f7e3ea8f98bede1b866c878..da50311efcae7859d573180c60cd7eceb6810791 100644 --- a/regtest/basic/rt-dimer-1/plumed.dat +++ b/regtest/basic/rt-dimer-1/plumed.dat @@ -1,4 +1,7 @@ -dim: DIMER NATOMS=22 ATOMS=1,3,14,17 Q=0.5 TEMP=300 DSIGMA=0.002 +GROUP ATOMS=1,3,14,17 LABEL=d1g1 +GROUP ATOMS=23,25,36,39 LABEL=d1g2 + +dim: DIMER ATOMS1=d1g1 ATOMS2=d1g2 Q=0.5 TEMP=300 DSIGMA=0.002 DUMPDERIVATIVES ARG=dim STRIDE=1 FILE=deriv FMT=%8.4f PRINT ARG=dim FILE=colvar FMT=%8.4f diff --git a/src/colvar/Dimer.cpp b/src/colvar/Dimer.cpp index baead008e84b7b611fc71e5aed2f5cfa8f139417..378cf8c855c270a19019b6efa89894433d925288 100644 --- a/src/colvar/Dimer.cpp +++ b/src/colvar/Dimer.cpp @@ -96,21 +96,24 @@ the total number of atoms: dim: DIMER TEMP=300 Q=0.5 ALLATOMS DSIGMA=0.002 NOVSITES \endplumedfile -The NOVSITES flag is not required if one provides the atom serial of each Dimer. This is -defined as the atom serial of the first bead of the dimer and is thus a number between 1 and N. -Along with the ATOMS list also the number N of lines describing the first beads has to be given. -For example, the Dimer interaction energy of dimers 1,5,7 is: +The NOVSITES flag is not required if one provides the atom serials of each Dimer. These are +defined through two atomlists provided __instead__ of the ALLATOMS keyword. +For example, the Dimer interaction energy of dimers specified by beads (1;23),(5;27),(7;29) is: \plumedfile -dim: DIMER TEMP=300 Q=0.5 NATOMS=N ATOMS=1,5,7 DSIGMA=0.002 +dim: DIMER TEMP=300 Q=0.5 ATOMS1=1,5,7 ATOMS2=23,27,29 DSIGMA=0.002 \endplumedfile +Note that the ATOMS1,ATOMS2 keywords can support atom groups and +interval notation as defined in \ref GROUP. + + In a Replica Exchange simulation the keyword DSIGMA can be used in two ways: if a plumed.n.dat file is provided for each replica, then DSIGMA is passed as a single value, like in the previous examples, and each replica will read its own DSIGMA value. If a unique plumed.dat is given, DSIGMA has to be a list containing a value for each replica. For 4 replicas: \plumedfile -dim: DIMER TEMP=300 Q=0.5 NATOMS=N ATOMS=1,5,7 DSIGMA=0.002,0.002,0.004,0.01 +dim: DIMER TEMP=300 Q=0.5 ATOMS1=1,5,7 ATOMS2=23,27,29 DSIGMA=0.002,0.002,0.004,0.01 \endplumedfile @@ -136,12 +139,14 @@ public: virtual void calculate(); protected: bool trimer,useall; - int myrank, nranks, natoms; + int myrank, nranks; double qexp,temperature,beta,dsigma; vector<double> dsigmas; private: void consistencyCheck(); - vector<int> usedatoms; + vector<AtomNumber> usedatoms1; + vector<AtomNumber> usedatoms2; + }; PLUMED_REGISTER_ACTION(Dimer, "DIMER") @@ -154,8 +159,8 @@ void Dimer::registerKeywords( Keywords& keys) { keys.add("compulsory","DSIGMA","The interaction strength of the dimer bond."); keys.add("compulsory", "Q", "The exponent of the dimer potential."); keys.add("compulsory", "TEMP", "The temperature (in Kelvin) of the simulation."); - keys.add("atoms", "ATOMS", "The list of atoms being considered by this CV. Used if ALLATOMS flag is missing"); - keys.add("atoms","NATOMS","The number of dimerized atoms. Used in combination with ATOMS list"); + keys.add("atoms", "ATOMS1", "The list of atoms representing the first bead of each Dimer being considered by this CV. Used if ALLATOMS flag is missing"); + keys.add("atoms", "ATOMS2", "The list of atoms representing the second bead of each Dimer being considered by this CV. Used if ALLATOMS flag is missing"); keys.addFlag("ALLATOMS", false, "Use EVERY atom of the system. Overrides ATOMS keyword."); keys.addFlag("NOVSITES", false, "If present the configuration is without virtual sites at the centroids."); @@ -193,6 +198,7 @@ Dimer::Dimer(const ActionOptions& ao): if(useall) { // go with every atom in the system but not the virtuals... + int natoms; if(trimer) natoms= 2*getTotAtoms()/3; else @@ -207,27 +213,23 @@ Dimer::Dimer(const ActionOptions& ao): } else // serials for the first beads of each dimer are given { - parseVector("ATOMS",usedatoms); - double ntm; - parse("NATOMS",ntm); - natoms=ntm; + parseAtomList("ATOMS1",usedatoms1); + parseAtomList("ATOMS2",usedatoms2); - int isz = usedatoms.size(); + int isz1 = usedatoms1.size(); - for(unsigned int i=0; i<isz; i++) + for(unsigned int i=0; i<isz1; i++) { AtomNumber ati; - ati.setIndex(usedatoms[i]-1); + ati.setIndex(usedatoms1[i].index()); atoms.push_back(ati); - } - for(unsigned int i=0; i<isz; i++) + int isz2 = usedatoms2.size(); + for(unsigned int i=0; i<isz2; i++) { AtomNumber atip2; - atip2.setIndex(usedatoms[i]+natoms-1); - if(usedatoms[i]>natoms) - error("The Dimer CV requires that when choosing atoms you refere only to the first beads."); + atip2.setIndex(usedatoms2[i].index()); atoms.push_back(atip2); } @@ -237,11 +239,8 @@ Dimer::Dimer(const ActionOptions& ao): beta = 1./(kBoltzmann*temperature); addValueWithDerivatives(); // allocate - requestAtoms(atoms); - setNotPeriodic(); - } void Dimer::calculate() @@ -302,13 +301,15 @@ These are checked here and PLUMED error handlers are (eventually) called. ******************/ void Dimer::consistencyCheck() { - if(useall==false && natoms==0) - error("Either NATOMS or ATOMS are required to specify the number of dimerized atoms."); + if(!useall && usedatoms1.size()!=usedatoms2.size()) + error("The provided atom lists are of different sizes."); if(qexp<0.5 || qexp>1) warning("Dimer CV is meant to be used with q-exponents between 0.5 and 1. We are not responsible for any black hole. :-)"); + if(dsigma<0) error("Please use positive sigma values for the Dimer strength constant"); + if(temperature<0) error("Please, use a positive value for the temperature...");