atomicrex
0.1
An advanced atomistic model building tool
|
This class defines a N x N x N supercell structure. More...
#include <SuperCellStructure.h>
Public Types | |
enum | LatticeType { LATTICE_FCC, LATTICE_HCP, LATTICE_BCC } |
The list of lattice types supported by this class. | |
![]() | |
enum | DirtyFlags { NEIGHBOR_LISTS = (1<<0), ATOM_POSITIONS = (1<<1), STRUCTURE_DOF = (1<<4) } |
Flags that indicate which parts of the structure need to be updated prior to the next energy calculation. More... | |
enum | OutputFormat { POSCAR, LAMMPS } |
Possible formats for writing the structure to file. | |
Public Member Functions | |
SuperCellStructure (const FPString &id, FitJob *job) | |
Constructor. | |
virtual void | updateStructure () override |
Updates the structure (atom positions, simulation cell, etc.) | |
virtual void | parse (XML::Element structureElement) override |
Parses any structure-specific parameters in the XML element in the job file. | |
![]() | |
AtomicStructure (const FPString &id, FitJob *job) | |
void | setupSimulationCell (const Matrix3 &cellVectors, const Point3 &cellOrigin=Point3::Origin(), const std::array< bool, 3 > &pbc=std::array< bool, 3 >{{true, true, true}}) |
Set up the simulation cell. More... | |
void | deformSimulationCell (const Matrix3 &deformation) |
Applies an affine transformation to the cell and the atoms. More... | |
const Matrix3 & | simulationCell () const |
Returns global simulation cell matrix. More... | |
const Point3 & | simulationCellOrigin () const |
The origin point of the global simulation cell in world coordinates. More... | |
const Matrix3 & | reciprocalSimulationCell () const |
The inverse of the simulation cell matrix used to transform absolute coordinates to reduced coordinates. More... | |
bool | hasPBC (size_t dimension) const |
Returns whether periodic boundary conditions are enabled in the given spatial dimension. More... | |
const std::array< bool, 3 > & | pbc () const |
Returns the periodic boundary condition flags. More... | |
Vector3I | periodicImage (const Point3 &p) const |
Determines the periodic image of the cell the given point is located in. | |
Point3 | wrapPoint (Point3 p) const |
Wraps a point to be inside the simulation cell if periodic boundary conditions are enabled. | |
Point3 | wrapReducedPoint (Point3 p) const |
Wraps a point given in reduced coordinated to be inside the simulation cell. | |
Point3 | reducedToAbsolute (const Point3 &reducedPoint) const |
Converts a point given in reduced cell coordinates to a point in absolute coordinates. | |
Point3 | absoluteToReduced (const Point3 &worldPoint) const |
Converts a point given in absolute coordinates to a point in reduced cell coordinates. | |
Vector3 | reducedToAbsolute (const Vector3 &reducedVec) const |
Converts a vector given in reduced cell coordinates to a vector in absolute coordinates. | |
Vector3 | absoluteToReduced (const Vector3 &worldVec) const |
Converts a vector given in absolute coordinates to a point in vector cell coordinates. | |
void | setAtomCount (int numLocalAtoms) |
Resizes the atoms array. More... | |
int | numLocalAtoms () const |
Returns the number of (real) atoms in the structure cell. | |
int | numGhostAtoms () const |
Returns the number of ghost atoms in the structure cell. | |
int | numAtoms () const |
Returns the total number of atoms in the structure cell including real and ghost atoms. | |
const std::vector< Point3 > & | atomPositions () const |
Returns the array of positions of all atoms (including ghosts) in the structure (const version). | |
std::vector< Point3 > & | atomPositions () |
Returns the array of positions of all atoms (including ghosts) in the structure cell (non-const version). | |
void | setAtomPositions (const std::vector< Point3 > &newPositions) |
Sets the array of positions of all atoms in the structure cell. More... | |
const std::vector< Point3 > & | atomDisplacements () const |
Returns the array of displacements of all atoms in the structure cell wrt a reference structure (const version). | |
std::vector< Point3 > & | atomDisplacements () |
Returns the array of displacements of all atoms in the structure cell wrt a reference structure (non-const version). | |
const std::vector< Point3 > & | atomInitialPositions () const |
Returns the initial positions of the all real atoms they had at the beginning of the job. | |
int | atomType (int i) const |
Returns the type of a i-th atom. | |
const std::vector< int > & | atomTypes () const |
Returns the array of types of all atoms in the cell (const version). | |
std::vector< int > & | atomTypes () |
Returns the array of types of all atoms in the cell (non-const version). | |
const std::vector< int > & | atomTags () const |
Returns the array of IDs of the atoms in the cell (const version). | |
std::vector< int > & | atomTags () |
Returns the array of IDs of the atoms in the cell (non-const version). | |
const std::vector< Vector3 > & | atomForces () const |
Returns the array of force vectors (const version). | |
std::vector< Vector3 > & | atomForces () |
Returns the array of force vectors (non-const version). | |
AtomVectorProperty & | atomForcesProperty () |
Returns the property for the atomic force vectors. | |
const std::vector< std::pair< int, int > > & | forwardMapping () const |
Returns an array of integer pairs that map the real atoms to the ghost atoms. | |
const std::vector< int > & | reverseMapping () const |
Returns an array of integers that maps the ghost atoms to the real atoms. | |
template<typename T > | |
T * | perAtomData () |
Returns a pointer to the memory buffer that stores temporary per-atom data used by the potential routines. | |
NeighborList & | neighborList (const Potential *potential) |
void | setDirty (DirtyFlags flags) |
Marks parts of the structure that must be updated before the next energy calculation. | |
bool | isDirty (DirtyFlags parts) const |
Tests whether certain parts of the structure must be updated before the next energy calculation. | |
void | clearDirty (DirtyFlags parts) |
Resets the dirty flags. | |
virtual void | dofValueChanged (DegreeOfFreedom &dof) override |
This callback function is called by the DOFs of the structure each time when their values changes. More... | |
virtual bool | computeProperties (bool isFitting) override |
Computes all enabled properties of the structures. More... | |
double | computeEnergy (bool computeForces, bool isFitting, bool suppressRelaxation=false) |
Computes the total energy and optionally the forces for this structure. More... | |
bool | relax (bool isFitting) |
Relaxes the structural degrees of freedom such that the total energy is minimized. More... | |
void | writeToDumpFile (const FPString &filename, bool includeGhostAtoms=false) const |
Exports the structure to a LAMMPS dump file. More... | |
void | writeToPoscarFile (const FPString &filename, bool includeGhostAtoms=false) const |
Exports the structure to a POSCAR file. More... | |
void | writeToFile () |
Exports the structure to file if a filename has been provided. | |
double | totalEnergy () const |
Returns the total potential energy of this structure after computeEnergy() has been called. | |
const std::array< double, 6 > & | virial () const |
Returns the virial tensor computed by the force routine. | |
std::array< double, 6 > & | virial () |
Returns a reference to the virial tensor. More... | |
double | pressureTensor (int voigtIndex) const |
Returns a component of the pressure tensor. More... | |
double | pressure () const |
Returns the hydrostatic part of the pressure tensor. More... | |
![]() | |
virtual | ~FitObject ()=default |
Virtual destructor. | |
double | relativeWeight () const |
Returns the relative fit weight assigned to this object. | |
void | setRelativeWeight (double weight) |
Assigns a relative fit weight to this object. | |
virtual void | assignAbsoluteWeights (double absoluteWeight) |
Recursively assigns absolute weights to the properties of this object and its sub-objects. | |
const std::vector< FitProperty * > & | properties () const |
Returns a list of fitting properties of this object. | |
void | listAllProperties (std::vector< FitProperty *> &list) const |
Builds a list of properties of this object and all its sub-objects. | |
FitProperty * | propertyById (const FPString &id) const |
Returns the property with the given ID. | |
const std::vector< DegreeOfFreedom * > & | DOF () const |
Returns a list of degrees of freedom of this object. | |
void | listAllDOF (std::vector< DegreeOfFreedom *> &list) const |
Builds a list of degrees of freedom of this object and all its sub-objects. | |
DegreeOfFreedom * | DOFById (const FPString &id, const FPString &tag=FPString()) const |
Returns the degree of freedom with the given ID (and tag). | |
const std::vector< FitObject * > & | fitObjects () const |
Returns the list of FitObjects which are part of this group. | |
void | registerSubObject (FitObject *subobject, bool deleteOnShutdown=false) |
Registers a sub-object. | |
virtual void | print (MsgLogger &stream) |
Outputs the name of the object. | |
bool | fitEnabled () const |
Returns whether this object and it's children are included in the fit. | |
void | setFitEnabled (bool enable) |
Sets whether this object and it's children are included in the fit. | |
bool | outputEnabled () const |
void | setOutputEnabled (bool enable) |
const FPString & | id () const |
Returns the identifier of this object instance. | |
void | setId (const FPString &id) |
Sets the main identification tag. | |
const FPString & | tag () const |
Returns the assigned tag string. | |
void | setTag (const FPString &tag) |
Sets the complementary identification tag. | |
FitJob * | job () const |
Returns a pointer to the job to which this object belongs. | |
FitObject * | parent () const |
Returns the parent of this object in the hierarchy. | |
Protected Member Functions | |
Matrix3 | unitCell () const |
Returns the geometry of the selected lattice unit cell. | |
Matrix3 | superCell () const |
Returns the geometry of the super cell. | |
std::vector< std::pair< Point3, int > > | unitCellBasis () const |
Returns the atoms in the lattice unit cell (reduced coordinates). | |
std::vector< std::pair< Point3, int > > | superCellAtoms () const |
Builds a list of atoms in the super cell. | |
![]() | |
FitObject () | |
Default Constructor. | |
FitObject (const FPString &id, FitJob *job, const FPString &tag=FPString()) | |
Constructor. | |
void | registerProperty (FitProperty *prop, bool deleteOnShutdown=false) |
Registers a property of this object. | |
void | registerDOF (DegreeOfFreedom *dof) |
Registers a DOF of this object. | |
Protected Attributes | |
int | _atomTypeA = 1 |
The atom type of the lattice. | |
![]() | |
ScalarFitProperty | _totalEnergyProperty |
Output of the energy calculation that can be used for fitting. | |
ScalarFitProperty | _atomicEnergyProperty |
Output of the per atom energy calculation that can be used for fitting. | |
ScalarFitProperty | _totalVolumeProperty |
The total volume of the structure cell. | |
ScalarFitProperty | _atomicVolumeProperty |
The average volume per atom in the structure cell. | |
ScalarFitProperty | _pressureTensorProperty [6] |
The components of the cell's pressure tensor. | |
ScalarFitProperty | _pressureProperty |
One third of the trace of the cell's pressure tensor. | |
ScalarFitProperty | _bulkModulusProperty |
The bulk modulus of the lattice. | |
ScalarFitProperty | _elasticConstantProperties [21] |
The elastic constants. | |
AtomVectorProperty | _atomForcesProperty |
The force vector. | |
AtomCoordinatesDOF | _atomCoordinatesDOF |
This DOF encapsulates the atomic degrees of freedom. | |
![]() | |
bool | _fitEnabled = true |
Controls whether this object and it's children are included in the fit. | |
bool | _outputEnabled = true |
FitJob * | _job = nullptr |
Pointer to the job this object belongs to. | |
FPString | _id |
The identifier string of this object instance. | |
double | _relativeWeight = 1.0 |
The relative fit weight assigned to this object. | |
This class defines a N x N x N supercell structure.
The class currently supports FCC, HCP, and BCC lattice and exposes a degree of freedom for the lattice constant and the c/a ratio in the case of HCP. The following code snippet exemplifies the definition of the super cell structure in the input file. The lattice parameter is typically slaved to the computed equilibrium lattice parameter of a primitive lattice structure using an 'equalto' reference.