DescriptorsCalc
-
template<typename D2 = tadah::models::D2_Base&, typename DM = tadah::models::DM_Base&, typename C2 = tadah::models::Cut_Base&, typename CM = tadah::models::Cut_Base&>
class DescriptorsCalc : public tadah::mlip::DC_Base Descriptors calculator.
This object does not store any data.
Usage example:
# Build calculator using tadah::core::Context object. DescriptorsCalc<D2_LJ, DM_Dummy> dc(context); # Calculate all descriptors in a Structure st StDescriptors std = dc.calc(st); # Calculate all descriptors in a StructureDB st_db StDescriptorsDB std_db = dc.calc(st_db);
This object sets the following INTERNAL_KEYS to the provided tadah::core::Context object:
SIZE2B,SIZE3B,SIZEMB,DSIZE
Required keys: INIT2B,INIT3B,INITMB, RCUT2B,RCUT3B,RCUTMB (for initialised ones)
- Template Parameters:
D2 – D2_Base child, two-body type calculator.
DM – DM_Base child, many-body type calculator.
C2 – Cut_Base child, two-body cutoff function.
CM – Cut_Base child, many-body cutoff function.
Public Functions
-
DescriptorsCalc(tadah::core::Context &c)
Constructor to fully initialise this object.
REQUIRED context KEYS: FORCE, STRESS, at least one of: RCUT2B, RCUT3B,RCUTMB
-
template<typename T1, typename T2, typename T3, typename T4>
DescriptorsCalc(tadah::core::Context &c, T1 &d2, T2 &dm, T3 &c2, T4 &cm) This constructor is equivalent to the main constructor above.
The difference is technical in nature. Here we use OOP with generic programming to call virtual functions to calculate descriptors - this incurs small efficiency penalty but makes selecting of descriptors somewhat easier at runtime.
In contrast, the main constructor above is purely generic.
The rule of thumb is: Use the main contructor unless it’s a pain.
Usage example:
# Build calculator using tadah::core::Context object. D2_Base *d2 = new D2_LJ(context); D2_Base *dm = new DM_Dummy(context); DescriptorsCalc<> dc(context, d2, dm); # Calculate all descriptors in a Structure st StDescriptors std = dc.calc(st); # Calculate all descriptors in a StructureDB st_db StDescriptorsDB std_db = dc.calc(st_db);
Warning
{ The unfortunate consequence is that you might want to try this
Basically you are trying to init abstract classes with context object. It won’t compile! }DescriptorsCalc<> dc(context);
-
virtual StDescriptors calc(const Structure &st) const
Calculate all descriptors in a Structure st
-
virtual StDescriptorsDB calc(const StructureDB &st_db) const
Calculate all descriptors in a StructureDB st_db
-
void calc_rho(const Structure &st, StDescriptors &std) const
Calculate density vector for the structure