class aux::ProblemSetUp

Overview

Set up the GP-dimer problem. More…

#include <gpr/auxiliary/ProblemSetUp.h>
 
class ProblemSetUp {
public:
    // construction
 
    ProblemSetUp();
    virtual ~ProblemSetUp();
 
    // methods
 
    bool activateFrozenAtoms(const gpr::Coord& R, const double activation_distance, gpr::AtomsConfiguration& atoms_config);
    void cutOffEnergy(const gpr::FieldMatrixd& E_reference, gpr::FieldMatrixd& E_R);
    void initializeEnergyAndGradient(const gpr::FieldMatrixd& E_reference, const gpr::AtomsConfiguration& atoms_config, const gpr::vector3_reg(&) system_size[3], gpr::Observation& middle_point, pot::PotentialWrapper& general_potential, gpr::Index_t& num_of_calls);
    void calculateGeneralPotential(const gpr::AtomsConfiguration& atoms_config, const gpr::vector3_reg(&) cell_dimensions[3], gpr::Observation& mid_point, pot::PotentialWrapper& general_potential, gpr::Index_t& num_of_calls, Eigen::Index batch_chunk = 0);
    void updateConf(const gpr::Coord& unfreezed_atoms, const gpr::AtomsConfiguration& atoms_config, gpr::Coord& coord_atom_new);
    void setPairtypeForMovingAtoms(const gpr::FieldMatrixIdx& atomtype_mov, gpr::Index_t& n_pt, gpr::FieldMatrixi& pairtype);
    void removeDuplicatedAtoms(const gpr::AtomsPositionAndType& moving_atoms, gpr::AtomsPositionAndType& active_atoms, gpr::AtomsPositionAndType& inactive_atoms);
};

Detailed Documentation

Set up the GP-dimer problem.

Methods

bool activateFrozenAtoms(const gpr::Coord& R, const double activation_distance, gpr::AtomsConfiguration& atoms_config)

Update the active frozen-atom set for one or more configurations.

If nn_frozen is positive, the active set contains the nearest nn_frozen atoms selected from the active and inactive frozen atoms, measured against every configuration in R. Otherwise, inactive atoms within activation_distance are activated; a nonpositive distance activates all inactive atoms. When evict_frozen is enabled, active atoms outside a positive activation radius return to the inactive set. Radius and nearest-neighbour distances use the configured periodic cell. Pair-type indices are added when the active set introduces a new pair.

Frozen atoms that coincide with moving atoms are removed from the frozen sets. The active set is rebuilt only when its membership changes, preserving feature order otherwise.

Parameters:

R

Configurations with one row per geometry. Each row may contain moving-atom coordinates only or the full frame; frozen coordinates in a full-frame row do not participate in selection.

activation_distance

Radius for activating and, when enabled, evicting frozen atoms.

atoms_config

Structure and active/inactive atom sets used by the GP model.

Returns:

True if the active frozen-atom membership changes; false otherwise.

void cutOffEnergy(const gpr::FieldMatrixd& E_reference, gpr::FieldMatrixd& E_R)

Subtract reference energy value from E_R.

Parameters:

E_reference

A field with the reference enerfy

E_R

In/out energy field

void initializeEnergyAndGradient(const gpr::FieldMatrixd& E_reference, const gpr::AtomsConfiguration& atoms_config, const gpr::vector3_reg(&) system_size[3], gpr::Observation& middle_point, pot::PotentialWrapper& general_potential, gpr::Index_t& num_of_calls)

Initialize energy and gradient.

void calculateGeneralPotential(const gpr::AtomsConfiguration& atoms_config, const gpr::vector3_reg(&) cell_dimensions[3], gpr::Observation& mid_point, pot::PotentialWrapper& general_potential, gpr::Index_t& num_of_calls, Eigen::Index batch_chunk = 0)

Invoke potential calculation.

Each row of ‘R’ represents one configuration including the coordinates of the moving atoms: [x_1,y_1,z_1,x_2,y_2,z_2,…].

Images are shared out over the MPI ranks by a layout-independent owner map, each rank evaluates its images in one call through the potential’s batch surface where it has one, a failure on any rank reaches every rank before the values are exchanged, and every rank holds the same energies and gradients afterwards.

Parameters:

atoms_config

Full configuration of the system (i.e. both constrained and unconstrained atoms)

cell_dimensions

Cell dimension

mid_point

Coordinates, energy and gradients of the middle point of the dimer (1 x D)

general_potential

Reference to a type-erased potential wrapper

num_of_calls

Number of calls for the general potential

batch_chunk

Oracle batch chunk (pot::OracleBatchLayout::chunk): 0 evaluates every image a rank owns in one call, K cuts the images into contiguous chunks of K

void updateConf(const gpr::Coord& unfreezed_atoms, const gpr::AtomsConfiguration& atoms_config, gpr::Coord& coord_atom_new)

Update an atomic configuration with new coordinates for the unfreezed atoms.

Parameters:

unfreezed_atoms

The coordinates of the unfreezed atoms

atoms_config

The initial configuration of atoms.

coord_atom_new

The new coordinates of all atoms.

void setPairtypeForMovingAtoms(const gpr::FieldMatrixIdx& atomtype_mov, gpr::Index_t& n_pt, gpr::FieldMatrixi& pairtype)

Set pairtype indices for moving+moving atom pairs and gives the updated number of active pairtypes.

The provided n_pt should be equal to the number of active pairtypes before the update.

Parameters:

atomtype_mov

Atomtype indices for moving atoms (1 x N_mov)

pairtype

Pairtype indices for pairs of atomtypes before the update (n_at x n_at)

n_pt

Number of active pairtypes before and after the update

void removeDuplicatedAtoms(const gpr::AtomsPositionAndType& moving_atoms, gpr::AtomsPositionAndType& active_atoms, gpr::AtomsPositionAndType& inactive_atoms)

Remove clones of the moving atoms from the set of inactive frozen atoms.