JDFTx  1.2.0
PCM.h
1 /*-------------------------------------------------------------------
2 Copyright 2013 Ravishankar Sundararaman, Deniz Gunceler
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_PCM_H
21 #define JDFTX_ELECTRONIC_PCM_H
22 
23 #include <fluid/FluidSolver.h>
24 #include <electronic/RadialFunction.h>
25 #include <core/EnergyComponents.h>
26 #include <core/Coulomb.h>
27 
29 class PCM : public FluidSolver
30 {
31 public:
32  PCM(const Everything& e, const FluidSolverParams& fsp);
33  virtual ~PCM();
34 
35  void dumpDensities(const char* filenamePattern) const;
36  void dumpDebug(const char* filenamePattern) const;
37 
38 protected:
41  ScalarField nCavity, tauCavity, nCavityEx[2];
43 
44  virtual void printDebug(FILE* fp) const {}
45 
46  void updateCavity();
47  void propagateCavityGradients(const ScalarField& A_shape, ScalarField& A_nCavity, ScalarFieldTilde& A_rhoExplicitTilde, bool electricOnly) const;
48  void setExtraForces(IonicGradient* forces, const ScalarFieldTilde& A_nCavityTilde) const;
50 private:
51  ScalarField Acavity_shape, Acavity_shapeVdw;
52  double A_nc, A_tension, A_vdwScale, A_eta_wDiel, A_pCavity;
53  double Rex[2];
54  RadialFunctionG wExpand[2];
55  RadialFunctionG wCavity;
56 protected:
57  std::vector<RadialFunctionG> Sf;
58  std::vector<int> atomicNumbers;
59  static ScalarFieldTilde coulomb(const ScalarFieldTilde& rho) { return (-4*M_PI) * Linv(O(rho)); }
60  friend struct ChargedDefect;
61 };
62 
63 #endif // JDFTX_ELECTRONIC_PCM_H
std::vector< RadialFunctionG > Sf
spherically-averaged structure factors for each solvent site
Definition: PCM.h:57
std::shared_ptr< ScalarFieldTildeData > ScalarFieldTilde
A smart reference-counting pointer to ScalarFieldTildeData.
Definition: ScalarField.h:45
void dumpDensities(const char *filenamePattern) const
dump cavity shape functions
ScalarFieldTilde Linv(const ScalarFieldTilde &)
Inverse Laplacian.
Abstract base class for the fluid solvers.
Definition: FluidSolver.h:31
ScalarField nCavityEx[2]
Cavity determining electron density (or product for SaLSA, or KE density for SG14tauVW, and expanded electron densities for the SGA13 variant)
Definition: PCM.h:41
ScalarFieldTilde O(const ScalarFieldTilde &)
Inner product operator (diagonal in PW basis)
EnergyComponents Adiel
PCM energy components.
Definition: PCM.h:39
ScalarFieldTilde rhoExplicitTilde
Charge density of explicit (electronic) system.
Definition: PCM.h:40
std::vector< int > atomicNumbers
atomic number for each solvent site (for dispersion interactions)
Definition: PCM.h:58
ScalarFieldTilde getFullCore() const
get full core correction for PCM variants that need them
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
Definition: Dump_internal.h:68
Definition: EnergyComponents.h:36
void updateCavity()
update shape function(s) from nCavity, and energies dependent upon shape alone
void dumpDebug(const char *filenamePattern) const
generate fluidDebug text file with common info to all PCMs
ScalarField shapeVdw
Electrostatic cavity shape function (and separate cavitation/dispersion shape function for the SGA13 ...
Definition: PCM.h:42
std::shared_ptr< ScalarFieldData > ScalarField
A smart reference-counting pointer to ScalarFieldData.
Definition: ScalarField.h:41
Extra parameters for fluids:
Definition: FluidSolverParams.h:93
Represent components of the (free) energy.
virtual void printDebug(FILE *fp) const
over-ride to get extra PCM-specific output in fluidDebug text file
Definition: PCM.h:44
Object to hold all the forces.
Definition: IonicMinimizer.h:31
void propagateCavityGradients(const ScalarField &A_shape, ScalarField &A_nCavity, ScalarFieldTilde &A_rhoExplicitTilde, bool electricOnly) const
propagate A_shape (+ cached Acavity_shape) and accumulate to those w.r.t nCavity and rhoExplicitTilde...
void setExtraForces(IonicGradient *forces, const ScalarFieldTilde &A_nCavityTilde) const
set extra fluid forces (vdw and full-core forces, when applicable)