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 processBondLimitOption( std::vector< std::string > &commands , int &current_pos , double &length_equil , double &length_perc );
57  void processSigmaMixOptions( std::vector< std::string > &commands , int &current_pos );
58  double getBinWidthFromElementalDistributions( std::vector< std::string > &commands , int &current_pos );
59  double getStickingCoeffFromDepositionEventOptions( std::vector< std::string > &commands , int &current_pos );
60  double getRateFromInputRateOptions( std::vector< std::string > &commands , int &current_pos );
61  void processCustomDiffEventOptions( std::vector< std::string > &commands , int &current_pos , std::string &custom_style , std::vector< int > &style_atomtypes );
62 
63  //ACCEPTABLE COMMANDS
64  void executeKMCstepsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
65  void executeKMCperMDCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
66  void executeTimeEndCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
67  void executeRandomSeedCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
68  void executeFluidAtomTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
69  void executeFrozenAtomTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
70  void executeDesorptionCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
71  void executeHeightCalculationCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
72  void executeSpeciesMaxBondsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
73  void executeSpeciesMaxBondTypesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
74  void executeMinimizePriorCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
75  void executeMinimizeAfterCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
76  void executeTrajectoryDurationCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
77  void executeDepoheightsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
78  void executeRandomDepovecsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
79  void executeRandomDiffvecsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
80  void executeCreateBondBreakCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
81  void executeCreateBondFormCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
82  void executeCreateDiffusionHopCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
83  void executeCreateDepositionCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
84  void executeCreateMonoatomicDesorptionCommand( std::vector< std:: string > &commands , PaprecaConfig &papreca_config );
85  void executeExportHeightVtimeCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
86  void executeExportSurfaceCoverageCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
87  void executeExportElementalDistributionsCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
88  void executeExportExecutionTimesCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
89  void executeRestartFreqCommand( std::vector< std::string > &commands , PaprecaConfig &papreca_config );
90  void executeSigmasOptionsCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
91  void executeInitSigmaCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
92 
93  //General command execution functions
94  void executePaprecaCommand( LAMMPS_NS::LAMMPS *lmp , std::vector< std::string > &commands , PaprecaConfig &papreca_config );
95  std::vector< std::string > processLine( char *line );
96  void abortIllegalRun( const int &proc_id , PaprecaConfig &papreca_config );
97  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
98 
99 
100 }//end of namespace PAPRECA
101 
102 #endif
103 
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:1047
void executeCreateBondFormCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:806
void executeSpeciesMaxBondTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:622
void executeRandomSeedCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:452
void processBondLimitOption(std::vector< std::string > &commands, int &current_pos, double &length_equil, double &length_perc)
Definition: input_file.cpp:190
void executeDesorptionCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:539
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:404
void executeFrozenAtomTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:504
std::vector< std::string > processLine(char *line)
Definition: input_file.cpp:1229
double getRateFromInputRateOptions(std::vector< std::string > &commands, int &current_pos)
Definition: input_file.cpp:294
void executeRandomDepovecsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:722
void executeCreateDiffusionHopCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:860
double getStickingCoeffFromDepositionEventOptions(std::vector< std::string > &commands, int &current_pos)
Definition: input_file.cpp:250
void executeHeightCalculationCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:575
void abortIllegalRun(const int &proc_id, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1267
void executeSpeciesMaxBondsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:604
void executePaprecaCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1151
void executeRandomDiffvecsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:735
void executeCreateBondBreakCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:758
void executeTimeEndCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:436
void executeMinimizePriorCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:643
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:905
void executeExportSurfaceCoverageCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:992
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:353
void executeFluidAtomTypesCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:472
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:701
void executeSigmasOptionsCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1085
void processSigmaMixOptions(std::vector< std::string > &commands, PaprecaConfig &papreca_config, int &current_pos)
Definition: input_file.cpp:200
void readInputAndInitPaprecaConfig(LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const char *file_name, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1290
void executeMinimizeAfterCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:665
void executeTrajectoryDurationCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:686
void executeRestartFreqCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1068
void executeKMCperMDCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:419
void executeCreateMonoatomicDesorptionCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:949
void executeExportElementalDistributionsCommand(std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1012
void executeInitSigmaCommand(LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
Definition: input_file.cpp:1123
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:971
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...