Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2013-2018 The plumed team
3 : (see the PEOPLE file at the root of the distribution for a list of names)
4 :
5 : See http://www.plumed.org for more information.
6 :
7 : This file is part of plumed, version 2.
8 :
9 : plumed is free software: you can redistribute it and/or modify
10 : it under the terms of the GNU Lesser General Public License as published by
11 : the Free Software Foundation, either version 3 of the License, or
12 : (at your option) any later version.
13 :
14 : plumed is distributed in the hope that it will be useful,
15 : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : GNU Lesser General Public License for more details.
18 :
19 : You should have received a copy of the GNU Lesser General Public License
20 : along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 : #ifndef __PLUMED_multicolvar_MultiColvarFunction_h
23 : #define __PLUMED_multicolvar_MultiColvarFunction_h
24 :
25 : #include "tools/Matrix.h"
26 : #include "MultiColvarBase.h"
27 : #include "AtomValuePack.h"
28 : #include "CatomPack.h"
29 : #include "vesselbase/StoreDataVessel.h"
30 :
31 : namespace PLMD {
32 : namespace multicolvar {
33 :
34 35 : class MultiColvarFunction : public MultiColvarBase {
35 : private:
36 : /// A tempory vector that is used for retrieving vectors
37 : std::vector<double> tvals;
38 : protected:
39 : /// Get the derivatives for the central atom with index ind
40 : CatomPack getCentralAtomPackFromInput( const unsigned& ind ) const ;
41 : /// Build sets by taking one multicolvar from each base
42 : void buildSets();
43 : public:
44 : explicit MultiColvarFunction(const ActionOptions&);
45 : static void registerKeywords( Keywords& keys );
46 : };
47 :
48 : inline
49 8501 : CatomPack MultiColvarFunction::getCentralAtomPackFromInput( const unsigned& ind ) const {
50 8501 : plumed_dbg_assert( atom_lab[ind].first>0 ); unsigned mmc=atom_lab[ind].first-1;
51 8501 : unsigned basen=0;
52 8501 : for(unsigned i=0; i<mmc; ++i) basen+=mybasemulticolvars[i]->getNumberOfAtoms();
53 8501 : return mybasemulticolvars[mmc]->getCentralAtomPack( basen, atom_lab[ind].second );
54 : }
55 :
56 : }
57 : }
58 : #endif
|