PAPRECA hybrid off-lattice kMC/MD simulator  2.0.0 (17 September 2024)
input_file.h
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------------------
2 PAPRECA hybrid off-lattice kinetic Monte Carlo/Molecular dynamics simulator.
3 Copyright (C) 2024 Stavros Ntioudis, James P. Ewen, Daniele Dini, and C. Heath Turner
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 ----------------------------------------------------------------------------------------*/
19 
22 
23 #ifndef INPUT_FILE_H
24 #define INPUT_FILE_H
25 
26 //System Headers
27 #include <iostream>
28 #include <fstream>
29 #include <sstream>
30 #include <vector>
31 #include <unordered_set>
32 #include <mpi.h>
33 
34 //LAMMPS Headers
35 #include "lammps.h"
36 #include "random_mars.h"
37 #include "update.h"
38 
39 //kMC Headers
40 #include "papreca_error.h"
41 #include "papreca_config.h"
42 #include "event_list.h"
43 #include "rates_calc.h"
44 #include "utilities.h"
45 #include "lammps_wrappers.h"
46 
47 namespace PAPRECA{
48 
49  //SUPPLEMENTARY SETTER FUNCTIONS FOR APRECAT CONFIG
50  void setTimeUnitsConversionConstant( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config );
51 
52  //ACCEPTABLE OPTIONAL COMMAND KEYWORDS and KEYWORD IDENTIFICATION FUNCTIONS.
53  void checkForAcceptableKeywordsUsedMultipleTimes( std::vector< std::string > &commands , const std::string &keyword );
54  void check4AcceptableKeywords( std::vector< std::string > &commands , const int &start , std::unordered_set< std::string > &acceptable_keywords , const bool &accept_bool );
55  void processCatalyzedOption( std::vector< std::string > &commands , int &current_pos , std::vector< int > &catalyzing_types );
56  void processSigmaMixOptions( std::vector< std::string > &commands , int &current_pos );
57  double getBinWidthFromElementalDistributions( std::vector< std::string > &commands , int &current_pos );
58  double getStickingCoeffFromDepositionEventOptions( std::vector< std::string > &commands , int &current_pos );
59  double getRateFromInputRateOptions( std::vector< std::string > &commands , int &current_pos );
60  void processCustomDiffEventOptions( std::vector< std::string > &commands , int &current_pos , std::string &custom_style , std::vector< int > &style_atomtypes );
61 
62  //ACCEPTABLE COMMANDS
63  void executeKMCstepsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
64  void executeKMCperMDCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
65  void executeTimeEndCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
66  void executeRandomSeedCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
67  void executeFluidAtomTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
68  void executeFrozenAtomTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
69  void executeDesorptionCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
70  void executeHeightCalculationCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
71  void executeSpeciesMaxBondsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
72  void executeSpeciesMaxBondTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
73  void executeMinimizePriorCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
74  void executeMinimizeAfterCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
75  void executeTrajectoryDurationCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
76  void executeDepoheightsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
77  void executeRandomDepovecsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
78  void executeRandomDiffvecsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
79  void executeCreateBondBreakCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
80  void executeCreateBondFormCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
81  void executeCreateDiffusionHopCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
82  void executeCreateDepositionCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
83  void executeCreateMonoatomicDesorptionCommand( std::vector< std:: string > &commands , PaprecaConfig &papreca_config );
84  void executeExportHeightVtimeCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
85  void executeExportSurfaceCoverageCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
86  void executeExportElementalDistributionsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
87  void executeExportExecutionTimesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
88  void executeRestartFreqCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
89  void executeSigmasOptionsCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
90  void executeInitSigmaCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
91 
92  //General command execution functions
93  void executePaprecaCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
94  std::vector< std::string > processLine( char *line );
95  void abortIllegalRun( const int &proc_id , PaprecaConfig &papreca_config );
96  void readInputAndInitPaprecaConfig( LAMMPS_NS::LAMMPS *lmp , const int &proc_id , const char *file_name , PaprecaConfig &papreca_config ); //Main function reading the input file and passing information (i.e., commands) to the execute commands function
97 
98 
99 }//end of namespace PAPRECA
100 
101 #endif
102 
Class storing settings and global variables for the PAPRECA run.
Definition: papreca_config.h:51
Declarations of PredefinedEvent classes.
Declarations for LAMMPS wrapper functions.
Definition: bond.cpp:26
void executeExportExecutionTimesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1025
void executeCreateBondFormCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:789
void executeSpeciesMaxBondTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:612
void executeRandomSeedCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:442
void executeDesorptionCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:529
void check4AcceptableKeywords(std::vector< std::string > &commands, const int &start, std::unordered_set< std::string > &acceptable_keywords, const bool &accept_bool)
Definition: input_file.cpp:103
void executeKMCstepsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:394
void executeFrozenAtomTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:494
std::vector< std::string > processLine(char *line)
Definition: input_file.cpp:1207
double getRateFromInputRateOptions(std::vector< std::string > &commands, int &current_pos)
Definition: input_file.cpp:284
void executeRandomDepovecsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:712
void executeCreateDiffusionHopCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:835
double getStickingCoeffFromDepositionEventOptions(std::vector< std::string > &commands, int &current_pos)
Definition: input_file.cpp:240
void executeHeightCalculationCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:565
void abortIllegalRun(const int &proc_id, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1245
void executeSpeciesMaxBondsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:594
void executePaprecaCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1129
void executeRandomDiffvecsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:725
void executeCreateBondBreakCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:748
void executeTimeEndCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:426
void executeMinimizePriorCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:633
void processCatalyzedOption(std::vector< std::string > &commands, int &current_pos, std::vector< int > &catalyzing_types)
Definition: input_file.cpp:149
void executeCreateDepositionCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:882
void executeExportSurfaceCoverageCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:970
double getBinWidthFromElementalDistributions(std::vector< std::string > &commands, int &current_pos)
void processCustomDiffEventOptions(std::vector< std::string > &commands, int &current_pos, std::string &custom_style, std::vector< int > &style_atomtypes)
Definition: input_file.cpp:343
void executeFluidAtomTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:462
void setTimeUnitsConversionConstant(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config)
Definition: input_file.cpp:28
void executeDepoheightsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:691
void executeSigmasOptionsCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1063
void processSigmaMixOptions(std::vector< std::string > &commands, PaprecaConfig &papreca_config, int &current_pos)
Definition: input_file.cpp:190
void readInputAndInitPaprecaConfig(LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const char *file_name, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1268
void executeMinimizeAfterCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:655
void executeTrajectoryDurationCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:676
void executeRestartFreqCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1046
void executeKMCperMDCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:409
void executeCreateMonoatomicDesorptionCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:927
void executeExportElementalDistributionsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:990
void executeInitSigmaCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1101
void checkForAcceptableKeywordsUsedMultipleTimes(std::vector< std::string > &commands, const std::string &keyword)
Definition: input_file.cpp:84
void executeExportHeightVtimeCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:949
Declarations for PAPRECA::PaprecaConfig class storing settings and global variables.
Functions that enable the communication of error/warning messages to the terminal and coordinate the ...
Includes functions used to calculate the rates of predefined events. All functions return rates in Hz...
Utility functions (e.g., for arrays, strings etc.) and typedefs used in papreca.cpp main and in the o...