|
funkalicious 0.1
|
00001 /* 00002 ** fftw_wavefunc.h 00003 ** 00004 Copyright (C) 2009 Joseph Pingenot 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Affero General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Affero General Public License for more details. 00015 00016 You should have received a copy of the GNU Affero General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 ** Made by Johnny Q. Hacker 00020 ** Login <solarion@nathan> 00021 ** 00022 ** Started on Mon Nov 16 06:35:01 2009 Johnny Q. Hacker 00023 ** Last update Mon Nov 16 06:35:01 2009 Johnny Q. Hacker 00024 */ 00025 00026 #include <libpostproc/lp_wavefunction.h> 00027 #include <libpostproc/density_1d.h> 00028 00029 #ifndef FFTW_WAVEFUNC_H_ 00030 # define FFTW_WAVEFUNC_H_ 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /**returns the electrostatic potential for a charge distribution rho and epsilon distribution epsilon. 00037 *\param rho a struct density containing the charge density. This should be in Coulombs per meter (the meter square would otherwise be multiplied internally; this increases accuracy to just do one division 00038 *\param epsilon a struct density containing the electrostatic constant for the materials across the structure (\epsilon*\epsilon_0) 00039 *\param rhoprime_out pointer to a pointer to a struct density to store rho divided by epsilon at each point. 00040 *\param dielectric_term_k: density which contains the *pre-fourier-transformed* inhomogeneous dielectric term (del ln(epsilon) . del phi) With this argument, this can be used for a step of an iterative or recursive approach. 00041 *\param dielectric_term_r: density which contains the realspace inhomogeneous dielectric term (del ln(epsilon) . del phi) With this argument, this can be used for a step of an iterative or recursive approach. 00042 *\return a struct density containing the electrostatic potential distribution. 00043 *\note the final result of the equation will be multiplied by -1; therefore, rho and the dielectric term will be *added* together internally. 00044 *\note RHO MUST BE IN UNITS OF COULOMBS PER METER. This is usually done by taking a pre-normalized wavefunction (i.e. wavefunction such that the sum at all of the points is 1) and dividing it by the length of a single side of a (cubic!) grid cell. Accepting inputs in C/m instead of C/m^3 has improved accuracy, since the m^3 in the demoninator would otherwise be (approximately; this is finite-precision math!) divided out when multiplying by delta^2 (using the notation in Numerical Recipes 3rd Ed, p. 1054) 00045 *\note epsilon should be in units of F/m. This is conventional. 00046 *\note dielectric_term_k and dielectric_term_r are complementary. It is not checked, however. The unused parameter should be set to NULL. 00047 */ 00048 struct density* get_potential_for_density(const struct density* rho, const struct density* epsilon, struct density** rhoprime_out, const struct density* dielectric_term_k, const struct density* dielectric_term_r, GError **e); 00049 00050 /**Solve the Poisson equation for an inhomogeneous dielectric using a multigrid method described in January 2011 00051 *\param rho charge dnesity in C/m (see comments on get_potential_for_density 00052 *\param epsilon dielectric constant as a function of position 00053 *\param close_enough convergence check (max abs percent change must be less than this value) 00054 *\param e pointer to a pointer to a GError to return error information. 00055 */ 00056 struct density* get_potential_for_density_inhomog_multigrid(const struct density* rho, const struct density* epsilon, double close_enough, GError **e); 00057 00058 /**Solve the Poisson equation for an inhomogeneous dielectric using simple symmetric finite differencing 00059 *\param rho charge dnesity in C/m (see comments on get_potential_for_density 00060 *\param epsilon dielectric constant as a function of position 00061 *\param close_enough convergence check (max abs percent change must be less than this value) 00062 *\param global use maximum abs value of d1 instead of the local value of d1 for finding percent difference between iterations 00063 *\param save_iterations save del_phi (z slices and grid dump) and phi (z slices) data from each iteration. 00064 *\param e pointer to a pointer to a GError to return error information. 00065 */ 00066 struct density* get_potential_for_density_inhomog_simple(const struct density* rho, const struct density* epsilon, double close_enough, int global, int save_iterations, GError **e); 00067 00068 struct density_1d* get_potential_for_density_1d(const struct density_1d* rho, const struct density_1d* epsilon, struct density_1d** rhoprime_out, GError **e); 00069 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif /* !FFTW_WAVEFUNC_H_ */