#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. | |
| bool | holdsExclusivePotential () const |
| True while no copy has shared the Potential from an exclusive handoff. | |
| Matter (const Matter &matter) | |
| const Matter & | operator= (const Matter &matter) |
| Matter (Matter &&other) noexcept | |
| Move: transfers retained movie ConFrames (move-only). | |
| 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 | pdistance (long index1, long index2, int axis) const |
| double | distance (const Matter &matter, long index) 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. | |
| 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 |
| std::shared_ptr< bool > | writeConForces_ |
| const Parameters * | parameters {nullptr} |
| 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 95 of file Matter.cpp.
| eonc::Matter::Matter | ( | const Matter & | matter | ) |
Definition at line 134 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 198 of file Matter.cpp.
|
private |
Definition at line 761 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 664 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 470 of file Matter.cpp.
|
inlinenodiscard |
|
private |
Definition at line 899 of file Matter.cpp.
| Matrix3d eonc::Matter::cauchyStress | ( | ) |
Cauchy stress in eV/Angstrom^3.
Recomputes the potential so the tensor belongs to this image. The potential must report stress.
Definition at line 920 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 254 of file Matter.cpp.
|
private |
Definition at line 695 of file Matter.cpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
| double eonc::Matter::distance | ( | const Matter & | matter, |
| long | index ) const |
Definition at line 541 of file Matter.cpp.
| double eonc::Matter::distance | ( | long | index1, |
| long | index2 ) const |
| double eonc::Matter::distanceTo | ( | const Matter & | matter | ) |
Definition at line 276 of file Matter.cpp.
|
nodiscardprivate |
Definition at line 676 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 957 of file Matter.cpp.
| AtomMatrix eonc::Matter::getAccelerations | ( | ) |
Definition at line 835 of file Matter.cpp.
| long eonc::Matter::getAtomicNr | ( | long int | atom | ) | const |
Definition at line 565 of file Matter.cpp.
| VectorXi eonc::Matter::getAtomicNrs | ( | ) | const |
Definition at line 786 of file Matter.cpp.
| VectorXi eonc::Matter::getAtomicNrsFree | ( | ) | const |
Definition at line 395 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 959 of file Matter.cpp.
| AtomMatrix eonc::Matter::getBiasForces | ( | ) |
Definition at line 455 of file Matter.cpp.
| BondBoost * eonc::Matter::getBiasPotential | ( | ) | const |
The bias potential added to this Matter's forces, or nullptr.
Definition at line 468 of file Matter.cpp.
| Matrix3d eonc::Matter::getCell | ( | ) | const |
Definition at line 345 of file Matter.cpp.
| double eonc::Matter::getEnergyVariance | ( | ) | const |
Definition at line 892 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 575 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 584 of file Matter.cpp.
|
nodiscard |
| long eonc::Matter::getForceCalls | ( | ) | const |
Definition at line 657 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getForces | ( | ) | const |
Definition at line 482 of file Matter.cpp.
| AtomMatrix eonc::Matter::getForcesFree | ( | ) | const |
Definition at line 502 of file Matter.cpp.
| VectorXd eonc::Matter::getForcesFreeV | ( | ) | const |
Definition at line 512 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getForcesRaw | ( | ) | const |
Definition at line 493 of file Matter.cpp.
| VectorXd eonc::Matter::getForcesV | ( | ) | const |
Definition at line 498 of file Matter.cpp.
| AtomMatrix eonc::Matter::getFree | ( | ) | const |
Definition at line 799 of file Matter.cpp.
| VectorXd eonc::Matter::getFreeV | ( | ) | const |
Definition at line 815 of file Matter.cpp.
|
inlinenodiscard |
| double eonc::Matter::getKineticEnergy | ( | ) | const |
Definition at line 632 of file Matter.cpp.
| double eonc::Matter::getMass | ( | long int | atom | ) | const |
Definition at line 548 of file Matter.cpp.
| Matrix< double, Eigen::Dynamic, 1 > eonc::Matter::getMasses | ( | ) | const |
Definition at line 846 of file Matter.cpp.
| double eonc::Matter::getMechanicalEnergy | ( | ) | const |
Definition at line 639 of file Matter.cpp.
|
inline |
|
inlinenodiscardnoexcept |
| double eonc::Matter::getPosition | ( | long int | atom, |
| int | axis ) const |
Definition at line 354 of file Matter.cpp.
| const AtomMatrix & eonc::Matter::getPositions | ( | ) | const |
Definition at line 378 of file Matter.cpp.
| AtomMatrix eonc::Matter::getPositionsCopy | ( | ) | const |
Definition at line 380 of file Matter.cpp.
| AtomMatrix eonc::Matter::getPositionsFree | ( | ) | const |
Definition at line 386 of file Matter.cpp.
| VectorXd eonc::Matter::getPositionsFreeV | ( | ) | const |
Definition at line 415 of file Matter.cpp.
| VectorXd eonc::Matter::getPositionsV | ( | ) | const |
Definition at line 382 of file Matter.cpp.
| std::shared_ptr< Potential > eonc::Matter::getPotential | ( | ) |
Definition at line 938 of file Matter.cpp.
| size_t eonc::Matter::getPotentialCalls | ( | ) | const |
Definition at line 888 of file Matter.cpp.
| double eonc::Matter::getPotentialEnergy | ( | ) | const |
Definition at line 624 of file Matter.cpp.
|
inlinenodiscardnoexcept |
| AtomMatrix eonc::Matter::getVelocities | ( | ) | const |
Definition at line 819 of file Matter.cpp.
|
nodiscardnoexcept |
Parameters.main_options().writeConForces for this Matter.
Follows later writes to that same Parameters. After it is destroyed, the last value remains. The read does not use the Parameters address.
Definition at line 117 of file Matter.cpp.
|
nodiscard |
True while no copy has shared the Potential from an exclusive handoff.
Definition at line 113 of file Matter.cpp.
|
inlinenodiscard |
Any structure file: .con/.convel via readcon, the rest via chemfiles.
Definition at line 278 of file Matter.h.
|
private |
Definition at line 103 of file Matter.cpp.
|
inlinenodiscard |
|
inlinenodiscard |
Definition at line 293 of file Matter.h.
|
inlinenodiscard |
|
inlinenodiscard |
Definition at line 300 of file Matter.h.
| double eonc::Matter::maxForce | ( | void | ) | const |
Definition at line 780 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 772 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 343 of file Matter.cpp.
| long int eonc::Matter::numberOfFixedAtoms | ( | ) | const |
Definition at line 643 of file Matter.cpp.
| long int eonc::Matter::numberOfFreeAtoms | ( | ) | const |
Definition at line 653 of file Matter.cpp.
Definition at line 139 of file Matter.cpp.
Definition at line 203 of file Matter.cpp.
| AtomMatrix eonc::Matter::pbc | ( | const AtomMatrix & | diff | ) | const |
Definition at line 943 of file Matter.cpp.
| VectorXd eonc::Matter::pbcV | ( | const VectorXd & | diff | ) | const |
Definition at line 950 of file Matter.cpp.
| double eonc::Matter::pdistance | ( | long | index1, |
| long | index2, | ||
| int | axis ) const |
Definition at line 527 of file Matter.cpp.
| double eonc::Matter::perAtomNorm | ( | const Matter & | matter | ) |
Definition at line 284 of file Matter.cpp.
|
inline |
Definition at line 349 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 404 of file Matter.cpp.
| void eonc::Matter::resetForceCalls | ( | ) |
Definition at line 659 of file Matter.cpp.
| void eonc::Matter::resize | ( | long int | nAtoms | ) |
Definition at line 297 of file Matter.cpp.
|
private |
Write .con forces without the fixed-atom mask setForces applies.
Definition at line 967 of file Matter.cpp.
| void eonc::Matter::setAtomicNr | ( | long int | atom, |
| long | atomicNr ) |
Definition at line 569 of file Matter.cpp.
| void eonc::Matter::setAtomicNrs | ( | const VectorXi & | atmnrs | ) |
Definition at line 788 of file Matter.cpp.
| void eonc::Matter::setAtomIndex | ( | long int | atom, |
| std::int64_t | index ) |
Definition at line 963 of file Matter.cpp.
| void eonc::Matter::setBiasForces | ( | const AtomMatrix & | bf | ) |
Definition at line 476 of file Matter.cpp.
| void eonc::Matter::setBiasPotential | ( | BondBoost * | bondBoost | ) |
Definition at line 464 of file Matter.cpp.
|
inline |
Definition at line 347 of file Matter.h.
| void eonc::Matter::setCell | ( | const Matrix3d & | newCell | ) |
Definition at line 347 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 869 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 325 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 607 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 597 of file Matter.cpp.
| void eonc::Matter::setFixedMask | ( | long int | atom, |
| std::array< bool, 3 > | mask ) |
Definition at line 615 of file Matter.cpp.
| void eonc::Matter::setForces | ( | const AtomMatrix & | f | ) |
Definition at line 827 of file Matter.cpp.
|
inline |
|
inline |
| void eonc::Matter::setMass | ( | long int | atom, |
| double | mass ) |
Definition at line 553 of file Matter.cpp.
| void eonc::Matter::setMasses | ( | const VectorXd & | massesIn | ) |
Definition at line 558 of file Matter.cpp.
|
inline |
|
inline |
| void eonc::Matter::setPosition | ( | long int | atom, |
| int | axis, | ||
| double | position ) |
Definition at line 360 of file Matter.cpp.
| void eonc::Matter::setPositions | ( | const AtomMatrix & | pos | ) |
Definition at line 420 of file Matter.cpp.
| void eonc::Matter::setPositionsFree | ( | const AtomMatrix & | pos | ) |
Definition at line 437 of file Matter.cpp.
| void eonc::Matter::setPositionsFreeV | ( | const VectorXd & | pos | ) |
Definition at line 451 of file Matter.cpp.
| void eonc::Matter::setPositionsV | ( | const VectorXd & | pos | ) |
Definition at line 433 of file Matter.cpp.
| void eonc::Matter::setPotential | ( | std::shared_ptr< Potential > | pot | ) |
Definition at line 850 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 687 of file Matter.cpp.
| void eonc::Matter::setVelocities | ( | const AtomMatrix & | v | ) |
Definition at line 823 of file Matter.cpp.
| void eonc::Matter::setVelocity | ( | long int | atom, |
| int | axis, | ||
| double | velocity ) |
Definition at line 371 of file Matter.cpp.
|
private |
Definition at line 107 of file Matter.cpp.
|
private |
Definition at line 682 of file Matter.cpp.
|
inlinenodiscard |
Take ownership of retained frames (leaves storage empty).
|
inlinenodiscard |
Definition at line 274 of file Matter.h.
|
friend |
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |