atomicrex  0.1
An advanced atomistic model building tool
TabulatedMEAMPotential.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/CubicSpline.h"
26 
27 namespace atomicrex {
28 
36 {
37 public:
38 
41 
43  virtual double cutoff() const override { return _cutoff; }
44 
46  virtual double computeEnergyAndForces(AtomicStructure& structure, NeighborList& neighborList) override;
47 
49  virtual double computeEnergy(AtomicStructure& structure, NeighborList& neighborList) override;
50 
52  void writeParamsFile(const FPString& filename) const;
53 
56  virtual size_t perAtomDataSize() const override { return sizeof(double); }
57 
60  virtual size_t perBondDataSize() const override { return sizeof(MEAMBondData); }
61 
63  void parseMEAMFile(const FPString& filename);
64 
65 public:
66 
68  virtual void parse(XML::Element potentialElement) override;
69 
70 protected:
71 
73  void parseSplineDefinition(CubicSpline& spline, std::istream& stream);
74 
76  void writeSplineDefinition(const CubicSpline& spline, std::ostream& stream) const;
77 
78 protected:
79 
80  CubicSpline phi; // Phi(r_ij)
81  CubicSpline rho; // Rho(r_ij)
82  CubicSpline f; // f(r_ij)
83  CubicSpline U; // U(rho)
84  CubicSpline g; // g(cos_theta)
85  double zero_atom_energy; // Embedding energy function is shifted by this value to make it vanish in vacuum.
86 
87  double _cutoff; // The local cutoff radius.
88 
89  // Helper data structure used to store temporary per-bond values during energy/force calculation.
90  struct MEAMBondData {
91  double f, fprime;
92  };
93 };
94 
95 } // End of namespace
Base class for maintaining structures.
Definition: AtomicStructure.h:42
void parseSplineDefinition(CubicSpline &spline, std::istream &stream)
Parses a single spline definition from the potential file.
Definition: TabulatedMEAMPotential.cpp:287
virtual double cutoff() const override
Returns the maximum cutoff of the potential.
Definition: TabulatedMEAMPotential.h:43
Definition: NeighborList.h:58
virtual double computeEnergyAndForces(AtomicStructure &structure, NeighborList &neighborList) override
Computes the total energy and forces of the structure.
Definition: TabulatedMEAMPotential.cpp:93
Definition: TabulatedMEAMPotential.h:35
void parseMEAMFile(const FPString &filename)
Parses the MEAM spline functionals from the given parameters file.
Definition: TabulatedMEAMPotential.cpp:255
Definition: CubicSpline.h:37
virtual double computeEnergy(AtomicStructure &structure, NeighborList &neighborList) override
Computes the total energy of the structure.
Definition: TabulatedMEAMPotential.cpp:43
Definition: TabulatedMEAMPotential.h:90
virtual size_t perAtomDataSize() const override
Definition: TabulatedMEAMPotential.h:56
void writeSplineDefinition(const CubicSpline &spline, std::ostream &stream) const
Writes a single spline definition to the output potential file.
Definition: TabulatedMEAMPotential.cpp:341
This file collects the definition of classes that define various simple crystal structures.
Definition: Atomicrex.h:67
TabulatedMEAMPotential(const FPString &id, FitJob *job)
Constructor.
Definition: TabulatedMEAMPotential.cpp:36
std::string FPString
The default string type used throughout the code:
Definition: Atomicrex.h:70
Definition: XMLUtilities.h:69
Definition: FitJob.h:37
FitJob * job() const
Returns a pointer to the job to which this object belongs.
Definition: FitObject.h:150
virtual size_t perBondDataSize() const override
Definition: TabulatedMEAMPotential.h:60
void writeParamsFile(const FPString &filename) const
Writes the potential&#39;s parameters to the given output file.
Definition: TabulatedMEAMPotential.cpp:321
virtual void parse(XML::Element potentialElement) override
Parses any potential-specific parameters in the XML element in the job file.
Definition: TabulatedMEAMPotential.cpp:236
Base class for potential.
Definition: Potential.h:41