#include <LAMMPSPot.h>
Public Member Functions | |
| bool | needsPerImageInstance () const noexcept override |
| Whether NEB should create separate Potential instances per image for true parallel force evaluation. | |
| LAMMPSPot (const eonc::Parameters &p) | |
| Production: process-default LammpsLoader and POSIX worker isolation. | |
| LAMMPSPot (const eonc::Parameters &p, eonc::ILammpsLoader &loader) | |
| Test seam: injected loader, no worker fork, no process-default load. | |
| ~LAMMPSPot () | |
| void | cleanMemory () |
| void | force (long N, const double *R, const int *atomicNrs, double *F, double *U, double *variance, const double *box) override |
| void | setFixedMask (long nAtoms, const double *isFixed) override |
| Optional frozen-atom mask (nAtoms*3, 1.0 = fixed). | |
| bool | computesStress () const noexcept override |
| True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance. | |
| Matrix3d | cauchyStress () const override |
| Cauchy stress in eV/Angstrom^3. | |
| Public Member Functions inherited from eonc::Potential | |
| Potential (PotType a_ptype) | |
| Production default: construction-scope registry, else PotRegistry::get(). | |
| Potential (PotType a_ptype, IPotRegistry ®istry) | |
| Test seam: injected registry, no process-default get() counters. | |
| Potential (PotType a_ptype, const Parameters &p) | |
| Potential (const Parameters &a_params) | |
| virtual | ~Potential () |
| void | force (std::span< const double > positions, std::span< const int > atomicNrs, std::span< double > forces, double *energy, double *variance, std::span< const double > box) |
| C++ call site: size-checked view over the raw FFI force(). | |
| std::tuple< double, AtomMatrix > | get_ef (const AtomMatrix &pos, const VectorXi &atmnrs, const Matrix3d &box) |
| PotType | getType () const |
| virtual double | finiteCutoff () const noexcept |
| Finite interaction range in position length units. | |
| virtual bool | isSurrogate () const noexcept |
| Whether this is a surrogate (GP) potential. | |
| virtual bool | requiresIsolatedMoleculeLayout () const noexcept |
| True for molecular QM / non-PBC backends (NWChem socket, ASE ORCA/NWChem, …). | |
| virtual bool | isThreadSafe () const noexcept |
| Whether this potential's force() can be called from multiple threads on the SAME instance. | |
| virtual unsigned | layoutFlags () const noexcept |
| virtual bool | isSharedInstanceThreadSafe () const noexcept |
| Conservative gate for sharing one Potential instance across threads. | |
| virtual std::shared_ptr< Potential > | clonePotential () const |
| Independent instance that does not reload from disk. | |
| virtual bool | supportsBatchEvaluation () const noexcept |
| Whether this potential supports batched evaluation of N systems in a single call. | |
| virtual void | forceBatchOwned (long nSystems, long nAtoms, const double *const *positions, const int *const *atomicNrs, double *const *forces, double *energies, double *variances, const double *const *boxes, const long *owners) |
| Evaluate forces for N systems in a single call. | |
| virtual void | forceBatch (long nSystems, long nAtoms, const double *const *positions, const int *const *atomicNrs, double *const *forces, double *energies, double *variances, const double *const *boxes) |
Private Member Functions | |
| LAMMPSPot (const eonc::Parameters &p, eonc::ILammpsLoader &loader, bool isolate_worker) | |
| void | makeNewLAMMPS (long N, const double *R, const int *atomicNrs, const double *box) |
| void | applySetforce (long N) |
| void | ensureWorker () |
| bool | noteScreenGeometry (long N, const double *box) |
| void | runWorkerLoop () |
| void | stopWorker () |
| void | forceLocal (long N, const double *R, const int *atomicNrs, double *F, double *U, const double *box) |
| void | lammpsCommand (const char *cmd) |
| void | drainLammpsScreen () |
Private Attributes | |
| eonc::ILammpsLoader & | loader_ |
| int | lammpsThr {0} |
| bool | lammpsLogging_ {false} |
| int | lammpsLogIndex_ {0} |
| std::mutex | maskMutex_ |
| std::string | lammpsScreenPath_ |
| std::int64_t | lammpsScreenPos_ {0} |
| bool | lammpsScreenRestart_ {false} |
| bool | workerChild_ {false} |
| long | numberOfAtoms {0} |
| double | oldBox [9] {} |
| void * | LAMMPSObj {nullptr} |
| bool | realunits {false} |
| Matrix3d | stress_ {Matrix3d::Zero()} |
| bool | haveStress_ {false} |
| std::vector< double > | fixedMask_ |
| long | maskN_ {0} |
| std::mutex | workerMutex |
| int | workerRespawnsLeft {3} |
| int | workerPid {-1} |
| int | reqFd {-1} |
| int | resFd {-1} |
| bool | workerSpawned {false} |
| bool | screenHaveGeom_ {false} |
| long | screenAtoms_ {0} |
| double | screenBox_ [9] {} |
Additional Inherited Members | |
| Public Types inherited from eonc::Potential | |
| enum class | PotLayout : unsigned { InProcess = 1u << 0 , NeedsWorkingDirectory = 1u << 1 , Subprocess = 1u << 2 } |
| How the pot is executed. Combine with bitwise or. More... | |
| Public Attributes inherited from eonc::Potential | |
| std::atomic< size_t > | forceCallCounter |
| Protected Attributes inherited from eonc::Potential | |
| PotType | ptype |
Definition at line 70 of file LAMMPSPot.h.
|
explicit |
Production: process-default LammpsLoader and POSIX worker isolation.
Definition at line 44 of file LAMMPSPot.cpp.
| LAMMPSPot::LAMMPSPot | ( | const eonc::Parameters & | p, |
| eonc::ILammpsLoader & | loader ) |
Test seam: injected loader, no worker fork, no process-default load.
Definition at line 47 of file LAMMPSPot.cpp.
| LAMMPSPot::~LAMMPSPot | ( | ) |
Definition at line 85 of file LAMMPSPot.cpp.
|
private |
Definition at line 50 of file LAMMPSPot.cpp.
|
private |
Definition at line 101 of file LAMMPSPot.cpp.
|
inlinenodiscardoverridevirtual |
Cauchy stress in eV/Angstrom^3.
sigma = (1/V) dE/dε for the right strain h <- h (I+ε) at fixed fractional coordinates.
Reimplemented from eonc::Potential.
Definition at line 90 of file LAMMPSPot.h.
| void LAMMPSPot::cleanMemory | ( | ) |
Definition at line 156 of file LAMMPSPot.cpp.
|
inlinenodiscardoverridevirtualnoexcept |
True when force() leaves a Cauchy stress that cauchyStress() can read until the next force() on this instance.
Reimplemented from eonc::Potential.
Definition at line 86 of file LAMMPSPot.h.
|
private |
Definition at line 687 of file LAMMPSPot.cpp.
|
private |
Definition at line 234 of file LAMMPSPot.cpp.
|
overridevirtual |
Implements eonc::Potential.
Definition at line 412 of file LAMMPSPot.cpp.
|
private |
Definition at line 554 of file LAMMPSPot.cpp.
|
private |
Definition at line 724 of file LAMMPSPot.cpp.
|
private |
Definition at line 733 of file LAMMPSPot.cpp.
|
inlinenodiscardoverridevirtualnoexcept |
Whether NEB should create separate Potential instances per image for true parallel force evaluation.
When true, NEB calls makePotential() once per image instead of sharing one instance. Override in potentials that use internal mutexes (e.g. MetatomicPotential).
Reimplemented from eonc::Potential.
Definition at line 73 of file LAMMPSPot.h.
|
private |
Definition at line 395 of file LAMMPSPot.cpp.
|
private |
Definition at line 295 of file LAMMPSPot.cpp.
|
overridevirtual |
Optional frozen-atom mask (nAtoms*3, 1.0 = fixed).
Default no-op. Matter calls this immediately before force() so wrappers that need it (LAMMPS setforce) see Atom.fixed without changing force().
Reimplemented from eonc::Potential.
Definition at line 87 of file LAMMPSPot.cpp.
|
private |
Definition at line 350 of file LAMMPSPot.cpp.
|
private |
Definition at line 121 of file LAMMPSPot.h.
|
private |
Definition at line 120 of file LAMMPSPot.h.
|
private |
Definition at line 97 of file LAMMPSPot.h.
|
private |
Definition at line 98 of file LAMMPSPot.h.
|
private |
Definition at line 114 of file LAMMPSPot.h.
|
private |
Definition at line 103 of file LAMMPSPot.h.
|
private |
Definition at line 104 of file LAMMPSPot.h.
|
private |
Definition at line 107 of file LAMMPSPot.h.
|
private |
Definition at line 96 of file LAMMPSPot.h.
|
private |
Definition at line 95 of file LAMMPSPot.h.
|
private |
Definition at line 99 of file LAMMPSPot.h.
|
private |
Definition at line 122 of file LAMMPSPot.h.
|
private |
Definition at line 112 of file LAMMPSPot.h.
|
private |
Definition at line 113 of file LAMMPSPot.h.
|
private |
Definition at line 118 of file LAMMPSPot.h.
|
private |
Definition at line 154 of file LAMMPSPot.h.
|
private |
Definition at line 155 of file LAMMPSPot.h.
|
private |
Definition at line 160 of file LAMMPSPot.h.
|
private |
Definition at line 161 of file LAMMPSPot.h.
|
private |
Definition at line 159 of file LAMMPSPot.h.
|
private |
Definition at line 119 of file LAMMPSPot.h.
|
private |
Definition at line 108 of file LAMMPSPot.h.
|
private |
Definition at line 126 of file LAMMPSPot.h.
|
private |
Definition at line 153 of file LAMMPSPot.h.
|
private |
Definition at line 144 of file LAMMPSPot.h.
|
private |
Definition at line 156 of file LAMMPSPot.h.