PAPRECA hybrid off-lattice kMC/MD simulator
2.0.0 (17 September 2024)
|
Driver function. Initializes MPI, LAMMPS, and PAPRECA. Then runs kMC/MD loops. More...
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <fstream>
#include <chrono>
#include <ctime>
#include <cmath>
#include <limits>
#include <mpi.h>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <algorithm>
#include "lammps.h"
#include "papreca.h"
Functions | |
void | initialize (int *narg, char ***arg, int *nprocs, int *proc_id, LAMMPS **lmp, PaprecaConfig &papreca_config) |
void | finalize (LAMMPS **lmp, PaprecaConfig &papreca_config, const int &proc_id) |
int | main (int narg, char **arg) |
Driver function. Initializes MPI, LAMMPS, and PAPRECA. Then runs kMC/MD loops.
void finalize | ( | LAMMPS ** | lmp, |
PaprecaConfig & | papreca_config, | ||
const int & | proc_id | ||
) |
Called at the end of the PAPRECA simulation. This function 1) closes all open files (if any), 2) deletes the previously instantiated LAMMPS object (in initializeLMP() function), and 3) calls MPI_Finalize() to ensure proper termination of all MPI processes.
[in,out] | lmp | pointer to pointer of LAMMPS object (used to delete the instantiated LAMMPS object in initializeLMP() function). |
[in] | papreca_config | object of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run. |
[in] | proc_id | ID of current MPI process. |
void initialize | ( | int * | narg, |
char *** | arg, | ||
int * | nprocs, | ||
int * | proc_id, | ||
LAMMPS ** | lmp, | ||
PaprecaConfig & | papreca_config | ||
) |
Intializes MPI, LAMMPS, and PAPRECA
[in] | narg | number of command-line arguments passed to the main function (i.e., the papreca executable) during the program invocation from the terminal. |
[in] | arg | array containing the char* passed to the main function during the program invocation from the terminal. |
[in,out] | nprocs | number of MPI processes. |
[in,out] | proc_id | ID of current MPI process. |
[in,out] | lmp | pointer to LAMMPS instance. |
[in,out] | papreca_config | object of the PAPRECA::PaprecaConfig class that stores global variables and settings for the current PAPRECA run. |
int main | ( | int | narg, |
char ** | arg | ||
) |
Driver function running the main PAPRECA simulation loop. The function sets up the MPI protocol, initializes all (LAMMPS and PAPRECA) variables, and performs the requested (by the user, in the PAPRECA input file) PAPRECA simulation KMC steps. On each PAPRECA simulation KMC step, each atom on every MPI process is scanned and PAPRECA::Events are discovered. Then, an event is executed on an MPI processes (the executed event as well as the MPI process firing the event are chosen based on the N-FOLD way).
[in] | narg | number of command-line arguments passed to the main function (i.e., the papreca executable) during the program invocation from the terminal. |
[in] | arg | array containing the char* passed to the main function during the program invocation from the terminal. |