Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2018,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 : #include "ActionShortcut.h" 23 : #include "PlumedMain.h" 24 : #include "ActionSet.h" 25 : 26 : namespace PLMD { 27 : 28 15 : void ActionShortcut::registerKeywords( Keywords& keys ) { 29 15 : Action::registerKeywords( keys ); 30 15 : } 31 : 32 12 : ActionShortcut::ActionShortcut(const ActionOptions&ao): 33 : Action(ao), 34 12 : shortcutlabel(label) 35 : { 36 24 : std::string s; Tools::convert(plumed.getActionSet().size(),s); 37 24 : if( shortcutlabel==("@" + s) ) { 38 12 : std::string t; Tools::convert(plumed.getActionSet().size()+1,t); 39 12 : shortcutlabel="@" + t; 40 12 : } else label = ("@" + s); 41 12 : } 42 : 43 36 : void ActionShortcut::readInputLine( const std::string& input ) { 44 36 : std::string f_input = input; 45 36 : if( update_from!=std::numeric_limits<double>::max() ) { 46 0 : std::string ufrom; Tools::convert( update_from, ufrom ); f_input += " UPDATE_FROM=" + ufrom; 47 : } 48 36 : if( update_until!=std::numeric_limits<double>::max() ) { 49 0 : std::string util; Tools::convert( update_until, util ); f_input += " UPDATE_UNTIL=" + util; 50 : } 51 72 : if( keywords.exists("RESTART") ) { 52 0 : if( restart ) f_input += " RESTART=YES"; 53 0 : if( !restart ) f_input += " RESTART=NO"; 54 : } 55 36 : plumed.readInputLine( f_input ); 56 36 : } 57 : 58 54 : const std::string & ActionShortcut::getShortcutLabel() const { 59 54 : return shortcutlabel; 60 : } 61 : 62 : }