1 /*-------------------------------------------------------------------
2 Copyright 2013 Ravishankar Sundararaman, Kendra Letchworth-Weaver
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_FLUID_FLUIDCOMPONENT_H
21 #define JDFTX_FLUID_FLUIDCOMPONENT_H
22 
23 #include <fluid/S2quad.h>
24 #include <fluid/Molecule.h>
25 
26 //! @addtogroup Fluid
27 //! @{
28 
29 //!Named fluid components for which bulk properties / geometries / excess functionals are available
30 struct FluidComponent
31 {
32 	//!Component names
33 	enum Name
34 	{	//Neutral solvent molecules:
35 		H2O, //!< Water
36 		CHCl3, //!< Chloroform
37 		CCl4, //!< Carbon tetrachloride
38 		CH3CN, //!< Acetonitrile
39 		DMC, //!< Dimethyl carbonate
40 		EC, //!< Ethylene carbonate
41 		PC, //!< Propylene carbonate
42 		DMF, //!< Dimethylformamide
43 		THF, //!< Tetrahydrofuran
44 		EthylEther, //!< Diethyl ether
45 		Chlorobenzene, //! Chlorobenzene
46 		Isobutanol, //! Isobutanol
47 		CarbonDisulfide, //! Carbon disulfide
48 		DMSO, //! Dimethyl sulfoxide
49 		CH2Cl2, //! Dichloromethane (methyl chloride)
50 		Ethanol,
51 		Methanol,
52 		Octanol,
53 		Glyme,
54 		EthyleneGlycol,
55 		CustomSolvent, //!< Custom solvent (molecule and other parameters initialized manually)
56 		//Cations:
57 		Sodium, //!< Na+
58 		HydratedSodium, //!< Na+ cluster with 6 octahedrally coordinated H2O molecules
59 		Potassium, //!< K+
60 		HydratedPotassium, //!< K+ cluster with 6 octahedrally coordinated H2O molecules
61 		Hydronium, //!< H3O+
62 		HydratedHydronium, //!< H3O+ cluster with 4 H2O molecules
63 		CustomCation, //!< Custom cation (molecule and other parameters initialized manually)
64 		//Anions:
65 		Chloride, //!< Cl-
66 		Fluoride, //!< F-
67 		Perchlorate, //!< ClO4-
68 		Hydroxide, //!< OH-
69 		HydratedHydroxide, //!< OH- cluster with 4 H2O molecules
70 		CustomAnion //!< Custom anion (molecule and other parameters initialized manually)
71 	};
72 	const Name name;
73 
74 	//!Type of component - used to determine role of component in simpler PCMs
75 	enum Type
76 	{	Solvent, Cation, Anion
77 	};
78 	const Type type;
79 	static Type getType(Name name);
80 
81 	//!Excess functional choices
82 	enum Functional
83 	{	ScalarEOS, //!< Generic hard sphere + weighted density functional constrained to equation of state \cite RigidCDFT \cite PolarizableCDFT
84 		FittedCorrelations, //!< H2O functional from \cite FittedCorrelations (DEPRECATED)
85 		BondedVoids, //!< H2O functional from \cite BondedVoids
86 		MeanFieldLJ, //!< Hard sphere + mean field Lennard-Jones perturbation (useful for ions in solution)
87 		FunctionalNone //!< No excess functional beyond hard spheres / electrostatics (or fex may be initialized manually)
88 	};
89 	const Functional functional;
90 	double epsLJ; //!< Lennard-Jones well depth for mean-field LJ functional
91 
92 	//!Ideal gas representation (does not affect simple fluids which always use IdealGasMonoatomic)
93 	enum Representation
94 	{	Pomega, //!< directly work with orientation probability density
95 		PsiAlpha, //!< site-potential representation
96 		MuEps //!< multipole density representation truncated at l=1 (default)
97 	}
98 	representation;
99 
100 	S2quadType s2quadType; //!< Quadrature on S2 that generates the SO(3) quadrature (default: 7design24)
101 	unsigned quad_nBeta, quad_nAlpha, quad_nGamma; //!< Subdivisions for euler angle outer-product quadrature
102 
103 	enum TranslationMode
104 	{	ConstantSpline,
105 		LinearSpline, //!< default and recommended
106 		Fourier
107 	}
108 	translationMode; //!< type of translation operator used for sampling rigid molecule geometry
109 
110 	//Bulk solvent properties (used by various PCM's):
111 	double epsBulk; //!< bulk dielectric constant
112 	double Nbulk; //!< bulk number-density of molecules in bohr^-3 (used as initial guess in mixtures)
113 	double pMol; //!< dipole moment of each molecule in e-bohr
114 	double epsInf; //!< optical-frequency dielectric constant
115 	double Pvap; //!< vapor pressure in Eh/bohr^3
116 	double sigmaBulk; //!< bulk surface tension in Eh/bohr^2
117 	double Rvdw; //!< effective van der Waals radius of liquid (derived from equation of state) in bohrs
118 	double Res; //!< electrostatic radius of solvent (derived from nonlocal response) in bohrs
119 
120 	//Frequency-dependence parameters:
121 	double tauNuc; //!< nuclear motion damping time: rotational for solvents, translational for ions
122 	struct PoleLD
123 	{	double omega0; //!< center frequency of Drude-Lorentz model
124 		double gamma0; //!< damping / frequency width of Drude-Lorentz model
125 		double A0; //!< scale factors for each pole (should add up to 1)
126 	};
127 	std::vector<PoleLD> polesEl; //!< electronic frequency dependence in Lorentz-oscillator model
128 	std::vector<complex> getChiPrefactor(const std::vector<complex>& omegaArr, double chi0nuc, double chi0el) const; //!< get frequency dependence
129 
130 	double Nnorm; //!< If Nnorm>=0, this component is switched to the canonical ensemble (number fixed to Nnorm)
131 
132 	//Molecule geometry and site properties:
133 	Molecule molecule;
134 
135 	double pureNbulk(double T) const; //!< get density of solvent component in the pure phase at temperature T (returns 1 mol/liter for ions)
136 
137 	FluidComponent(Name name, double T, Functional functional); //!< set default properties
138 
139 	//Extra properties when participating in a classical density functional FluidMixture:
140 	std::shared_ptr<class SO3quad> quad; //!< orientation quadrature
141 	std::shared_ptr<class TranslationOperator> trans; //!< translation operator
142 	std::shared_ptr<class IdealGas> idealGas; //!< Indep <-> Density converter and entropy calculator
143 	std::shared_ptr<class Fex> fex; //!< Excess functional (in excess to sphere mixture and long-range)
144 	std::shared_ptr<struct ScalarEOS> eos; //!< Equation of states for ScalarEOS functionals
145 	unsigned offsetIndep; //!< Offset to the independent variables of this component
146 	unsigned offsetDensity; //!< Offset to the site densities that belong to this component
147 	void addToFluidMixture(class FluidMixture* fluidMixture); //!< Initialize fex, idealGas and register with fluidMixture
148 };
149 
150 //! @}
151 #endif // JDFTX_FLUID_FLUIDCOMPONENT_H
152