JDFTx  1.1.0
SaLSA.h
1 /*-------------------------------------------------------------------
2 Copyright 2012 Ravishankar Sundararaman
3 
4 This file is part of JDFTx.
5 
6 JDFTx is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 JDFTx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with JDFTx. If not, see <http://www.gnu.org/licenses/>.
18 -------------------------------------------------------------------*/
19 
20 #ifndef JDFTX_ELECTRONIC_SALSA_H
21 #define JDFTX_ELECTRONIC_SALSA_H
22 
23 #include <fluid/PCM.h>
24 #include <core/Minimize.h>
25 
26 class SaLSA : public PCM, public LinearSolvable<ScalarFieldTilde>
27 {
28 public:
29  SaLSA(const Everything& e, const FluidSolverParams& fsp);
30  virtual ~SaLSA();
31  bool prefersGummel() const { return false; }
32 
33  ScalarFieldTilde chi(const ScalarFieldTilde&) const;
36  double sync(double x) const;
37 
38  void minimizeFluid();
39  void loadState(const char* filename);
40  void saveState(const char* filename) const;
41  void dumpDensities(const char* filenamePattern) const;
42 
43 protected:
44  void set_internal(const ScalarFieldTilde& rhoExplicitTilde, const ScalarFieldTilde& nCavityTilde);
45  double get_Adiel_and_grad_internal(ScalarFieldTilde& grad_rhoExplicitTilde, ScalarFieldTilde& grad_nCavityTilde, IonicGradient* extraForces, bool electricOnly) const;
46 
47 private:
48  std::vector< std::shared_ptr<struct MultipoleResponse> > response; //array of multipolar components in chi
49  int rStart, rStop; //MPI division of response array
50  RadialFunctionG chi0eff; //effective weight function (l=0) for charge neutrality constraint
51  RadialFunctionG nFluid; //electron density model for the fluid
52  RadialFunctionG Kkernel; ScalarField epsInv; //for preconditioner
53  ScalarFieldArray siteShape; //shape functions for sites
54 };
55 
56 #endif // JDFTX_ELECTRONIC_SALSA_H
ScalarFieldTilde chi(const ScalarFieldTilde &) const
Apply the non-local chi (i.e. compute induced charge density given a potential)
ScalarFieldTilde precondition(const ScalarFieldTilde &) const
Implements a modified inverse kinetic preconditioner.
void dumpDensities(const char *filenamePattern) const
dump cavity shape functions
std::vector< ScalarField > ScalarFieldArray
dynamic size collection of real space scalar fields
Definition: ScalarFieldArray.h:32
Definition: Minimize.h:86
void loadState(const char *filename)
Load state from file.
std::shared_ptr< ScalarFieldTildeData > ScalarFieldTilde
A smart reference-counting pointer to ScalarFieldTildeData.
Definition: ScalarField.h:44
double sync(double x) const
All processes minimize together; make sure scalars are in sync to round-off error.
SaLSA(const Everything &e, const FluidSolverParams &fsp)
Parameters same as createFluidSolver()
void minimizeFluid()
Converge using linear conjugate gradients.
void set_internal(const ScalarFieldTilde &rhoExplicitTilde, const ScalarFieldTilde &nCavityTilde)
Fluid-dependent implementation of set()
double get_Adiel_and_grad_internal(ScalarFieldTilde &grad_rhoExplicitTilde, ScalarFieldTilde &grad_nCavityTilde, IonicGradient *extraForces, bool electricOnly) const
Fluid-dependent implementation of get_Adiel_and_grad()
Definition: SaLSA.h:26
ScalarFieldTilde rhoExplicitTilde
Charge density of explicit (electronic) system.
Definition: PCM.h:40
void saveState(const char *filename) const
Save state to file.
G-space radial function stored on a uniform grid (of |G|)
Definition: RadialFunction.h:28
Definition: Everything.h:41
Base class for all PCMs.
Definition: PCM.h:29
ScalarFieldTilde hessian(const ScalarFieldTilde &) const
Implements LinearSolvable::hessian for the non-local poisson-like equation.
Nonlinear minimization templates.
std::shared_ptr< ScalarFieldData > ScalarField
A smart reference-counting pointer to ScalarFieldData.
Definition: ScalarField.h:40
Extra parameters for fluids:
Definition: FluidSolverParams.h:93
bool prefersGummel() const
Specify whether fluid prefers a gummel loop (true) or is minimized each time (false) ...
Definition: SaLSA.h:31
Object to hold all the forces.
Definition: IonicMinimizer.h:31