DescriptorsCalc

template<typename D2 = D2_Base&, typename D3 = D3_Base&, typename DM = DM_Base&, typename C2 = Cut_Base&, typename C3 = Cut_Base&, typename CM = Cut_Base&>
class DescriptorsCalc : public DC_Base

Descriptors calculator.

This object does not store any data.

Usage example:

# Build calculator using Config object.
DescriptorsCalc<D2_LJ, D3_Dummy, DM_Dummy> dc(config);

# 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 Config object:

SIZE2B,SIZE3B,SIZEMB,DSIZE

Required keys: INIT2B,INIT3B,INITMB, RCUT2B,RCUT3B,RCUTMB (for initialised ones)

Template Parameters:
  • D2D2_Base child, two-body type calculator.

  • D3 – D3_Base child, three-body type calculator.

  • DMDM_Base child, many-body type calculator.

  • C2Cut_Base child, two-body cutoff function.

  • C3Cut_Base child, three-body cutoff function.

  • CMCut_Base child, many-body cutoff function.

Public Functions

DescriptorsCalc(Config &c)

Constructor to fully initialise this object.

REQUIRED CONFIG KEYS: FORCE, STRESS, at least one of: RCUT2B, RCUT3B,RCUTMB

template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
DescriptorsCalc(Config &c, T1 &d2, T2 &d3, T3 &dm, T4 &c2, T5 &c3, T6 &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 Config object.
D2_Base *d2 = new D2_LJ(config);
D2_Base *d3 = new D3_Dummy(config);
D2_Base *dm = new DM_Dummy(config);
DescriptorsCalc<> dc(config, d2, d3, 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

DescriptorsCalc<> dc(config);
Basically you are trying to init abstract classes with config object. It won’t compile! }

virtual StDescriptors calc(const Structure &st)

Calculate all descriptors in a Structure st

virtual StDescriptorsDB calc(const StructureDB &st_db)

Calculate all descriptors in a StructureDB st_db

void calc_rho(const Structure &st, StDescriptors &std)

Calculate density vector for the structure