PAPRECA hybrid off-lattice kMC/MD simulator  2.0.0 (17 September 2024)
event_detect.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 
23 
24 #ifndef EVENT_DETECT_H
25 #define EVENT_DETECT_H
26 
27 //System Headers
28 #include <vector>
29 #include <mpi.h>
30 
31 
32 //LAMMPS headers
33 #include "lammps.h"
35 #include "pointers.h"
37 
38 //KMC headers
39 #include "event.h"
40 #include "event_list.h"
41 #include "bond.h"
42 #include "papreca_config.h"
43 #include "lammps_wrappers.h"
44 #include "geometry_calc.h"
45 #include "utilities.h"
46 
47 namespace PAPRECA{
48 
49  //Diffusion events
50  const bool feCandidateHas4PO4Neibs( PaprecaConfig &papreca_config , PredefinedDiffusionHop *diff_template , LAMMPS_NS::tagint *atom_ids , int *atom_types , int *neighbors , int &neighbors_num , ATOM2BONDS_MAP &atomID2bonds );
51  void getDiffPointCandidateCoords( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , double *iatom_xyz , double *candidate_xyz , PredefinedDiffusionHop *diff_template );
52  const bool candidateDiffHasCollisions( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , int *neighbors , int &neighbors_num , double *candidate_xyz , const int &diffused_type , double *iatom_xyz , const int &iatom_type );
53  void getDiffEventsFromAtom( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , const int &iatom , int *neighbors , int &neighbors_num , std::vector< Event* > &events_local , ATOM2BONDS_MAP &atomID2bonds );
54 
55  //Deposition events
56  const bool atomIsInDepoScanRange( PaprecaConfig &papreca_config , double *iatom_xyz , double &film_height );
57  void getDepoPointCandidateCoords( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , double *iatom_xyz , double *candidate_xyz , PredefinedDeposition *depo_template );
58  const bool depoCandidateIsBelowRejectionHeight( PaprecaConfig &papreca_config , double *candidate_xyz , const double &film_height );
59  void getMolCoords( LAMMPS_NS::LAMMPS *lmp , double **mol_xyz , double **mol_dx , const int &mol_natoms , double *candidate_center );
60  void initMolCoordsArr( double ***mol_xyz , const int &mol_natoms );
61  void deleteMolCoordsArr( double **mol_xyz , const int &mol_natoms );
62  bool atomHasCollisionWithMolAtoms( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , double *atom_xyz , const int &atom_type , const int &mol_natoms , double **mol_xyz , int *mol_atomtype );
63  bool candidateDepoHasCollisions( LAMMPS_NS::LAMMPS *lmp , const int &proc_id , const int &nprocs , PaprecaConfig &papreca_config , int *neighbors , int neighbors_num , double *candidate_center , double *iatom_xyz , const int &iatom_type , PredefinedDeposition *depo_template );
64  void getDepoEventsFromAtom( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , const int &proc_id , const int &nprocs , const int &iatom , int *neighbors , int &neighbors_num , double &film_height , std::vector< Event* > &events_local );
65 
66  //Bond-Breaking and formation events
67  const bool headAtomIsCatalyzed( PredefinedReaction *reaction_template , int *atom_types , int *neighbors , int &neighbors_num );
68  void getBondBreakingEventsFromAtom( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , const int &iatom , int *neighbors , int &neighbors_num , std::vector<Event*> &events_local , ATOM2BONDS_MAP &atomID2bonds );
69  const bool atomsBelong2TheSameMol( const LAMMPS_NS::tagint &iatom_mol , const LAMMPS_NS::tagint &jneib_mol );
70  const bool atomHasMaxBonds( PaprecaConfig &papreca_config , ATOM2BONDS_MAP &atomID2bonds , const LAMMPS_NS::tagint &atom_id , const int atom_type );
71  bool bondBetweenAtomsExists( ATOM2BONDS_MAP &atomID2bonds , const LAMMPS_NS::tagint &atom1_id , const LAMMPS_NS::tagint &atom2_id );
72  const bool atomCandidatesAreLone( const LAMMPS_NS::tagint atom1_id , const LAMMPS_NS::tagint atom2_id , ATOM2BONDS_MAP &atomID2bonds );
73  const bool atomHasMaxBondTypes( PaprecaConfig &papreca_config , ATOM2BONDS_MAP &atomID2bonds , const LAMMPS_NS::tagint &atom_id , const int &atom_type , const int &bond_type );
74  void getBondFormEventsFromAtom( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , const int &iatom , int *neighbors , int &neighbors_num , std::vector<Event*> &events_local , ATOM2BONDS_MAP &atomID2bonds );
75 
76  //Monoatomic Desorption events
77  void getMonoDesEventsFromAtom( LAMMPS_NS::LAMMPS *lmp , PaprecaConfig &papreca_config , const int &iatom , std::vector< Event* > &events_local , ATOM2BONDS_MAP &atomID2bonds );
78 
79  //General Functions
80  void loopAtomsAndIdentifyEvents( LAMMPS_NS::LAMMPS *lmp , const int &proc_id , int &nprocs , const int &KMC_loopid , PaprecaConfig &papreca_config , std::vector<Event*> &events_local , ATOM2BONDS_MAP &atomID2bonds , double &film_height );
81 
82 
83 }//end of PAPRECA namespace
84 
85 
86 #endif
Declarations for PAPRECA::Bond.
Declarations for PAPRECA:Event class and its children classes.
Declarations of PredefinedEvent classes.
Header for geometry calculation functions (e.g., film height, interference).
Declarations for LAMMPS wrapper functions.
Definition: bond.cpp:26
const bool candidateDiffHasCollisions(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, int *neighbors, int &neighbors_num, double *candidate_xyz, const int &diffused_type, double *iatom_xyz, const int &iatom_type)
Definition: event_detect.cpp:118
bool atomHasCollisionWithMolAtoms(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *atom_xyz, const int &atom_type, const int &mol_natoms, double **mol_xyz, int *mol_atomtype)
Definition: event_detect.cpp:331
void getBondFormEventsFromAtom(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &iatom, int *neighbors, int &neighbors_num, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:643
const bool atomIsInDepoScanRange(PaprecaConfig &papreca_config, double *iatom_xyz, double &film_height)
Definition: event_detect.cpp:205
void getDiffPointCandidateCoords(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *iatom_xyz, double *candidate_xyz, PredefinedDiffusionHop *diff_template)
Definition: event_detect.cpp:70
const bool feCandidateHas4PO4Neibs(PaprecaConfig &papreca_config, PredefinedDiffusionHop *diff_template, LAMMPS_NS::tagint *atom_ids, int *atom_types, int *neighbors, int &neighbors_num, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:28
std::unordered_map< LAMMPS_NS::tagint, BOND_VECTOR > ATOM2BONDS_MAP
maps atom IDs to their associated PAPRECA::BOND_VECTOR to allow easy access of bonds and bond types.
Definition: bond.h:46
const bool atomCandidatesAreLone(const LAMMPS_NS::tagint atom1_id, const LAMMPS_NS::tagint atom2_id, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:603
const bool atomsBelong2TheSameMol(const LAMMPS_NS::tagint &iatom_mol, const LAMMPS_NS::tagint &jneib_mol)
Definition: event_detect.cpp:551
void getBondBreakingEventsFromAtom(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &iatom, int *neighbors, int &neighbors_num, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:501
const bool depoCandidateIsBelowRejectionHeight(PaprecaConfig &papreca_config, double *candidate_xyz, const double &film_height)
Definition: event_detect.cpp:258
void getDiffEventsFromAtom(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &iatom, int *neighbors, int &neighbors_num, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:151
void getMonoDesEventsFromAtom(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &iatom, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
Definition: event_detect.cpp:714
void getDepoPointCandidateCoords(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *iatom_xyz, double *candidate_xyz, PredefinedDeposition *depo_template)
Definition: event_detect.cpp:218
bool candidateDepoHasCollisions(LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const int &nprocs, PaprecaConfig &papreca_config, int *neighbors, int neighbors_num, double *candidate_center, double *iatom_xyz, const int &iatom_type, PredefinedDeposition *depo_template)
Definition: event_detect.cpp:357
void loopAtomsAndIdentifyEvents(LAMMPS_NS::LAMMPS *lmp, const int &proc_id, int &nprocs, const int &KMC_loopid, PaprecaConfig &papreca_config, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds, double &film_height)
Definition: event_detect.cpp:752
void initMolCoordsArr(double ***mol_xyz, const int &mol_natoms)
Definition: event_detect.cpp:296
const bool atomHasMaxBondTypes(PaprecaConfig &papreca_config, ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom_id, const int &atom_type, const int &bond_type)
Definition: event_detect.cpp:618
const bool headAtomIsCatalyzed(PredefinedReaction *reaction_template, int *atom_types, int *neighbors, int &neighbors_num)
Definition: event_detect.cpp:471
void deleteMolCoordsArr(double **mol_xyz, const int &mol_natoms)
Definition: event_detect.cpp:314
void getMolCoords(LAMMPS_NS::LAMMPS *lmp, double **mol_xyz, double **mol_dx, const int &mol_natoms, double *candidate_center)
Definition: event_detect.cpp:272
void getDepoEventsFromAtom(LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &proc_id, const int &nprocs, const int &iatom, int *neighbors, int &neighbors_num, double &film_height, std::vector< Event * > &events_local)
Definition: event_detect.cpp:413
bool bondBetweenAtomsExists(ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom1_id, const LAMMPS_NS::tagint &atom2_id)
Definition: event_detect.cpp:577
const bool atomHasMaxBonds(PaprecaConfig &papreca_config, ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom_id, const int atom_type)
Definition: event_detect.cpp:563
Declarations for PAPRECA::PaprecaConfig class storing settings and global variables.
Utility functions (e.g., for arrays, strings etc.) and typedefs used in papreca.cpp main and in the o...