n2p2 - A neural network potential package
nnp::Atom::Neighbor Struct Reference

Struct to store information on neighbor atoms. More...

#include <Atom.h>

Collaboration diagram for nnp::Atom::Neighbor:

Public Member Functions

 Neighbor ()
 Neighbor constructor, initialize to zero. More...
 
bool operator== (Neighbor const &rhs) const
 Overload == operator. More...
 
bool operator!= (Neighbor const &rhs) const
 Overload != operator. More...
 
bool operator< (Neighbor const &rhs) const
 Overload < operator. More...
 
bool operator> (Neighbor const &rhs) const
 Overload > operator. More...
 
bool operator<= (Neighbor const &rhs) const
 Overload <= operator. More...
 
bool operator>= (Neighbor const &rhs) const
 Overload >= operator. More...
 
std::vector< std::string > info () const
 Get atom information as a vector of strings. More...
 

Public Attributes

std::size_t index
 Index of neighbor atom. More...
 
int64_t tag
 Tag of neighbor atom. More...
 
std::size_t element
 Element index of neighbor atom. More...
 
double d
 Distance to neighbor atom. More...
 
Vec3D dr
 Distance vector to neighbor atom. More...
 
std::vector< double > cache
 Symmetry function cache (e.g. for cutoffs, compact functions). More...
 
std::vector< Vec3DdGdr
 Derivatives of symmetry functions with respect to neighbor coordinates. More...
 

Detailed Description

Struct to store information on neighbor atoms.

Definition at line 34 of file Atom.h.

Constructor & Destructor Documentation

◆ Neighbor()

Atom::Neighbor::Neighbor ( )

Neighbor constructor, initialize to zero.

Definition at line 460 of file Atom.cpp.

460 : index (0 ),
461 tag (0 ),
462 element (0 ),
463 d (0.0 )
464{
465}
std::size_t index
Index of neighbor atom.
Definition: Atom.h:37
std::size_t element
Element index of neighbor atom.
Definition: Atom.h:41
double d
Distance to neighbor atom.
Definition: Atom.h:43
int64_t tag
Tag of neighbor atom.
Definition: Atom.h:39

Member Function Documentation

◆ operator==()

bool Atom::Neighbor::operator== ( Atom::Neighbor const &  rhs) const

Overload == operator.

Definition at line 467 of file Atom.cpp.

468{
469 if (element != rhs.element) return false;
470 if (d != rhs.d ) return false;
471 return true;
472}

References d, d, element, and nnp::Atom::element.

◆ operator!=()

bool nnp::Atom::Neighbor::operator!= ( Atom::Neighbor const &  rhs) const
inline

Overload != operator.

Definition at line 258 of file Atom.h.

259{
260 return !((*this) == rhs);
261}

◆ operator<()

bool Atom::Neighbor::operator< ( Atom::Neighbor const &  rhs) const

Overload < operator.

Definition at line 474 of file Atom.cpp.

475{
476 if (element < rhs.element) return true;
477 else if (element > rhs.element) return false;
478 if (d < rhs.d ) return true;
479 else if (d > rhs.d ) return false;
480 return false;
481}

References d, d, element, and nnp::Atom::element.

◆ operator>()

bool nnp::Atom::Neighbor::operator> ( Atom::Neighbor const &  rhs) const
inline

Overload > operator.

Definition at line 263 of file Atom.h.

264{
265 return rhs < (*this);
266}

◆ operator<=()

bool nnp::Atom::Neighbor::operator<= ( Atom::Neighbor const &  rhs) const
inline

Overload <= operator.

Definition at line 268 of file Atom.h.

269{
270 return !((*this) > rhs);
271}

◆ operator>=()

bool nnp::Atom::Neighbor::operator>= ( Atom::Neighbor const &  rhs) const
inline

Overload >= operator.

Definition at line 273 of file Atom.h.

274{
275 return !((*this) < rhs);
276}

◆ info()

vector< string > Atom::Neighbor::info ( ) const

Get atom information as a vector of strings.

Returns
Lines with atom information.

Definition at line 483 of file Atom.cpp.

484{
485 vector<string> v;
486
487 v.push_back(strpr("********************************\n"));
488 v.push_back(strpr("NEIGHBOR \n"));
489 v.push_back(strpr("********************************\n"));
490 v.push_back(strpr("index : %d\n", index));
491 v.push_back(strpr("tag : %" PRId64 "\n", tag));
492 v.push_back(strpr("element : %d\n", element));
493 v.push_back(strpr("d : %16.8E\n", d));
494 v.push_back(strpr("dr : %16.8E %16.8E %16.8E\n", dr[0], dr[1], dr[2]));
495 v.push_back(strpr("--------------------------------\n"));
496#ifndef N2P2_NO_SF_CACHE
497 v.push_back(strpr("cache [*] : %d\n", cache.size()));
498 v.push_back(strpr("--------------------------------\n"));
499 for (size_t i = 0; i < cache.size(); ++i)
500 {
501 v.push_back(strpr("%29d : %16.8E\n", i, cache.at(i)));
502 }
503 v.push_back(strpr("--------------------------------\n"));
504 v.push_back(strpr("--------------------------------\n"));
505#endif
506 v.push_back(strpr("dGdr [*] : %d\n", dGdr.size()));
507 v.push_back(strpr("--------------------------------\n"));
508 for (size_t i = 0; i < dGdr.size(); ++i)
509 {
510 v.push_back(strpr("%29d : %16.8E %16.8E %16.8E\n", i, dGdr.at(i)[0], dGdr.at(i)[1], dGdr.at(i)[2]));
511 }
512 v.push_back(strpr("--------------------------------\n"));
513 v.push_back(strpr("********************************\n"));
514
515 return v;
516}
string strpr(const char *format,...)
String version of printf function.
Definition: utility.cpp:90
std::vector< double > cache
Symmetry function cache (e.g. for cutoffs, compact functions).
Definition: Atom.h:48
Vec3D dr
Distance vector to neighbor atom.
Definition: Atom.h:45
std::vector< Vec3D > dGdr
Derivatives of symmetry functions with respect to neighbor coordinates.
Definition: Atom.h:59

References d, nnp::Atom::dGdr, nnp::Atom::element, nnp::Atom::index, nnp::strpr(), and nnp::Atom::tag.

Here is the call graph for this function:

Member Data Documentation

◆ index

std::size_t nnp::Atom::Neighbor::index

Index of neighbor atom.

Definition at line 37 of file Atom.h.

Referenced by nnp::InterfaceLammps::addNeighbor().

◆ tag

int64_t nnp::Atom::Neighbor::tag

Tag of neighbor atom.

Definition at line 39 of file Atom.h.

Referenced by nnp::InterfaceLammps::addNeighbor().

◆ element

◆ d

◆ dr

◆ cache

◆ dGdr


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