Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2012-2019 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_ActionVolume_h
23 : #define __PLUMED_multicolvar_ActionVolume_h
24 :
25 : #include "tools/HistogramBead.h"
26 : #include "VolumeGradientBase.h"
27 :
28 : namespace PLMD {
29 : namespace multicolvar {
30 :
31 : /**
32 : \ingroup INHERIT
33 : This is the abstract base class to use for implementing a new way of definining a particular region of the simulation
34 : box. You can use this to calculate the number of atoms inside that part or the average value of a quantity like the
35 : coordination number inside that part of the cell.
36 : */
37 :
38 56 : class ActionVolume : public VolumeGradientBase {
39 : private:
40 : /// Number of quantities in use in this colvar
41 : unsigned nquantities;
42 : /// The value of sigma
43 : double sigma;
44 : /// Are we interested in the area outside the colvar
45 : bool not_in;
46 : /// The kernel type for this histogram
47 : std::string kerneltype;
48 : protected:
49 : double getSigma() const ;
50 : std::string getKernelType() const ;
51 : public:
52 : static void registerKeywords( Keywords& keys );
53 : explicit ActionVolume(const ActionOptions&);
54 : /// Get the number of quantities that are calculated each time
55 : virtual unsigned getNumberOfQuantities() const ;
56 : /// Calculate whats in the volume
57 : void calculateAllVolumes( const unsigned& curr, MultiValue& outvals ) const ;
58 : /// This calculates whether or not a particular is inside the box of interest
59 : /// this is used for neighbour list with volumes
60 : bool inVolumeOfInterest( const unsigned& curr ) const ;
61 : virtual double calculateNumberInside( const Vector& cpos, Vector& derivatives, Tensor& vir, std::vector<Vector>& refders ) const=0;
62 : unsigned getCentralAtomElementIndex();
63 : };
64 :
65 : inline
66 71213 : unsigned ActionVolume::getNumberOfQuantities() const {
67 71213 : return nquantities;
68 : }
69 :
70 : inline
71 : double ActionVolume::getSigma() const {
72 98014 : return sigma;
73 : }
74 :
75 : inline
76 : std::string ActionVolume::getKernelType() const {
77 : return kerneltype;
78 : }
79 :
80 : inline
81 : unsigned ActionVolume::getCentralAtomElementIndex() {
82 : return 1;
83 : }
84 :
85 : }
86 : }
87 : #endif
|