diff --git a/.travis.yml b/.travis.yml index 298ddb7bddcdfd5dbf9bd20d014ebea5877b7a20..927ad4d68bf6f7d7b29122687c019436d58cc1f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,6 +85,8 @@ install: - if test "$CPPCHECK" == yes ; then ./.travis/install.cppcheck $CPPCHECK_VERSION ; fi # for plumedcheck I need latest gawk - if test "$CPPCHECK" == yes ; then ./.travis/install.gawk 4.1.4 ; fi +# for plumedcheck I need astyle + - if test "$CPPCHECK" == yes ; then make -j 4 -C astyle ; fi # installation of these packages takes a lot of time # we do it only when needed - if test "$PLUMED_CXX" == "mpic++" -a "$TRAVIS_OS_NAME" == "linux" ; then sudo apt-get install -y libopenmpi-dev openmpi-bin ; fi diff --git a/CHANGES/v2.3.txt b/CHANGES/v2.3.txt index b8b36e4341ce2396cd0183370797b6cd2175b8ed..3ca2505ba2d1dd586d44d22301525e6299608da3 100644 --- a/CHANGES/v2.3.txt +++ b/CHANGES/v2.3.txt @@ -162,5 +162,7 @@ See branch \branch{v2.3} on git repository. For developers: - plumedcheck validation has been made stricter. All the checks are now described in the developer manual. +- IMPORTANT: we started to enforce code formatting using astyle. Check the developer documentation to learn how to + take care of not-yet-formatted branches. */ diff --git a/README.md b/README.md index 00d71211a1cab0a8d6fc0b98f8e5b86e9d9ee021..4a619ac3195ebc6019e52d74b5f310e468808bf0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,57 @@ +Branches and releases +--------------------- + +Several branches and tags are stored on the git repository. + +Branches named `v2.X` correspond to release branches. + +Master branch may contain non tested features and is not expected to be used by non-developers. +It typically contains features that will be available on the next release. + +Tags named `v2.XbY` correspond to beta releases, use it with care. +Tags named `v2.X.Y` correspond to official releases, use the latest available. + +In addition, the repository contains a number of other branches related to specific features. +Please contact the developers that are committing on those branches before basing your work +there, since they might contain temporary work and might be rebased later. +For instance, branch `testdoc` is setup so as to push a test copy of the manual +and is often force pushed. + +To report problems found on beta or official releases, use the normal +[plumed-users@googlegroups.com](mailto:plumed-users@googlegroups.com) +mailing list. Please state exactly which version you are using. +To report problems found on `master` branch, use the +[plumed2-git@googlegroups.com](plumed2-git@googlegroups.com) mailing list. +This is also the correct place for discussions about new features etc. +When reporting please provide the git hash (you can obtain it with `git rev-parse HEAD`). + +Status +------ + +Below you find the status on [Travis-CI](http://travis-ci.org/plumed/plumed2) for the release branches. + +| Branch | Status | First stable release | Still supported | +|:--------:|:-------------:|:--------:|:------:| +| master | [](https://travis-ci.org/plumed/plumed2) | v2.4 is expected late 2017 | / | +| v2.3 | [](https://travis-ci.org/plumed/plumed2) | Dec 12, 2016 | yes | +| v2.2 | [](https://travis-ci.org/plumed/plumed2) | Oct 13, 2015 |no | +| v2.1 | [](https://travis-ci.org/plumed/plumed2) | Sep 9, 2014 | no | +| v2.0 | Not available | Sep 27, 2013 | no | Content ------- - CHANGES/ : change log +Here's a description of the content of each file and directory in the root PLUMED directory. + + CHANGES : change log COPYING.LESSER : license Makefile : makefile Makefile.conf.in : template configuration makefile PEOPLE : list of authors README : this file VERSION : version file - configurations/ : template configuration files + astyle : a local version of astyle, used to format code + configurations : template configuration files configure : configuration script configure.ac : configuration script (autoconf) developer-doc : developer documentation @@ -20,30 +62,27 @@ Content regtest : regression tests, including reference results scripts : shell tools src : source code - sourceme.sh : template configuration script + sourceme.sh.in : template configuration script test : examples user-doc : user documentation vim : directory where vim syntax is generated -Install -------- - -Extensive installation instructions are in the user documentation. -Links to precompiled versions of the documentation can be found [here](http://www.plumed.org/documentation). +Required software +----------------- Required software: -* GNU make +* GNU make. * C/c++ compiler (c++11 support is required as of version 2.4). -* A modern version of the `patch` command line tool -* Support for POSIX library `dirent.h` -* `xxd` (present in most unix distributions) +* A modern version of the `patch` command line tool. +* Support for POSIX library `dirent.h`. +* `xxd` (present in most UNIX distributions). Suggested software (libraries are checked by `./configure` and enabled if available): -* Optimized blas and lapack libraries. Can be replaced by an internal version if not available. * MPI library to run parallel simulations. It should be the same library used by your MD code. -* [VMD molfile plugins](http://www.ks.uiuc.edu/Research/vmd/plugins) to read arbitrary file formats. Can be replaced by an internal version supporting a few formats if not available. +* Optimized blas and lapack libraries. They are automatically replaced by an internal version if not available. +* [VMD molfile plugins](http://www.ks.uiuc.edu/Research/vmd/plugins) to read arbitrary file formats. They are automatically replaced by an internal version supporting a few formats if not available. * [Matheval library](http://www.gnu.org/software/libmatheval) to use algebraic collective variables. * [Zlib library](http://zlib.net/) to use compressed data files. * [Xdrfile library](http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library) to have read/write access to gromacs @@ -56,6 +95,7 @@ Suggested software (libraries are checked by `./configure` and enabled if availa Quick compilation instructions ------------------------------ +Extensive installation instructions are in the [user documentation](http://www.plumed.org/documentation). Configure for your system ./configure --prefix=$HOME/opt @@ -74,12 +114,14 @@ The `plumed` executable should be now in your execution path plumed help -Compile the manuals (pre-compiled manual is available online): +Compile the manuals. make doc User documentation can be found at `user-doc/html/index.html`. Developer documentation can be found at `developer-doc/html/index.html`. +[Pre-compiled documentation](http://www.plumed.org/documentation) is available online, so this is only required +if you are working with a modified version of the code! Install PLUMED in `$HOME/opt` (directory should be set during `./configure`): @@ -87,38 +129,4 @@ Install PLUMED in `$HOME/opt` (directory should be set during `./configure`): make install A sample modulefile with environment variable will be placed in -`$HOME/opt/lib/plumed/src/lib/modulefile`. Path to the installed documentation can be found with command `plumed info --user-doc`. - - -Branches and releases ---------------------- - -Several branches and tags are stored on the git repository. - -Branches named `v2.X` correspond to release branches. - -Master branch may contain non tested features and is not expected to be used by non-developers. -It typically contains features that will be available on the next release. - -Tags named `v2.XbY` correspond to beta releases, use it with care. -Tags named `v2.X.Y` correspond to official releases, use the latest available. - -To report problems found on beta or official releases, use the normal `plumed-users@googlegroups.com` -mailing list. Just state exactly which version you are using. - -To report problems found on `master` branch, use the `plumed2-git@googlegroups.com` mailing list. -This is also the correct place for discussions about new features etc. -When reporting please provide the git hash (you can obtain it with `git rev-parse HEAD`). - -Status ------- - -| Branch | Status | Supported | -|:--------:|:-------------:|:--------:| -| master | [](https://travis-ci.org/plumed/plumed2) | yes | -| v2.3 | [](https://travis-ci.org/plumed/plumed2) | yes | -| v2.2 | [](https://travis-ci.org/plumed/plumed2) | no | -| v2.1 | [](https://travis-ci.org/plumed/plumed2) | no | -| v2.0 | Not available | no | - - +`$HOME/opt/lib/plumed/src/lib/modulefile`. If you compiled your own documentation, paths to the installed documentation can be found with command `plumed info --user-doc`. diff --git a/src/colvar/Gyration.cpp b/src/colvar/Gyration.cpp index 5cf35aea068468d6c4dd3a8a291392d4d4deace3..791f6a3ed81b0f950c5f430218ee545887703201 100644 --- a/src/colvar/Gyration.cpp +++ b/src/colvar/Gyration.cpp @@ -149,10 +149,13 @@ Gyration::Gyration(const ActionOptions&ao): if(rg_type>TRACE) log<<" Bibliography "<<plumed.cite("JiriĚ Vymetal and JiriĚ Vondrasek, J. Phys. Chem. A 115, 11455 (2011)"); log<<"\n"; log.printf(" atoms involved : "); - for(unsigned i=0; i<atoms.size(); ++i) log.printf("%d ",atoms[i].serial()); + for(unsigned i=0; i<atoms.size(); ++i) { + if(i%25==0) log<<"\n"; + log.printf("%d ",atoms[i].serial()); + } log.printf("\n"); - if(!nopbc) { + if(nopbc) { log<<" PBC will be ignored\n"; } else { log<<" broken molecules will be rebuilt assuming atoms are in the proper order\n"; diff --git a/src/core/SetupMolInfo.cpp b/src/core/SetupMolInfo.cpp index 662ddfb1c452cdaff2652c8bc7d212a22d016d43..ece94a7f09d65c1158ee33755b41c2a36e21f6f0 100644 --- a/src/core/SetupMolInfo.cpp +++ b/src/core/SetupMolInfo.cpp @@ -43,7 +43,7 @@ void SetupMolInfo::registerKeywords( Keywords& keys ) { keys.add("compulsory","STRUCTURE","a file in pdb format containing a reference structure. " "This is used to defines the atoms in the various residues, chains, etc . " "For more details on the PDB file format visit http://www.wwpdb.org/docs.html"); - keys.add("compulsory","MOLTYPE","protein","what kind of molecule is contained in the pdb file"); + keys.add("compulsory","MOLTYPE","protein","what kind of molecule is contained in the pdb file - usually not needed since protein/RNA/DNA are compatible"); keys.add("atoms","CHAIN","(for masochists ( mostly Davide Branduardi ) ) The atoms involved in each of the chains of interest in the structure."); } diff --git a/src/function/Target.cpp b/src/function/Target.cpp index 12630e43bc2b5b4711e593c1ead01d9b2d3f3c4c..5ce91249563a68b9599abf0806d02b3aa7c95f65 100644 --- a/src/function/Target.cpp +++ b/src/function/Target.cpp @@ -45,7 +45,7 @@ d(X,X') = \vert X - X' \vert where \f$ X \f$ is the instaneous values for a set of collective variables for the system and \f$ X' \f$ is the values that these self-same set of collective variables take in some reference structure provided as input. -If we call our set of collective variables \f$\{s_i\}f\$ then this CV computes: +If we call our set of collective variables \f$\{s_i\}\f$ then this CV computes: \f[ d = \sqrt{ \sum_{i=1}^N (s_i - s_i^{(ref)})^2 } diff --git a/src/generic/Group.cpp b/src/generic/Group.cpp index 0403d6b76198ccd7c8ef614e0668570bd07fa5f6..80393a9ce3924e73438f19113cb0212058a2842d 100644 --- a/src/generic/Group.cpp +++ b/src/generic/Group.cpp @@ -56,6 +56,7 @@ The flow is the following: - If UNIQUE is present the resuling list is sorted and duplicate elements are removed. Notice that this command just creates a shortcut, and does not imply any real calculation. +So, having a huge group defined does not slow down your calculation in any way. It is just convenient to better organize input files. Might be used in combination with the \ref INCLUDE command so as to store long group definitions in a separate file. @@ -175,11 +176,14 @@ Group::Group(const ActionOptions&ao): parseAtomList("REMOVE",remove); if(remove.size()>0) { std::vector<AtomNumber> notfound; + unsigned k=0; log<<" removing these atoms from the list:"; for(unsigned i=0; i<remove.size(); i++) { const auto it = find(atoms.begin(),atoms.end(),remove[i]); if(it!=atoms.end()) { + if(k%25==0) log<<"\n"; log<<" "<<(*it).serial(); + k++; atoms.erase(it); } else notfound.push_back(remove[i]); } @@ -205,8 +209,11 @@ Group::Group(const ActionOptions&ao): } this->atoms.insertGroup(getLabel(),atoms); - log.printf(" list of atoms "); - for(unsigned i=0; i<atoms.size(); i++) log<<" "<<atoms[i].serial(); + log.printf(" list of atoms:"); + for(unsigned i=0; i<atoms.size(); i++) { + if(i%25==0) log<<"\n"; + log<<" "<<atoms[i].serial(); + } log.printf("\n"); } diff --git a/src/generic/UpdateIf.cpp b/src/generic/UpdateIf.cpp index 1db2b6cb196d2c9adb7039d4badb5433f11166b4..2d067fcf3db179ca6ce259b41a611dfd262908fc 100644 --- a/src/generic/UpdateIf.cpp +++ b/src/generic/UpdateIf.cpp @@ -66,7 +66,10 @@ the solute. solute: GROUP ATOMS=1-124 coord: COORDINATION GROUPA=solute GROUPB=500 R_0=0.5 -UPDATE_IF ARG=coord LESS_THAN=0.5 +# A coordination number higher than 0.5 indicate that there is at least one +# atom of group `solute` at less than 5 A from atom number 500 + +UPDATE_IF ARG=coord MORE_THAN=0.5 DUMPATOMS ATOMS=solute,500 FILE=output.xyz UPDATE_IF ARG=coord END \endverbatim diff --git a/src/maketools/codecheck b/src/maketools/codecheck index 89781a37143d7dee8a667cfb13bfba991aa5c09a..2479cdb69de9207aaf047e719b85e87c5224ad72 100755 --- a/src/maketools/codecheck +++ b/src/maketools/codecheck @@ -22,9 +22,9 @@ done if [ $do_plumedcheck == true ] ; then if [ $do_local == true ] ; then - ../maketools/plumedcheck *.{h,cpp} ../../configure.ac + ../maketools/plumedcheck *.{h,cpp} ../../configure.ac --astyle=../../astyle/astyle --astyle-options=../../.astyle.options else - maketools/plumedcheck --global-check */*.{h,cpp} ../configure.ac + maketools/plumedcheck --global-check */*.{h,cpp} ../configure.ac --astyle=../astyle/astyle --astyle-options=../.astyle.options fi fi diff --git a/src/maketools/plumedcheck b/src/maketools/plumedcheck index 751a07db36b0d7db9b18261ad9fd3b9d9e5859e0..120808decbabe905049f6c393a0cfbf14e68cfa3 100755 --- a/src/maketools/plumedcheck +++ b/src/maketools/plumedcheck @@ -66,6 +66,7 @@ BEGIN{ newargv[0]=ARGV[0] pre="" opt_global_check=0 + astyle="astyle" for(i=1;i<ARGC;i++){ opt=pre ARGV[i] pre="" @@ -75,6 +76,14 @@ BEGIN{ usage(); break; case "--global-check": opt_global_check=1; break; + case /--astyle=.*/: + sub("^--astyle=","",opt); + astyle=opt; + case /--astyle-options=.*/: + sub("^--astyle-options=","",opt); + astyle_options=opt; + break; + break; case /-.*/: print "Unknown option " opt; exit(1) default: @@ -129,6 +138,9 @@ BEGIN{ core_modules["core"]=1 core_modules["tools"]=1 core_modules["reference"]=1 + +# create tmp dir for future usage + "mktemp -d" | getline tmpdir } # for each input file @@ -182,6 +194,14 @@ BEGINFILE{ # checks that are done only on some modules will be skipped if the module name is not known if((filetype=="source" || filetype=="header") && !module) information("missing_module_name","module name is not know, some check will be skipped"); + if(filetype=="source" || filetype=="header"){ + tempfile = tmpdir "/astyle" + system(astyle " --options=" astyle_options " < " FILENAME " > " tempfile) + s=system("diff -q " FILENAME " " tempfile ">/dev/null 2>/dev/null") + if(s!=0) error("astyle","astyle not satisfied") + system("rm " tempfile) + } + } # line by line analysis @@ -526,6 +546,9 @@ END{ error("unused_has","has " has " at " plumed_definehas[has] " is not used") } } + +# remove temporary directory + system("rmdir " tmpdir); } EOF diff --git a/src/setup/MolInfo.cpp b/src/setup/MolInfo.cpp index ed2ca421c0735dd0f6199c601e3dad94648d7405..03a0012f97a8eaac8c5561aa7fa55f303f718282 100644 --- a/src/setup/MolInfo.cpp +++ b/src/setup/MolInfo.cpp @@ -44,12 +44,13 @@ If you are using gromacs, the safest way is to use reference pdb file generated with `gmx editconf -f topol.tpr -o reference.pdb`. -Using MOLINFO with a protein's pdb extend the possibility of atoms selection using the @ special +Using MOLINFO with a protein's or nucleic acid's pdb extends the possibility of atoms selection using the @ special symbol. Providing `MOLTYPE=protein`, `MOLTYPE=rna`, or `MOLTYPE=dna` will instruct plumed to look -for known residues from these three types of molecule (so that any of these three choice -can be safely used in a RNA/protein complex). +for known residues from these three types of molecule. In other words, this is available for +historical reasons and to allow future extensions where alternative lists will be provided. +As of now, you can just ignore this keyoword. For protein residues, the following groups are available: @@ -80,6 +81,9 @@ For DNA or RNA residues, the following groups are available: @v3-# @v4-# +# quadruplet corresponding to the chi torsional angle +@chi-# + # backbone, sugar, and base heavy atoms @back-# @sugar-# diff --git a/src/vatom/COM.cpp b/src/vatom/COM.cpp index 65f69a403e7526f2516a85b99f21062049bad0b1..f9334eb6b676914d389b279e0adf5d270a6260ea 100644 --- a/src/vatom/COM.cpp +++ b/src/vatom/COM.cpp @@ -94,7 +94,10 @@ COM::COM(const ActionOptions&ao): parseFlag("NOPBC",nopbc); checkRead(); log.printf(" of atoms"); - for(unsigned i=0; i<atoms.size(); ++i) log.printf(" %d",atoms[i].serial()); + for(unsigned i=0; i<atoms.size(); ++i) { + if(i%25==0) log<<"\n"; + log.printf(" %d",atoms[i].serial()); + } log.printf("\n"); if(!nopbc) { log<<" PBC will be ignored\n"; diff --git a/src/vatom/Center.cpp b/src/vatom/Center.cpp index d29fca69fc6e08c57fa6145feb6de1cdec441912..7e4cdd440239f6dbe9ef99ced9da6d836017dacc 100644 --- a/src/vatom/Center.cpp +++ b/src/vatom/Center.cpp @@ -108,20 +108,29 @@ Center::Center(const ActionOptions&ao): parseFlag("MASS",weight_mass); parseFlag("NOPBC",nopbc); checkRead(); - log.printf(" of atoms"); - for(unsigned i=0; i<atoms.size(); ++i) log.printf(" %d",atoms[i].serial()); + log.printf(" of atoms:"); + for(unsigned i=0; i<atoms.size(); ++i) { + if(i%25==0) log<<"\n"; + log.printf(" %d",atoms[i].serial()); + } + log<<"\n"; if(weight_mass) { log<<" mass weighted\n"; if(weights.size()!=0) error("WEIGHTS and MASS keywords should not be used simultaneously"); } else { if( weights.size()==0) { + log<<" using the geometric center\n"; weights.resize( atoms.size() ); for(unsigned i=0; i<atoms.size(); i++) weights[i] = 1.; + } else { + log<<" with weights:"; + if( weights.size()!=atoms.size() ) error("number of elements in weight vector does not match the number of atoms"); + for(unsigned i=0; i<weights.size(); ++i) { + if(i%25==0) log<<"\n"; + log.printf(" %f",weights[i]); + } + log.printf("\n"); } - log<<" with weights"; - if( weights.size()!=atoms.size() ) error("number of elements in weight vector does not match the number of atoms"); - for(unsigned i=0; i<weights.size(); ++i) log.printf(" %f",weights[i]); - log.printf("\n"); } if(!nopbc) { log<<" PBC will be ignored\n"; diff --git a/user-doc/Functions.txt b/user-doc/Functions.txt index dc6aafd01b4161ed94b24cbac46bff522dc4f127..8bf37c42db0e66f5e2727bb98b419edeb4f88217 100644 --- a/user-doc/Functions.txt +++ b/user-doc/Functions.txt @@ -3,7 +3,43 @@ When performing biased dynamics or analysing a trajectory you may wish to analyse/bias the value of some function of a set of collective variables rather than the values of the collective variables -directly. You can do this with PLUMED by using any one of the following list of functions: +directly. You can do this with PLUMED by using any one of the following list of functions. + +Notice that in many functions you should explicitly say to PLUMED whether the result +is a periodic variable or not using the keyword `PERIODIC`. +This is crucial to allow a variable to be properly based. +To know if a function is periodic +of not you should answer to the following question: + +- Can my function change with a discontinuity when I move my atoms in a continuous manner? + +In case the answer is no, than you should use `PERIODIC=NO`. In case the answer is yes, then you should +consider the following question: + +- Are the values of the function at the discontinuity always the same or do they change? + +In case the answer is that they are the same, you should use `PERIODIC=A,B` where `A` +is the smallest value and `B` is the largest value. In case the answer is that the +values at the discontinuity are not always the same, then you cannot construct a variable that +can be biased with PLUMED. Consider the following examples: + +\verbatim +t: TORSION ATOMS=1,2,3,4 +# When atoms are moved, t could jump suddenly from -pi to +pi + +c: MATHEVAL ARG=t FUNC=x*x*x PERIODIC=-31.0062766802998,31.0062766802998 +# When atoms are moved, c could jump suddenly from -pi**3 to +pi**3 + +# equivalently, we could have used: +# c: COMBINE ARG=t POWERS=3 PERIODIC=-31.0062766802998,31.0062766802998 + +# compute x/y/z components of the distance between atoms 1 and 10 +d: DISTANCE ATOMS=1,10 COMPONENTS + +# make a new variable equal to d.z but with the correct periodicity +dz: COMBINE ARG=d.z PERIODIC=-10,10 +# here we assumed the system is in a orthorhombic box with z side = 20 +\endverbatim @FUNCTION@ diff --git a/user-doc/Misc.txt b/user-doc/Misc.txt index 0ee019d2695eb53ae2081fcc4d76e3c2f132e52f..284a2a6e9bdfc65ce0b7e12f698bafd089cea19d 100644 --- a/user-doc/Misc.txt +++ b/user-doc/Misc.txt @@ -281,12 +281,13 @@ With these settings, in the first example (`DU<CTRL+X><CTRL+O`) VIM will only co As you can imagine, if you use autocompletion after you have typed the word `DISTANCE` followed by a space you will see -a menu listing `LABEL=`, `COMPONENTS`, etc. Basically, all the keywords that are possibly used withint a `DISTANCE` line -will be shown. +a menu listing `LABEL=`, `COMPONENTS`, etc. Basically, all the keywords that are possibly used within a `DISTANCE` line +will be shown. This is very useful if you do not remember the exact name of the keywords associated with +a given action. \par Quick help -You can also retrieve quick explanation of the input options for a specific collective variable. +You can also retrieve quick explanation of the input options for a specific action. Try to do the following. Enable plumed syntax: \verbatim :set ft=plumed @@ -328,7 +329,7 @@ To simplify this, when PLUMED syntax for VIM is configured properly VIM should b Notice that the syntax file for the output files (`plumedf.vim`) is not the same one that is used for the PLUMED input file (`plumed.vim`). -To make output files more readable, vi will show `FIELDS` and `SET` words in a different color, +To make output files more readable, vim will show `FIELDS` and `SET` words in a different color, and data columns with alternating colors (e.g. dark/light/dark/light). The colors in the columns are consistent with those shown in the FIELD line. In the example above, 1, 2, and 3 will be of the same color as A, B, and C respectively.