Set up the GP-dimer problem. More...
#include <gpr/auxiliary/ProblemSetUp.h>
Public Member Functions | |
| ProblemSetUp () | |
| virtual | ~ProblemSetUp () |
| 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. | |
| void | cutOffEnergy (const gpr::FieldMatrixd &E_reference, gpr::FieldMatrixd &E_R) |
| Subtract reference energy value from 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) |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
Set up the GP-dimer problem.
Definition at line 33 of file ProblemSetUp.h.
| aux::ProblemSetUp::ProblemSetUp | ( | ) |
Definition at line 40 of file ProblemSetUp.cpp.
|
virtual |
Definition at line 42 of file ProblemSetUp.cpp.
| bool aux::ProblemSetUp::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.
| 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. |
We let it go on if all atoms are moving. If frozen atoms exist, some of them must be either active or inactive: all of them already active (every frozen atom within the activation distance from the start) is a complete state with nothing left to activate, not an error.
Definition at line 138 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::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,...].
| 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 |
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.
Definition at line 579 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::cutOffEnergy | ( | const gpr::FieldMatrixd & | E_reference, |
| gpr::FieldMatrixd & | E_R ) |
Subtract reference energy value from E_R.
| E_reference | A field with the reference enerfy |
| E_R | In/out energy field |
Definition at line 44 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::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.
Definition at line 744 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::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.
Definition at line 520 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::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.
| 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 |
Definition at line 502 of file ProblemSetUp.cpp.
| void aux::ProblemSetUp::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.
| unfreezed_atoms | The coordinates of the unfreezed atoms |
| atoms_config | The initial configuration of atoms. |
| coord_atom_new | The new coordinates of all atoms. |
Definition at line 475 of file ProblemSetUp.cpp.