00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _chemistry_solvent_bem_h
00029 #define _chemistry_solvent_bem_h
00030
00031 #include <util/class/class.h>
00032 #include <util/state/state.h>
00033 #include <util/keyval/keyval.h>
00034 #include <math/isosurf/volume.h>
00035 #include <math/isosurf/surf.h>
00036 #include <math/scmat/matrix.h>
00037 #include <chemistry/molecule/molecule.h>
00038
00039
00040
00041 class BEMSolvent: public DescribedClass {
00042 private:
00043 int debug_;
00044
00045 Ref<Molecule> solute_;
00046 Ref<Molecule> solvent_;
00047 double solvent_density_;
00048 double dielectric_constant_;
00049 Ref<SCMatrixKit> matrixkit_;
00050 RefSCMatrix system_matrix_i_;
00051 double f_;
00052 Ref<MessageGrp> grp_;
00053
00054 double area_;
00055 double volume_;
00056 double computed_enclosed_charge_;
00057 double edisp_;
00058 double erep_;
00059
00060 Ref<TriangulatedImplicitSurface> surf_;
00061
00062 double** alloc_array(int n, int m);
00063 void free_array(double**);
00064
00065
00066
00067 double* vertex_area_;
00068
00069
00070 void charges_to_surface_charge_density(double *charges);
00071
00072
00073 void surface_charge_density_to_charges(double *charges);
00074 public:
00075 BEMSolvent(const Ref<KeyVal>&);
00076 virtual ~BEMSolvent();
00077
00078
00079
00080
00081 void init();
00082
00083 void done(int clear_surface = 1);
00084
00085 int ncharge() { return surf_->nvertex(); }
00086
00087 Ref<Molecule> solvent() { return solvent_ ;}
00088 double solvent_density() { return solvent_density_ ;}
00089
00090
00091 double** alloc_charge_positions() { return alloc_array(ncharge(), 3); }
00092 void free_charge_positions(double**a) { free_array(a); }
00093
00094 double** alloc_normals() { return alloc_array(ncharge(), 3); }
00095 void free_normals(double**a) { free_array(a); }
00096
00097 double* alloc_efield_dot_normals() { return new double[ncharge()]; }
00098 void free_efield_dot_normals(double*a) { delete[] a; }
00099
00100 double* alloc_charges() { return new double[ncharge()]; }
00101 void free_charges(double*a) { delete[] a; }
00102
00103 void charge_positions(double**);
00104 void normals(double**);
00105
00106
00107
00108 void compute_charges(double* efield_dot_normals, double* charge);
00109
00110
00111
00112
00113 void normalize_charge(double enclosed_charge, double* charges);
00114
00115
00116 double nuclear_charge_interaction_energy(double *nuclear_charge,
00117 double** charge_positions,
00118 double* charge);
00119
00120
00121
00122 double nuclear_interaction_energy(double** charge_positions,
00123 double* charge);
00124
00125
00126 double self_interaction_energy(double** charge_positions, double *charge);
00127
00128
00129 double polarization_charge(double* charge);
00130
00131
00132 double area() const { return area_; }
00133
00134 double volume() const { return volume_; }
00135
00136 double computed_enclosed_charge() const {
00137 return computed_enclosed_charge_;
00138 }
00139
00140 double disp() {return edisp_;}
00141 double rep() {return erep_;}
00142 double disprep();
00143
00144
00145 void init_system_matrix();
00146
00147 Ref<TriangulatedImplicitSurface> surface() const { return surf_; }
00148
00149 Ref<SCMatrixKit> matrixkit() { return matrixkit_; }
00150 };
00151
00152
00153 #endif
00154
00155
00156
00157
00158