144 std::string
const& element);
168 std::string>
const& lines);
180 double maxCutoffRadius);
190 bool sortByDistance =
false);
202 std::vector<double>>& cutoffs);
213 std::vector<double>> cutoffs);
295 Eigen::VectorXd hardness,
296 Eigen::MatrixXd gammaSqrt2,
297 Eigen::VectorXd sigmaSqrtPi,
299 double const fourPiEps,
315 Eigen::MatrixXd gammaSqrt2,
316 Eigen::VectorXd sigmaSqrtPi,
318 double const fourPiEps);
331 Eigen::MatrixXd gammaSqrt2,
332 double const fourPiEps,
355 std::vector<size_t>
const& atomsIndices,
356 std::vector<size_t>
const& compIndices,
357 double const maxCutoffRadius,
358 std::vector<Element>
const& elements);
372 Eigen::VectorXd hardness,
373 Eigen::MatrixXd gammaSqrt2,
374 Eigen::VectorXd sigmaSqrtPi,
376 double const fourPiEps);
428 double const maxCutoffRadius = 0.0);
466 std::string
const& property,
467 std::map<std::string, double>& error,
468 std::size_t& count)
const;
492 std::string
const fileName =
"output.data",
493 bool const ref =
true,
494 bool const append =
false)
const;
502 std::ofstream*
const& file,
503 bool const ref =
true)
const;
517 std::ofstream*
const& file)
const;
524 std::ofstream*
const& file,
525 std::string
const elements)
const;
530 std::vector<std::string>
info()
const;
Setup data for Ewald summation.
A screening functions for use with electrostatics.
Storage for a single atom.
Helper class to store previously calculated values of erfc() that are needed during the charge equili...
Storage for one atomic configuration.
void freeAtoms(bool all, double const maxCutoffRadius=0.0)
Free symmetry function memory for all atoms, see free() in Atom class.
void calculateVolume()
Calculate volume from box vectors.
SampleType
Enumerates different sample types (e.g.
@ ST_VALIDATION
Structure is part of validation set (currently unused).
@ ST_TRAINING
Structure is part of the training set.
@ ST_UNKNOWN
Sample type not assigned yet.
@ ST_TEST
Structure is part of the test set.
Vec3D invbox[3]
Inverse simulation box vectors.
void toPhysicalUnits(double meanEnergy, double convEnergy, double convLength, double convCharge)
Switch to physical units, shift energy and change energy, length and charge unit.
Vec3D box[3]
Simulation box vectors.
bool isTriclinic
If the simulation box is triclinic.
std::size_t getMaxNumNeighbors() const
Find maximum number of neighbors.
void setupNeighborCutoffMap(std::vector< std::vector< double > > cutoffs)
Set up a neighbor cut-off map which gives the index (value) of the last needed neighbor corresponding...
void sortNeighborList()
Sort all neighbor lists of this structure with respect to the distance.
Eigen::VectorXd const calculateForceLambdaElec() const
Calculate lambda_elec vector which is needed for the electrostatic force calculation in 4G NN.
std::vector< std::size_t > numAtomsPerElement
Number of atoms of each element in this structure.
double lambda
Lagrange multiplier used for charge equilibration.
void calculateMaxCutoffRadiusOverall(EwaldSetup &ewaldSetup, double rcutScreen, double maxCutoffRadius)
Calculate maximal cut-off if cut-off of screening and real part Ewald summation are also considered.
bool canMinimumImageConventionBeApplied(double cutoffRadius)
Check if cut-off radius is small enough to apply minimum image convention.
void writeToFile(std::string const fileName="output.data", bool const ref=true, bool const append=false) const
Write configuration to file.
void calculateDQdChi(std::vector< Eigen::VectorXd > &dQdChi)
Calculates derivative of the charges with respect to electronegativities.
std::string comment
Structure comment.
bool isPeriodic
If periodic boundary conditions apply.
double maxCutoffRadiusOverall
Maximum cut-off radius with respect to symmetry functions, screening function and Ewald summation.
double charge
Charge determined by neural network potential.
double calculateElectrostaticEnergy(EwaldSetup &ewaldSetup, Eigen::VectorXd hardness, Eigen::MatrixXd gammaSqrt2, Eigen::VectorXd sigmaSqrtPi, ScreeningFunction const &fs, double const fourPiEps, ErfcBuf &erfcBuf)
Compute electrostatic energy with global charge equilibration.
bool NeighborListIsSorted
If the neighbor list has been sorted by distance.
ElementMap elementMap
Copy of element map provided as constructor argument.
void setElementMap(ElementMap const &elementMap)
Set element map of structure.
std::size_t index
Index number of this structure.
void remap()
Translate all atoms back into box if outside.
std::vector< std::string > getChargesLines() const
Get reference and NN charges for all atoms.
double chargeRef
Reference charge.
SampleType sampleType
Sample type (training or test set).
double energyShort
Short-range part of the potential energy predicted by NNP.
void calculateDQdJ(std::vector< Eigen::VectorXd > &dQdJ)
Calculates derivative of the charges with respect to atomic hardness.
bool hasAMatrix
If A matrix of this structure is currently stored.
void addAtom(Atom const &atom, std::string const &element)
Add a single atom to structure.
void calculateInverseBox()
Calculate inverse box.
void writeToFilePoscar(std::ofstream *const &file) const
Write configuration to POSCAR file.
void writeToFileXyz(std::ofstream *const &file) const
Write configuration to xyz file.
bool hasSymmetryFunctionDerivatives
If symmetry function derivatives are saved for each atom.
void calculateDQdr(std::vector< size_t > const &atomsIndices, std::vector< size_t > const &compIndices, double const maxCutoffRadius, std::vector< Element > const &elements)
Calculates derivative of the charges with respect to the atom's position.
Eigen::MatrixXd A
Global charge equilibration matrix A'.
void calculatePbcCopies(double cutoffRadius, int(&pbc)[3])
Calculate required PBC copies.
Eigen::VectorXd const calculateForceLambdaTotal() const
Calculate lambda_total vector which is needed for the total force calculation in 4G NN.
std::string getEnergyLine() const
Get reference and NN energy.
void clearElectrostatics(bool clearDQdr=false)
Clear A-matrix, dAdrQ and optionally dQdr.
double energyElec
Electrostatics part of the potential energy predicted by NNP.
double energy
Potential energy determined by neural network.
void readFromFile(std::string const fileName="input.data")
Read configuration from file.
double energyRef
Reference potential energy.
int pbc[3]
Number of PBC images necessary in each direction for max cut-off.
void toNormalizedUnits(double meanEnergy, double convEnergy, double convLength, double convCharge)
Normalize structure, shift energy and change energy, length and charge unit.
void reset()
Reset everything but elementMap.
std::vector< std::string > getForcesLines() const
Get reference and NN forces for all atoms.
Structure()
Constructor, initializes to zero.
double volume
Simulation box volume.
void calculateElectrostaticEnergyDerivatives(Eigen::VectorXd hardness, Eigen::MatrixXd gammaSqrt2, Eigen::VectorXd sigmaSqrtPi, ScreeningFunction const &fs, double const fourPiEps)
Calculates partial derivatives of electrostatic Energy with respect to atom's coordinates and charges...
Vec3D applyMinimumImageConvention(Vec3D const &dr)
Calculate distance between two atoms in the minimum image convention.
void calculateNeighborList(double cutoffRadius, bool sortByDistance=false)
Calculate neighbor list for all atoms.
std::size_t numAtoms
Total number of atoms present in this structure.
std::size_t numElements
Global number of elements (all structures).
void updateError(std::string const &property, std::map< std::string, double > &error, std::size_t &count) const
Update property error metrics with this structure.
void calculateDAdrQ(EwaldSetup &ewaldSetup, Eigen::MatrixXd gammaSqrt2, double const fourPiEps, ErfcBuf &erfcBuf)
Calculates derivative of A-matrix with respect to the atoms positions and contract it with Q.
std::vector< Atom > atoms
Vector of all atoms in this structure.
std::size_t numElementsPresent
Number of elements present in this structure.
void readFromLines(std::vector< std::string > const &lines)
Read configuration from lines.
double calculateScreeningEnergy(Eigen::MatrixXd gammaSqrt2, Eigen::VectorXd sigmaSqrtPi, ScreeningFunction const &fs, double const fourPiEps)
Calculate screening energy which needs to be added (!) to the electrostatic energy in order to remove...
bool hasNeighborList
If the neighbor list has been calculated.
void clearNeighborList()
Clear neighbor list of all atoms.
std::vector< std::string > info() const
Get structure information as a vector of strings.
bool hasCharges
If all charges of this structure have been calculated (and stay the same, e.g.
bool hasSymmetryFunctions
If symmetry function values are saved for each atom.
Vector in 3 dimensional real space.