LCOV - code coverage report
Current view: top level - crystallization - LocalSteinhardt.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 15 20 75.0 %
Date: 2020-11-18 11:20:57 Functions: 9 17 52.9 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-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_crystallization_LocalSteinhardt_h
      23             : #define __PLUMED_crystallization_LocalSteinhardt_h
      24             : #include "OrientationSphere.h"
      25             : 
      26             : namespace PLMD {
      27             : namespace crystallization {
      28             : 
      29             : template<class T>
      30          10 : class LocalSteinhardt : public OrientationSphere {
      31             : public:
      32           8 :   static void registerKeywords( Keywords& keys ) {
      33           8 :     OrientationSphere::registerKeywords(keys);
      34           8 :   }
      35           5 :   explicit LocalSteinhardt(const ActionOptions& ao): Action(ao), OrientationSphere(ao)
      36             :   {
      37          19 :     for(unsigned i=0; i<getNumberOfBaseMultiColvars(); ++i) {
      38           7 :       T* mc=dynamic_cast<T*>( getBaseMultiColvar(i) );
      39           7 :       if(!mc) {
      40           0 :         if( getBaseMultiColvar(i)->getNumberOfBaseMultiColvars()==0 ) {
      41           0 :           error("input action is not calculating the correct vectors");
      42             :         }
      43           0 :         for(unsigned j=0; j<getBaseMultiColvar(i)->getNumberOfBaseMultiColvars(); ++j) {
      44           0 :           T* mmc=dynamic_cast<T*>( getBaseMultiColvar(i)->getBaseMultiColvar(j) );
      45           0 :           if( !mmc ) error("input action is not calculating the correct vectors");
      46             :         }
      47             :       }
      48             :     }
      49           5 :   }
      50       43186 :   double computeVectorFunction( const Vector& conn, const std::vector<double>& vec1, const std::vector<double>& vec2,
      51             :                                 Vector& dconn, std::vector<double>& dvec1, std::vector<double>& dvec2 ) const {
      52       43186 :     double dot=0; dconn.zero();
      53     3454880 :     for(unsigned k=2; k<vec1.size(); ++k) {
      54     4491344 :       dot+=vec1[k]*vec2[k]; dvec1[k]=vec2[k]; dvec2[k]=vec1[k];
      55             :     }
      56       43186 :     return dot;
      57             :   }
      58             : };
      59             : 
      60             : }
      61        4839 : }
      62             : #endif

Generated by: LCOV version 1.13