APBS  1.4.1
Vfetk class

FEtk master class (interface between FEtk and APBS) More...

Files

file  vfetk.c
 Class Vfetk methods.
 
file  vfetk.h
 Contains declarations for class Vfetk.
 

Data Structures

struct  sVfetk
 Contains public data members for Vfetk class/module. More...
 
struct  sVfetk_LocalVar
 Vfetk LocalVar subclass. More...
 

Macros

#define VRINGMAX   1000
 Maximum number of simplices in a simplex ring.
 
#define VATOMMAX   1000000
 Maximum number of atoms associated with a vertex.
 

Typedefs

typedef enum eVfetk_LsolvType Vfetk_LsolvType
 Declare FEMparm_LsolvType type.
 
typedef enum eVfetk_MeshLoad Vfetk_MeshLoad
 Declare FEMparm_GuessType type.
 
typedef enum eVfetk_NsolvType Vfetk_NsolvType
 Declare FEMparm_NsolvType type.
 
typedef enum eVfetk_GuessType Vfetk_GuessType
 Declare FEMparm_GuessType type.
 
typedef enum eVfetk_PrecType Vfetk_PrecType
 Declare FEMparm_GuessType type.
 
typedef struct sVfetk_LocalVar Vfetk_LocalVar
 Declaration of the Vfetk_LocalVar subclass as the Vfetk_LocalVar structure.
 
typedef struct sVfetk Vfetk
 Declaration of the Vfetk class as the Vfetk structure.
 

Enumerations

enum  eVfetk_LsolvType { VLT_SLU =0, VLT_MG =1, VLT_CG =2, VLT_BCG =3 }
 Linear solver type. More...
 
enum  eVfetk_MeshLoad { VML_DIRICUBE, VML_NEUMCUBE, VML_EXTERNAL }
 Mesh loading operation. More...
 
enum  eVfetk_NsolvType { VNT_NEW =0, VNT_INC =1, VNT_ARC =2 }
 Non-linear solver type. More...
 
enum  eVfetk_GuessType { VGT_ZERO =0, VGT_DIRI =1, VGT_PREV =2 }
 Initial guess type. More...
 
enum  eVfetk_PrecType { VPT_IDEN =0, VPT_DIAG =1, VPT_MG =2 }
 Preconditioner type. More...
 

Functions

VPUBLIC double Vfetk_energy (Vfetk *thee, int color, int nonlin)
 Return the total electrostatic energy. More...
 
VEXTERNC Gem * Vfetk_getGem (Vfetk *thee)
 Get a pointer to the Gem (grid manager) object. More...
 
VEXTERNC AM * Vfetk_getAM (Vfetk *thee)
 Get a pointer to the AM (algebra manager) object. More...
 
VEXTERNC VpbeVfetk_getVpbe (Vfetk *thee)
 Get a pointer to the Vpbe (PBE manager) object. More...
 
VEXTERNC VcsmVfetk_getVcsm (Vfetk *thee)
 Get a pointer to the Vcsm (charge-simplex map) object. More...
 
VEXTERNC int Vfetk_getAtomColor (Vfetk *thee, int iatom)
 Get the partition information for a particular atom. More...
 
VEXTERNC VfetkVfetk_ctor (Vpbe *pbe, Vhal_PBEType type)
 Constructor for Vfetk object. More...
 
VEXTERNC int Vfetk_ctor2 (Vfetk *thee, Vpbe *pbe, Vhal_PBEType type)
 FORTRAN stub constructor for Vfetk object. More...
 
VEXTERNC void Vfetk_dtor (Vfetk **thee)
 Object destructor. More...
 
VEXTERNC void Vfetk_dtor2 (Vfetk *thee)
 FORTRAN stub object destructor. More...
 
VEXTERNC double * Vfetk_getSolution (Vfetk *thee, int *length)
 Create an array containing the solution (electrostatic potential in units of $k_B T/e$) at the finest mesh level. More...
 
VEXTERNC void Vfetk_setParameters (Vfetk *thee, PBEparm *pbeparm, FEMparm *feparm)
 Set the parameter objects. More...
 
VEXTERNC double Vfetk_dqmEnergy (Vfetk *thee, int color)
 Get the "mobile charge" and "polarization" contributions to the electrostatic energy. More...
 
VEXTERNC double Vfetk_qfEnergy (Vfetk *thee, int color)
 Get the "fixed charge" contribution to the electrostatic energy. More...
 
VEXTERNC unsigned long int Vfetk_memChk (Vfetk *thee)
 Return the memory used by this structure (and its contents) in bytes. More...
 
VEXTERNC void Vfetk_setAtomColors (Vfetk *thee)
 Transfer color (partition ID) information frmo a partitioned mesh to the atoms. More...
 
VEXTERNC void Bmat_printHB (Bmat *thee, char *fname)
 Writes a Bmat to disk in Harwell-Boeing sparse matrix format. More...
 
VEXTERNC Vrc_Codes Vfetk_genCube (Vfetk *thee, double center[3], double length[3], Vfetk_MeshLoad meshType)
 Construct a rectangular mesh (in the current Vfetk object) More...
 
VEXTERNC Vrc_Codes Vfetk_loadMesh (Vfetk *thee, double center[3], double length[3], Vfetk_MeshLoad meshType, Vio *sock)
 Loads a mesh into the Vfetk (and associated) object(s). More...
 
VEXTERNC PDE * Vfetk_PDE_ctor (Vfetk *fetk)
 Constructs the FEtk PDE object. More...
 
VEXTERNC int Vfetk_PDE_ctor2 (PDE *thee, Vfetk *fetk)
 Intializes the FEtk PDE object. More...
 
VEXTERNC void Vfetk_PDE_dtor (PDE **thee)
 Destroys FEtk PDE object. More...
 
VEXTERNC void Vfetk_PDE_dtor2 (PDE *thee)
 FORTRAN stub: destroys FEtk PDE object. More...
 
VEXTERNC void Vfetk_PDE_initAssemble (PDE *thee, int ip[], double rp[])
 Do once-per-assembly initialization. More...
 
VEXTERNC void Vfetk_PDE_initElement (PDE *thee, int elementType, int chart, double tvx[][VAPBS_DIM], void *data)
 Do once-per-element initialization. More...
 
VEXTERNC void Vfetk_PDE_initFace (PDE *thee, int faceType, int chart, double tnvec[])
 Do once-per-face initialization. More...
 
VEXTERNC void Vfetk_PDE_initPoint (PDE *thee, int pointType, int chart, double txq[], double tU[], double tdU[][VAPBS_DIM])
 Do once-per-point initialization. More...
 
VEXTERNC void Vfetk_PDE_Fu (PDE *thee, int key, double F[])
 Evaluate strong form of PBE. For interior points, this is:

\[ -\nabla \cdot \epsilon \nabla u + b(u) - f \]

where $b(u)$ is the (possibly nonlinear) mobile ion term and $f$ is the source charge distribution term (for PBE) or the induced surface charge distribution (for RPBE). For an interior-boundary (simplex face) point, this is:

\[ [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^+} - [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^-} \]

where $n(x)$ is the normal to the simplex face and the term represents the jump in dielectric displacement across the face. There is no outer-boundary contribution for this problem. More...

 
VEXTERNC double Vfetk_PDE_Fu_v (PDE *thee, int key, double V[], double dV[][VAPBS_DIM])
 This is the weak form of the PBE; i.e. the strong form integrated with a test function to give:

\[ \int_\Omega \left[ \epsilon \nabla u \cdot \nabla v + b(u) v - f v \right] dx \]

where $b(u)$ denotes the mobile ion term. More...

 
VEXTERNC double Vfetk_PDE_DFu_wv (PDE *thee, int key, double W[], double dW[][VAPBS_DIM], double V[], double dV[][VAPBS_DIM])
 This is the linearization of the weak form of the PBE; e.g., for use in a Newton iteration. This is the functional linearization of the strong form integrated with a test function to give:

\[ \int_\Omega \left[ \epsilon \nabla w \cdot \nabla v + b'(u) w v - f v \right] dx \]

where $b'(u)$ denotes the functional derivation of the mobile ion term. More...

 
VEXTERNC void Vfetk_PDE_delta (PDE *thee, int type, int chart, double txq[], void *user, double F[])
 Evaluate a (discretized) delta function source term at the given point. More...
 
VEXTERNC void Vfetk_PDE_u_D (PDE *thee, int type, int chart, double txq[], double F[])
 Evaluate the Dirichlet boundary condition at the given point. More...
 
VEXTERNC void Vfetk_PDE_u_T (PDE *thee, int type, int chart, double txq[], double F[])
 Evaluate the "true solution" at the given point for comparison with the numerical solution. More...
 
VEXTERNC void Vfetk_PDE_bisectEdge (int dim, int dimII, int edgeType, int chart[], double vx[][VAPBS_DIM])
 Define the way manifold edges are bisected. More...
 
VEXTERNC void Vfetk_PDE_mapBoundary (int dim, int dimII, int vertexType, int chart, double vx[VAPBS_DIM])
 Map a boundary point to some pre-defined shape. More...
 
VEXTERNC int Vfetk_PDE_markSimplex (int dim, int dimII, int simplexType, int faceType[VAPBS_NVS], int vertexType[VAPBS_NVS], int chart[], double vx[][VAPBS_DIM], void *simplex)
 User-defined error estimator – in our case, a geometry-based refinement method; forcing simplex refinement at the dielectric boundary and (for non-regularized PBE) the charges. More...
 
VEXTERNC void Vfetk_PDE_oneChart (int dim, int dimII, int objType, int chart[], double vx[][VAPBS_DIM], int dimV)
 Unify the chart for different coordinate systems – a no-op for us. More...
 
VEXTERNC double Vfetk_PDE_Ju (PDE *thee, int key)
 Energy functional. This returns the energy (less delta function terms) in the form:

\[ c^{-1}/2 \int (\epsilon (\nabla u)^2 + \kappa^2 (cosh u - 1)) dx \]

for a 1:1 electrolyte where $c$ is the output from Vpbe_getZmagic. More...

 
VEXTERNC void Vfetk_externalUpdateFunction (SS **simps, int num)
 External hook to simplex subdivision routines in Gem. Called each time a simplex is subdivided (we use it to update the charge-simplex map) More...
 
VEXTERNC int Vfetk_PDE_simplexBasisInit (int key, int dim, int comp, int *ndof, int dof[])
 Initialize the bases for the trial or the test space, for a particular component of the system, at all quadrature points on the master simplex element. More...
 
VEXTERNC void Vfetk_PDE_simplexBasisForm (int key, int dim, int comp, int pdkey, double xq[], double basis[])
 Evaluate the bases for the trial or test space, for a particular component of the system, at all quadrature points on the master simplex element. More...
 
VEXTERNC void Vfetk_readMesh (Vfetk *thee, int skey, Vio *sock)
 Read in mesh and initialize associated internal structures. More...
 
VEXTERNC void Vfetk_dumpLocalVar ()
 Debugging routine to print out local variables used by PDE object. More...
 
VEXTERNC int Vfetk_fillArray (Vfetk *thee, Bvec *vec, Vdata_Type type)
 Fill an array with the specified data. More...
 
VEXTERNC int Vfetk_write (Vfetk *thee, const char *iodev, const char *iofmt, const char *thost, const char *fname, Bvec *vec, Vdata_Format format)
 Write out data. More...
 
VEXTERNC Vrc_Codes Vfetk_loadGem (Vfetk *thee, Gem *gm)
 Load a Gem geometry manager object into Vfetk. More...
 

Detailed Description

FEtk master class (interface between FEtk and APBS)

Enumeration Type Documentation

◆ eVfetk_GuessType

Initial guess type.

Note
Do not change these values; they correspond to settings in FEtk
Enumerator
VGT_ZERO 

Zero initial guess

VGT_DIRI 

Dirichlet boundary condition initial guess

VGT_PREV 

Previous level initial guess

Definition at line 138 of file vfetk.h.

◆ eVfetk_LsolvType

Linear solver type.

Note
Do not change these values; they correspond to settings in FEtk
Enumerator
VLT_SLU 

SuperLU direct solve

VLT_MG 

Multigrid

VLT_CG 

Conjugate gradient

VLT_BCG 

BiCGStab

Definition at line 86 of file vfetk.h.

◆ eVfetk_MeshLoad

Mesh loading operation.

Enumerator
VML_DIRICUBE 

Dirichlet cube

VML_NEUMCUBE 

Neumann cube

VML_EXTERNAL 

External mesh (from socket)

Definition at line 104 of file vfetk.h.

◆ eVfetk_NsolvType

Non-linear solver type.

Note
Do not change these values; they correspond to settings in FEtk
Enumerator
VNT_NEW 

Newton solver

VNT_INC 

Incremental

VNT_ARC 

Psuedo-arclength

Definition at line 121 of file vfetk.h.

◆ eVfetk_PrecType

Preconditioner type.

Note
Do not change these values; they correspond to settings in FEtk
Enumerator
VPT_IDEN 

Identity matrix

VPT_DIAG 

Diagonal scaling

VPT_MG 

Multigrid

Definition at line 155 of file vfetk.h.

Function Documentation

◆ Bmat_printHB()

VEXTERNC void Bmat_printHB ( Bmat *  thee,
char *  fname 
)

Writes a Bmat to disk in Harwell-Boeing sparse matrix format.

Author
Stephen Bond
Note
This is a friend function of Bmat
Bug:
Hardwired to only handle the single block symmetric case.
Parameters
theeThe matrix to write
fnameFilename for output

Definition at line 1026 of file vfetk.c.

◆ Vfetk_ctor()

VEXTERNC Vfetk* Vfetk_ctor ( Vpbe pbe,
Vhal_PBEType  type 
)

Constructor for Vfetk object.

Author
Nathan Baker
Returns
Pointer to newly allocated Vfetk object
Note
This sets up the Gem, AM, and Aprx FEtk objects but does not create a mesh. The easiest way to create a mesh is to then call Vfetk_genCube
Parameters
pbeVpbe (PBE manager object)
typeVersion of PBE to solve

Definition at line 532 of file vfetk.c.

◆ Vfetk_ctor2()

VEXTERNC int Vfetk_ctor2 ( Vfetk thee,
Vpbe pbe,
Vhal_PBEType  type 
)

FORTRAN stub constructor for Vfetk object.

Author
Nathan Baker
Returns
1 if successful, 0 otherwise
Note
This sets up the Gem, AM, and Aprx FEtk objects but does not create a mesh. The easiest way to create a mesh is to then call Vfetk_genCube
Parameters
theeVfetk object memory
pbePBE manager object
typeVersion of PBE to solve

Definition at line 545 of file vfetk.c.

◆ Vfetk_dqmEnergy()

VEXTERNC double Vfetk_dqmEnergy ( Vfetk thee,
int  color 
)

Get the "mobile charge" and "polarization" contributions to the electrostatic energy.

Using the solution at the finest mesh level, get the electrostatic energy due to the interaction of the mobile charges with the potential and polarization of the dielectric medium:

\[ G = \frac{1}{4 I_s} \sum_i c_i q_i^2 \int \overline{\kappa}^2(x) e^{-q_i u(x)} dx + \frac{1}{2} \int \epsilon ( \nabla u )^2 dx \]

for the NPBE and

\[ G = \frac{1}{2} \int \overline{\kappa}^2(x) u^2(x) dx + \frac{1}{2} \int \epsilon ( \nabla u )^2 dx \]

for the LPBE. Here $i$ denotes the counterion species, $I_s$ is the bulk ionic strength, $\overline{\kappa}^2(x)$ is the modified Debye-Huckel parameter, $c_i$ is the concentration of species $i$, $q_i$ is the charge of species $i$, $\epsilon$ is the dielectric function, and $u(x)$ is the dimensionless electrostatic potential. The energy is scaled to units of $k_b T$.

Author
Nathan Baker
Parameters
theeVfetk object
colorPartition restriction for energy evaluation, only used if non-negative
Returns
The "mobile charge" and "polarization" contributions to the electrostatic energy in units of $k_B T$.
Parameters
theeThe Vfetk object
colorPartition restriction for energy calculation; if non-negative, energy calculation is restricted to the specified partition (indexed by simplex and atom colors

Definition at line 842 of file vfetk.c.

◆ Vfetk_dtor()

VEXTERNC void Vfetk_dtor ( Vfetk **  thee)

Object destructor.

Author
Nathan Baker
Parameters
theePointer to memory location of Vfetk object

Definition at line 625 of file vfetk.c.

◆ Vfetk_dtor2()

VEXTERNC void Vfetk_dtor2 ( Vfetk thee)

FORTRAN stub object destructor.

Author
Nathan Baker
Parameters
theePointer to Vfetk object to be destroyed

Definition at line 633 of file vfetk.c.

◆ Vfetk_dumpLocalVar()

VEXTERNC void Vfetk_dumpLocalVar ( )

Debugging routine to print out local variables used by PDE object.

Author
Nathan Baker
Bug:
This function is not thread-safe

Definition at line 2255 of file vfetk.c.

◆ Vfetk_energy()

VEXTERNC double Vfetk_energy ( Vfetk thee,
int  color,
int  nonlin 
)

Return the total electrostatic energy.

Using the solution at the finest mesh level, get the electrostatic energy using the free energy functional for the Poisson-Boltzmann equation without removing any self-interaction terms (i.e., removing the reference state of isolated charges present in an infinite dielectric continuum with the same relative permittivity as the interior of the protein) and return the result in units of $k_B T$. The argument color allows the user to control the partition on which this energy is calculated; if (color == -1) no restrictions are used. The solution is obtained from the finest level of the passed AM object, but atomic data from the Vfetk object is used to calculate the energy.

Author
Nathan Baker
Returns
Total electrostatic energy in units of $k_B T$.

< Total energy

<

<

Parameters
theeTHe Vfetk object
colorPartition restriction for energy calculation; if non-negative, energy calculation is restricted to the specified partition (indexed by simplex and atom colors
nonlinIf 1, the NPBE energy functional is used; otherwise, the LPBE energy functional is used. If -2, SMPBE is used.

Definition at line 693 of file vfetk.c.

◆ Vfetk_externalUpdateFunction()

VEXTERNC void Vfetk_externalUpdateFunction ( SS **  simps,
int  num 
)

External hook to simplex subdivision routines in Gem. Called each time a simplex is subdivided (we use it to update the charge-simplex map)

Author
Nathan Baker
Bug:
This function is not thread-safe.
Parameters
simpsList of parent (simps[0]) and children (remainder) simplices
numNumber of simplices in list

Definition at line 2078 of file vfetk.c.

◆ Vfetk_fillArray()

VEXTERNC int Vfetk_fillArray ( Vfetk thee,
Bvec *  vec,
Vdata_Type  type 
)

Fill an array with the specified data.

Author
Nathan Baker
Note
This function is thread-safe
Bug:
Several values of type are not implemented
Returns
1 if successful, 0 otherwise
Parameters
theeThe Vfetk object with the data
vecThe vector to hold the data
typeTHe type of data to write

Definition at line 2299 of file vfetk.c.

◆ Vfetk_genCube()

VEXTERNC Vrc_Codes Vfetk_genCube ( Vfetk thee,
double  center[3],
double  length[3],
Vfetk_MeshLoad  meshType 
)

Construct a rectangular mesh (in the current Vfetk object)

Author
Nathan Baker

Generates a new cube mesh within the provided Vfetk object based on the specified mesh type. Creates a new copy of the mesh based on the global variables at the top of the file and the mesh type, then recenters the mesh based on the center and length variables provided to the function.

Parameters
theeVfetk object
centerCenter for mesh, which the new mesh will adjust to
lengthMesh lengths, which the new mesh will adjust to
meshTypeMesh boundary conditions

Definition at line 885 of file vfetk.c.

◆ Vfetk_getAM()

VEXTERNC AM* Vfetk_getAM ( Vfetk thee)

Get a pointer to the AM (algebra manager) object.

Author
Nathan Baker
Returns
Pointer to the AM (algebra manager) object
Parameters
theeThe Vfetk object

Definition at line 497 of file vfetk.c.

◆ Vfetk_getAtomColor()

VEXTERNC int Vfetk_getAtomColor ( Vfetk thee,
int  iatom 
)

Get the partition information for a particular atom.

Author
Nathan Baker
Note
Friend function of Vatom
Returns
Partition ID
Parameters
theeThe Vfetk object
iatomValist atom index

Definition at line 517 of file vfetk.c.

◆ Vfetk_getGem()

VEXTERNC Gem* Vfetk_getGem ( Vfetk thee)

Get a pointer to the Gem (grid manager) object.

Author
Nathan Baker
Returns
Pointer to the Gem (grid manager) object
Parameters
theeVfetk object

Definition at line 490 of file vfetk.c.

◆ Vfetk_getSolution()

VEXTERNC double* Vfetk_getSolution ( Vfetk thee,
int *  length 
)

Create an array containing the solution (electrostatic potential in units of $k_B T/e$) at the finest mesh level.

Author
Nathan Baker and Michael Holst
Note
The user is responsible for destroying the newly created array
Returns
Newly created array of length "length" (see above); the user is responsible for destruction
Parameters
theeVfetk object with solution
lengthSte to length of the newly created solution array

Definition at line 641 of file vfetk.c.

◆ Vfetk_getVcsm()

VEXTERNC Vcsm* Vfetk_getVcsm ( Vfetk thee)

Get a pointer to the Vcsm (charge-simplex map) object.

Author
Nathan Baker
Returns
Pointer to the Vcsm (charge-simplex map) object
Parameters
theeThe Vfetk object

Definition at line 510 of file vfetk.c.

◆ Vfetk_getVpbe()

VEXTERNC Vpbe* Vfetk_getVpbe ( Vfetk thee)

Get a pointer to the Vpbe (PBE manager) object.

Author
Nathan Baker
Returns
Pointer to the Vpbe (PBE manager) object
Parameters
theeThe Vfetk object

Definition at line 503 of file vfetk.c.

◆ Vfetk_loadGem()

VEXTERNC Vrc_Codes Vfetk_loadGem ( Vfetk thee,
Gem *  gm 
)

Load a Gem geometry manager object into Vfetk.

Author
Nathan Baker
Parameters
theeDestination
gmGeometry manager source

◆ Vfetk_loadMesh()

VEXTERNC Vrc_Codes Vfetk_loadMesh ( Vfetk thee,
double  center[3],
double  length[3],
Vfetk_MeshLoad  meshType,
Vio *  sock 
)

Loads a mesh into the Vfetk (and associated) object(s).

Author
Nathan Baker

If we have an external mesh, load that external mesh from the provided socket. If we specify a non-external mesh type, we generate a new mesh cube based on templates. We then create and store a new Vcsm object in our Vfetk structure, which will carry the mesh data.

Parameters
theeVfetk object to load into
centerCenter for mesh (if constructed)
lengthMesh lengths (if constructed)
meshTypeType of mesh to load
sockSocket for external mesh data (NULL otherwise)

Definition at line 980 of file vfetk.c.

◆ Vfetk_memChk()

VEXTERNC unsigned long int Vfetk_memChk ( Vfetk thee)

Return the memory used by this structure (and its contents) in bytes.

Author
Nathan Baker
Returns
The memory used by this structure and its contents in bytes
Parameters
theeTHe Vfetk object

Definition at line 867 of file vfetk.c.

◆ Vfetk_PDE_bisectEdge()

VEXTERNC void Vfetk_PDE_bisectEdge ( int  dim,
int  dimII,
int  edgeType,
int  chart[],
double  vx[][VAPBS_DIM] 
)

Define the way manifold edges are bisected.

Author
Nathan Baker and Mike Holst
Note
This function is thread-safe.
Parameters
dimIntrinsic dimension of manifold
dimIIEmbedding dimension of manifold
edgeTypeType of edge being refined
chartChart for edge vertices, used here as accessibility bitfields
vxEdge vertex coordindates

◆ Vfetk_PDE_ctor()

VEXTERNC PDE* Vfetk_PDE_ctor ( Vfetk fetk)

Constructs the FEtk PDE object.

Author
Nathan Baker
Returns
Newly-allocated PDE object
Bug:
Not thread-safe
Parameters
fetkThe Vfetk object

Definition at line 1176 of file vfetk.c.

◆ Vfetk_PDE_ctor2()

VEXTERNC int Vfetk_PDE_ctor2 ( PDE *  thee,
Vfetk fetk 
)

Intializes the FEtk PDE object.

Author
Nathan Baker (with code by Mike Holst)
Returns
1 if successful, 0 otherwise
Bug:
Not thread-safe
Parameters
theeThe newly-allocated PDE object
fetkThe parent Vfetk object

Definition at line 1187 of file vfetk.c.

◆ Vfetk_PDE_delta()

VEXTERNC void Vfetk_PDE_delta ( PDE *  thee,
int  type,
int  chart,
double  txq[],
void *  user,
double  F[] 
)

Evaluate a (discretized) delta function source term at the given point.

Author
Nathan Baker
Bug:
This function is not thread-safe
Parameters
theePDE object
typeVertex type
chartChart for point coordinates
txqPoint coordinates
userVertex object pointer
FSet to delta function value

Definition at line 1780 of file vfetk.c.

◆ Vfetk_PDE_DFu_wv()

VEXTERNC double Vfetk_PDE_DFu_wv ( PDE *  thee,
int  key,
double  W[],
double  dW[][VAPBS_DIM],
double  V[],
double  dV[][VAPBS_DIM] 
)

This is the linearization of the weak form of the PBE; e.g., for use in a Newton iteration. This is the functional linearization of the strong form integrated with a test function to give:

\[ \int_\Omega \left[ \epsilon \nabla w \cdot \nabla v + b'(u) w v - f v \right] dx \]

where $b'(u)$ denotes the functional derivation of the mobile ion term.

Author
Nathan Baker and Mike Holst
Returns
Integrand value
Bug:
This function is not thread-safe
Parameters
theeThe PDE object
keyIntegrand to evaluate (0 = interior weak form, 1 = boundary weak form)
WTrial function value at current point
dWTrial function gradient at current point
VTest function value at current point
dVTest function gradient

◆ Vfetk_PDE_dtor()

VEXTERNC void Vfetk_PDE_dtor ( PDE **  thee)

Destroys FEtk PDE object.

Author
Nathan Baker
Note
Thread-safe
Parameters
theePointer to PDE object memory

Definition at line 1231 of file vfetk.c.

◆ Vfetk_PDE_dtor2()

VEXTERNC void Vfetk_PDE_dtor2 ( PDE *  thee)

FORTRAN stub: destroys FEtk PDE object.

Author
Nathan Baker
Note
Thread-safe
Parameters
theePDE object memory

Definition at line 1246 of file vfetk.c.

◆ Vfetk_PDE_Fu()

VEXTERNC void Vfetk_PDE_Fu ( PDE *  thee,
int  key,
double  F[] 
)

Evaluate strong form of PBE. For interior points, this is:

\[ -\nabla \cdot \epsilon \nabla u + b(u) - f \]

where $b(u)$ is the (possibly nonlinear) mobile ion term and $f$ is the source charge distribution term (for PBE) or the induced surface charge distribution (for RPBE). For an interior-boundary (simplex face) point, this is:

\[ [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^+} - [\epsilon(x) \nabla u(x) \cdot n(x)]_{x=0^-} \]

where $n(x)$ is the normal to the simplex face and the term represents the jump in dielectric displacement across the face. There is no outer-boundary contribution for this problem.

Author
Nathan Baker
Bug:

This function is not thread-safe

This function is not implemented (sets error to zero)

Parameters
theeThe PDE object
keyType of point (0 = interior, 1 = boundary, 2 = interior boundary
FSet to value of residual

Definition at line 1695 of file vfetk.c.

◆ Vfetk_PDE_Fu_v()

VEXTERNC double Vfetk_PDE_Fu_v ( PDE *  thee,
int  key,
double  V[],
double  dV[][VAPBS_DIM] 
)

This is the weak form of the PBE; i.e. the strong form integrated with a test function to give:

\[ \int_\Omega \left[ \epsilon \nabla u \cdot \nabla v + b(u) v - f v \right] dx \]

where $b(u)$ denotes the mobile ion term.

Author
Nathan Baker and Mike Holst
Returns
Integrand value
Bug:
This function is not thread-safe
Parameters
theeThe PDE object
keyIntegrand to evaluate (0 = interior weak form, 1 = boundary weak form
VTest function at current point
dVTest function derivative at current point

Definition at line 1703 of file vfetk.c.

◆ Vfetk_PDE_initAssemble()

VEXTERNC void Vfetk_PDE_initAssemble ( PDE *  thee,
int  ip[],
double  rp[] 
)

Do once-per-assembly initialization.

Author
Nathan Baker and Mike Holst
Note
Thread-safe
Parameters
theePDE object
ipInteger parameter array (not used)
rpDouble parameter array (not used)

Definition at line 1508 of file vfetk.c.

◆ Vfetk_PDE_initElement()

VEXTERNC void Vfetk_PDE_initElement ( PDE *  thee,
int  elementType,
int  chart,
double  tvx[][VAPBS_DIM],
void *  data 
)

Do once-per-element initialization.

Author
Nathan Baker and Mike Holst
Bug:
This function is not thread-safe
Parameters
theePDE object
elementTypeMaterial type (not used)
chartChart in which the vertex coordinates are provided, used here as a bitfield to store molecular accessibility
tvxVertex coordinates
dataSimplex pointer (hack)

◆ Vfetk_PDE_initFace()

VEXTERNC void Vfetk_PDE_initFace ( PDE *  thee,
int  faceType,
int  chart,
double  tnvec[] 
)

Do once-per-face initialization.

Author
Nathan Baker and Mike Holst
Bug:
This function is not thread-safe
Parameters
theeTHe PDE object
faceTypeSimplex face type (interior or various boundary types)
chartChart in which the vertex coordinates are provided, used here as a bitfield for molecular accessibility
tnvecCoordinates of outward normal vector for face

Definition at line 1559 of file vfetk.c.

◆ Vfetk_PDE_initPoint()

VEXTERNC void Vfetk_PDE_initPoint ( PDE *  thee,
int  pointType,
int  chart,
double  txq[],
double  tU[],
double  tdU[][VAPBS_DIM] 
)

Do once-per-point initialization.

Author
Nathan Baker
Bug:

This function is not thread-safe

This function uses pre-defined boudnary definitions for the molecular surface.

Parameters
theeThe PDE object
pointTypeThe type of point – interior or various faces
chartThe chart in which the point coordinates are provided, used here as bitfield for molecular accessibility
txqPoint coordinates
tUSolution value at point
tdUSolution derivative at point

◆ Vfetk_PDE_Ju()

VEXTERNC double Vfetk_PDE_Ju ( PDE *  thee,
int  key 
)

Energy functional. This returns the energy (less delta function terms) in the form:

\[ c^{-1}/2 \int (\epsilon (\nabla u)^2 + \kappa^2 (cosh u - 1)) dx \]

for a 1:1 electrolyte where $c$ is the output from Vpbe_getZmagic.

Author
Nathan Baker
Returns
Energy value (in kT)
Bug:
This function is not thread-safe.
Parameters
theeThe PDE object
keyWhat to evluate: interior (0) or boundary (1)?

Definition at line 2003 of file vfetk.c.

◆ Vfetk_PDE_mapBoundary()

VEXTERNC void Vfetk_PDE_mapBoundary ( int  dim,
int  dimII,
int  vertexType,
int  chart,
double  vx[VAPBS_DIM] 
)

Map a boundary point to some pre-defined shape.

Author
Nathan Baker and Mike Holst
Note
This function is thread-safe and is a no-op
Parameters
dimIntrinsic dimension of manifold
dimIIEmbedding dimension of manifold
vertexTypeType of vertex
chartChart for vertex coordinates
vxVertex coordinates

◆ Vfetk_PDE_markSimplex()

VEXTERNC int Vfetk_PDE_markSimplex ( int  dim,
int  dimII,
int  simplexType,
int  faceType[VAPBS_NVS],
int  vertexType[VAPBS_NVS],
int  chart[],
double  vx[][VAPBS_DIM],
void *  simplex 
)

User-defined error estimator – in our case, a geometry-based refinement method; forcing simplex refinement at the dielectric boundary and (for non-regularized PBE) the charges.

Author
Nathan Baker
Returns
1 if mark simplex for refinement, 0 otherwise
Bug:
This function is not thread-safe
Parameters
dimIntrinsic manifold dimension
dimIIEmbedding manifold dimension
simplexTypeType of simplex being refined
faceTypeTypes of faces in simplex
vertexTypeTypes of vertices in simplex
chartCharts for vertex coordinates
vxVertex coordinates
simplexSimplex pointer

◆ Vfetk_PDE_oneChart()

VEXTERNC void Vfetk_PDE_oneChart ( int  dim,
int  dimII,
int  objType,
int  chart[],
double  vx[][VAPBS_DIM],
int  dimV 
)

Unify the chart for different coordinate systems – a no-op for us.

Author
Nathan Baker
Note
Thread-safe; a no-op
Parameters
dimIntrinsic manifold dimension
dimIIEmbedding manifold dimension
objType???
chartCharts of vertices' coordinates
vxVertices' coordinates
dimVNumber of vertices

◆ Vfetk_PDE_simplexBasisForm()

VEXTERNC void Vfetk_PDE_simplexBasisForm ( int  key,
int  dim,
int  comp,
int  pdkey,
double  xq[],
double  basis[] 
)

Evaluate the bases for the trial or test space, for a particular component of the system, at all quadrature points on the master simplex element.

Author
Mike Holst
Parameters
keyBasis type to evaluate (0 = trial, 1 = test, 2 = trialB, 3 = testB)
dimSpatial dimension
compWhich component of elliptic system to produce basis for
pdkeyBasis partial differential equation evaluation key:
  • 0 = evaluate basis(x,y,z)
  • 1 = evaluate basis_x(x,y,z)
  • 2 = evaluate basis_y(x,y,z)
  • 3 = evaluate basis_z(x,y,z)
  • 4 = evaluate basis_xx(x,y,z)
  • 5 = evaluate basis_yy(x,y,z)
  • 6 = evaluate basis_zz(x,y,z)
  • 7 = etc...
xqSet to quad pt coordinate
basisSet to all basis functions evaluated at all quadrature pts

Definition at line 2203 of file vfetk.c.

◆ Vfetk_PDE_simplexBasisInit()

VEXTERNC int Vfetk_PDE_simplexBasisInit ( int  key,
int  dim,
int  comp,
int *  ndof,
int  dof[] 
)

Initialize the bases for the trial or the test space, for a particular component of the system, at all quadrature points on the master simplex element.

Author
Mike Holst
Note
*   The basis ordering is important.  For a fixed quadrature
*   point iq, you must follow the following ordering in p[iq][],
*   based on how you specify the degrees of freedom in dof[]:
*
*   <v_0 vDF_0>,      <v_1 vDF_0>,      ..., <v_{nv} vDF_0>
*   <v_0 vDF_1>,      <v_1 vDF_1>,      ..., <v_{nv} vDF_1>
*                           ...
*   <v_0 vDF_{nvDF}>, <v_0 vDF_{nvDF}>, ..., <v_{nv} vDF_{nvDF}>
*
*   <e_0 eDF_0>,      <e_1 eDF_0>,      ..., <e_{ne} eDF_0>
*   <e_0 eDF_1>,      <e_1 eDF_1>,      ..., <e_{ne} eDF_1>
*                           ...
*   <e_0 eDF_{neDF}>, <e_1 eDF_{neDF}>, ..., <e_{ne} eDF_{neDF}>
*
*   <f_0 fDF_0>,      <f_1 fDF_0>,      ..., <f_{nf} fDF_0>
*   <f_0 fDF_1>,      <f_1 fDF_1>,      ..., <f_{nf} fDF_1>
*                           ...
*   <f_0 fDF_{nfDF}>, <f_1 fDF_{nfDF}>, ..., <f_{nf} fDF_{nfDF}>
*
*   <s_0 sDF_0>,      <s_1 sDF_0>,      ..., <s_{ns} sDF_0>
*   <s_0 sDF_1>,      <s_1 sDF_1>,      ..., <s_{ns} sDF_1>
*                           ...
*   <s_0 sDF_{nsDF}>, <s_1 sDF_{nsDF}>, ..., <s_{ns} sDF_{nsDF}>
*
*   For example, linear elements in R^3, with one degree of freedom at each *
*   vertex, would use the following ordering:
*
*     <v_0 vDF_0>, <v_1 vDF_0>, <v_2 vDF_0>, <v_3 vDF_0>
*
*   Quadratic elements in R^2, with one degree of freedom at each vertex and
*   edge, would use the following ordering:
*
*     <v_0 vDF_0>, <v_1 vDF_0>, <v_2 vDF_0>
*     <e_0 eDF_0>, <e_1 eDF_0>, <e_2 eDF_0>
*
*   You can use different trial and test spaces for each component of the
*   elliptic system, thereby allowing for the use of Petrov-Galerkin methods.
*   You MUST then tag the bilinear form symmetry entries as nonsymmetric in
*   your PDE constructor to reflect that DF(u)(w,v) will be different from
*   DF(u)(v,w), even if your form acts symmetrically when the same basis is
*   used for w and v.
*
*   You can also use different trial spaces for each component of the elliptic
*   system, and different test spaces for each component of the elliptic
*   system.  This allows you to e.g.  use a basis which is vertex-based for
*   one component, and a basis which is edge-based for another.  This is
*   useful in fluid mechanics, eletromagnetics, or simply to play around with
*   different elements.
*
*   This function is called by MC to build new master elements whenever it
*   reads in a new mesh.  Therefore, this function does not have to be all
*   that fast, and e.g.  could involve symbolic computation.
*   
Parameters
keyBasis type to evaluate (0 = trial, 1 = test, 2 = trialB, 3 = testB)
dimSpatial dimension
compWhich component of elliptic system to produce basis for?
ndofSet to the number of degrees of freedom
dofSet to degree of freedom per v/e/f/s

Definition at line 2140 of file vfetk.c.

◆ Vfetk_PDE_u_D()

VEXTERNC void Vfetk_PDE_u_D ( PDE *  thee,
int  type,
int  chart,
double  txq[],
double  F[] 
)

Evaluate the Dirichlet boundary condition at the given point.

Author
Nathan Baker
Bug:

This function is hard-coded to call only multiple-sphere Debye-Hü functions.

This function is not thread-safe.

Parameters
theePDE object
typeVertex boundary type
chartChart for point coordinates
txqPoint coordinates
FSet to boundary values

Definition at line 1867 of file vfetk.c.

◆ Vfetk_PDE_u_T()

VEXTERNC void Vfetk_PDE_u_T ( PDE *  thee,
int  type,
int  chart,
double  txq[],
double  F[] 
)

Evaluate the "true solution" at the given point for comparison with the numerical solution.

Author
Nathan Baker
Note
This function only returns zero.
Bug:
This function is not thread-safe.

The signature here doesn't match what's in mc's src/pde/mc/pde.h, which g++ seems to dislike for GAMer integration. Trying a change of function signature to match to see if that makes g++ happy. Also see vfetk.h for similar signature change. - P. Ellis 11-8-2011

Parameters
theePDE object
typePoint type
chartChart for point coordinates
txqPoint coordinates
FSet to value at point

Definition at line 1886 of file vfetk.c.

◆ Vfetk_qfEnergy()

VEXTERNC double Vfetk_qfEnergy ( Vfetk thee,
int  color 
)

Get the "fixed charge" contribution to the electrostatic energy.

Using the solution at the finest mesh level, get the electrostatic energy due to the interaction of the fixed charges with the potential:

\[ G = \sum_i q_i u(r_i) \]

and return the result in units of $k_B T$. Clearly, no self-interaction terms are removed. A factor a 1/2 has to be included to convert this to a real energy.

Author
Nathan Baker
Parameters
theeVfetk object
colorPartition restriction for energy evaluation, only used if non-negative
Returns
The fixed charge electrostatic energy in units of $k_B T$.
Parameters
theeThe Vfetk object
colorPartition restriction for energy evaluation, only used if non-negative

Definition at line 732 of file vfetk.c.

◆ Vfetk_readMesh()

VEXTERNC void Vfetk_readMesh ( Vfetk thee,
int  skey,
Vio *  sock 
)

Read in mesh and initialize associated internal structures.

Author
Nathan Baker
Note
See also
Vfetk_genCube
Parameters
theeTHe Vfetk object
skeyThe sock format key (0 = MCSF simplex format)
sockSocket object ready for reading

◆ Vfetk_setAtomColors()

VEXTERNC void Vfetk_setAtomColors ( Vfetk thee)

Transfer color (partition ID) information frmo a partitioned mesh to the atoms.

Transfer color information from partitioned mesh to the atoms. In the case that a charge is shared between two partitions, the partition color of the first simplex is selected. Due to the arbitrary nature of this selection, THIS METHOD SHOULD ONLY BE USED IMMEDIATELY AFTER PARTITIONING!!!

Warning
This function should only be used immediately after mesh partitioning
Author
Nathan Baker
Note
This is a friend function of Vcsm
Parameters
theeTHe Vfetk object

Definition at line 849 of file vfetk.c.

◆ Vfetk_setParameters()

VEXTERNC void Vfetk_setParameters ( Vfetk thee,
PBEparm pbeparm,
FEMparm feparm 
)

Set the parameter objects.

Author
Nathan Baker
Parameters
theeThe Vfetk object
pbeparmParameters for solution of the PBE
feparmFEM-speecific solution parameters

Definition at line 615 of file vfetk.c.

◆ Vfetk_write()

VEXTERNC int Vfetk_write ( Vfetk thee,
const char *  iodev,
const char *  iofmt,
const char *  thost,
const char *  fname,
Bvec *  vec,
Vdata_Format  format 
)

Write out data.

Author
Nathan Baker
Parameters
theeVfetk object
vecFEtk Bvec vector to use
formatFormat for data
iodevOutput device type (FILE/BUFF/UNIX/INET)
iofmtOutput device format (ASCII/XDR)
thostOutput hostname (for sockets)
fnameOutput FILE/BUFF/UNIX/INET name
Note
This function is thread-safe
Bug:
Some values of format are not implemented
Returns
1 if successful, 0 otherwise
Parameters
theeThe Vfetk object
iodevOutput device type (FILE = file, BUFF = buffer, UNIX = unix pipe, INET = network socket)
iofmtOutput device format (ASCII = ascii/plaintext, XDR = xdr)
thostOutput hostname for sockets
fnameOutput filename for other
vecData vector
formatData format

Definition at line 2464 of file vfetk.c.