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

Custom bond class (not to be confused with a LAMMPS bond). More...

#include <bond.h>

Public Member Functions

 Bond ()
 
 Bond (const LAMMPS_NS::tagint &bond_atom_in, const int &bond_type_in, const bool &head_parent_atom_in)
 
 ~Bond ()
 
const LAMMPS_NS::tagint & getBondAtom () const
 
const int & getBondType () const
 
bool parentAtomIsHead () const
 For each bond in the system a tail and a head atom are (randomly) defined. This prevents the discovery of identical (i.e., defined twice) PAPRECA::BondBreak events. More...
 
void assignBondAtom (const LAMMPS_NS::tagint &bond_atom_in)
 
void assignBondType (const int &bond_type_in)
 

Static Public Member Functions

static const bool atomIDIsMapped (LAMMPS_NS::tagint &parent_atomID, ATOM2BONDS_MAP &atomID2bonds)
 
static void addBond2BondVector (int &bond_type, LAMMPS_NS::tagint &parent_atomID, LAMMPS_NS::tagint &bond_atomID, const bool &head_atom_parent, ATOM2BONDS_MAP &atomID2bonds)
 
static void fillAtomID2BondsContainer (ATOM2BONDS_MAP &atomID2bonds, LAMMPS_NS::tagint *bonds_list, const LAMMPS_NS::bigint &bonds_num)
 
static void initAtomID2BondsMap (LAMMPS_NS::LAMMPS *lmp, const int &proc_id, ATOM2BONDS_MAP &atomID2bonds)
 
static bool atomHasBonds (const LAMMPS_NS::tagint &iatom_id, ATOM2BONDS_MAP &atomID2bonds)
 
static void recursiveCollectBondedAtoms (LAMMPS_NS::tagint &atom_id, std::vector< LAMMPS_NS::tagint > &delids_local, TAGINT_SET &delids_set, ATOM2BONDS_MAP &atomID2bonds)
 

Private Attributes

LAMMPS_NS::tagint bond_atom = -1
 
int bond_type = -1
 
bool head_parent_atom = false
 

Detailed Description

Custom bond class (not to be confused with a LAMMPS bond).

Every atom in the system is associated with a vector of bond objects. The bonds vector of objects provides easy access to bonded atom IDs and bond types. PAPRECA::Bond objects enable bond formation, bond breaking, and custom diffusion events (e.g., the Fe_4PO4neib diffusion style deploys the bond vectors of the neighbors of the candidate Fe atom to determine whether or not there are 4 PO4 in the parent Fe neighborhood). The unordered_map PAPRECA::ATOM2BONDS_MAP can be used to retrieve the relevant vector of bond objects using a LAMMPS atom ID.

Constructor & Destructor Documentation

◆ Bond() [1/2]

PAPRECA::Bond::Bond ( )

◆ Bond() [2/2]

PAPRECA::Bond::Bond ( const LAMMPS_NS::tagint &  bond_atom_in,
const int &  bond_type_in,
const bool &  head_parent_atom_in 
)

◆ ~Bond()

PAPRECA::Bond::~Bond ( )

Member Function Documentation

◆ addBond2BondVector()

void PAPRECA::Bond::addBond2BondVector ( int &  bond_type,
LAMMPS_NS::tagint &  parent_atomID,
LAMMPS_NS::tagint &  bond_atomID,
const bool &  head_atom_parent,
ATOM2BONDS_MAP atomID2bonds 
)
static

Receives the bond type and atom IDs of a bond. Then, initializes a PAPRECA::Bond and inserts it in the relevant std::vector< PAPRECA::Bond > containers. The std::vector< PAPRECA::Bond > containers are stored in the atomID2bonds map.

Parameters
[in]bond_typetype of bond.
[in]parent_atomIDID of the first atom ID of the bond.
[in]bond_atomIDID of the second atom ID of the bond.
[in]head_atom_parentboolean dictating whether the parent_atomID is the head atom of the current bond
[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::Bond::fillAtomID2BondsContainer(), PAPRECA::Bond::initAtomID2BondsMap(), PAPRECA::Bond::atomIDIsMapped(), PAPRECA::Bond::initAndGatherBondsList()

◆ assignBondAtom()

void PAPRECA::Bond::assignBondAtom ( const LAMMPS_NS::tagint &  bond_atom_in)

◆ assignBondType()

void PAPRECA::Bond::assignBondType ( const int &  bond_type_in)

◆ atomHasBonds()

bool PAPRECA::Bond::atomHasBonds ( const LAMMPS_NS::tagint &  iatom_id,
ATOM2BONDS_MAP atomID2bonds 
)
static

◆ atomIDIsMapped()

const bool PAPRECA::Bond::atomIDIsMapped ( LAMMPS_NS::tagint &  parent_atomID,
PAPRECA::ATOM2BONDS_MAP atomID2bonds 
)
static

Checks if the parent_atomID is contained in the atomID2bonds map

Parameters
[in]parent_atomIDID of parent 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.
See also
PAPRECA::Bond::fillAtomID2BondsContainer(), PAPRECA::Bond::addBond2BondVector(), PAPRECA::Bond::initAtomID2BondsMap(), PAPRECA::Bond::initAndGatherBondsList()

◆ fillAtomID2BondsContainer()

void PAPRECA::Bond::fillAtomID2BondsContainer ( ATOM2BONDS_MAP atomID2bonds,
LAMMPS_NS::tagint *  bonds_list,
const LAMMPS_NS::bigint &  bonds_num 
)
static

Fills atomID2bonds container with bonds gathered from LAMMPS and stored in the bonds_list array.

Parameters
[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.
[in]bonds_listarray containing the IDs of bonds.
[in]bonds_numnumber of bonds in the bonds_list array.
See also
PAPRECA::Bond::initAtomID2BondsMap(), PAPRECA::Bond::addBond2BondVector(), PAPRECA::Bond::atomIDIsMapped(), PAPRECA::Bond::initAndGatherBondsList()

◆ getBondAtom()

const LAMMPS_NS::tagint & PAPRECA::Bond::getBondAtom ( ) const

◆ getBondType()

const int & PAPRECA::Bond::getBondType ( ) const

◆ initAtomID2BondsMap()

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

Initializes/fills atomID2bonds map. This is done by 1) gathering all bonds from the LAMMPS instance, 2) creating a std::vector< PAPRECA::Bond > container for each atomID, 3) filling the std::vector< PAPRECA::Bond > container with the IDs of bonded atoms.

Parameters
[in]lmppointer to LAMMPS object.
[in]proc_idID of current MPI process.
[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::Bond::fillAtomID2BondsContainer(), PAPRECA::Bond::addBond2BondVector(), PAPRECA::Bond::atomIDIsMapped(), PAPRECA::Bond::initAndGatherBondsList()

◆ parentAtomIsHead()

bool PAPRECA::Bond::parentAtomIsHead ( ) const

For each bond in the system a tail and a head atom are (randomly) defined. This prevents the discovery of identical (i.e., defined twice) PAPRECA::BondBreak events.

◆ recursiveCollectBondedAtoms()

void PAPRECA::Bond::recursiveCollectBondedAtoms ( LAMMPS_NS::tagint &  atom_id,
std::vector< LAMMPS_NS::tagint > &  delids_local,
TAGINT_SET delids_set,
ATOM2BONDS_MAP atomID2bonds 
)
static

Recursively collects all bonded atoms of an atom. The IDs of collected atoms are inserted in the std::vector< tagint > container (delids_local). The vector of PAPRECA::Bond objects is retrieved for the atom_id from the atomID2bonds map. The function uses an atom tagint to start adding bonded atoms and returns when all bonded atoms are recursively collected (uses an std::unordered_set to decide that).

Parameters
[in]atom_idID of atom.
[in,out]delids_localvector of collected atom IDs.
[in,out]delids_setstd::unordered_set< LAMMPS_NS::tagint > containing atom IDs marked for deletion. Used to avoid duplicate deletion of atoms.
[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.
Note
This function works consistently because all MPI processes contain the same data in their atomID2bonds map.
See also
PAPRECA::Bond::initAtomID2BondsMap()

Member Data Documentation

◆ bond_atom

LAMMPS_NS::tagint PAPRECA::Bond::bond_atom = -1
private

◆ bond_type

int PAPRECA::Bond::bond_type = -1
private

◆ head_parent_atom

bool PAPRECA::Bond::head_parent_atom = false
private

The documentation for this class was generated from the following files: