#include <Matter.h>
Classes | |
| struct | Impl |
Public Member Functions | |
| ~Matter () | |
| Matter (std::shared_ptr< Potential > pot, const Parameters ¶ms) | |
| Matter (std::unique_ptr< Potential > pot, const Parameters ¶ms) | |
| Exclusive handoff. | |
| Matter (const Matter &matter) | |
| Matter (Matter &&other) noexcept | |
| Move: transfers retained movie ConFrames (move-only). | |
| bool | holdsExclusivePotential () const |
| True while no copy has shared the Potential from an exclusive handoff. | |
| const Matter & | operator= (const Matter &matter) |
| Matter & | operator= (Matter &&other) noexcept |
| bool | compare (const Matter &matter, bool indistinguishable=false) |
| double | distanceTo (const Matter &matter) |
| double | perAtomNorm (const Matter &matter) |
| void | setPotential (std::shared_ptr< Potential > pot) |
| std::shared_ptr< Potential > | getPotential () |
| void | resize (long int nAtoms) |
| long int | numberOfAtoms () const |
| Matrix3d | getCell () const |
| void | setCell (const Matrix3d &newCell) |
| double | getPosition (long int atom, int axis) const |
| void | setPosition (long int atom, int axis, double position) |
| void | setVelocity (long int atom, int axis, double velocity) |
| bool | relax (bool quiet=false, bool writeMovie=false, bool checkpoint=false, std::string prefixMovie=std::string(), std::string prefixCheckpoint=std::string(), bool retainMovieFrames=false) |
| const std::vector< readcon::ConFrame > & | movieFrames () const |
| In-memory minimization movie (same stamps as writeMovie CON). | |
| void | clearMovieFrames () |
| std::vector< readcon::ConFrame > | takeMovieFrames () |
| Take ownership of retained frames (leaves storage empty). | |
| AtomMatrix | pbc (const AtomMatrix &diff) const |
| VectorXd | pbcV (const VectorXd &diff) const |
| size_t | getPotentialCalls () const |
| const AtomMatrix & | getPositions () const |
| AtomMatrix | getPositionsCopy () const |
| VectorXd | getPositionsV () const |
| AtomMatrix | getPositionsFree () const |
| VectorXd | getPositionsFreeV () const |
| void | setPositions (const AtomMatrix &pos) |
| void | setPositionsV (const VectorXd &pos) |
| void | setPositionsFree (const AtomMatrix &pos) |
| void | setPositionsFreeV (const VectorXd &pos) |
| AtomMatrix | getVelocities () const |
| void | setVelocities (const AtomMatrix &v) |
| void | setBiasForces (const AtomMatrix &bf) |
| void | setBiasPotential (BondBoost *bondBoost) |
| BondBoost * | getBiasPotential () const |
| The bias potential added to this Matter's forces, or nullptr. | |
| void | assignKeepingBias (const Matter &other) |
| Copy another structure in and keep this Matter's own bias potential. | |
| void | setForces (const AtomMatrix &f) |
| AtomMatrix | getAccelerations () |
| const AtomMatrix & | getForces () const |
| const AtomMatrix & | getForcesRaw () const |
| AtomMatrix | getBiasForces () |
| VectorXd | getForcesV () const |
| AtomMatrix | getForcesFree () const |
| VectorXd | getForcesFreeV () const |
| PbcConvention | getPbcConvention () const |
| void | setPbcConvention (PbcConvention convention) |
| double | getMass (long int atom) const |
| void | setMass (long int atom, double mass) |
| void | setMasses (const VectorXd &massesIn) |
| long | getAtomicNr (long int atom) const |
| void | setAtomicNr (long int atom, long atomicNr) |
| VectorXi | getAtomicNrs () const |
| VectorXi | getAtomicNrsFree () const |
| void | setAtomicNrs (const VectorXi &atmnrs) |
| int | getFixed (long int atom) const |
| 1 if every Cartesian axis of the atom is fixed, else 0. | |
| int | getFixed (long int atom, int axis) const |
| 1 if this atom's axis is fixed, else 0. axis is 0=x, 1=y, 2=z. | |
| std::array< bool, 3 > | getFixedMask (long int atom) const |
| Per-axis CON column-4 mask (bit0=x, bit1=y, bit2=z). | |
| void | setFixed (long int atom, int isFixed) |
| Broadcast a whole-atom flag onto all three axes. | |
| void | setFixed (long int atom, int axis, int isFixed) |
| Set one Cartesian axis. axis is 0=x, 1=y, 2=z. | |
| void | setFixedMask (long int atom, std::array< bool, 3 > mask) |
| double | getEnergyVariance () const |
| double | getPotentialEnergy () const |
| Matrix3d | cauchyStress () |
| Cauchy stress in eV/Angstrom^3. | |
| bool | needsForceUpdate () const |
| Whether forces need recomputation (positions or surface epoch changed). | |
| void | setSurfaceEpoch (unsigned long long epoch) |
| Host surface generation. | |
| unsigned long long | getSurfaceEpoch () const noexcept |
| double * | forcesData () |
| Mutable access to force storage for batched potential evaluation. | |
| void | setEvaluation (const AtomMatrix &forces, double energy) |
| Puts a known evaluation back after a position reset: the forces and energy of a geometry this object held before, so no potential call follows. | |
| void | setComputedPotential (double energy, double variance) |
| Set energy/variance from external batched evaluation and mark forces as up-to-date (recomputePotential = false). | |
| double | getKineticEnergy () const |
| double | getMechanicalEnergy () const |
| double | distance (long index1, long index2) const |
| double | distance (const Matter &matter, long index) const |
| double | pdistance (long index1, long index2, int axis) const |
| long int | numberOfFreeAtoms () const |
| long int | numberOfFixedAtoms () const |
| long | getForceCalls () const |
| void | resetForceCalls () |
| double | maxForce (void) const |
| double | maxFreeAtomForce (const AtomMatrix &rows) const |
| Max per-atom Euclidean norm of rows. | |
| bool | getWriteConForces () const noexcept |
| Parameters.main_options().writeConForces for this Matter, if bound. | |
| io::IoStatus | writeTibble (std::string filename) |
| io::IoStatus | inp2matter (const std::string &filename) |
| Any structure file: .con/.convel via readcon, the rest via chemfiles. | |
| io::IoStatus | con2matter (std::string filename) |
| io::IoStatus | con2matter (const readcon::ConFrame &frame, io::ConFrameMetadata *out_metadata=nullptr) |
| io::IoStatus | convel2matter (std::string filename) |
| io::IoStatus | matter2con (std::string filename, bool append=false, const io::ConFrameMetadata *metadata=nullptr) |
| io::IoStatus | matter2convel (std::string filename) |
| io::IoStatus | matter2xyz (std::string filename, bool append=false) |
| AtomMatrix | getFree () const |
| VectorXd | getFreeV () const |
| Eigen::Matrix< double, Eigen::Dynamic, 1 > | getMasses () const |
| std::int64_t | getAtomIndex (long int atom) const |
| .con column-5 index (pre-grouping); public for I/O / bindings. | |
| void | setAtomIndex (long int atom, std::int64_t index) |
| long | mapFileRow (long file_row) const |
| Map a CON file-order row onto the Matter row after matter_order. | |
| void | setFileToMatter (std::vector< long > map) |
| const std::array< std::string, 5 > & | getHeaderCon () const |
| CON header lines (indices 0..4); public for I/O / bindings. | |
| void | setHeaderCon (const std::array< std::string, 5 > &headers) |
| void | setHeaderConLine (size_t i, std::string line) |
| bool | getPeriodic () const noexcept |
| void | setPeriodic (bool periodic) |
| void | setCancelToken (CancelToken token) |
| const CancelToken & | cancelToken () const |
| void | pollCancel (const char *site) const |
| void | applyPeriodicBoundaryIfEnabled () |
| Apply MIC wrap when periodic boundaries are enabled (I/O path). | |
Private Member Functions | |
| Potential * | livePotential () const |
| void | shareOwnedPotential () const |
| void | assertIsolatedMoleculeLayoutSafe () const |
| Throw if pot forbids PBC (isolated molecular QM backends, issue #188). | |
| bool | epochDirty () const |
| void | stampSurfaceEpoch () const |
| void | computePotential () const |
| void | captureStress () const |
| void | applyPeriodicBoundary () |
| void | applyPeriodicBoundary (double &component, int axis) |
| void | applyPeriodicBoundary (AtomMatrix &diff) |
| void | restoreFileForces (const AtomMatrix &fileForces, bool trustEnergy, double energy) |
| Write .con forces without the fixed-atom mask setForces applies. | |
Private Attributes | |
| eonc::log::Scoped | m_log |
| std::unique_ptr< Potential > | ownedPotential |
| std::shared_ptr< Potential > | potential |
| bool | usePeriodicBoundaries |
| PbcConvention | pbcConvention |
| bool | recomputePotential |
| long | forceCalls |
| std::array< std::string, 5 > | headerCon |
| bool | removeNetForce {true} |
| StructureComparisonOptions | structComp |
| const Parameters * | parameters |
| long | nAtoms |
| std::unique_ptr< Impl > | impl_ |
| BondBoost * | biasPotential {nullptr} |
| std::vector< long > | fileToMatter |
| std::vector< int > | freeIndices |
| bool | recomputeFreeMask {true} |
| bool | recomputeMaskedForces {true} |
| double | energyVariance |
| std::vector< readcon::ConFrame > | movie_frames_ |
| double | potentialEnergy |
| unsigned long long | surfaceEpoch_ {0} |
| unsigned long long | cachedHostEpoch_ {0} |
| unsigned long long | cachedPotEpoch_ {0} |
| CancelToken | cancel_token_ |
Friends | |
| io::IoStatus | io::con2matter (Matter &, const readcon::ConFrame &, io::ConFrameMetadata *) |
|
default |
| eonc::Matter::Matter | ( | std::shared_ptr< Potential > | pot, |
| const Parameters & | params ) |
Definition at line 76 of file Matter.cpp.
| eonc::Matter::Matter | ( | std::unique_ptr< Potential > | pot, |
| const Parameters & | params ) |
Exclusive handoff.
The Potential stays a unique_ptr until a copy shares that same instance. A copy does not clone it.
Definition at line 94 of file Matter.cpp.
| eonc::Matter::Matter | ( | const Matter & | matter | ) |
Definition at line 133 of file Matter.cpp.
|
noexcept |
Move: transfers retained movie ConFrames (move-only).
User copy suppresses implicit move — without this, relax(inplace=False, retain_frames=True) loses frames when returning the working Matter.
Definition at line 196 of file Matter.cpp.
|
private |
Definition at line 758 of file Matter.cpp.
|
private |
|
private |
|
inline |
Apply MIC wrap when periodic boundaries are enabled (I/O path).
|
private |
Throw if pot forbids PBC (isolated molecular QM backends, issue #188).
Definition at line 661 of file Matter.cpp.
| void eonc::Matter::assignKeepingBias | ( | const Matter & | other | ) |
Copy another structure in and keep this Matter's own bias potential.
operator= clears the bias pointer, because it names the source's boost.
Definition at line 467 of file Matter.cpp.
|
inlinenodiscard |
|
private |
Definition at line 896 of file Matter.cpp.
Cauchy stress in eV/Angstrom^3.
Recomputes the potential so the tensor belongs to this image. The potential must report stress.
Definition at line 917 of file Matter.cpp.
|
inline |
Definition at line 141 of file Matter.h.
| bool eonc::Matter::compare | ( | const Matter & | matter, |
| bool | indistinguishable = false ) |
Definition at line 251 of file Matter.cpp.
|
private |
Definition at line 692 of file Matter.cpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
| double eonc::Matter::distance | ( | const Matter & | matter, |
| long | index ) const |
Definition at line 538 of file Matter.cpp.
| double eonc::Matter::distance | ( | long | index1, |
| long | index2 ) const |
| double eonc::Matter::distanceTo | ( | const Matter & | matter | ) |
Definition at line 273 of file Matter.cpp.
|
nodiscardprivate |
Definition at line 673 of file Matter.cpp.
| double * eonc::Matter::forcesData | ( | ) |
Mutable access to force storage for batched potential evaluation.
Caller must also call setComputedPotential() after writing forces.
Definition at line 954 of file Matter.cpp.
Definition at line 832 of file Matter.cpp.
| long eonc::Matter::getAtomicNr | ( | long int | atom | ) | const |
Definition at line 562 of file Matter.cpp.
| VectorXi eonc::Matter::getAtomicNrs | ( | ) | const |
Definition at line 783 of file Matter.cpp.
| VectorXi eonc::Matter::getAtomicNrsFree | ( | ) | const |
Definition at line 392 of file Matter.cpp.
|
nodiscard |
.con column-5 index (pre-grouping); public for I/O / bindings.
Held 64-bit wide: readcon carries the column as a uint64_t, and a 32-bit slot drops the high half of any id past 2^31.
Definition at line 956 of file Matter.cpp.
Definition at line 452 of file Matter.cpp.
| BondBoost * eonc::Matter::getBiasPotential | ( | ) | const |
The bias potential added to this Matter's forces, or nullptr.
Definition at line 465 of file Matter.cpp.
| Matrix3d eonc::Matter::getCell | ( | ) | const |
Definition at line 342 of file Matter.cpp.
| double eonc::Matter::getEnergyVariance | ( | ) | const |
Definition at line 889 of file Matter.cpp.
| int eonc::Matter::getFixed | ( | long int | atom | ) | const |
1 if every Cartesian axis of the atom is fixed, else 0.
Definition at line 572 of file Matter.cpp.
| int eonc::Matter::getFixed | ( | long int | atom, |
| int | axis ) const |
1 if this atom's axis is fixed, else 0. axis is 0=x, 1=y, 2=z.
Definition at line 581 of file Matter.cpp.
|
nodiscard |
| long eonc::Matter::getForceCalls | ( | ) | const |
Definition at line 654 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getForces | ( | ) | const |
Definition at line 479 of file Matter.cpp.
| AtomMatrix eonc::Matter::getForcesFree | ( | ) | const |
Definition at line 499 of file Matter.cpp.
| VectorXd eonc::Matter::getForcesFreeV | ( | ) | const |
Definition at line 509 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getForcesRaw | ( | ) | const |
Definition at line 490 of file Matter.cpp.
| VectorXd eonc::Matter::getForcesV | ( | ) | const |
Definition at line 495 of file Matter.cpp.
| AtomMatrix eonc::Matter::getFree | ( | ) | const |
Definition at line 796 of file Matter.cpp.
| VectorXd eonc::Matter::getFreeV | ( | ) | const |
Definition at line 812 of file Matter.cpp.
|
inlinenodiscard |
| double eonc::Matter::getKineticEnergy | ( | ) | const |
Definition at line 629 of file Matter.cpp.
| double eonc::Matter::getMass | ( | long int | atom | ) | const |
Definition at line 545 of file Matter.cpp.
| Matrix< double, Eigen::Dynamic, 1 > eonc::Matter::getMasses | ( | ) | const |
Definition at line 843 of file Matter.cpp.
| double eonc::Matter::getMechanicalEnergy | ( | ) | const |
Definition at line 636 of file Matter.cpp.
|
inline |
|
inlinenodiscardnoexcept |
| double eonc::Matter::getPosition | ( | long int | atom, |
| int | axis ) const |
Definition at line 351 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getPositions | ( | ) | const |
Definition at line 375 of file Matter.cpp.
| AtomMatrix eonc::Matter::getPositionsCopy | ( | ) | const |
Definition at line 377 of file Matter.cpp.
| AtomMatrix eonc::Matter::getPositionsFree | ( | ) | const |
Definition at line 383 of file Matter.cpp.
| VectorXd eonc::Matter::getPositionsFreeV | ( | ) | const |
Definition at line 412 of file Matter.cpp.
| VectorXd eonc::Matter::getPositionsV | ( | ) | const |
Definition at line 379 of file Matter.cpp.
| std::shared_ptr< Potential > eonc::Matter::getPotential | ( | ) |
Definition at line 935 of file Matter.cpp.
| size_t eonc::Matter::getPotentialCalls | ( | ) | const |
Definition at line 885 of file Matter.cpp.
| double eonc::Matter::getPotentialEnergy | ( | ) | const |
Definition at line 621 of file Matter.cpp.
|
inlinenodiscardnoexcept |
| AtomMatrix eonc::Matter::getVelocities | ( | ) | const |
Definition at line 816 of file Matter.cpp.
|
nodiscardnoexcept |
Parameters.main_options().writeConForces for this Matter, if bound.
Definition at line 116 of file Matter.cpp.
|
nodiscard |
True while no copy has shared the Potential from an exclusive handoff.
Definition at line 112 of file Matter.cpp.
|
inlinenodiscard |
|
private |
Definition at line 102 of file Matter.cpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
| double eonc::Matter::maxForce | ( | void | ) | const |
Definition at line 777 of file Matter.cpp.
|
nodiscard |
Max per-atom Euclidean norm of rows.
Atoms fixed on every axis are ignored. rows must have one row per atom.
Definition at line 769 of file Matter.cpp.
|
inlinenodiscard |
In-memory minimization movie (same stamps as writeMovie CON).
Cleared when retainMovieFrames=false on the next relax, or via clearMovieFrames().
|
inlinenodiscard |
Whether forces need recomputation (positions or surface epoch changed).
| long int eonc::Matter::numberOfAtoms | ( | ) | const |
Definition at line 340 of file Matter.cpp.
| long int eonc::Matter::numberOfFixedAtoms | ( | ) | const |
Definition at line 640 of file Matter.cpp.
| long int eonc::Matter::numberOfFreeAtoms | ( | ) | const |
Definition at line 650 of file Matter.cpp.
Definition at line 138 of file Matter.cpp.
Definition at line 201 of file Matter.cpp.
| AtomMatrix eonc::Matter::pbc | ( | const AtomMatrix & | diff | ) | const |
Definition at line 940 of file Matter.cpp.
| VectorXd eonc::Matter::pbcV | ( | const VectorXd & | diff | ) | const |
Definition at line 947 of file Matter.cpp.
| double eonc::Matter::pdistance | ( | long | index1, |
| long | index2, | ||
| int | axis ) const |
Definition at line 524 of file Matter.cpp.
| double eonc::Matter::perAtomNorm | ( | const Matter & | matter | ) |
Definition at line 281 of file Matter.cpp.
|
inline |
Definition at line 347 of file Matter.h.
| bool eonc::Matter::relax | ( | bool | quiet = false, |
| bool | writeMovie = false, | ||
| bool | checkpoint = false, | ||
| std::string | prefixMovie = std::string(), | ||
| std::string | prefixCheckpoint = std::string(), | ||
| bool | retainMovieFrames = false ) |
Definition at line 401 of file Matter.cpp.
| void eonc::Matter::resetForceCalls | ( | ) |
Definition at line 656 of file Matter.cpp.
| void eonc::Matter::resize | ( | long int | nAtoms | ) |
Definition at line 294 of file Matter.cpp.
|
private |
Write .con forces without the fixed-atom mask setForces applies.
Definition at line 964 of file Matter.cpp.
| void eonc::Matter::setAtomicNr | ( | long int | atom, |
| long | atomicNr ) |
Definition at line 566 of file Matter.cpp.
| void eonc::Matter::setAtomicNrs | ( | const VectorXi & | atmnrs | ) |
Definition at line 785 of file Matter.cpp.
| void eonc::Matter::setAtomIndex | ( | long int | atom, |
| std::int64_t | index ) |
Definition at line 960 of file Matter.cpp.
| void eonc::Matter::setBiasForces | ( | const AtomMatrix & | bf | ) |
Definition at line 473 of file Matter.cpp.
| void eonc::Matter::setBiasPotential | ( | BondBoost * | bondBoost | ) |
Definition at line 461 of file Matter.cpp.
|
inline |
Definition at line 345 of file Matter.h.
| void eonc::Matter::setCell | ( | const Matrix3d & | newCell | ) |
Definition at line 344 of file Matter.cpp.
| void eonc::Matter::setComputedPotential | ( | double | energy, |
| double | variance ) |
Set energy/variance from external batched evaluation and mark forces as up-to-date (recomputePotential = false).
Definition at line 866 of file Matter.cpp.
|
inline |
Puts a known evaluation back after a position reset: the forces and energy of a geometry this object held before, so no potential call follows.
Fixed-atom masking applies on read as for any evaluation.
Definition at line 238 of file Matter.h.
|
inline |
Definition at line 323 of file Matter.h.
| void eonc::Matter::setFixed | ( | long int | atom, |
| int | axis, | ||
| int | isFixed ) |
Set one Cartesian axis. axis is 0=x, 1=y, 2=z.
Definition at line 604 of file Matter.cpp.
| void eonc::Matter::setFixed | ( | long int | atom, |
| int | isFixed ) |
Broadcast a whole-atom flag onto all three axes.
Definition at line 594 of file Matter.cpp.
| void eonc::Matter::setFixedMask | ( | long int | atom, |
| std::array< bool, 3 > | mask ) |
Definition at line 612 of file Matter.cpp.
| void eonc::Matter::setForces | ( | const AtomMatrix & | f | ) |
Definition at line 824 of file Matter.cpp.
|
inline |
|
inline |
| void eonc::Matter::setMass | ( | long int | atom, |
| double | mass ) |
Definition at line 550 of file Matter.cpp.
| void eonc::Matter::setMasses | ( | const VectorXd & | massesIn | ) |
Definition at line 555 of file Matter.cpp.
|
inline |
|
inline |
| void eonc::Matter::setPosition | ( | long int | atom, |
| int | axis, | ||
| double | position ) |
Definition at line 357 of file Matter.cpp.
| void eonc::Matter::setPositions | ( | const AtomMatrix & | pos | ) |
Definition at line 417 of file Matter.cpp.
| void eonc::Matter::setPositionsFree | ( | const AtomMatrix & | pos | ) |
Definition at line 434 of file Matter.cpp.
| void eonc::Matter::setPositionsFreeV | ( | const VectorXd & | pos | ) |
Definition at line 448 of file Matter.cpp.
| void eonc::Matter::setPositionsV | ( | const VectorXd & | pos | ) |
Definition at line 430 of file Matter.cpp.
| void eonc::Matter::setPotential | ( | std::shared_ptr< Potential > | pot | ) |
Definition at line 847 of file Matter.cpp.
| void eonc::Matter::setSurfaceEpoch | ( | unsigned long long | epoch | ) |
Host surface generation.
A GP refit increments this; identical positions then miss the energy and variance caches. Combined with Potential::surfaceEpoch() as the other half of the cache key.
Definition at line 684 of file Matter.cpp.
| void eonc::Matter::setVelocities | ( | const AtomMatrix & | v | ) |
Definition at line 820 of file Matter.cpp.
| void eonc::Matter::setVelocity | ( | long int | atom, |
| int | axis, | ||
| double | velocity ) |
Definition at line 368 of file Matter.cpp.
|
private |
Definition at line 106 of file Matter.cpp.
|
private |
Definition at line 679 of file Matter.cpp.
|
inlinenodiscard |
Take ownership of retained frames (leaves storage empty).
|
inlinenodiscard |
|
friend |
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
mutableprivate |
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |