atomicrex  0.1
An advanced atomistic model building tool
TabulatedEAMPotential.h
1 //
3 // Copyright (C) 2017, Alexander Stukowski and Paul Erhart
4 //
5 // This file is part of atomicrex.
6 //
7 // Atomicrex is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Atomicrex is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 //
21 
22 #pragma once
23 
24 #include "Potential.h"
25 #include "functions/GridCubicSpline.h"
26 
27 namespace atomicrex {
28 
33 {
34 public:
35 
37  TabulatedEAMPotential(const FPString& id, FitJob* job) : Potential(id, job, "Tabulated-EAM") {}
38 
40  virtual double cutoff() const override { return _cutoff; }
41 
43  virtual double computeEnergyAndForces(AtomicStructure& structure, NeighborList& neighborList) override;
44 
46  virtual double computeEnergy(AtomicStructure& structure, NeighborList& neighborList) override;
47 
50  virtual size_t perAtomDataSize() const override { return sizeof(EAMAtomData); }
51 
52 public:
53 
55  void parseFuncflEAMFile(const FPString& filename);
56 
58  void parseSetflEAMFile(const FPString& filename);
59 
61  virtual void parse(XML::Element potentialElement) override;
62 
63 private:
64 
65  GridCubicSpline z2r; // z2r(r_ij)
66  GridCubicSpline rho; // rho(r_ij)
67  GridCubicSpline U; // U(rho)
68 
69  double _cutoff; // The local cutoff radius.
70 
71  struct EAMAtomData {
72  double rho, Uprime;
73  };
74 };
75 
76 } // End of namespace
Base class for maintaining structures.
Definition: AtomicStructure.h:42
Definition: NeighborList.h:58
Definition: GridCubicSpline.h:40
virtual size_t perAtomDataSize() const override
Definition: TabulatedEAMPotential.h:50
virtual double computeEnergy(AtomicStructure &structure, NeighborList &neighborList) override
Computes the total energy of the structure.
Definition: TabulatedEAMPotential.cpp:123
void parseSetflEAMFile(const FPString &filename)
Parses the tabulated EAM functionals from the given file in "setfl" format.
Definition: TabulatedEAMPotential.cpp:75
virtual double cutoff() const override
Returns the maximum cutoff of the potential.
Definition: TabulatedEAMPotential.h:40
TabulatedEAMPotential(const FPString &id, FitJob *job)
Constructor.
Definition: TabulatedEAMPotential.h:37
virtual void parse(XML::Element potentialElement) override
Parses any potential-specific parameters in the XML element in the job file.
Definition: TabulatedEAMPotential.cpp:235
This file collects the definition of classes that define various simple crystal structures.
Definition: Atomicrex.h:67
std::string FPString
The default string type used throughout the code:
Definition: Atomicrex.h:70
Definition: XMLUtilities.h:69
Definition: FitJob.h:37
Definition: TabulatedEAMPotential.h:32
FitJob * job() const
Returns a pointer to the job to which this object belongs.
Definition: FitObject.h:150
void parseFuncflEAMFile(const FPString &filename)
Parses the tabulated EAM functionals from the given file in "funcfl" format.
Definition: TabulatedEAMPotential.cpp:35
virtual double computeEnergyAndForces(AtomicStructure &structure, NeighborList &neighborList) override
Computes the total energy and forces of the structure.
Definition: TabulatedEAMPotential.cpp:152
Base class for potential.
Definition: Potential.h:41