1#ifndef RPG_AM_ITERATOR_GRID_H
2#define RPG_AM_ITERATOR_GRID_H
12#include <prdc/cuda/types.h>
13#include <pscf/cuda/DeviceArray.h>
14#include <pscf/iterator/AmIteratorTmpl.h>
16#include <pscf/iterator/AmbdInteraction.h>
17#include <util/containers/DArray.h>
18#include <util/containers/RingBuffer.h>
23 template <
int D>
class System;
27 using namespace Prdc::Cuda;
82 using Iterator<D>::setFlexibleParams;
105 void setup(
bool isContinuation)
override;
120 int nElements()
override;
125 bool hasInitialGuess()
override;
132 void getCurrent(
VectorT& curr)
override;
137 void evaluate()
override;
144 void getResidual(
VectorT& resid)
override;
151 void update(
VectorT& newGuess)
override;
156 void outputToLog()
override;
171 double dotProduct(
VectorT const & a,
179 double maxAbs(
VectorT const & a)
override;
200 VectorT const & b,
double c)
override;
209 cudaReal findAverage(
VectorT const & field);
VectorT const & residual() const
int solve(bool isContinuation=false)
Modified interaction to compute residual defn.
Dynamic array on the GPU device with aligned data.
Rpg implementation of the Anderson Mixing iterator.
AmIteratorGrid(System< D > &system)
Constructor.
void readParameters(std::istream &in)
Read all parameters and initialize.
void setup(bool isContinuation) override
Setup iterator just before entering iteration loop.
DeviceArray< cudaReal > VectorT
Typename for state and residual vectors.
void outputTimers(std::ostream &out) const
Output timing results to log file.
AmIteratorTmpl< Iterator< D >, VectorT > Base
Aliase for base class.
~AmIteratorGrid()
Destructor.
Base class for iterative solvers for SCF equations.
Main class, representing a complete physical system.
FSArrayParam< Type, N > & readOptionalFSArray(std::istream &in, const char *label, FSArray< Type, N > &array, int size)
Add and read an optional FSArray < Type, N > array parameter.
void setClassName(const char *className)
Set class name string.
ScalarParam< Type > & readOptional(std::istream &in, const char *label, Type &value)
Add and read a new optional ScalarParam < Type > object.
void readParamCompositeOptional(std::istream &in, ParamComposite &child, bool next=true)
Add and attempt to read an optional child ParamComposite.
Periodic fields and crystallography.
SCFT and PS-FTS with real periodic fields (GPU)
PSCF package top-level namespace.