PAPRECA hybrid off-lattice kMC/MD simulator  2.0.0 (17 September 2024)
PAPRECA Namespace Reference

Classes

class  Bond
 Custom bond class (not to be confused with a LAMMPS bond). More...
 
class  Event
 Parent class for PAPRECA events. More...
 
class  Reaction
 Child of PAPRECA:Event and parent of PAPRECA::BondBreak and PAPRECA::BondForm classes. More...
 
class  BondBreak
 child of PAPRECA::Reaction dedicated to bond-breaking events. More...
 
class  BondForm
 child of PAPRECA::Reaction dedicated to bond formation events. More...
 
class  Deposition
 Child of PAPRECA::Event dedicated to monoatomic or molecular adsorption. More...
 
class  Diffusion
 child of PAPRECA::Event class dedicated to diffusion events. More...
 
class  MonoatomicDesorption
 child of PAPRECA::Event dedicated to monoatomic desorption events (i.e., where a single atom is ejected from the system). More...
 
class  PredefinedReaction
 class associated with reaction events. This is a Predefined template for PAPRECA::BondBreak and PAPRECA::BondForm events. More...
 
class  PredefinedBondForm
 child class of PAPRECA::PredefinedReaction associated with bond formation events. This is a Predefined template for PAPRECA::BondForm events. More...
 
class  PredefinedDiffusionHop
 class associated with diffusion events. This is a Predefined template for PAPRECA::DiffusionHop events. More...
 
class  PredefinedDeposition
 class associated with deposition events. This is a Predefined template for PAPRECA::Deposition events. More...
 
class  PredefinedMonoatomicDesorption
 associated with monoatomic desorption events. This is a Predefined template for PAPRECA::MonoatomicDesorption events. More...
 
class  PredefinedEventsCatalog
 General class that stores ALL the predefined events in the system. You can consider this as the Predefined Catalog of Events. More...
 
class  File
 General parent file class. Any PAPRECA export file should be a child to this class. More...
 
class  Log
 Child class of File, manages papreca.log files. More...
 
class  HeightVtime
 Child class of File, manages heightVtime.log files. More...
 
class  SurfaceCoverage
 Child class of File, manages surface_coverage.log files. More...
 
class  ElementalDistribution
 Child class of File, manages distribution.log files. More...
 
class  ExecTime
 Child class of File, manages execTimes.log files. More...
 
class  PaprecaConfig
 Class storing settings and global variables for the PAPRECA run. More...
 
class  PairHash
 Utility hash function (struct) for custom typedefs. More...
 

Typedefs

typedef std::vector< BondBOND_VECTOR
 
typedef std::unordered_map< LAMMPS_NS::tagint, BOND_VECTORATOM2BONDS_MAP
 maps atom IDs to their associated PAPRECA::BOND_VECTOR to allow easy access of bonds and bond types. More...
 
typedef std::unordered_map< int, PredefinedReaction * > TYPE2REACTION_MAP
 
typedef std::unordered_map< INT_PAIR, PredefinedBondForm *, PairHashPAIR2BONDFORM_MAP
 
typedef std::unordered_map< int, PredefinedDiffusionHop * > TYPE2DIFFUSION_MAP
 
typedef std::unordered_map< int, PredefinedDeposition * > TYPE2DEPOSITION_MAP
 
typedef std::unordered_map< int, PredefinedMonoatomicDesorption * > TYPE2MONODES_MAP
 
typedef std::pair< int, int > INT_PAIR
 
typedef std::unordered_set< INT_PAIR, PairHashPAIR_SET
 
typedef std::unordered_map< INT_PAIR, double, PairHashINTPAIR2DOUBLE_MAP
 
typedef std::unordered_map< INT_PAIR, int, PairHashINTPAIR2INT_MAP
 
typedef std::unordered_map< int, int > INT2INT_MAP
 
typedef std::unordered_map< int, INT2INT_MAPINT2INTSMAP_MAP
 
typedef std::unordered_set< int > INT_SET
 
typedef std::unordered_set< LAMMPS_NS::tagint > TAGINT_SET
 
typedef std::array< double, 3 > ARRAY3D
 
typedef std::pair< double, int > DOUBLE2INTPAIR
 
typedef std::vector< DOUBLE2INTPAIRDOUBLE2INTPAIR_VEC
 

Functions

void debugPrintBondMapPairs (ATOM2BONDS_MAP const &bonds_map, const int &proc_id)
 
void debugPrintBasicAtomInfo (LAMMPS_NS::LAMMPS *lmp, const int &proc_id)
 
void debugPrintNeighborLists (LAMMPS_NS::LAMMPS *lmp, const int &proc_id)
 
void debugCheckBondsInNeibLists (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, ATOM2BONDS_MAP &atomID2bonds)
 
void debugPrintBondsList (LAMMPS_NS::tagint *bonds_list, LAMMPS_NS::bigint &bonds_num, const int &proc_id)
 
void debugPrintType2SigmaMap (INTPAIR2DOUBLE_MAP &types2sigma)
 
void debugPrintEventInfo (Event *event, const int &proc_id)
 
void debugCheckDeposition ()
 
void fillDelidsLocalVec (LAMMPS_NS::LAMMPS *lmp, const double &desorb_cut, std::vector< LAMMPS_NS::tagint > &delids_local, ATOM2BONDS_MAP &atomID2bonds)
 
bool delidsLocalVectorsAreEmpty (std::vector< LAMMPS_NS::tagint > &delids_local)
 
void gatherAndTrimDelIdsOnDriverProc (const int &proc_id, const int &nprocs, std::vector< LAMMPS_NS::tagint > &delids_local, std::vector< LAMMPS_NS::tagint > &delids_global)
 
int fillDelidsVec (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const double &desorb_cut, std::vector< LAMMPS_NS::tagint > &delids, ATOM2BONDS_MAP &atomID2bonds)
 
void broadcastDelidsFromMasterProc (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, int &delids_num, std::vector< LAMMPS_NS::tagint > &delids)
 
void deleteDesorbedAtoms (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, int &proc_id, const int &nprocs, double &film_height, ATOM2BONDS_MAP &atomID2bonds)
 
void equilibrateFluidAtoms (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double &time)
 
void equilibrate (LAMMPS_NS::LAMMPS *lmp, int &proc_id, const int &nprocs, double &time, PaprecaConfig &papreca_config, double &film_height, int &zero_rate, const int &KMC_loopid, ATOM2BONDS_MAP &atomID2bonds)
 
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)
 
void getDiffPointCandidateCoords (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *iatom_xyz, double *candidate_xyz, PredefinedDiffusionHop *diff_template)
 
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)
 
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)
 
const bool atomIsInDepoScanRange (PaprecaConfig &papreca_config, double *iatom_xyz, double &film_height)
 
void getDepoPointCandidateCoords (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *iatom_xyz, double *candidate_xyz, PredefinedDeposition *depo_template)
 
const bool depoCandidateIsBelowRejectionHeight (PaprecaConfig &papreca_config, double *candidate_xyz, const double &film_height)
 
void getMolCoords (LAMMPS_NS::LAMMPS *lmp, double **mol_xyz, double **mol_dx, const int &mol_natoms, double *candidate_center)
 
void initMolCoordsArr (double ***mol_xyz, const int &mol_natoms)
 
void deleteMolCoordsArr (double **mol_xyz, const int &mol_natoms)
 
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)
 
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)
 
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)
 
const bool headAtomIsCatalyzed (PredefinedReaction *reaction_template, int *atom_types, int *neighbors, int &neighbors_num)
 
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)
 
const bool atomsBelong2TheSameMol (const LAMMPS_NS::tagint &iatom_mol, const LAMMPS_NS::tagint &jneib_mol)
 
const bool atomHasMaxBonds (PaprecaConfig &papreca_config, ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom_id, const int atom_type)
 
bool bondBetweenAtomsExists (ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom1_id, const LAMMPS_NS::tagint &atom2_id)
 
const bool atomCandidatesAreLone (const LAMMPS_NS::tagint atom1_id, const LAMMPS_NS::tagint atom2_id, ATOM2BONDS_MAP &atomID2bonds)
 
const bool atomHasMaxBondTypes (PaprecaConfig &papreca_config, ATOM2BONDS_MAP &atomID2bonds, const LAMMPS_NS::tagint &atom_id, const int &atom_type, const int &bond_type)
 
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)
 
void getMonoDesEventsFromAtom (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &iatom, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
 
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)
 
void fillFormTransferDataArr (BondForm *bond_form, int *form_data)
 
void deserializeFormTransferDataArr (int *form_data, int &bond_type, int &delete_atoms)
 
void executeBondForm (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const int &nprocs, const int &event_proc, Event *selected_event)
 
void executeBondBreak (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const int &nprocs, const int &event_proc, Event *selected_event, ATOM2BONDS_MAP &atomID2bonds)
 
void fillDepoDataTransfArr (double *depo_data, Deposition *depo)
 
void deserializeDepoTransfData (double *depo_data, double *site_pos, double *rot_pos, double &rot_theta, double &insertion_vel)
 
void executeDeposition (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &proc_id, const int &nprocs, const int &event_proc, Event *selected_event)
 
void fillIntegerDiffDataTransfArray (int *diff_intdata, Diffusion *diff)
 
void fillDoubleDiffDataTransfArray (double *diff_doubledata, Diffusion *diff)
 
void deserializeIntegerDiffDataArr (int *diff_intdata, int &parent_type, int &is_displacive, int &diffused_type)
 
void deserializeDoubleDiffDataArr (double *diff_doubledata, double *vac_pos, double &insertion_vel)
 
void executeDiffusion (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &proc_id, const int &nprocs, const int &event_proc, Event *selected_event)
 
void executeMonoatomicDesorption (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const int &nprocs, const int &event_proc, Event *selected_event)
 
void printStepInfo (PaprecaConfig &papreca_config, const int &KMC_loopid, const double &time, const double &film_height, const double &proc_rates_sum)
 
void executeEvent (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, const int &proc_id, const int &nprocs, const int &event_proc, const int &event_num, char *event_type, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds)
 
int selectAndExecuteEvent (LAMMPS_NS::LAMMPS *lmp, int &KMC_loopid, double &time, char *event_type, int &proc_id, int &nprocs, PaprecaConfig &papreca_config, std::vector< Event * > &events_local, ATOM2BONDS_MAP &atomID2bonds, double &film_height)
 
double getLocalRate (std::vector< Event * > &events_local, PaprecaConfig &papreca_config)
 
void fillAndSortIndexedRatesVec (double *arr, const int &arr_size, DOUBLE2INTPAIR_VEC &rates_indexed)
 
int selectProcessStochastically (double *arr, const int &arr_size, double &rnum, double &rates_sum)
 
void calcLocalMassAndFillMassProfile (LAMMPS_NS::LAMMPS *lmp, double **mass_profiles, double &local_mass, const int &atom_type, double *atom_xyz, const double &atom_mass, const double &bin_width, const int &bins_num)
 
double ** initMassProfilesArr (const int &types_num, const int &bins_num)
 
void deleteMassProfilesArr (double **mass_profiles, const int &bins_num)
 
void fillMassProfilesTotalArrFromMassProfilesLocal (const int &bins_num, const int &types_num, double **mass_profiles_total, double **mass_profiles_local)
 
void getFilmHeightFromMassBinsMethod (PaprecaConfig &papreca_config, LAMMPS_NS::LAMMPS *lmp, const int &proc_id, double &film_height, double **mass_profiles_total, const double &local_mass, double *atom_mass, const int &bins_num, const int &types_num, const double &bin_width)
 
void calcFilmHeight (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const int &KMC_loopid, PaprecaConfig &papreca_config, double &film_height)
 
const bool atomsCollide (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config, double *atom1_xyz, const int &atom1_type, double *atom2_xyz, const int &atom2_type)
 
void setTimeUnitsConversionConstant (LAMMPS_NS::LAMMPS *lmp, PaprecaConfig &papreca_config)
 
void checkForAcceptableKeywordsUsedMultipleTimes (std::vector< std::string > &commands, const std::string &keyword)
 
void check4AcceptableKeywords (std::vector< std::string > &commands, const int &start, std::unordered_set< std::string > &acceptable_keywords, const bool &accept_bool)
 
void processCatalyzedOption (std::vector< std::string > &commands, int &current_pos, std::vector< int > &catalyzing_types)
 
void processSigmaMixOptions (std::vector< std::string > &commands, PaprecaConfig &papreca_config, int &current_pos)
 
void processBinWidthOptionForElementalDistributions (std::vector< std::string > &commands, PaprecaConfig &papreca_config, int &current_pos)
 
double getStickingCoeffFromDepositionEventOptions (std::vector< std::string > &commands, int &current_pos)
 
double getRateFromInputRateOptions (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)
 
void executeKMCstepsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeKMCperMDCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeTimeEndCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeRandomSeedCommand (LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeFluidAtomTypesCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeFrozenAtomTypesCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeDesorptionCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeHeightCalculationCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeSpeciesMaxBondsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeSpeciesMaxBondTypesCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeMinimizePriorCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeMinimizeAfterCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeTrajectoryDurationCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeDepoheightsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeRandomDepovecsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeRandomDiffvecsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeCreateBondBreakCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeCreateBondFormCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeCreateDiffusionHopCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeCreateDepositionCommand (LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeCreateMonoatomicDesorptionCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeExportHeightVtimeCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeExportSurfaceCoverageCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeExportElementalDistributionsCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeExportExecutionTimesCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeRestartFreqCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeSigmasOptionsCommand (LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executeInitSigmaCommand (LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void executePaprecaCommand (LAMMPS_NS::LAMMPS *lmp, std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
std::vector< std::string > processLine (char *line)
 
void warn4IllegalRuns (const int &proc_id, PaprecaConfig &papreca_config)
 
void abortIllegalRun (const int &proc_id, PaprecaConfig &papreca_config)
 
void readInputAndInitPaprecaConfig (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, const char *file_name, PaprecaConfig &papreca_config)
 
void processSigmaMixOptions (std::vector< std::string > &commands, int &current_pos)
 
double getBinWidthFromElementalDistributions (std::vector< std::string > &commands, int &current_pos)
 
void executeCreateDepositionCommand (std::vector< std::string > &commands, PaprecaConfig &papreca_config)
 
void initializeLMP (LAMMPS_NS::LAMMPS **lmp)
 Initialize LAMMPS. More...
 
void readLMPinput (const std::string &lmp_input, LAMMPS_NS::LAMMPS *lmp)
 
void runLammps (LAMMPS_NS::LAMMPS *lmp, const int &timesteps_num)
 
void remap3DArrayInPeriodicBox (LAMMPS_NS::LAMMPS *lmp, double *arr)
 
void resetMobileAtomsGroups (LAMMPS_NS::LAMMPS *lmp, const std::vector< int > &fluid_atomtypes)
 
void deleteAtoms (LAMMPS_NS::LAMMPS *lmp, LAMMPS_NS::tagint *atom_ids, const int &num_atoms, const std::string &delete_bonds, const std::string &delete_molecule)
 
void deleteAtoms (LAMMPS_NS::LAMMPS *lmp, std::vector< LAMMPS_NS::tagint > &atom_ids, const std::string &delete_bonds, const std::string &delete_molecule)
 
void deleteAtomsInBoxRegion (LAMMPS_NS::LAMMPS *lmp, double &boxxlo, double &boxxhi, double &boxylo, double &boxyhi, double &boxzlo, double &boxzhi, const std::string &delete_bonds, const std::string &delete_molecule)
 
void createAtom (LAMMPS_NS::LAMMPS *lmp, const double atom_pos[3], const int &atom_type)
 
void deleteBond (LAMMPS_NS::LAMMPS *lmp, const LAMMPS_NS::tagint &atom1id, const LAMMPS_NS::tagint &atom2id, const bool special)
 
void formBond (LAMMPS_NS::LAMMPS *lmp, const LAMMPS_NS::tagint &atom1id, const LAMMPS_NS::tagint &atom2id, const int &bond_type)
 
void insertMolecule (LAMMPS_NS::LAMMPS *lmp, const double site_pos[3], const double rot_pos[3], const double &rot_theta, const int &type_offset, const char *mol_name)
 
void diffuseAtom (LAMMPS_NS::LAMMPS *lmp, const double vac_pos[3], const LAMMPS_NS::tagint &parent_id, const int &parent_type, const int &is_displacive, const int &diffused_type)
 
void initType2SigmaFromLammpsPairCoeffs (LAMMPS_NS::LAMMPS *lmp, INTPAIR2DOUBLE_MAP &type2sigma)
 
int getMaskedNeibIndex (int *neighbors, int &j)
 
void initAndGatherBondsList (LAMMPS_NS::LAMMPS *lmp, LAMMPS_NS::tagint **bonds_list, LAMMPS_NS::bigint &bonds_num)
 
const int getMolIndexFromMolName (LAMMPS_NS::LAMMPS *lmp, std::string mol_name)
 
void computeMolCenter (LAMMPS_NS::LAMMPS *lmp, std::string mol_name)
 
void dumpRestart (LAMMPS_NS::LAMMPS *lmp, const int &KMC_loopid, const int &dump_freq)
 
double get3DSqrDistWithPBC (LAMMPS_NS::LAMMPS *lmp, const double *x1, const double *x2)
 
void MPIBcastAndExecuteCommand (LAMMPS_NS::LAMMPS *lmp, std::string &command)
 
void setupMPI (int *narg, char ***arg, int *nprocs, int *proc_id)
 
const int getMPIRank (MPI_Comm communicator)
 
void warnOne (MPI_Comm communicator, const std::string &message)
 
void warnAll (MPI_Comm communicator, const std::string &message)
 
void allAbort (MPI_Comm communicator)
 
void allAbortWithMessage (MPI_Comm communicator, const std::string &message)
 
double getRateFromArrhenius (const double &activation_energy, const double &attempt_freq, const double &temperature)
 
double getDepoRateFromHertzKnudsen (const double &pressure_in, const double &ads_area_in, const double &ads_mass_in, const double &temperature_in)
 
double getDesorptionRate (const double &activation_energy, const double &temperature)
 
void advanceSimClockFromKMC (PaprecaConfig &papreca_config, const double &proc_rates_sum, double &time)
 
void advanceSimClockFromLAMMPS (PaprecaConfig &papreca_config, double &time)
 
double doubleArrSum (double *arr, const int &size)
 
void copyDoubleArray3D (double *copy, const double *source, const int start, const int end)
 
const std::string getConcatenatedStringFromStringsVector (const std::vector< std::string > &strings, size_t start=-1, size_t end=-1)
 
const std::string getConcatenatedStringWithSpacesFromStringsVector (const std::vector< std::string > &strings, size_t start=-1, size_t end=-1)
 
const int getStringPosInStringVec (const std::string &string2check, const std::vector< std::string > &strings)
 
bool stringIsNumber (const std::string &string)
 
bool stringIsIntNumber (const std::string &string)
 
const bool stringIsBool (const std::string &string)
 
const unsigned long int string2UnsignedLongInt (std::string &string)
 
const int string2Int (std::string &string)
 
const double string2Double (std::string &string)
 
const bool string2Bool (std::string &string)
 
const int boolString2Int (std::string &string)
 
template<typename T >
getSumOfVecElements (const std::vector< T > &vec)
 
template<typename T , size_t N>
void pushArrayToVector (const T *arr, std::vector< T > &vec)
 
template<typename T >
std::vector< T > getSubVectorFromVector (const std::vector< T > &vec, size_t start, size_t end)
 
template<typename T , typename Hash >
bool elementIsInUnorderedSet (const std::unordered_set< T, Hash > &set, const T &element)
 
template<typename KeyType , typename ValueType , typename Hash >
bool mappingExists (const std::unordered_map< KeyType, ValueType, Hash > &map, const KeyType &key)
 
template<typename T >
bool elementIsInVector (const std::vector< T > &vec, const T &element)
 

Typedef Documentation

◆ ARRAY3D

typedef std::array< double , 3 > PAPRECA::ARRAY3D

◆ ATOM2BONDS_MAP

typedef std::unordered_map< LAMMPS_NS::tagint , BOND_VECTOR > PAPRECA::ATOM2BONDS_MAP

maps atom IDs to their associated PAPRECA::BOND_VECTOR to allow easy access of bonds and bond types.

◆ BOND_VECTOR

typedef std::vector< Bond > PAPRECA::BOND_VECTOR

◆ DOUBLE2INTPAIR

typedef std::pair< double , int > PAPRECA::DOUBLE2INTPAIR

◆ DOUBLE2INTPAIR_VEC

◆ INT2INT_MAP

typedef std::unordered_map< int , int > PAPRECA::INT2INT_MAP

◆ INT2INTSMAP_MAP

typedef std::unordered_map< int , INT2INT_MAP > PAPRECA::INT2INTSMAP_MAP

◆ INT_PAIR

typedef std::pair< int , int > PAPRECA::INT_PAIR

◆ INT_SET

typedef std::unordered_set< int > PAPRECA::INT_SET

◆ INTPAIR2DOUBLE_MAP

typedef std::unordered_map< INT_PAIR , double , PairHash > PAPRECA::INTPAIR2DOUBLE_MAP

◆ INTPAIR2INT_MAP

typedef std::unordered_map< INT_PAIR , int , PairHash > PAPRECA::INTPAIR2INT_MAP

◆ PAIR2BONDFORM_MAP

typedef std::unordered_map< INT_PAIR , PredefinedBondForm* , PairHash > PAPRECA::PAIR2BONDFORM_MAP

◆ PAIR_SET

typedef std::unordered_set< INT_PAIR , PairHash > PAPRECA::PAIR_SET

◆ TAGINT_SET

typedef std::unordered_set< LAMMPS_NS::tagint > PAPRECA::TAGINT_SET

◆ TYPE2DEPOSITION_MAP

typedef std::unordered_map< int , PredefinedDeposition* > PAPRECA::TYPE2DEPOSITION_MAP

◆ TYPE2DIFFUSION_MAP

typedef std::unordered_map< int , PredefinedDiffusionHop* > PAPRECA::TYPE2DIFFUSION_MAP

◆ TYPE2MONODES_MAP

typedef std::unordered_map< int , PredefinedMonoatomicDesorption* > PAPRECA::TYPE2MONODES_MAP

◆ TYPE2REACTION_MAP

typedef std::unordered_map< int , PredefinedReaction* > PAPRECA::TYPE2REACTION_MAP

Function Documentation

◆ abortIllegalRun()

void PAPRECA::abortIllegalRun ( const int &  proc_id,
PaprecaConfig papreca_config 
)

After processing all commands, this function is called abort illegal PAPRECA runs.

Parameters
[in]proc_idID of current MPI process.
[in]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ advanceSimClockFromKMC()

void PAPRECA::advanceSimClockFromKMC ( PaprecaConfig papreca_config,
const double &  proc_rates_sum,
double &  time 
)

Stochastically advances the simulation clock by a KMC step.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_rates_sumtotal (gathered/sum from all MPI processes) event rate.
[in,out]timetime on current PAPRECA step.
Note
This function should not be confused with PAPRECA::advanceSimClockFromLAMMPS(). PAPRECA::advanceSimClockFromLAMMPS() advances the clock forward by timestep*dt (LAMMPS variables).
See this paper for more information regarding the classic N-FOLD way and the advancement of the simulation clock: https://www.sciencedirect.com/science/article/pii/S0927025623004159

◆ advanceSimClockFromLAMMPS()

void PAPRECA::advanceSimClockFromLAMMPS ( PaprecaConfig papreca_config,
double &  time 
)

Advances the simulation clock by timestep*dt (as defined in the LAMMPS and PAPRECA inputs).

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in,out]timecurrent time.
Note
This function should not be confused with PAPRECA::advanceSimClockFromKMC(). PAPRECA::advanceSimClockFromKMC() advances the clock forward in the KMC/N-FOLD way.

◆ allAbort()

void PAPRECA::allAbort ( MPI_Comm  communicator)

Aborts all MPI processes.

Parameters
[in]communicatorcommunicator

◆ allAbortWithMessage()

void PAPRECA::allAbortWithMessage ( MPI_Comm  communicator,
const std::string &  message 
)

Aborts all MPI processes and throws a message on the screen.

Parameters
[in]communicatorMPI communicator.
[in]messagestd::string of the error message.

◆ atomCandidatesAreLone()

const bool PAPRECA::atomCandidatesAreLone ( const LAMMPS_NS::tagint  atom1_id,
const LAMMPS_NS::tagint  atom2_id,
ATOM2BONDS_MAP atomID2bonds 
)

Checks if two atoms are lone (i.e., if they do not have any bonds). This is done by retrieving the PAPRECA:Bond objects vector for each atom from the atomID2bonds container.

Parameters
[in]atom1_idID of the first atom.
[in]atom2_idID of the second atom.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
Returns
true if both atoms are lone (not bonded to any other atom) or false if one or both atoms contain atoms (i.e., if the size of their PAPRECA::Bond objects vector is non-zero.

◆ atomHasCollisionWithMolAtoms()

bool PAPRECA::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 
)

Checks if the parent event atom has collisions with any of the inserted molecule atoms.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]atom_xyzcoordinates of the parent atom.
[in]atom_typeatom type of parent atom.
[in]mol_natomstotal number of atoms in the inserted molecule.
[in]mol_xyza mol_natomsx3 array storing the coordinates of all inserted molecule atoms.
[in]mol_atomtypearray storing the atom types of all inserted molecule atoms.
Returns
true or false if atom has collisions with molecule atoms or not, respectively.
See also
PAPRECA::getDepoEventsFromAtom(), PAPRECA::atomsCollide(), PAPRECA::candidateDepoHasCollisions()

◆ atomHasMaxBonds()

const bool PAPRECA::atomHasMaxBonds ( PaprecaConfig papreca_config,
ATOM2BONDS_MAP atomID2bonds,
const LAMMPS_NS::tagint &  atom_id,
const int  atom_type 
)

Determines the total number of bonds for an atom by retrieving its PAPRECA::Bond objects vector. Then compares it to the user defined species max bonds.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
[in]atom_idID of atom.
[in]atom_typetype of current atom.
Returns
true if the size of PAPRECA::Bond objects vector is greater or equal to the user defined species max bonds.

◆ atomHasMaxBondTypes()

const bool PAPRECA::atomHasMaxBondTypes ( PaprecaConfig papreca_config,
ATOM2BONDS_MAP atomID2bonds,
const LAMMPS_NS::tagint &  atom_id,
const int &  atom_type,
const int &  bond_type 
)

Checks if the number of bonds of a specific bond type for the current atom is greater or equal than the user defined max bond types of species. This is done by retrieving the PAPRECA::Bond objects vector of the current atom from the atomID2bonds map.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
[in]atom_idid of current atom.
[in]atom_typeof current atom.
[in]bond_typeto be checked
Returns
true if the number of bonds of a specific bond type for the current atom is greater or equal than the user defined max bond types of species. False otherwise.

◆ atomIsInDepoScanRange()

const bool PAPRECA::atomIsInDepoScanRange ( PaprecaConfig papreca_config,
double *  iatom_xyz,
double &  film_height 
)

Checks if the parent atom is within the acceptable scan range for deposition events. The acceptable scan ranges can be modified through the PAPRECA input file.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatom_xyzcoordinates of candidate atom
[in]film_heightheight in current PAPRECA step.
Returns
true if the parent atom is within the acceptable scan range or false otherwise.
See also
PAPRECA::getDepoEventsFromAtom()

◆ atomsBelong2TheSameMol()

const bool PAPRECA::atomsBelong2TheSameMol ( const LAMMPS_NS::tagint &  iatom_mol,
const LAMMPS_NS::tagint &  jneib_mol 
)

Uses LAMMPS molecule IDs to decide if two atoms pbelong to the same mol.

Parameters
[in]iatom_molID of the first atom.
[in]jneib_molID of the second atom (which is typically one of the neighbors of iatom).
Returns
true if atoms belong to the same molecule or false if the atoms do not belong to the same molecule.

◆ atomsCollide()

const bool PAPRECA::atomsCollide ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
double *  atom1_xyz,
const int &  atom1_type,
double *  atom2_xyz,
const int &  atom2_type 
)

Checks for collisions between two atoms. It is assumed that two atoms of types i and j "collide" if the distance between them is smaller than sigma_ij.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]atom1_xyzcoordinates of the first atom (x,y, and z).
[in]atom1_typeatom type of the first atom.
[in]atom2_xyzcoordinates of the second atom (x,y, and z).
[in]atom2_typeatom type of the second atom.
Returns
true or false if atoms collide or don't collide, respectively.
See also
PAPRECA::getDepoEventsFromAtom(), PAPRECA::atomHasCollisionWithMolAtoms(), PAPRECA::candidateDepoHasCollisions(), PAPRECA::getDiffEventsFromAtom()

◆ bondBetweenAtomsExists()

bool PAPRECA::bondBetweenAtomsExists ( ATOM2BONDS_MAP atomID2bonds,
const LAMMPS_NS::tagint &  atom1_id,
const LAMMPS_NS::tagint &  atom2_id 
)

The PAPRECA::Bond objects vector is retrieved from the atomID2bonds container for two atoms to determine if the two atoms are already bonded.

Parameters
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
[in]atom1_idID of the first atom.
[in]atom2_idID of the second atom.
Returns
true or false depending on whether there is an existing bond between the two atoms or not, respectively.

◆ boolString2Int()

const int PAPRECA::boolString2Int ( std::string &  string)

This function receives an std::string which is yes/no and converts it to an int (1/0, respectively).

Parameters
[in]stringstd::string to be converted.
Returns
converted integer.

◆ broadcastDelidsFromMasterProc()

void PAPRECA::broadcastDelidsFromMasterProc ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
int &  delids_num,
std::vector< LAMMPS_NS::tagint > &  delids 
)

Broadcasts the delids vector (containing the IDs of atoms marked for deletion) from the master MPI process to all other processes. This function is only called when the delete_desorbed option is active and the gather_all algorithm is selected.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]delids_numnumber of atom IDs marked for deletion.
[in,out]delidsvector of collected atom IDs initialized by the master MPI process and broadcasted to all other MPI processes.
See also
PAPRECA::deleteDesorbedAtoms(), PAPRECA::fillDelidsVec(), PAPRECA::Bond::recursiveCollectBondedAtoms()

◆ calcFilmHeight()

void PAPRECA::calcFilmHeight ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const int &  KMC_loopid,
PaprecaConfig papreca_config,
double &  film_height 
)

Calculates the film height based on the user defined film calculation method.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]KMC_loopidPAPRECA (kMC) step number.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in,out]film_heightheight at current PAPRECA (kMC) step.
See also
PAPRECA::initMassProfilesArr(), PAPRECA::deleteMassProfilesArr(), PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal(), PAPRECA::getFilmHeightFromMassBinsMethod(), PAPRECA::calcLocalMassAndFillMassProfile()
Note
This function also dumps ElementalDistributions files.

◆ calcLocalMassAndFillMassProfile()

void PAPRECA::calcLocalMassAndFillMassProfile ( LAMMPS_NS::LAMMPS *  lmp,
double **  mass_profiles,
double &  local_mass,
const int &  atom_type,
double *  atom_xyz,
const double &  atom_mass,
const double &  bin_width,
const int &  bins_num 
)

Appends atom_mass to the relevant bin of mass_profiles array.

Parameters
[in]lmppointer to LAMMPS object.
[in,out]mass_profiles2D (i.e., mass_profiles[bins_num][atomtypes_num]) array containing the total mass of a specific atom type for each x-y slice (bin) in the system.
[in,out]local_masstotal mass in current MPI process.
[in]atom_typetype of the current atom.
[in]atom_xyzarray containing the coordinates of the current atom.
[in]atom_massmass of current atom.
[in]bin_widthwidth of current x-y slice (bin).
[in]bins_numtotal number of x-y slices (bins).
See also
PAPRECA::initMassProfilesArr(), PAPRECA::deleteMassProfilesArr(), PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal(), PAPRECA::getFilmHeightFromMassBinsMethod(), PAPRECA::calcFilmHeight()

◆ candidateDepoHasCollisions()

bool PAPRECA::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 
)

Checks if the inserted molecule atoms have collisions with 1) the parent atom, 2) all neighbors of the parent event atom.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]neighborsIDs of all neighbors of the parent event atom.
[in]neighbors_numnumber of atoms.
[in]candidate_centercoordinates of the center of mass of the candidate inserted molecule.
[in]iatom_xyzcoordinates of parent atom.
[in]iatom_typeatom type of parent atom.
[in]depo_templateDeposition template (PAPRECA::PredefinedDeposition) as initialized by the user (in the PAPRECA input file).
Returns
true or false if candidate deposition has collisions or not, respectively.
See also
PAPRECA::getDepoEventsFromAtom(), PAPRECA::atomHasCollisionWithMolAtoms(), PAPRECA::atomsCollide()
Note
This function assumes that any potential collision between the inserted molecule and existing atoms in the system can be detected using the parent atom neighbors. For very big molecules there is a chance that a molecule atom collides with existing atoms not included in the parent atom neighbor list. Hence, this function might require modifications in the future.

◆ candidateDiffHasCollisions()

const bool PAPRECA::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 
)

Checks for collisions between the diffusion atom (i.e., atom moving to the vacancy) and existing atoms in the simulation.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]neighborsIDs of neighbors of the parent atom.
[in]neighbors_numnumber of neighbors of the parent atom.
[in]candidate_xyzcoordinates (x,y, and z) of vacancy (point towards which the atom diffuses).
[in]diffused_typeatom type of diffused atom.
[in]iatom_xyzcoordinates of the parent atom.
[in]iatom_typeatom type of parent atom.
Returns
true or false if the diffused candidate atom has or does not have collisions with existing atoms, respectively.
See also
PAPRECA::getDiffEventsFromAtom()

◆ check4AcceptableKeywords()

void PAPRECA::check4AcceptableKeywords ( std::vector< std::string > &  commands,
const int &  start,
std::unordered_set< std::string > &  acceptable_keywords,
const bool &  accept_bool 
)

Checks if a specific command line includes acceptable keyword. The "acceptable_keyword" unordered set has to be initialized correctly by the user, before the call to this function. The present function aborts if it detected a non-acceptable keyword (i.e, a keyword not included in the acceptable_keywords set).

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in]startcurrent index position in the commands vector. Only check keywords for indices that are equal or greater than start.
[in]acceptable_keywordsunordered_set containing the acceptable (for this command) keywords. Has to be initialized by the user before the call to this function.
[in]accept_boolif true, then yes and no keywords are also accepted in the command line.

◆ checkForAcceptableKeywordsUsedMultipleTimes()

void PAPRECA::checkForAcceptableKeywordsUsedMultipleTimes ( std::vector< std::string > &  commands,
const std::string &  keyword 
)

Receives the commands vector of strings and aborts if the provided "keyword" is used multiple times.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in]keywordspecific keyword to be checked.

◆ computeMolCenter()

void PAPRECA::computeMolCenter ( LAMMPS_NS::LAMMPS *  lmp,
std::string  mol_name 
)

Invokes the LAMMPS function compute_center for the mol_name.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]mol_namevalid molecule names (as defined in the LAMMPS input file. e.g., if you used this command: "molecule mmmTCP ./TCP.xyz", then mol_name should be "mmmTCP").
Note
This function is a wrapper around the compute_center of molecule.h.
THis function can be helpful if you want to get the molecule center before the start of the run (i.e., to populate kMC events etc).
This function HAS to be used to initialize the events list for deposition events. If not used you will get a segmentation fault as the molecule center will not be calculated.

◆ copyDoubleArray3D()

void PAPRECA::copyDoubleArray3D ( double *  copy,
const double *  source,
const int  start,
const int  end 
)

Receives an array of doubles and copies it to a different array of doubles.

Parameters
[in,out]copycopied array.
[in]sourceoriginal array.
[in]startcopy starting from that index.
[in]endcopy all elements whose index is less than this variable (i.e., copy[i] with i < end ).
Note
This function will result in a segmentation fault if the "start" or "end" indexes are out-of-bounds (i.e., not mapped for the source array).

◆ createAtom()

void PAPRECA::createAtom ( LAMMPS_NS::LAMMPS *  lmp,
const double  atom_pos[3],
const int &  atom_type 
)

Inserts an atom in the simulation.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]atom_poscoordinates (x,y, and z) of insertion point.
[in]atom_typetype of insert atom
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/create_atoms.html
CAREFUL: Currently, the inserted atom has zero velocity and charges!
CAREFUL: LAMMPS will NOT create the atom if it lies exactly at or outside the periodic box! PAPRECA uses other functions to remap coordinates inside the periodic box (e.g., PAPRECA::remap3DArrayInPeriodicBox).

◆ debugCheckBondsInNeibLists()

void PAPRECA::debugCheckBondsInNeibLists ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
ATOM2BONDS_MAP atomID2bonds 
)

◆ debugCheckDeposition()

void PAPRECA::debugCheckDeposition ( )

◆ debugPrintBasicAtomInfo()

void PAPRECA::debugPrintBasicAtomInfo ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id 
)

◆ debugPrintBondMapPairs()

void PAPRECA::debugPrintBondMapPairs ( ATOM2BONDS_MAP const &  bonds_map,
const int &  proc_id 
)

◆ debugPrintBondsList()

void PAPRECA::debugPrintBondsList ( LAMMPS_NS::tagint *  bonds_list,
LAMMPS_NS::bigint &  bonds_num,
const int &  proc_id 
)

◆ debugPrintEventInfo()

void PAPRECA::debugPrintEventInfo ( Event event,
const int &  proc_id 
)

◆ debugPrintNeighborLists()

void PAPRECA::debugPrintNeighborLists ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id 
)

◆ debugPrintType2SigmaMap()

void PAPRECA::debugPrintType2SigmaMap ( INTPAIR2DOUBLE_MAP types2sigma)

◆ deleteAtoms() [1/2]

void PAPRECA::deleteAtoms ( LAMMPS_NS::LAMMPS *  lmp,
LAMMPS_NS::tagint *  atom_ids,
const int &  num_atoms,
const std::string &  delete_bonds,
const std::string &  delete_molecule 
)

Receives an array of atom IDs (atom_ids) and deletes all atoms in the simulation with the corresponding IDs.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]atom_idsarray of IDs of atoms to be deleted.
[in]num_atomsnumber of atoms to be deleted (length of atom_ids vector).
[in]delete_bondsif "yes", then the LAMMPS delete_atoms command is called with the "bond yes" keyword.
[in]delete_moleculeif "yes", then the LAMMPS delete atoms command is called with the "mol yes" option.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/delete_atoms.html.
This function uses a dummy group named "deletion" to delete atoms. You should NOT use a group with the same name in your LAMMPS input file.

◆ deleteAtoms() [2/2]

void PAPRECA::deleteAtoms ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< LAMMPS_NS::tagint > &  atom_ids,
const std::string &  delete_bonds,
const std::string &  delete_molecule 
)

Receives a vector of atom IDs and deletes all atoms in the simulation with the corresponding IDs.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]atom_idsstd::vector of IDs of atoms to be deleted.
[in]delete_bondsif "yes", then the LAMMPS delete_atoms command is called with the "bond yes" keyword.
[in]delete_moleculeif "yes", then the LAMMPS delete atoms command is called with the "mol yes" option.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/delete_atoms.html.
This function uses a dummy group named "deletion" to delete atoms. You should NOT use a group with the same name in your LAMMPS input file.

◆ deleteAtomsInBoxRegion()

void PAPRECA::deleteAtomsInBoxRegion ( LAMMPS_NS::LAMMPS *  lmp,
double &  boxxlo,
double &  boxxhi,
double &  boxylo,
double &  boxyhi,
double &  boxzlo,
double &  boxzhi,
const std::string &  delete_bonds,
const std::string &  delete_molecule 
)

Deletes all atoms in a block region defined by the input region bounds.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]boxxlolow deletion region x-boundary.
[in]boxxhihigh deletion region x-boundary.
[in]boxylolow deletion region y-boundary.
[in]boxyhihigh deletion region y-boundary.
[in]boxzlolow deletion region z-boundary.
[in]boxzhihigh deletion region z-boundary.
[in]delete_bondsif "yes" then the delete_atoms LAMMPS command is called with the "bond yes" keyword. The delete_atoms command is called to delete atoms in the deletion region.
[in]delete_moleculeif "yes" then the delete_atoms LAMMPS command is called with the "mol yes" keyword. The delete_atoms command is called to delete atoms in the deletion region.
Note
This function is a wrapper of these LAMMPS commands: https://docs.lammps.org/region.html, https://docs.lammps.org/group.html, https://docs.lammps.org/delete_atoms.html
This function uses a dummy group named "del_atoms" to delete atoms. You should NOT use a group with the same name in your LAMMPS input file.
This function uses a dummy region named "del_region". You should NOT use a region with the same name in your LAMMPS input file.

◆ deleteBond()

void PAPRECA::deleteBond ( LAMMPS_NS::LAMMPS *  lmp,
const LAMMPS_NS::tagint &  atom1id,
const LAMMPS_NS::tagint &  atom2id,
const bool  special 
)

Deletes an existing bond between atom1 and atom2.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]atom1idID of the first atom.
[in]atom2idID of the second atom.
[in]specialif true, then the delete_bonds LAMMPS command is called with the "special" keyword.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/delete_bonds.html
The delete_bonds command in LAMMPS deletes ALL bonds of a specific type between 2 atoms Hence, to delete one specific bond, we temporarily move the bond to a dummy bond type group and then invoke the delete_bonds command Such method is safe since ONLY ONE BOND CAN BE FORMED BETWEEN A SET OF ATOMS (e.g., one P atom and one O atom should only have one bond between each other. If you want 2 specific atom IDS to form more that one bond between (e.g., a double/triple bond), consider using one bond type instead of 3 separate bond types.
If an bond does not exist between the 2 atoms, LAMMPS will not throw an error! This happens because the bond deletion group will be empty by the time the delete_bonds command is called.
This function uses a dummy group named bonddel to delete atoms. Do not define another group with the same name in your LAMMPS input file.

◆ deleteDesorbedAtoms()

void PAPRECA::deleteDesorbedAtoms ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
int &  proc_id,
const int &  nprocs,
double &  film_height,
ATOM2BONDS_MAP atomID2bonds 
)

This function is always called but performs computations only if the user has set a desorption height cutoff in the PAPRECA input file. The present function compares the z-coordinate of each atom with the desorption height cutoff. If any z-coordinate value is greater than or equal to the desorption height cutoff, the associated atom (along with its bonded atoms) is deleted. Currently, the user can select between two different algorithms: 1) gather_local (see fillDelidsLocalVec() function description/notes), and 2) gather_all (see fillDelidsVec() function description/notes). A comparison of the performance between the two algorithms is not currently available. However, as a quick note, it can be mentioned that gather_all is expected to be more memory intensive, since it calls the LAMMPS function lammps_gather_atoms_concat() to gather the coordinates of non-consecutive IDs on the master proc.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]film_heightheight at current PAPRECA step.
[in,out]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::fillDelidsLocalVec(), PAPRECA::fillDelidsVec()
Note
The user is advised to refer to the LAMMPS developer documentation (https://docs.lammps.org/) to understand how lammps_gather_atoms_concant works (called by gather_all deletion algorithm).

◆ deleteMassProfilesArr()

void PAPRECA::deleteMassProfilesArr ( double **  mass_profiles,
const int &  bins_num 
)

Deletes a previously-initialized 2D array of mass profiles.

Parameters
[in,out]mass_profiles2D array of mass profiles
[in]bins_numnumber of x-y slices (bins).
See also
PAPRECA::initMassProfilesArr(), PAPRECA::calcLocalMassAndFillMassProfile(), PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal(), PAPRECA::getFilmHeightFromMassBinsMethod(), PAPRECA::calcFilmHeight()

◆ deleteMolCoordsArr()

void PAPRECA::deleteMolCoordsArr ( double **  mol_xyz,
const int &  mol_natoms 
)

Deletes the molecule coordinates array used to check for collisions between the deposited molecule and system atoms.

Parameters
[in,out]mol_xyzarray storing the x,y, and z distances of each molecule atom from the molecule center. See molecule.h and molecule.cpp files in the LAMMPS source directory for more information.
[in]mol_natomstotal number of molecule atoms.
See also
PAPRECA::getDepoEventsFromAtom(), PAPRECA::initMolCoordsArr()

◆ delidsLocalVectorsAreEmpty()

bool PAPRECA::delidsLocalVectorsAreEmpty ( std::vector< LAMMPS_NS::tagint > &  delids_local)

Communicates information between MPI processes to check if every local (i.e., on every MPI process) delids_local container is empty. Effectively, this means that the z-coordinates of all atoms in the simulation are lower than desorb_cut and that no deletions have to be performed.

Parameters
[in]delids_localvector of collected atom IDs.
Returns
true if the delids_local vector is empty on all MPI processes. False, otherwise.
See also
PAPRECA::deleteDesorbedAtoms()

◆ depoCandidateIsBelowRejectionHeight()

const bool PAPRECA::depoCandidateIsBelowRejectionHeight ( PaprecaConfig papreca_config,
double *  candidate_xyz,
const double &  film_height 
)

Checks if the deposition candidate point is below the rejection height (as set in the PAPRECA input).

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]candidate_xyzarray storing the coordinates of the candidate deposition point.
[in]film_heightfilm height at the current PAPRECA step.
Returns
true or false if the candidate point is below or above the rejection height, respectively.
See also
PAPRECA::getDepoEventsFromAtom()

◆ deserializeDepoTransfData()

void PAPRECA::deserializeDepoTransfData ( double *  depo_data,
double *  site_pos,
double *  rot_pos,
double &  rot_theta,
double &  insertion_vel 
)

Deserializes (post-processes) data after calls to MPI function related to the execution of PAPRECA::Deposition events.

Parameters
[in]depo_data8-element array of serialized (in fillDepoDataTransfArr() function) data.
[in,out]site_posarray containing the coordinates of the center-of-mass of the inserted molecule/atom.
[in,out]rot_posarray containing the coordinates of the center-of-rotation of the inserted molecule.
[in,out]rot_thetaangle of rotation of inserted molecule
[in,out]insertion_velvelocity of inserted molecule.
See also
PAPRECA::fillDepoDataTransfArr(), PAPRECA::executeDeposition()

◆ deserializeDoubleDiffDataArr()

void PAPRECA::deserializeDoubleDiffDataArr ( double *  diff_doubledata,
double *  vac_pos,
double &  insertion_vel 
)

Deserializes (post-processes) double data after calls to MPI function related to the execution of PAPRECA::Diffusion events.

Parameters
[in]diff_doubledata4-element array of serialized (in fillDoubleDiffDataTransfArray() function) data.
[in,out]vac_poscoordinates of vacancy.
[in,out]insertion_velvelocity of diffused atom.
See also
PAPRECA::fillDoubleDiffDataTransfArray(), PAPRECA::executeDiffusion()

◆ deserializeFormTransferDataArr()

void PAPRECA::deserializeFormTransferDataArr ( int *  form_data,
int &  bond_type,
int &  delete_atoms 
)

Deserializes (post-processes) data after calls to MPI function related to the execution of PAPRECA::BondForm events.

Parameters
[in]form_data2-element array of serialized (in fillFormTransferDataArr() function) data.
[in,out]bond_typetype of bond.
[in,out]delete_atoms0 if atoms are not deleted after the execution of the bond formation event, or 1 if atoms are deleted.
See also
PAPRECA::fillFormTransferDataArr(), PAPRECA::executeBondForm()

◆ deserializeIntegerDiffDataArr()

void PAPRECA::deserializeIntegerDiffDataArr ( int *  diff_intdata,
int &  parent_type,
int &  is_displacive,
int &  diffused_type 
)

Deserializes (post-processes) integer data after calls to MPI function related to the execution of PAPRECA::Diffusion events.

Parameters
[in]diff_intdata3-element array of serialized (in fillIntegerDiffDataTransfArray() function) data.
[in,out]parent_typeatom type of parent atom.
[in,out]is_displacive0 or 1 depending on whether the diffusion event is diplacive or not.
[in,out]diffused_typeatom type of diffused atom.
See also
PAPRECA::fillIntegerDiffDataTransfArray(), PAPRECA::executeDiffusion()

◆ diffuseAtom()

void PAPRECA::diffuseAtom ( LAMMPS_NS::LAMMPS *  lmp,
const double  vac_pos[3],
const LAMMPS_NS::tagint &  parent_id,
const int &  parent_type,
const int &  is_displacive,
const int &  diffused_type 
)

Executes a diffusion operation (i.e., moves if the diffusion is displacive, or creates an atom if the diffusion is non-displacive).

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]vac_poscoordinates (x,y, and z) of vacancy.
[in]parent_idID of parent candidate atom.
[in]parent_typeatom type of parent candidate atom.
[in]is_displacive1 if the diffusion is displacive (i.e., if the parent atom moves), or 0 if the diffusion is non-displacive (i.e., if a new atom is created on the vacancy position).
[in]diffused_typetype of diffused atom. Can be the same as parent type or can be set to a different type if you wish to change the atom type after performing a diffusion event.
See also
createAtom(), deleteAtoms()
Note
If diffusion is displacive, the original atom moves. Instead of deleting bonds to move an atom it would be easier to delete the diffusing atom and spawn it again. This approximation introduces an error: it assumes that the charge of the atom becomes zero during diffusion. However, if you use any charge equilibration scheme this shouldn't be an issue because the atom is going to obtain the correct charge during equilibration. More sophisticated solutions would include: Actual moving of atom or even transferring (using set functions of charges).
If diffusion is non-displacive, we create a new atom in the vacancy position instead of moving the parent atom. Again, we assume that the charge of the atom is 0 to begin with.

◆ doubleArrSum()

double PAPRECA::doubleArrSum ( double *  arr,
const int &  size 
)

Receives a C-style array of doubles and returns the sum of its elements.

Parameters
[in]arrpointer to 1-D array of doubles.
[in]sizesize (length) of arr.
Returns
sum of all elements of arr.

◆ dumpRestart()

void PAPRECA::dumpRestart ( LAMMPS_NS::LAMMPS *  lmp,
const int &  KMC_loopid,
const int &  dump_freq 
)

Dumps a LAMMPS simulation restart file (can be used to restart a PAPRECA simulation).

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]KMC_loopidcurrent PAPRECA step number.
[in]dump_freqdump a restart file every dump_freq PAPRECA step.
Note
Restarts are controlled from this wrapper and NOT BY LAMMPS. LAMMPS will choose to create restarts based on the MD step, but we want to create restarts based on the KMC step.
The dumping frequency can be set in the PAPRECA input file.

◆ elementIsInUnorderedSet()

template<typename T , typename Hash >
bool PAPRECA::elementIsInUnorderedSet ( const std::unordered_set< T, Hash > &  set,
const T &  element 
)

Searches if an element is included in an unordered set.

Parameters
[in]setunordered set to be searched.
[in]elementelement to be searched in the unordered set.
Returns
true if the element is in the unordered set or false otherwise.
Note
This is a template function that allows searches on unordered sets of any data type. Custom hash functions can also be used.

◆ elementIsInVector()

template<typename T >
bool PAPRECA::elementIsInVector ( const std::vector< T > &  vec,
const T &  element 
)

Searches if an element is included in an std::vector.

Parameters
[in]vecvector to be searched.
[in]elementelement to be searched in the vector.
Returns
true if the element is in the vector or false otherwise.
Note
This is a template function that allows searches on vector of any primitive data types.

◆ equilibrate()

void PAPRECA::equilibrate ( LAMMPS_NS::LAMMPS *  lmp,
int &  proc_id,
const int &  nprocs,
double &  time,
PaprecaConfig papreca_config,
double &  film_height,
int &  zero_rate,
const int &  KMC_loopid,
ATOM2BONDS_MAP atomID2bonds 
)

This function performs a LAMMPS run on the current system configuration, every KMC_per_MD (as set by the user in the PAPRECA input file). Then, it deletes atoms whose z-coordinate is equal to or greater than the desorption height cutoff (defined in the PAPRECA input file).

Parameters
[in,out]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in,out]timecurrent PAPRECA simulation time.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]film_heightcurrent PAPRECA simulation height.
[in]zero_rate0 if the total event rate at the current step is zero, or 1 otherwise.
[in]KMC_loopidcurrent PAPRECA simulation step.
[in,out]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::equilibrateFluidAtoms(), PAPRECA::deleteDesorbedAtoms()
Note
The function also calculates the execution times during the LAMMPS (MD) step (if the executionTimes file has been activated in the PAPRECA input file).

◆ equilibrateFluidAtoms()

void PAPRECA::equilibrateFluidAtoms ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
double &  time 
)

Performs a LAMMPS simulation on the fluid atom types (as defined in the PAPRECA input). Then, updates the simulation clock by timestep*trajectory_duration (as defined by the user in the LAMMPS and PAPRECA inputs). Additionally, might perform minimizations before/after the LAMMPS trajectory (if an appropriate LAMMPS minimization command is defined by the user).

Parameters
[in,out]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in,out]timecurrent time.
See also
PAPRECA::runLammps()

◆ executeBondBreak()

void PAPRECA::executeBondBreak ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
Event selected_event,
ATOM2BONDS_MAP atomID2bonds 
)

Executes PAPRECA::Bondbreak event. This is done by 1) communicating information from the MPI process that detected the event to all other MPI processes, and 2) calling deleteBond() after the appropriate data have been communicated.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procMPI process calling the function (i.e., proc that detected this event).
[in]selected_eventselected (for execution) PAPRECA::Event. Casted to the correct type (i.e., PAPRECA::BondBreak) before execution.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::deleteBond()

◆ executeBondForm()

void PAPRECA::executeBondForm ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
Event selected_event 
)

Executes PAPRECA::BondForm event. This is done by 1) communicating information from the MPI process that detected the event to all other MPI processes, and 2) calling formBond() and potentially deleteAtoms() after the appropriate data have been communicated.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procMPI process calling the function (i.e., proc that detected this event).
[in]selected_eventPAPRECA::Event selected (to be executed). Casted to the correct type (i.e., PAPRECA::BondForm) before execution.
See also
PAPRECA::formBond(), PAPRECA::deleteAtoms()

◆ executeCreateBondBreakCommand()

void PAPRECA::executeCreateBondBreakCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes a PAPRECA::PredefinedBondBreak event template and inserts it in the PAPRECA::PredefinedEventsCatalog of the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeCreateBondFormCommand()

void PAPRECA::executeCreateBondFormCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes a PAPRECA::PredefinedBondForm event template and inserts it in the PAPRECA::PredefinedEventsCatalog of the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
In the current version the catalyzed option for bond formation events is not available. It can be passed from the input file to papreca_config, but this is left here as a placeholder. In the documentation we do not even mention that the catalyzed option (keyword) can be used with bond-formation events.

◆ executeCreateDepositionCommand() [1/2]

void PAPRECA::executeCreateDepositionCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes a PAPRECA::PredefinedDeposition event template and inserts it in the PAPRECA::PredefinedEventsCatalog of the PAPRECA::PaprecaConfig object.

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
This function will not check if a molecule with the provided adsorbate_name was previously initialized in the LAMMPS input file. If the adsorbate nate was note correctly set by the user LAMMPS will fail with an error the moment it attempts to execute the deposition event.

◆ executeCreateDepositionCommand() [2/2]

void PAPRECA::executeCreateDepositionCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

◆ executeCreateDiffusionHopCommand()

void PAPRECA::executeCreateDiffusionHopCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes a PAPRECA::PredefinedDiffusionHop event template and inserts it in the PAPRECA::PredefinedEventsCatalog of the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeCreateMonoatomicDesorptionCommand()

void PAPRECA::executeCreateMonoatomicDesorptionCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes a PAPRECA::PredefinedMonoatomicDesorption event template and inserts it in the PAPRECA::PredefinedEventsCatalog of the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeDepoheightsCommand()

void PAPRECA::executeDepoheightsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the c_height_scan and c_height_reject parameters in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeDeposition()

void PAPRECA::executeDeposition ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
Event selected_event 
)

Executes PAPRECA::Deposition event. This is done by 1) communicating information from the MPI process that detected the event to all other MPI processes, and 2) calling insertMolecule() after the appropriate data have been communicated.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procMPI process calling the function (i.e., proc that detected this event).
[in]selected_eventPAPRECA::Event selected (to be executed). Casted to the correct type (i.e., PAPRECA::Deposition) before execution.
See also
PAPRECA::insertMolecule(), PAPRECA::resetMobileAtomsGroups()

◆ executeDesorptionCommand()

void PAPRECA::executeDesorptionCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the necessary parameters for the desorption command in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeDiffusion()

void PAPRECA::executeDiffusion ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
Event selected_event 
)

Executes PAPRECA::Diffusion event. This is done by 1) communicating information from the MPI process that detected the event to all other MPI processes, and 2) calling diffuseAtom() after the appropriate data have been communicated.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procMPI process calling the function (i.e., proc that detected this event).
[in]selected_eventPAPRECA::Event selected (to be executed). Casted to the correct type (i.e., PAPRECA::Diffusion) before execution.
See also
PAPRECA::diffuseAtom(), PAPRECA::resetMobileAtomsGroups()

◆ executeEvent()

void PAPRECA::executeEvent ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
const int &  event_num,
char *  event_type,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds 
)

Casts event type from parent MPI process to all other processes and then executes event. Currently, only PAPRECA::BondForm, PAPRECA::BondBreak, PAPRECA::Deposition, PAPRECA::Diffusion, PAPRECA::MonoatomicDesorption events are supported.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procID of proc that discovered the event.
[in]event_numlocal (on the MPI process that discovered the event) event index (in the PAPRECA::Event objects vector).
[in,out]event_typetype of selected event.
[in]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
lammps_wrappers.h and lammps_wrappers.cpp
Note
Information should be communicated among the processes before the execution of an event. This happens because to execute an event we need to call lammps_command or lmp->input->one. lammps_command and lmp->input->one functions have to be called simultaneously by all MPI processes (otherwise the program will hang).
This function will almost certainly require a few changes if the user decides to modify the existing classes of events (bond form/break, deposition, diffusion) or add a new class of events. If changes are made the user will have to find a way to communicate data between procs (similar solutions as the solutions above can be used, of course).

◆ executeExportElementalDistributionsCommand()

void PAPRECA::executeExportElementalDistributionsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Enables the generation of PAPRECA::ElementalDistribution files with a give frequency in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeExportExecutionTimesCommand()

void PAPRECA::executeExportExecutionTimesCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Enables the generation of PAPRECA::ExecTime files with a give frequency in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeExportHeightVtimeCommand()

void PAPRECA::executeExportHeightVtimeCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Enables the generation of PAPRECA::HeightVtime files with a give frequency in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeExportSurfaceCoverageCommand()

void PAPRECA::executeExportSurfaceCoverageCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Enables the generation of PAPRECA::SurfaceCoverage files with a give frequency in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeFluidAtomTypesCommand()

void PAPRECA::executeFluidAtomTypesCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes the fluid atom types in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeFrozenAtomTypesCommand()

void PAPRECA::executeFrozenAtomTypesCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes the frozen atom types in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeHeightCalculationCommand()

void PAPRECA::executeHeightCalculationCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets all parameters relevant to height calculation for the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeInitSigmaCommand()

void PAPRECA::executeInitSigmaCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the sigma value for a pair of atom types in the PAPRECA::PaprecaConfig object.

Parameters
[in]lmppointer to previously initialized LAMMPS object.
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeKMCperMDCommand()

void PAPRECA::executeKMCperMDCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the frequency of MD (LAMMPS) steps (i.e., how many KMC stages are performed for every MD stages) in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeKMCstepsCommand()

void PAPRECA::executeKMCstepsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the total number of KMC steps in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeMinimizeAfterCommand()

void PAPRECA::executeMinimizeAfterCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the after minimization command in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
This function will note check if the set minimization command is valid (i.e., if it is an acceptable LAMMPS command). If the user inputs (in the PAPRECA input file) an invalid minimization command, LAMMPS will fail with an error when the illegal minimize command gets executed.

◆ executeMinimizePriorCommand()

void PAPRECA::executeMinimizePriorCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets a prior minimization command in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
This function will note check if the set minimization command is valid (i.e., if it is an acceptable LAMMPS command). If the user inputs (in the PAPRECA input file) an invalid minimization command, LAMMPS will fail with an error when the illegal minimize command gets executed.

◆ executeMonoatomicDesorption()

void PAPRECA::executeMonoatomicDesorption ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const int &  nprocs,
const int &  event_proc,
Event selected_event 
)

Executes PAPRECA::MonoatomicDesorption event. This is done by 1) communicating information from the MPI process that detected the event to all other MPI processes, and 2) calling deleteAtoms() after the appropriate data have been communicated.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]event_procMPI process calling the function (i.e., proc that detected this event).
[in]selected_eventPAPRECA::Event selected (to be executed). Casted to the correct type (i.e., PAPRECA::MonoatomicDesorption) before execution.
See also
PAPRECA::deleteAtoms(), PAPRECA::resetMobileAtomsGroups()

◆ executePaprecaCommand()

void PAPRECA::executePaprecaCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

General PAPRECA input function that redirects commands to the relevant command function.

Parameters
[in]lmppointer to previously initialized LAMMPS object.
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
The first word (string) in the commands vector of strings ( i.e., commands[0] ) indicates the type of command.

◆ executeRandomDepovecsCommand()

void PAPRECA::executeRandomDepovecsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the type of deposition vector (random or above) in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeRandomDiffvecsCommand()

void PAPRECA::executeRandomDiffvecsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the type of diffusion vector in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeRandomSeedCommand()

void PAPRECA::executeRandomSeedCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Initializes the LAMMPS random number generator (RanMars) of the PAPRECA::PaprecaConfig object using the input random seed.

Parameters
[in]lmppointer to LAMMPS object.
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeRestartFreqCommand()

void PAPRECA::executeRestartFreqCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Enables the generation of LAMMPS restart files with a give frequency in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeSigmasOptionsCommand()

void PAPRECA::executeSigmasOptionsCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the sigma options in the PAPRECA::PaprecaConfig object.

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeSpeciesMaxBondsCommand()

void PAPRECA::executeSpeciesMaxBondsCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets a maximum number of bonds for a species in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeSpeciesMaxBondTypesCommand()

void PAPRECA::executeSpeciesMaxBondTypesCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets a maximum number of bonds of specific bond type for an atom type in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeTimeEndCommand()

void PAPRECA::executeTimeEndCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the ending target time in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ executeTrajectoryDurationCommand()

void PAPRECA::executeTrajectoryDurationCommand ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config 
)

Sets the LAMMPS trajectory duration in the PAPRECA::PaprecaConfig object.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ feCandidateHas4PO4Neibs()

const bool PAPRECA::feCandidateHas4PO4Neibs ( PaprecaConfig papreca_config,
PredefinedDiffusionHop diff_template,
LAMMPS_NS::tagint *  atom_ids,
int *  atom_types,
int *  neighbors,
int &  neighbors_num,
ATOM2BONDS_MAP atomID2bonds 
)

Scans neighbors of a diffusion parent atom to check whether 4 distinct PO4 (phosphate) structures exist in the neighbors list. This function is only called when the custom PAPRECA::PredefinedDiffusionHop style: Fe_4PO4neib is active.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]diff_templateDiffusion Hop template (PAPRECA::PredefinedDiffusionHop) as initialized by the user (in the PAPRECA input file).
[in]atom_idsLAMMPS atom ids.
[in]atom_typesLAMMPS atom types.
[in]neighborsLAMMPS array storing the IDs of neighbors of the current (parent) atom type.
[in]neighbors_numtotal number of neighbors.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
Returns
true/false depending on whether at least 4 PO4 (phosphate) structures exist or not in the neighborhood of the diffusion parent candidate atom.
See also
PAPRECA::getDiffEventsFromAtom()

◆ fillAndSortIndexedRatesVec()

void PAPRECA::fillAndSortIndexedRatesVec ( double *  arr,
const int &  arr_size,
DOUBLE2INTPAIR_VEC rates_indexed 
)

Uses std::sort to sort a double array. Typically used to sort rates vector in ascending order. Sorting helps with faster event selection. It also ensures repeatability (if the same random number seed is used), because the event enumeration is maintained even if the domain decomposition numbering changes (i.e., if MPI decides to decompose the domain differently). The sorting is not performed on the array itself but on an auxiliary std::vector< std::pair< double , int > > containers that helps us sort while maintaining the index of events. This is necessary, since each time we stochastically select an event using the rates array, we have to link it (by index) to the correct PAPRECA::Event.

Parameters
[in]arrdouble array container.
[in]arr_sizesize of arr.
[in,out]rates_indexedstd::vector< std::pair< double , int > > container used for ascending sorting.

◆ fillDelidsLocalVec()

void PAPRECA::fillDelidsLocalVec ( LAMMPS_NS::LAMMPS *  lmp,
const double &  desorb_cut,
std::vector< LAMMPS_NS::tagint > &  delids_local,
ATOM2BONDS_MAP atomID2bonds 
)

Called by deleteDesorbedAtoms() and only when the delete_desorbed algorithm is set to gather_local. The function compares the z-coordinate of an atom. If the atom z-value is higher than desorb_cut, the atom ID is marked for deletion (i.e., inserted in the delids_local container) and it is later deleted along with its bonded atoms (retrieved from atomID2bonds map).

Parameters
[in]lmppointer to LAMMPS object.
[in]desorb_cutcutoff distance for atom deletion. Atoms whose z-coordinate is equal to or greater than desorb_cut are marked for deletion.
[in,out]delids_localvector of collected atom IDs (delids_local will be different on each MPI process).
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::deleteDesorbedAtoms(), PAPRECA::Bond::recursiveCollectBondedAtoms()
Note
When deleting an atom, all atoms bonded with the deleted atom have to be deleted as well. Otherwise, LAMMPS will likely throw a "Missing Bond Atoms in proc %d" error. See lammps documentation (https://docs.lammps.org/) for more information.
This function is not to be confused with fillDelidsVec(). fillDelidsVec() is only called when the user sets the delete_desorbed algorithm to gather_all, while this function (i.e., fillDelidsLocalVec() ) is called if the user set the delete_desorbed algorithm to gather_local.

◆ fillDelidsVec()

int PAPRECA::fillDelidsVec ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const double &  desorb_cut,
std::vector< LAMMPS_NS::tagint > &  delids,
ATOM2BONDS_MAP atomID2bonds 
)

Called by deleteDesorbedAtoms() and only when the delete_desorbed algorithm is set to gather_all. The function compares the z-coordinate of an atom. If the atom z-coordinate is higher than desorb_cut, the atom ID is marked for deletion (i.e., inserted in the delids container) and it is deleted along with its bonded atoms (retrieved from atomID2bonds map). Here, a gather operation collects data from all atoms on the master MPI process (i.e., proc_id==0) before comparing the z-coordinates of atoms with desorb_cut.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]desorb_cutcutoff distance for atom deletion. Atoms whose z-coordinate is equal to or greater than desorb_cut are marked for deletion.
[in,out]delidsvector of collected atom IDs on the master MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::deleteDesorbedAtoms(), PAPRECA::broadcastDelidsFromMasterProc(), PAPRECA::Bond::recursiveCollectBondedAtoms()
Note
When deleting an atom, all atoms bonded with the deleted atom have to be deleted as well. Otherwise, LAMMPS will likely throw a "Missing Bond Atoms in proc %d" error. See lammps documentation (https://docs.lammps.org/) for more information.
This function is not to be confused with fillDelidsLocalVec(). fillDelidsLocalVec() is only called when the user sets the delete_desorbed algorithm to gather_local, while this function (i.e., fillDelidsVec() ) is called if the user set the delete_desorbed algorithm to gather_all.

◆ fillDepoDataTransfArr()

void PAPRECA::fillDepoDataTransfArr ( double *  depo_data,
Deposition depo 
)

Serializes (prepares) data for calls to MPI function related to the execution of PAPRECA::Deposition events.

Parameters
[in,out]depo_data8-element array of double data for transfer.
[in]depoPAPRECA::Deposition event to be executed.
Note
depo_data[0], depo_data[1], depo_data[2] are the deposition site coordinates (x,y, and z). depo_data[3], depo_data[4], depo_data[5] are the coordinates of the center of rotation of the molecule. depo_data[6] is the angle of rotation. depo_data[7] is the insertion velocity.
See also
PAPRECA::deserializeDepoTransfData(), PAPRECA::executeDeposition()

◆ fillDoubleDiffDataTransfArray()

void PAPRECA::fillDoubleDiffDataTransfArray ( double *  diff_doubledata,
Diffusion diff 
)

Serializes (prepares) double data for calls to MPI function related to the execution of PAPRECA::Diffusion events.

Parameters
[in,out]diff_doubledata4-element array of double data for transfer.
[in]diffPAPRECA::Diffusion event to be executed.
Note
diff_doubledata[0], diff_doubledata[1], diff_doubledata[2] contain the x,y, and z coordinates of the diffusion point (vacancy). diff_doubledata[3] contains the insertion velocity.
See also
PAPRECA::deserializeDoubleDiffDataArr(), PAPRECA::executeDiffusion()

◆ fillFormTransferDataArr()

void PAPRECA::fillFormTransferDataArr ( BondForm bond_form,
int *  form_data 
)

Serializes (prepares) data for calls to MPI function related to the execution of PAPRECA::BondForm events.

Parameters
[in]bond_formPAPRECA::BondForm event to be executed.
[in,out]form_data2-element array of int data.
Note
form_data[0] stores the bond type. form_data[0] tells us if we need to delete atoms after bond form or not (1 delete/0 don't delete).
See also
PAPRECA::deserializeFormTransferDataArr(), PAPRECA::executeBondForm()

◆ fillIntegerDiffDataTransfArray()

void PAPRECA::fillIntegerDiffDataTransfArray ( int *  diff_intdata,
Diffusion diff 
)

Serializes (prepares) integer data for calls to MPI function related to the execution of PAPRECA::Diffusion events.

Parameters
[in,out]diff_intdata3-element array of integer data for transfer.
[in]diffPAPRECA::Diffusion event to be executed.
Note
diff_intdata[0] contains the parent type. diff_intdata[1] is 0 if the diffusion type is displacive (see PAPRECA::Diffusion, and PAPRECA::PredefinedDiffusionHop definitions). diff_intdata[2] contains the diffused type.
See also
PAPRECA::deserializeIntegerDiffDataArr(), PAPRECA::executeDiffusion()

◆ fillMassProfilesTotalArrFromMassProfilesLocal()

void PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal ( const int &  bins_num,
const int &  types_num,
double **  mass_profiles_total,
double **  mass_profiles_local 
)

Fills global array of mass profiles on master process (i.e., proc_id==0). This is done by invoking MPI_Reduce on the local mass profile arrays.

Parameters
[in]bins_numtotal number of x-y slices (bins).
[in]types_numtotal number of atom types.
[in,out]mass_profiles_totalglobal 2D mass profiles array initialized and filled ONLY for the master process (i.e., proc_id==0).
[in]mass_profiles_locallocal (per MPI process) 2D array of mass profiles.
See also
PAPRECA::initMassProfilesArr(), PAPRECA::deleteMassProfilesArr(), PAPRECA::calcLocalMassAndFillMassProfile(), PAPRECA::getFilmHeightFromMassBinsMethod(), PAPRECA::calcFilmHeight()

◆ formBond()

void PAPRECA::formBond ( LAMMPS_NS::LAMMPS *  lmp,
const LAMMPS_NS::tagint &  atom1id,
const LAMMPS_NS::tagint &  atom2id,
const int &  bond_type 
)

Bonds atom1 and atom2 with a specific bond type (as defined in the LAMMPS input file).

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]atom1idID of the first atom.
[in]atom2idID of the second atom.
[in]bond_typetype of bond to be formed.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/create_bonds.html

◆ gatherAndTrimDelIdsOnDriverProc()

void PAPRECA::gatherAndTrimDelIdsOnDriverProc ( const int &  proc_id,
const int &  nprocs,
std::vector< LAMMPS_NS::tagint > &  delids_local,
std::vector< LAMMPS_NS::tagint > &  delids_global 
)

Called by deleteDesorbedAtoms() and only when the delete_desorbed algorithm is set to gather_local. The gather_local algorithm compares the z-coordinates of atoms with desorb_cut locally (i.e., individually for each MPI process). After all comparisons are performed, this function (i.e., gatherAndTrimDelIdsOnDriverProc() ) communicates information among the MPI processes. Then, the function fills delids_global with the IDs of all atoms marked for deletion and makes sure that no duplicate deletions are performed.

Parameters
[in]proc_idID of current MPI process.
[in]nprocsnumber of MPI processes.
[in]delids_localcontains the IDs of atoms marked for deletion on a specific MPI process (i.e., the delids_local container is different on each MPI process).
[in,out]delids_globalvector containing the IDs of all atoms marked for deletion (contains the same data on each MPI process as casted from the master process).
See also
PAPRECA::deleteDesorbedAtoms(), PAPRECA::fillDelidsLocalVec()

Different MPI processes can return a different number of delids so we need to calculate the counts/displacements first and then use Gatherv

◆ get3DSqrDistWithPBC()

double PAPRECA::get3DSqrDistWithPBC ( LAMMPS_NS::LAMMPS *  lmp,
const double *  x1,
const double *  x2 
)

Calculates and returns the distances between 2 points, while accounting for any Periodic Boundary Conditions (PBC) in the system.

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]x1array of coordinates of atom1.
[in]x2array of coordinates of atom2.
Returns
minimum image distance between point1 (with coordinates as in array x1) and point2 (with coordinates as in array x2).

◆ getBinWidthFromElementalDistributions()

double PAPRECA::getBinWidthFromElementalDistributions ( std::vector< std::string > &  commands,
int &  current_pos 
)

◆ getBondBreakingEventsFromAtom()

void PAPRECA::getBondBreakingEventsFromAtom ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  iatom,
int *  neighbors,
int &  neighbors_num,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds 
)

Scans all atoms in the current MPI process for PAPRECA::BondBreak (a.k.a. PAPRECA::PredefinedReaction) events. Discovered events are inserted in the events_local vector of PAPRECA::Event objects (storing all events of the current MPI process).

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatomlocal (LAMMPS, per MPI process) index of candidate atom.
[in]neighborsarray storing the IDs of LAMMPS neighbors of the candidate atom.
[in]neighbors_numtotal number of neighbors of the candidate atom.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::loopAtomsAndIdentifyEvents()

◆ getBondFormEventsFromAtom()

void PAPRECA::getBondFormEventsFromAtom ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  iatom,
int *  neighbors,
int &  neighbors_num,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds 
)

Scans a half neighbor list and detect bond formation (a.k.a. PAPRECA::PredefinedBondForm). Detected events are inserted in events_local vector, which is a container of PAPRECA::Event object and stores the events detected on the current MPI process.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatomlocal index of current atom.
[in]neighborsIDs of neighbors of the current atom.
[in]neighbors_numnumber of neighbors of the current atom.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::loopAtomsAndIdentifyEvents()

◆ getConcatenatedStringFromStringsVector()

const std::string PAPRECA::getConcatenatedStringFromStringsVector ( const std::vector< std::string > &  strings,
size_t  start = -1,
size_t  end = -1 
)

Receives an std::vector of strings and returns a concatenated std::string (i.e., a string combining all elements of the std::vector< std::string > container)

Parameters
[in]stringsstd::vector< std::string > container
[in]startconcatenate strings starting for this index in the strings vector.
[in]endconcatenate strings whose index in the strings vector is less than end.
Returns
std::string of concatenated strings from input std::vector< std::string > container.
See also
getConcatenatedStringWithSpacesFromStringsVector()

◆ getConcatenatedStringWithSpacesFromStringsVector()

const std::string PAPRECA::getConcatenatedStringWithSpacesFromStringsVector ( const std::vector< std::string > &  strings,
size_t  start = -1,
size_t  end = -1 
)

Same as getConcatenatedStringFromStringsVector(). However, the present function also adds a space character between each concatenated string (received from std::vector< string > ).

Parameters
[in]stringsstd::vector< std::string > container
[in]startconcatenate strings starting for this index in the strings vector.
[in]endconcatenate strings whose index in the strings vector is less than end.
Returns
std::string of concatenated strings from input std::vector< std::string > container.
See also
getConcatenatedStringFromStringsVector()

◆ getDepoEventsFromAtom()

void PAPRECA::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 
)

Checks if a system atom is parent to a deposition event (a.k.a. PAPRECA::PredefinedDeposition). Detected deposition events are inserted in the events_local vector of PAPRECA::Event objects (storing all events of the current MPI process).

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]iatomlocal index of current atom.
[in]neighborsarray containing the IDs of the neighbors to the current atom.
[in]neighbors_numtotal number of neighbors
[in]film_heightfilm height at the current PAPRECA step.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
See also
PAPRECA::loopAtomsAndIdentifyEvents()

◆ getDepoPointCandidateCoords()

void PAPRECA::getDepoPointCandidateCoords ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
double *  iatom_xyz,
double *  candidate_xyz,
PredefinedDeposition depo_template 
)

Fills candidate_xyz array with the coordinates of the deposition candidate. The deposition candidate coordinates DO NOT coincide with the parent atom coordinates. Depending on the user input settings in PAPRECA input, the deposition candidate coordinates can either be directly above the parent atom or on the surface of the upper hemisphere centered at the parent atom coordinates.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatom_xyzcoordinates of parent atom.
[in,out]candidate_xyzcoordinates of candidate point for the deposition event.
[in]depo_templateDeposition template (PAPRECA::PredefinedDeposition) as initialized by the user (in the PAPRECA input file).
Note
In the current version deposition candidates are always placed above the candidate atom. This means that you cannot use this version to place a molecule underneath the parent atom. Hence, you cannot get a film growing towards -z.
The user is given the chance to produce a point at a random position on the surface of a sphere and at a distance equal to depo_offset. depo_offset is defined as the offset distance for the deposition event (using the create_Deposition command in the PAPRECA input file). Here, we use the random number generator (on the parent event proc) to generate 2 random numbers. Those 2 random numbers are used to generate a random vector on a sphere with a radius of depo_offset around the parent atom.
See also
PAPRECA::getDepoEventsFromAtom()

◆ getDepoRateFromHertzKnudsen()

double PAPRECA::getDepoRateFromHertzKnudsen ( const double &  pressure_in,
const double &  ads_area_in,
const double &  ads_mass_in,
const double &  temperature_in 
)

This function outputs the deposition base rate using the Hertz-Knudsen equation (kinetic theory of gases).

Parameters
[in]pressure_inPartial Pressure in [Bar] units.
[in]ads_area_inAdsorption Site Area in [Angstrom^2] units.
[in]ads_mass_inMolecule mass in [g/mol] units.
[in]temperature_intemperature in [K].
Returns
rate in Hz units
Note
See: https://chem.libretexts.org/Bookshelves/Physical_and_Theoretical_Chemistry_Textbook_Maps/Surface_Science_(Nix)/02%3A_Adsorption_of_Molecules_on_Surfaces/2.03%3A_Kinetics_of_Adsorption.
Disclaimer: This function assumes that the sticking coefficients is 1. However, you can still use that function even if the sticking coefficient is non-unity or if the sticking coefficient is a function of surface coverage. Simply multiply the rate obtained from the function with your sticking coefficient of choice. This is automatically done in the PaprecaConfig class.

◆ getDesorptionRate()

double PAPRECA::getDesorptionRate ( const double &  activation_energy,
const double &  temperature 
)

Calculates a desorption rate based on an Arrhenius-type equation.

Parameters
[in]activation_energyActivation Energy in [kcal/mol] units.
[in]temperatureTemperature in [K] units.
Returns
rate in Hz units
Note
See: https://pubs.acs.org/doi/epdf/10.1021/acs.jpcc.8b06909.
The pre-exponential is calculated from the boltzmann and plank constants, at a given temperature. The exponential term can be calculated from the universal gas constant.

◆ getDiffEventsFromAtom()

void PAPRECA::getDiffEventsFromAtom ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  iatom,
int *  neighbors,
int &  neighbors_num,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds 
)

Checks if the current atom is candidate to diffusion events (a.k.a. PAPRECA::PredefinedDiffusionHop). Detected deposition events are inserted in the events_local vector of PAPRECA::Event objects (storing all events of the current MPI process).

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatomlocal index of current atom.
[in]neighborsIDs of neighbors of the current atom.
[in]neighbors_numnumber of neighbors of the current atom.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::loopAtomsAndIdentifyEvents()

◆ getDiffPointCandidateCoords()

void PAPRECA::getDiffPointCandidateCoords ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
double *  iatom_xyz,
double *  candidate_xyz,
PredefinedDiffusionHop diff_template 
)

Calculates the diffusion point (vacancy) coordinates for a given parent atom. Depending on the user settings, the diffusion point can be directly above the parent atom or at the surface of a sphere centered at the coordinates of the parent atom.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatom_xyzcoordinates of parent atom.
[in,out]candidate_xyzcoordinates of diffusion point.
[in]diff_templateDiffusion template (PAPRECA::PredefinedDiffusionHop) as initialized by the user (in the PAPRECA input file).
See also
PAPRECA::getDiffEventsFromAtom()

◆ getFilmHeightFromMassBinsMethod()

void PAPRECA::getFilmHeightFromMassBinsMethod ( PaprecaConfig papreca_config,
LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
double &  film_height,
double **  mass_profiles_total,
const double &  local_mass,
double *  atom_mass,
const int &  bins_num,
const int &  types_num,
const double &  bin_width 
)

Uses the global 2D mass profiles array (initialized/filled in the master process) to calculate the film height in the current step.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]lmppointer to LAMMPS object.
[in]proc_idid of current MPI process.
[in,out]film_heightheight of current step.
[in]mass_profiles_totalglobal 2D array of mass_profiles (initialized/filled in master MPI process).
[in]local_masstotal mass in the current MPI process.
[in]atom_massLAMMPS array storing the masses of atom_types.
[in]bins_numtotal number of x-y slices (bins).
[in]types_numtotal number of atom types.
[in]bin_widthwidth of each x-y slice (bin).
See also
PAPRECA::initMassProfilesArr(), PAPRECA::deleteMassProfilesArr(), PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal(), PAPRECA::calcLocalMassAndFillMassProfile(), PAPRECA::calcFilmHeight()

◆ getLocalRate()

double PAPRECA::getLocalRate ( std::vector< Event * > &  events_local,
PaprecaConfig papreca_config 
)

Calculates the total local (on the current MPI process) rate by summing the rates of the detected local events (contained in the PAPRECA::Event objects vector, events_local).

Parameters
[in]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
Returns
local (per MPI process) rate.
Note
This function also dumps surface coverage file (if activated by the user).

◆ getMaskedNeibIndex()

int PAPRECA::getMaskedNeibIndex ( int *  neighbors,
int &  j 
)

Neighbor indexes in neighbor lists are masked with extra bits. This function unmasks the index and returns a valid local index to avoid segmentation faults.

Parameters
[in]neighborsarray of IDs of neighbors.
[in]jneighbor index.
Returns
unmasked (valid) neighbor index.
Note
See here:https://matsci.org/t/requesting-a-full-neighbor-list-in-c-code-using-lammps-as-a-library/48294/4

◆ getMolCoords()

void PAPRECA::getMolCoords ( LAMMPS_NS::LAMMPS *  lmp,
double **  mol_xyz,
double **  mol_dx,
const int &  mol_natoms,
double *  candidate_center 
)

Fills mol_xyz with the coordinates of the candidate molecule for deposition.

Parameters
[in]lmppointer to LAMMPS object.
[in,out]mol_xyzTemporary array storing the candidate (for deposition) molecule coordinates. Container mol_xyz is only used to check for possible collisions between the inserted molecule and system molecules.
[in]mol_dxarray storing the x,y, and z distances of each molecule atom from the molecule center. See molecule.h and molecule.cpp files in the LAMMPS source directory for more information.
[in]mol_natomstotal number of molecule atoms.
[in]candidate_centercoordinates of the candidate deposition point.
See also
PAPRECA::getDepoEventsFromAtom()

◆ getMolIndexFromMolName()

static const int PAPRECA::getMolIndexFromMolName ( LAMMPS_NS::LAMMPS *  lmp,
std::string  mol_name 
)
inline

Receives a molecule name and returns its molecule index. This allows one to access a LAMMPS molecule by using: lmp->atom->molecules[imol] (where imol is the molecule index).

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]mol_namevalid molecule names (as defined in the LAMMPS input file. e.g., if you used this command: "molecule mmmTCP ./TCP.xyz", then mol_name should be "mmmTCP").
Returns
valid molecule index. Aborts if index is -1 (i.e., if mol_name was not defined in the LAMMPS input file).
Note
This function wraps around the find_molecule LAMMPS function in atom.cpp header.

◆ getMonoDesEventsFromAtom()

void PAPRECA::getMonoDesEventsFromAtom ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config,
const int &  iatom,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds 
)

Checks if the parent atom is candidate to monoatomic desorption events (a.k.a. PAPRECA::PredefinedMonoatomicDesorption). Detected events are inserted in events_local vector, which is a container of PAPRECA::Event object and stores the events detected on the current MPI process.

Parameters
[in]lmppointer to LAMMPS object.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]iatomlocal index of current atom.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
See also
PAPRECA::loopAtomsAndIdentifyEvents()

◆ getMPIRank()

const int PAPRECA::getMPIRank ( MPI_Comm  communicator)

Wrapper around MPI_Comm_rank. Returns the MPI process ID of the specific process calling the function.

Parameters
[in]communicatorMPI communicator.
Returns
ID of MPI process.

◆ getRateFromArrhenius()

double PAPRECA::getRateFromArrhenius ( const double &  activation_energy,
const double &  attempt_freq,
const double &  temperature 
)

This function uses the classic Hertzian equation to output the rate of a rare event.

Parameters
[in]activation_energyActivation energy in [kcal/mol] units.
[in]attempt_freqAttempt frequency in [Hz (1/s)] units.
[in]temperaturein [K] units.
Returns
rate in Hz units.
Note
Hardcoded parameters: Universal gas constant in [kcal/(mol*K)] units.

◆ getRateFromInputRateOptions()

double PAPRECA::getRateFromInputRateOptions ( std::vector< std::string > &  commands,
int &  current_pos 
)

Calculates the predefined event rate by calling the chosen (in the command-line) function in rates_calc.h and returns it to the caller function.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.
Returns
rate of predefined event.

◆ getStickingCoeffFromDepositionEventOptions()

double PAPRECA::getStickingCoeffFromDepositionEventOptions ( std::vector< std::string > &  commands,
int &  current_pos 
)

Extracts the sticking coefficient from the commands vector returns it to the caller function.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.
Returns
sticking coefficient (returns -1 if the sticking coefficient is variable).

◆ getStringPosInStringVec()

const int PAPRECA::getStringPosInStringVec ( const std::string &  string2check,
const std::vector< std::string > &  strings 
)

Returns the position of a string in a vector of strings (std::vector< std::string > container).

Parameters
[in]string2checkstring to identify.
[in]stringsstd::vector< std::string > container.
Returns
position (index) of string in the std::vector< std::string > container or -1 if the string2check is not in the vector of strings.
Note
This function is useful to check for keywords in command lines (e.g., PAPRECA input file).

◆ getSubVectorFromVector()

template<typename T >
std::vector< T > PAPRECA::getSubVectorFromVector ( const std::vector< T > &  vec,
size_t  start,
size_t  end 
)

Receives an std::vector and returns a new std::vector containing all the elements of the original vector whose indexes are equal to or greater than "start" and smaller than "end".

Parameters
[in]vecinput std::vector.
[in]startstarting index (i.e., include all elements whose indexes are equal to or greater than start).
[in]endending index (i.e., include elements whose indexes are smaller than end).
Note
This is a template function so it works with std::vector containers of any primitive type (i.e., integers, doubles, floats, etc.).

◆ getSumOfVecElements()

template<typename T >
T PAPRECA::getSumOfVecElements ( const std::vector< T > &  vec)

Receives an std::vector and returns the sum of its elements.

Parameters
[in]vecstd::vector
Returns
sum of elements.
Note
This is a template function so it works with std::vector containers of any primitive type (i.e., integers, doubles, floats, etc.).

◆ headAtomIsCatalyzed()

const bool PAPRECA::headAtomIsCatalyzed ( PredefinedReaction reaction_template,
int *  atom_types,
int *  neighbors,
int &  neighbors_num 
)

Scans neighbors of parent predefined reaction candidate to check if catalyzing types exist in the neighborhood. The catalyzing types are provided in the PAPRECA input file.

Parameters
[in]reaction_templateReaction template (PAPRECA::PredefinedReaction or PAPRECA::PredefinedBondForm) as initialized by the user (in the PAPRECA input file).
[in]atom_typesnumber of LAMMPS atom types.
[in]neighborsarray storing the neighbor IDs of the parent PAPRECA::PredefinedReaction candidate atom.
[in]neighbors_numnumber of neighbors of the parent candidate atom.
Returns
true/false depending on whether a catalyzing type exists or not in the neighborhood of the reaction parent candidate atom.
Note
: This function can be called by either the getBondBreakingEventsFromAtom() or the getBondFormEventsFromAtom(). This means that the reaction template can be either a PAPRECA::PredefinedReaction (parent class) or a PAPRECA::PredefinedBondForm (derived class) object. If this function is called with the derived class object there is still no need to cast it to PAPRECA::PredefinedBondForm since we only use the parent class (PAPRECA::PredefinedReaction) functions here.
See also
PAPRECA::getBondBreakingEventsFromAtom(), PAPRECA::getBondFormEventsFromAtom()

◆ initAndGatherBondsList()

void PAPRECA::initAndGatherBondsList ( LAMMPS_NS::LAMMPS *  lmp,
LAMMPS_NS::tagint **  bonds_list,
LAMMPS_NS::bigint &  bonds_num 
)

Calls lammps_gather_bonds to fill array bonds_list. The container bonds_list contains the IDs of bonds of the LAMMPS object (lmp).

Parameters
[in]lmppointer to LAMMPS object.
[in,out]bonds_listarray containing the IDs of bonds.
[in,out]bonds_numnumber of bonds in the bonds_list array.
See also
PAPRECA::Bond::fillAtomID2BondsContainer(), PAPRECA::Bond::addBond2BondVector(), PAPRECA::Bond::atomIDIsMapped(), PAPRECA::Bond::initAtomID2BondsMap()
Note
See LAMMPS documentation (https://docs.lammps.org/) for more information about lammps_gather_bonds.

◆ initializeLMP()

void PAPRECA::initializeLMP ( LAMMPS_NS::LAMMPS **  lmp)

Initialize LAMMPS.

Instantiates a LAMMPS object

Parameters
[in,out]lmppointer to LAMMPS object.

◆ initMassProfilesArr()

double ** PAPRECA::initMassProfilesArr ( const int &  types_num,
const int &  bins_num 
)

Initializes a 2D array of mass profiles (i.e., arr[bins_num][types_num]).

Parameters
[in]types_numtotal number of atom types.
[in]bins_numtotal number of x-y slices (bins).
Returns
pointer to initialized 2D array of mass profiles.
See also
PAPRECA::calcLocalMassAndFillMassProfile(), PAPRECA::deleteMassProfilesArr(), PAPRECA::fillMassProfilesTotalArrFromMassProfilesLocal(), PAPRECA::getFilmHeightFromMassBinsMethod(), PAPRECA::calcFilmHeight()
Note
Arrays initialized with this function have to be deleted manually using PAPRECA::deleteMassProfilesArr().

◆ initMolCoordsArr()

void PAPRECA::initMolCoordsArr ( double ***  mol_xyz,
const int &  mol_natoms 
)

Initializes the molecule coordinates array used to check for collisions between the deposited molecule and system atoms.

Parameters
[in,out]mol_xyzarray storing the x,y, and z distances of each molecule atom from the molecule center. See molecule.h and molecule.cpp files in the LAMMPS source directory for more information.
[in]mol_natomstotal number of molecule atoms.
Note
Molecule coordinates arrays initialized with this function have to be manually deleted using the deleteMolcoordsArr() function.
See also
PAPRECA::getDepoEventsFromAtom(), PAPRECA::deleteMolCoordsArr()

◆ initType2SigmaFromLammpsPairCoeffs()

void PAPRECA::initType2SigmaFromLammpsPairCoeffs ( LAMMPS_NS::LAMMPS *  lmp,
INTPAIR2DOUBLE_MAP type2sigma 
)

Retrieves the pairstyle sigmas from LAMMPS to initialize the type sigmas in PAPRECA.

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in,out]type2sigmaPAPRECA::INTPAIR2DOUBLE_MAP mapping a pair of atom types to their corresponding sigma.
Note
WARNING: You need to have a sigma pairstyle to use this function (i.e., sigma LJ or equivalent.). If you don't have such pair style you would have to MANUALLY add those parameters. The input file helps you setup/manage those options

◆ insertMolecule()

void PAPRECA::insertMolecule ( LAMMPS_NS::LAMMPS *  lmp,
const double  site_pos[3],
const double  rot_pos[3],
const double &  rot_theta,
const int &  type_offset,
const char *  mol_name 
)

Inserts a molecule in the current LAMMPS system.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]site_posarray of insertion site coordinates. LAMMPS will insert a new molecule such that its center-of-mass coincides with site_pos.
[in]rot_posarray of coordinates of the center of rotation.
[in]rot_thetaangle of molecule rotation.
[in]type_offsetadd type_offset to the atom types of the molecule (as defined in the LAMMPS molecule template file). WARNING: For almost all cases you should use a value of 0 to ensure that the inserted atom types are identical to the atom types as defined in the LAMMPS molecule input file.
[in]mol_namename of molecule (as defined in the LAMMPS input command. e.g., if you used this command: "molecule mmmTCP ./TCP.xyz", your mol_name should be "mmmTCP" ).
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/create_atoms.html
the create_atoms command is called with the "units box keyword".

◆ loopAtomsAndIdentifyEvents()

void PAPRECA::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 
)

1) Calculates film height (if that is requested by the user). 2) Discovers events and inserts them in the PAPRECA::Event objects vector (storing all events detected on the current MPI process). PAPRECA::BondBreak, PAPRECA::Deposition, PAPRECA::MonoatomicDesorption, and PAPRECA::Diffusion are discovered through a full neighbors list. PAPRECA::BondForm are detected using a half-neighbors list. This is done because bondbreak, deposition, monoatomic desorption, and diffusion events perform collision checks which require full neighbor lists (because we need to know all the neighbors of each atom). On the other hand, it is more efficient to check for PAPRECA:BondForm events using a half neighbors list that include each neighbor pair once.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]KMC_loopidcurrent PAPRECA step.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in,out]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
[in,out]film_heightfilm height at current PAPRECA step.
See also
PAPRECA::calcFilmHeight(), PAPRECA::getBondBreakingEventsFromAtom(), PAPRECA::getDepoEventsFromAtom(), PAPRECA::getDiffEventsFromAtom(), PAPRECA::getMonoDesEventsFromAtom(), PAPRECA::getBondFormEventsFromAtom()
Note
The user is advised to consult the LAMMPS documentation (https://docs.lammps.org/) for more information about neighbors lists as well as details related to the lammps_neighlist_num_elements andlammps_neighlist_element_neighbors functions used to retrieve the neighbor lists containers.

◆ mappingExists()

template<typename KeyType , typename ValueType , typename Hash >
bool PAPRECA::mappingExists ( const std::unordered_map< KeyType, ValueType, Hash > &  map,
const KeyType &  key 
)

Searches if an element is included in an unordered map.

Parameters
[in]mapunordered_map to be searched.
[in]keyelement to be searched in the unordered map.
Returns
true if the element is in the unordered map or false otherwise.
Note
This is a template function that allows searches on unordered maps of any data type. Custom hash functions can also be used.

◆ MPIBcastAndExecuteCommand()

void PAPRECA::MPIBcastAndExecuteCommand ( LAMMPS_NS::LAMMPS *  lmp,
std::string &  command 
)

◆ printStepInfo()

void PAPRECA::printStepInfo ( PaprecaConfig papreca_config,
const int &  KMC_loopid,
const double &  time,
const double &  film_height,
const double &  proc_rates_sum 
)

Prints essential PAPRECA information to the screen/terminal.

Parameters
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]KMC_loopidnumber of current PAPRECA step.
[in]timecurrent time.
[in]film_heightcurrent height.
[in]proc_rates_sumtotal (gathered/sum from all MPI processes) event rate.
Note
The printed information is NOT appended to the papreca.log file. papreca.log file stores information in a more simplified format (see export_files.h and export_files.cpp).

◆ processBinWidthOptionForElementalDistributions()

void PAPRECA::processBinWidthOptionForElementalDistributions ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config,
int &  current_pos 
)

Sets the bind width variable of the PAPRECA::PaprecaConfig object (based on the input command-line).

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.

◆ processCatalyzedOption()

void PAPRECA::processCatalyzedOption ( std::vector< std::string > &  commands,
int &  current_pos,
std::vector< int > &  catalyzing_types 
)

Checks if the optional "catalyzed" keyword is present in a command. If yes then the catalyzing types are inserted in the catalyzing_types std::vector< int > container.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.
[in,out]catalyzing_typesvector containing the catalyzing types for a specific command (typically create_BondBreak or create_BondForm).

◆ processCustomDiffEventOptions()

void PAPRECA::processCustomDiffEventOptions ( std::vector< std::string > &  commands,
int &  current_pos,
std::string &  custom_style,
std::vector< int > &  style_atomtypes 
)

Initializes custom_style and style_atomtypes for custom diffusion events.

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.
[in,out]custom_styletype of custom style.
[in,out]style_atomtypespotentially useful auxiliary vector storing atom types and passing them to the main function of papreca.cpp.

◆ processLine()

std::vector< std::string > PAPRECA::processLine ( char *  line)

Receives a line from the PAPRECA input file, removes blank characters and comments (i.e., text to the right of a '#' character). Then, converts the char* to an std::vector< std::string > container that stores each word/command/keyword on a separate std::string.

Parameters
[in]lineraw (unprocessed command-line sent from the PAPRECA input file.
Returns
vector of string container with processed line (command).

◆ processSigmaMixOptions() [1/2]

void PAPRECA::processSigmaMixOptions ( std::vector< std::string > &  commands,
int &  current_pos 
)

◆ processSigmaMixOptions() [2/2]

void PAPRECA::processSigmaMixOptions ( std::vector< std::string > &  commands,
PaprecaConfig papreca_config,
int &  current_pos 
)

Sets the sigma mix variable of the PAPRECA::PaprecaConfig object (based on the input command-line).

Parameters
[in]commandstrimmed/processed vector of strings. This is effectively the entire command line with each vector element (i.e., std::string) being a single word/number.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
[in,out]current_posposition on the commands vector. This variable gets updated after the call to the function to denote the exiting position in the commands vector.

◆ pushArrayToVector()

template<typename T , size_t N>
void PAPRECA::pushArrayToVector ( const T *  arr,
std::vector< T > &  vec 
)

Receives an std::vector and an array and pushes all the array elements to the vector.

Parameters
[in]arrinput array.
[in,out]vecstd::vector container.
Note
This is a template function so it works with std::vector containers of any primitive type (i.e., integers, doubles, floats, etc.).

◆ readInputAndInitPaprecaConfig()

void PAPRECA::readInputAndInitPaprecaConfig ( LAMMPS_NS::LAMMPS *  lmp,
const int &  proc_id,
const char *  file_name,
PaprecaConfig papreca_config 
)

Reads PAPRECA input line-by-line on the master MPI process and casts each line to all other processes. Then, all MPI processes execute the relevant PAPRECA command in executePaprecaCommand(). In the end, all MPI processes initialize an identical copy of PAPRECA::PaprecaConfig (containing the settings and global variables for the PAPRECA run).

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]proc_idID of current MPI process.
[in]file_namename of PAPRECA input file.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
After initializing the PAPRECA::PaprecaConfig object in all procs, this function warns for or aborts illegal runs.

◆ readLMPinput()

void PAPRECA::readLMPinput ( const std::string &  lmp_input,
LAMMPS_NS::LAMMPS *  lmp 
)

Reads LAMMPS input and initializes LAMMPS parameters.

Parameters
[in]lmp_inputname of LAMMPS input file (command-line argument).
[in,out]lmppointer to LAMMPS object.

◆ remap3DArrayInPeriodicBox()

void PAPRECA::remap3DArrayInPeriodicBox ( LAMMPS_NS::LAMMPS *  lmp,
double *  arr 
)

Receives an 1D array of 3 elements (i.e., x,y, and z coordinates) and remaps it inside the existing periodic box (as set in the provided LAMMPS object).

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in]arrarray of coordinates.
Note
See domain.h header for more information about the domain->remap function.

◆ resetMobileAtomsGroups()

void PAPRECA::resetMobileAtomsGroups ( LAMMPS_NS::LAMMPS *  lmp,
const std::vector< int > &  fluid_atomtypes 
)

Clears the fluid group (containing the fluid atom types, as defined in the PAPRECA input file) and redefines it to. This ensures that all atoms of fluid types are included in the fluid group.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]fluid_atomtypesvector containing the fluid atom types.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/group.html.
This operation is necessary each time you add/remove atoms. This ensures that the correct group of atoms will keep moving in the simulation.

◆ runLammps()

void PAPRECA::runLammps ( LAMMPS_NS::LAMMPS *  lmp,
const int &  timesteps_num 
)

Runs LAMMPS trajectory for given (previously initialized) LAMMPS object.

Parameters
[in,out]lmppointer to previously instantiated LAMMPS object.
[in]timesteps_numnumber of timesteps to execute.
Note
This function is a wrapper of this LAMMPS command: https://docs.lammps.org/run.html

◆ selectAndExecuteEvent()

int PAPRECA::selectAndExecuteEvent ( LAMMPS_NS::LAMMPS *  lmp,
int &  KMC_loopid,
double &  time,
char *  event_type,
int &  proc_id,
int &  nprocs,
PaprecaConfig papreca_config,
std::vector< Event * > &  events_local,
ATOM2BONDS_MAP atomID2bonds,
double &  film_height 
)

Gets total event rate by gathering all local rates (i.e., sum of rates on a single MPI process). Then, selects an event MPI process using the N-FOLD way. Afterwards, an event is chosen from the selected MPI process and executed on all procs.

Parameters
[in,out]lmppointer to LAMMPS object.
[in]KMC_loopidcurrent PAPRECA step.
[in,out]timecurrent time.
[in,out]event_typetype of selected event.
[in]proc_idID of current MPI process.
[in]nprocstotal number of MPI processes.
[in]papreca_configobject of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run.
[in]events_localvector containing all the PAPRECA::Event objects for a specific MPI process.
[in]atomID2bondsPAPRECA::ATOM2BONDS_MAP container (i.e., std::unordered_map< LAMMPS_NS::tagint parent_atomID , std::vector< PAPRECA::Bond > >). The atomID2bonds container provides direct access to all the bonds of the parent atom.
[in]film_heightcurrent height.
Note
Currently, we discover events on all MPI processes. However, KMC events are not executed in parallel as only one event from one MPI processes is fired at a time. We plan to introduce parallel event execution in subsequent versions of PAPRECA. Additional code will have to be written to prevent errors in neighboring events (e.g., execution of 2 deposition events that overlap, breaking of the same bond twice, etc.). Of course, executing events in parallel is expected to elevate the scalability and boost the efficiency of the code even further.
See this paper for more information regarding the classic N-FOLD way and the selection of events: https://www.sciencedirect.com/science/article/pii/S0927025623004159

◆ selectProcessStochastically()

int PAPRECA::selectProcessStochastically ( double *  arr,
const int &  arr_size,
double &  rnum,
double &  rates_sum 
)

Selects a process stochastically (through the classic N-FOLD way selection process). Can be used to select an MPI proc that fires an event or can be used to select the next kMC event inside the proc. The event selection is performed on a std::vector< std::pair< double , int > > container that holds the rate and the associated index of events.

Parameters
[in]arrarray of rates.
[in]arr_sizesize of arr.
[in]rnumuniformly distributed (between 0 and 1) pseudorandom number (usually drawn on master proc).
[in]rates_sumtotal sum of rates
Returns
integer that corresponds to the ith position of the provided vector (i.e., index of the selected process) or -1 if the function could not select a process (indicates error).
See also
PAPRECA::selectAndExecuteEvent()
Note
See paper and equation 3 here for more information regarding the classic N-FOLD way and the event selection process: https://www.sciencedirect.com/science/article/pii/S0927025623004159

◆ setTimeUnitsConversionConstant()

void PAPRECA::setTimeUnitsConversionConstant ( LAMMPS_NS::LAMMPS *  lmp,
PaprecaConfig papreca_config 
)

Retrieves the LAMMPS units style from the provided LAMMPS object (lmp) and sets the conversion time variable of the PAPRECA::PaprecaConfig object.

Parameters
[in]lmppointer to previously instantiated LAMMPS object.
[in,out]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.
Note
This operation is necessary, since PAPRECA will always report time in seconds (SI units), regardless of the LAMMPS time units. Any other variable in PAPRECA (e.g., length) has units consistent with LAMMPS units.

◆ setupMPI()

void PAPRECA::setupMPI ( int *  narg,
char ***  arg,
int *  nprocs,
int *  proc_id 
)

Initializes MPI environment using command-line arguments passed during the program invocation from the terminal.

Parameters
[in]nargnumber of command-line arguments.
[in]argarray containing command-line arguments.
[in,out]nprocsnumber of MPI processes.
[in,out]proc_ididentifier of current MPI process.

◆ string2Bool()

const bool PAPRECA::string2Bool ( std::string &  string)

Converts an input std::string to a boolean.

Parameters
[in]stringstd::string to be converted.
Returns
converted boolean.
Note
This function only works if the string is either yes (i.e., 1 ) or no (i.e., 0 );

◆ string2Double()

const double PAPRECA::string2Double ( std::string &  string)

Converts an input std::string to a double number.

Parameters
[in]stringstd::string to be converted.
Returns
converted double number.

◆ string2Int()

const int PAPRECA::string2Int ( std::string &  string)

Converts an std::string to an integer.

Parameters
[in]stringstd::string to be converted.
Returns
converted integer.

◆ string2UnsignedLongInt()

const unsigned long int PAPRECA::string2UnsignedLongInt ( std::string &  string)

Converts input string to unsigned long int.

Parameters
[in]stringstd::string to be converted.
Returns
converted unsigned long integer.

◆ stringIsBool()

const bool PAPRECA::stringIsBool ( const std::string &  string)

Checks if the string is a bool (i.e., yes or no).

Parameters
[in]stringstd::string to be checked.
Returns
true if the the string is "yes" or "no". False otherwise.

◆ stringIsIntNumber()

bool PAPRECA::stringIsIntNumber ( const std::string &  string)

This function checks if the string is a number.

Parameters
[in]stringstd::string to be checked.
Returns
false if a decimal or exponential is detected. true otherwise.
Note
Same as stringIsNumber() but now we allow positive/negative signs.
See also
stringIsNumber()

◆ stringIsNumber()

bool PAPRECA::stringIsNumber ( const std::string &  string)

This function checks if the string is a number. We allow negative/positive signs and decimal points in there so we can potentially indetify double numbers or negative numbers or exponentials as well.

Parameters
[in]stringinput std::string.
Returns
true if the string is a number or false if it is not.
Note
See this post in stackoverflow: https://stackoverflow.com/questions/4654636/how-to-determine-if-a-string-is-a-number-with-c#:~:text=The%20most%20efficient%20way%20would,the%20string%20not%20a%20number.&text=As%20pointed%20out%20in%20the,only%20works%20for%20positive%20integers.
See also
stringIsIntNumber()

◆ warn4IllegalRuns()

void PAPRECA::warn4IllegalRuns ( const int &  proc_id,
PaprecaConfig papreca_config 
)

After processing all commands, this function is called to warn all MPI processes for potentially illegal PAPRECA runs.

Parameters
[in]proc_idID of current MPI process.
[in]papreca_configpreviously instantiated PAPRECA::PaprecaConfig object storing the settings and global variables for the PAPRECA simulation.

◆ warnAll()

void PAPRECA::warnAll ( MPI_Comm  communicator,
const std::string &  message 
)

Throws a warning to all MPI processes.

Parameters
[in]communicatorMPI communicator.
[in]messagestd::string of the warning message.

◆ warnOne()

void PAPRECA::warnOne ( MPI_Comm  communicator,
const std::string &  message 
)

Throws a warning on a specific MPI process.

Parameters
[in]communicatorMPI communicator.
[in]messagestd::string of the warning message.