68 return apply(coords, cell, cellInverse);
76 apply(AtomMatrix::Map(diffVector.data(), diffVector.size() / 3, 3), cell,
78 return VectorXd(VectorXd::Map(pbcMatrix.data(), diffVector.size()));
101 bool compare(
const Matter &matter,
bool indistinguishable =
false);
117 long int atom,
int axis,
120 long int atom,
int axis,
122 bool relax(
bool quiet =
false,
bool writeMovie =
false,
123 bool checkpoint =
false, std::string prefixMovie = std::string(),
124 std::string prefixCheckpoint = std::string(),
125 bool retainMovieFrames =
false);
129 [[nodiscard]]
const std::vector<readcon::ConFrame> &
movieFrames()
const {
139 VectorXd
pbcV(
const VectorXd &diff)
const;
182 double getMass(
long int atom)
const;
183 void setMass(
long int atom,
double mass);
184 void setMasses(
const VectorXd &massesIn);
186 long int atom)
const;
196 int getFixed(
long int atom,
int axis)
const;
198 [[nodiscard]] std::array<bool, 3>
getFixedMask(
long int atom)
const;
200 void setFixed(
long int atom,
int isFixed);
202 void setFixed(
long int atom,
int axis,
int isFixed);
203 void setFixedMask(
long int atom, std::array<bool, 3> mask);
229 double distance(
long index1,
long index2)
231 double pdistance(
long index1,
long index2,
int axis)
const;
276 bool append =
false) {
282 Eigen::Matrix<double, Eigen::Dynamic, 1>
getMasses()
const;
287 [[nodiscard]] std::int64_t
getAtomIndex(
long int atom)
const;
294 if (file_row < 0 || file_row >=
nAtoms ||
336 std::shared_ptr<Potential>
Eigen::Matrix< double, 3, 3, eOnStorageOrder > Matrix3d
Eigen::Matrix< double, Eigen::Dynamic, 3, eOnStorageOrder > AtomMatrix
Functionality relying on the conjugate gradients algorithm.
void applyPeriodicBoundary()
void setBiasPotential(BondBoost *bondBoost)
double getKineticEnergy() const
io::IoStatus writeTibble(std::string filename)
bool getWriteConForces() const noexcept
Parameters.main_options().writeConForces for this Matter, if bound.
VectorXi getAtomicNrs() const
void setComputedPotential(double energy, double variance)
Set energy/variance from external batched evaluation and mark forces as up-to-date (recomputePotentia...
io::IoStatus convel2matter(std::string filename)
void setForces(const AtomMatrix &f)
void setFixed(long int atom, int isFixed)
Broadcast a whole-atom flag onto all three axes.
std::shared_ptr< Potential > getPotential()
BondBoost * getBiasPotential() const
The bias potential added to this Matter's forces, or nullptr.
double maxFreeAtomForce(const AtomMatrix &rows) const
Max per-atom Euclidean norm of rows.
void setFixedMask(long int atom, std::array< bool, 3 > mask)
void setPosition(long int atom, int axis, double position)
PbcConvention pbcConvention
const AtomMatrix & getPositions() const
bool relax(bool quiet=false, bool writeMovie=false, bool checkpoint=false, std::string prefixMovie=std::string(), std::string prefixCheckpoint=std::string(), bool retainMovieFrames=false)
double distanceTo(const Matter &matter)
VectorXd getForcesFreeV() const
void setPositions(const AtomMatrix &pos)
void setAtomicNr(long int atom, long atomicNr)
double pdistance(long index1, long index2, int axis) const
AtomMatrix getForcesFree() const
const Matter & operator=(const Matter &matter)
std::vector< readcon::ConFrame > movie_frames_
bool compare(const Matter &matter, bool indistinguishable=false)
void setHeaderConLine(size_t i, std::string line)
io::IoStatus matter2convel(std::string filename)
void setPositionsV(const VectorXd &pos)
void setCell(const Matrix3d &newCell)
std::vector< int > freeIndices
AtomMatrix getFree() const
bool getPeriodic() const noexcept
void setVelocity(long int atom, int axis, double velocity)
void computePotential() const
void setPbcConvention(PbcConvention convention)
void setPotential(std::shared_ptr< Potential > pot)
void setPositionsFreeV(const VectorXd &pos)
bool recomputeMaskedForces
void setPeriodic(bool periodic)
void applyPeriodicBoundaryIfEnabled()
Apply MIC wrap when periodic boundaries are enabled (I/O path).
const Parameters * parameters
long int numberOfAtoms() const
Matrix3d cauchyStress()
Cauchy stress in eV/Angstrom^3.
std::shared_ptr< Potential > potential
long getForceCalls() const
VectorXd getPositionsFreeV() const
BondBoost * biasPotential
void setAtomicNrs(const VectorXi &atmnrs)
AtomMatrix getVelocities() const
void setVelocities(const AtomMatrix &v)
double getMechanicalEnergy() const
void setAtomIndex(long int atom, std::int64_t index)
PbcConvention getPbcConvention() const
double perAtomNorm(const Matter &matter)
const AtomMatrix & getForcesRaw() const
void resize(long int nAtoms)
VectorXd pbcV(const VectorXd &diff) const
AtomMatrix getPositionsFree() const
double getPosition(long int atom, int axis) const
void applyPeriodicBoundary(double &component, int axis)
size_t getPotentialCalls() const
VectorXi getAtomicNrsFree() const
const std::vector< readcon::ConFrame > & movieFrames() const
In-memory minimization movie (same stamps as writeMovie CON).
void restoreFileForces(const AtomMatrix &fileForces, bool trustEnergy, double energy)
Write .con forces without the fixed-atom mask setForces applies.
Eigen::Matrix< double, Eigen::Dynamic, 1 > getMasses() const
long int numberOfFixedAtoms() const
std::unique_ptr< Impl > impl_
double distance(long index1, long index2) const
double getMass(long int atom) const
void setMasses(const VectorXd &massesIn)
void setMass(long int atom, double mass)
io::IoStatus con2matter(const readcon::ConFrame &frame, io::ConFrameMetadata *out_metadata=nullptr)
double getPotentialEnergy() const
AtomMatrix getAccelerations()
double * forcesData()
Mutable access to force storage for batched potential evaluation.
bool needsForceUpdate() const
Whether forces need recomputation (positions changed since last eval).
AtomMatrix getBiasForces()
long mapFileRow(long file_row) const
Map a CON file-order row onto the Matter row after matter_order.
std::array< std::string, 5 > headerCon
void setHeaderCon(const std::array< std::string, 5 > &headers)
StructureComparisonOptions structComp
bool usePeriodicBoundaries
long int numberOfFreeAtoms() const
VectorXd getFreeV() const
Matter(std::shared_ptr< Potential > pot, const Parameters ¶ms)
long getAtomicNr(long int atom) const
double getEnergyVariance() const
AtomMatrix getPositionsCopy() const
std::array< bool, 3 > getFixedMask(long int atom) const
Per-axis CON column-4 mask (bit0=x, bit1=y, bit2=z).
io::IoStatus matter2xyz(std::string filename, bool append=false)
void setBiasForces(const AtomMatrix &bf)
void setPositionsFree(const AtomMatrix &pos)
std::vector< long > fileToMatter
const std::array< std::string, 5 > & getHeaderCon() const
CON header lines (indices 0..4); public for I/O / bindings.
std::int64_t getAtomIndex(long int atom) const
.con column-5 index (pre-grouping); public for I/O / bindings.
void assertIsolatedMoleculeLayoutSafe() const
Throw if pot forbids PBC (isolated molecular QM backends, issue #188).
VectorXd getPositionsV() const
void assignKeepingBias(const Matter &other)
Copy another structure in and keep this Matter's own bias potential.
const AtomMatrix & getForces() const
void setFileToMatter(std::vector< long > map)
io::IoStatus matter2con(std::string filename, bool append=false, const io::ConFrameMetadata *metadata=nullptr)
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 ...
int getFixed(long int atom) const
1 if every Cartesian axis of the atom is fixed, else 0.
io::IoStatus con2matter(std::string filename)
std::vector< readcon::ConFrame > takeMovieFrames()
Take ownership of retained frames (leaves storage empty).
VectorXd getForcesV() const
void applyPeriodicBoundary(AtomMatrix &diff)
double maxForce(void) const
IoStatus convel2matter(Matter &m, std::string filename)
IoStatus matter2convel(Matter &m, std::string filename)
IoStatus matter2con(Matter &m, std::string filename, bool append, const ConFrameMetadata *metadata)
Append a frame to a .con, or truncate and write one frame.
IoStatus con2matter(Matter &m, std::string filename)
IoStatus matter2xyz(Matter &m, std::string filename, bool append)
Write one extended-XYZ frame: Lattice= cell and 17-digit coordinates.
IoStatus
Structured I/O result for the client surface (nanobind-friendly).
IoStatus writeTibble(Matter &m, std::string fname)
Debug table (positions, optional cached forces). Not a structure format.
void wrapMinimumImage(double *data, size_t n)
AtomMatrix apply(const AtomMatrix &diff, const Matrix3d &cell, const Matrix3d &cellInverse)
void wrapLegacyUnit(double *data, size_t n)
AtomMatrix applyLegacy(const AtomMatrix &coords, const Matrix3d &cell, const Matrix3d &cellInverse)
AtomMatrix applyPositions(const AtomMatrix &coords, const Matrix3d &cell, const Matrix3d &cellInverse, PbcConvention convention)
VectorXd applyV(const VectorXd &diffVector, const Matrix3d &cell, const Matrix3d &cellInverse)
RAII resource manager for the ARTn C library with global synchronization.
void evaluateTogether(Potential &pot, std::span< Matter *const > systems)
Evaluates every system that needs a force update.
Options for Matter::compare / distance.
RAII helper for class-scoped logging.