Finite-difference Poisson-Boltzmann calculations
Parameters for a finite-difference polar solvation calculation.
- apbs.input_file.calculate.finite_difference.ERROR_TOLERANCE = 1e-06
Relative error tolerance for iterative solver.
- class apbs.input_file.calculate.finite_difference.FiniteDifference(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters for a finite-difference polar solvation Poisson-Boltzmann calculation.
Objects can be initialized with dictionary/JSON/YAML data with the following keys:
boundary condition
:boundary_condition()
calculate energy
: seecalculate_energy()
calculate forces
: seecalculate_forces()
calculation type
: seecalculation_type()
as well asFocus
andManual
calculation parameters
: seecalculation_parameters()
charge discretization
: method used to map charges onto the grid; seecharge_discretization()
error tolerance
: solver error tolerance; seeerror_tolerance()
equation
: what version of the Poisson-Boltzmann equation to solve; seeequation()
ions
: information about mobile ion species; seeions()
molecule
: alias to molecule for calculation; seemolecule()
no-op
: determine whether the solver should be run; seenoop()
solute dielectric
: seesolute_dielectric()
solvent dielectric
: seesolvent_dielectric()
solvent radius
: seesolvent_radius()
surface method
: seesurface_method()
surface spline window
: seesurface_spline_window()
temperature
: seetemperature()
use maps
: use input map for one or more properties of the system; seeuse_maps()
write atom potentials
: write out atom potentials; seewrite_atom_potentials()
write maps
: write out one or more properties of the system to a map; seewrite_maps()
- property boundary_condition: str
Boundary condition for Poisson-Boltzmann equation.
This property can have one of the following values:
zero
: Dirichlet condition where the potential at the boundary is set to zero. This condition is not commonly used and can result in large errors if used inappropriately.single sphere
: Dirichlet condition where the potential at the boundary is set to the values prescribed by a Debye-Hückel model for a single sphere with a point charge, dipole, and quadrupole. The sphere radius in this model is set to the radius of the biomolecule and the sphere charge, dipole, and quadrupole are set to the total moments of the protein. This condition works best when the boundary is sufficiently far (multiple Debye lengths) from the biomolecule.multiple sphere
: Dirichlet condition where the potential at the boundary is set to the values prescribed by a Debye-Hückel model for multiple, non-interacting spheres with a point charges. The radii of the non-interacting spheres are set to the atomic radii of and the sphere charges are set to the atomic charges. This condition works better thansingle sphere
for closer boundaries but can be very slow for large biomolecules.focus
alias
: Dirichlet condition where the potential at the boundary is set to the values computed by a previous (usually lower-resolution) PB calculation with aliasalias
. All of the boundary points should lie within the domain of the previous calculation for best accuracy; if any boundary points lie outside, their values are computed using thesingle sphere
Debye-Hückel boundary condition (see above).
- Raises
ValueError – if set to an invalid boundary type
IndexError – if an insufficient number of words are present
- property calculate_energy: bool
Indicate whether energy should be calculated.
- Raises
TypeError – if not Boolean
- property calculate_forces: bool
Indicate whether forces should be calculated.
- Raises
TypeError – if not Boolean
- property calculation_parameters: InputFile
Specify parameters specific to the calculation type.
The specific class is specific to the calculation type (see
calculation_type()
):Note
The
calculation_type()
property must be set before setting this property (sorry…)- Raises
ValueError – if calculation parameter class doesn’t match calculation type or if
- property calculation_type: str
Specify the type of finite difference calculation to perform:
focus
: this uses multiple grids to generate high-resolution solutions at a region of interest. SeeFocus
for more information.manual
: perform a traditional non-focused calculation. SeeManual
for more information.
- Raises
ValueError – if invalid calculation type specified
- property charge_discretization: str
The method by which the biomolecular point charges (i.e., Dirac delta functions) by which charges are mapped to the grid used for the finite difference calculation.
As we are attempting to model delta functions, the support (domain) of these discretized charge distributions is always strongly dependent on the grid spacing.
The following types of discretization are supported:
linear
: Traditional trilinear interpolation (linear splines). The charge is mapped onto the nearest-neighbor grid points. Resulting potentials are very sensitive to grid spacing, length, and position.cubic
: Cubic B-spline discretization. The charge is mapped onto the nearest- and next-nearest-neighbor grid points. Resulting potentials are somewhat less sensitive (thanlinear
) to grid spacing, length, and position.quintic
: Quintic B-spline discretization. Similar tocubic
, except the charge/multipole is additionally mapped to include next-next-nearest neighbors (125 grid points receive charge density).
- Raises
TypeError – if not set to string
ValueError – if not one of the allowed values above
- property equation: str
Specifies which version of the Poisson-Boltzmann equation (PBE) to solve:
Most users should use one of these:
linearized pbe
nonlinear pbe
These versions are experimental and unstable:
linearized regularized pbe
nonlinear regularized pbe
- Raises
TypeError – if not set to a string.
ValueError – if set to an invalid value
- property error_tolerance: float
Relative error tolerance for iterative solver.
If not specified, the default value is
ERROR_TOLERANCE
.- Raises
TypeError – if not set to positive number
ValueError – if not set to number less than 1
- from_dict(input_)[source]
Load object from dictionary.
- Raises
KeyError – if some entries not found.
ValueError – for invalid entries.
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property ions: MobileIons
Descriptions of mobile ion species.
- Raises
TypeError – if not set to a
Ions
object
- property molecule: str
Specify which molecule to use for calculation.
- Returns
alias for molecule read (see Data loading input file section (required))
- Raises
TypeError – if not set to a string
- property noop: bool
Determine whether solver is run.
If set to
True
, then skip running the solver but still calculate coefficient maps, etc.The default value of this property is
False
.- Raises
TypeError – if not set to
bool
- property solute_dielectric: float
Solute dielectric.
The dielectric value of a solute is often chosen using the following rules of thumb:
1: only used to compare calculation results with non-polarizable molecular simulation
2-4: “molecular” dielectric value; used when conformational degrees of freedom are modeled explicitly
4-8: used to mimic sidechain libration and other small-scale conformational degrees of freedom
8-12: used to model larger-scale sidechain rearrangement
20-40: used to model larger-scale macromolecular conformational changes and/or water penetration into interior of molecule
Note
What does the continuum dielectric value of a non-continuum molecule mean? Hard to say – this approximation can be very difficult to interpret and can significant affect your results.
- Returns
a floating point number greater than or equal to one
- Raises
TypeError – if not a number
ValueError – if not greater than or equal to 1
- property solvent_dielectric: float
Solvent dielectric.
78.5 is a good choice for water at 298 K.
- Returns
a floating point number greater than or equal to one
- Raises
TypeError – if not a number
ValueError – if not greater than or equal to 1
- property solvent_radius: float
Radius of the solvent molecules.
This parameter is used to define various solvent-related surfaces and volumes (see
surface_method()
). This value is usually set to 1.4 Å for a water-like molecular surface and set to 0 Å for a van der Waals surface.- Raises
ValueError – if value is not a non-negative number
- property surface_method: str
Method used to defined solute-solvent interface.
One of the following values:
molecular surface
: The dielectric coefficient is defined based on a molecular surface definition. The problem domain is divided into two spaces. The “free volume” space is defined by the union of solvent-sized spheres (seesolvent_radius()
) which do not overlap with the solute atoms. This free volume is assigned bulk solvent dielectric values. The complement of this space is assigned solute dielectric values. When the solvent radius is set to zero, this method corresponds to a van der Waals surface definition. The ion-accessibility coefficient is defined by an “inflated” van der Waals model. Specifically, the radius of each biomolecular atom is increased by the radius of the ion species (as specified with theion()
property). The problem domain is then divided into two spaces. The space inside the union of these inflated atomic spheres is assigned an ion-accessibility value of 0; the complement space is assigned the bulk ion accessibility value. See Connolly ML, J Appl Crystallography 16 548-558, 1983 (10.1107/S0021889883010985).smoothed molecular surface
: The dielectric and ion-accessibility coefficients are defined as for themolecular surface
(see above). However, they are then “smoothed” by a 9-point harmonic averaging to somewhat reduce sensitivity to the grid setup. See Bruccoleri et al. J Comput Chem 18 268-276, 1997 (10.1007/s00214-007-0397-0).cubic spline
: The dielectric and ion-accessibility coefficients are defined by a cubic-spline surface as described by Im et al, Comp Phys Commun 111 (1-3) 59-75, 1998 (10.1016/S0010-4655(98)00016-2). The width of the dielectric interface is controlled by thespline_window()
property. These spline-based surface definitions are very stable with respect to grid parameters and therefore ideal for calculating forces. However, they require substantial reparameterization of the force field; interested users should consult Nina et al, Biophys Chem 78 (1-2) 89-96, 1999 (10.1016/S0301-4622(98)00236-1). Additionally, these surfaces can generate unphysical results with non-zero ionic strengths.septic spline
: The dielectric and ion-accessibility coefficients are defined by a 7th order polynomial. This surface definition has characteristics similar to the cubic spline, but provides higher order continuity necessary for stable force calculations with atomic multipole force fields (up to quadrupole).
- Raises
TypeError – if not set to a string
ValueError – if set to invalid value
- property surface_spline_window: float
Window for spline-based surface definitions (not needed otherwise).
This is the distance (in Å) over which the spline transitions from the solvent dielectric value to the solute dielectric value. A typical value is 0.3 Å.
- Returns
positive number
- Raises
TypeError – if not a positive number
- property temperature: float
Temperature for the calculation in Kelvin.
- Raises
ValueError – if not a positive number (no violations of the 3rd Law!)
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.
- property use_maps: list
Information for (optionally) using maps read into APBS.
- Returns
list of
UseMap
objects- Raises
TypeError – if not a list of
UseMap
objects
- property write_atom_potentials: str
Write out the electrostatic potential at each atom location.
Write out text file with potential at center of atom in units of \(k_b \, T \, e_c^{-1}\).
Note
These numbers are meaningless by themselves due to the presence of “self-energy” terms that are sensitive to grid spacing and position. These numbers should be evaluated with respect to a reference calculation: the potentials from that reference calculation should be subtracted from the target system. For example, one calculation might include a molecule with a heterogeneous dielectric coefficient and the reference system might be exactly the same system setup but with a homeogeneous dielectric coefficient. If the results from the reference calculation are substracted from the first calculation, then the result will be a physically meaningful reaction field potential. However, the results from the first and reference calculations are meaningless by themselves.
- Returns
path to text file for writing atom potential values.
- Raises
TypeError – if not set to string
- property write_maps: list
Write out maps related to computed properties.
See
WriteMap
for more information.- Raises
TypeError – if set to wrong type
- class apbs.input_file.calculate.finite_difference.Focus(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters specific to a focused-grid finite-difference polar solvation Poisson-Boltzmann calculation.
Focusing provides automatically configured finite difference Poisson-Boltzmann calculations.
This multigrid calculation automatically sets up and performs a string of single-point PBE calculations to “focus” on a region of interest (binding site, etc.) in a system. It is basically an automated way to set parameters in
Manual
, allowing for (hopefully) easier use. Most users should use thisFocus
rather thanManual
.Focusing is a method for solving the Poisson-Boltzmann equation in a finite difference setting. Some of the earliest references to this method are from Gilson and Honig (DOI:10.1038/330084a0). The method starts by solving the equation on a coarse grid (i.e., few grid points) with large dimensions (i.e., grid lengths). The solution on this coarse grid is then used to set the Dirichlet boundary condition values for a smaller problem domain – and therefore a finer grid – surrounding the region of interest. The finer grid spacing in the smaller problem domain often provides greater accuracy in the solution.
Note
During focusing calculations, you may encounter the message
WARNING! Unusually large potential values detected on the focusing boundary!
for some highly charged systems based on location of the focusing boundary. First, you should determine if you received any other warning or error messages as part of this calculation, particularly those referring to exceeded number of iterations or error tolerance. Next, you should check if the calculation converged to a reasonable answer. In particular, you should check sensitivity to the grid spacing by making small changes to the grid lengths and see if the changes in energies are correspondingly small. If so, then this warning can be safely ignored.Objects can be initialized with dictionary/JSON/YAML data with the following keys:
coarse grid center
: center of the coarse grid, seecoarse_grid_center()
coarse grid dimensions
: dimensions of the coarse grid, seecoarse_grid_dimensions()
fine grid center
: center of the fine grid, seefine_grid_center()
fine grid dimensions
: dimensions of the fine grid, seefine_grid_dimensions()
parallel
: a Boolean, indicating whether a parallel calculation should be performed; seeparallel()
. If this value is true, theparallel parameters
object should be included in the input file; seeparallel_parameters()
.parallel parameters
: optional information for configuring a parallel focusing run; required ifparallel()
is True. Seeparallel_parameters()
andParallelFocus
for more information.
- property coarse_grid_center: GridCenter
The center of the coarse grid in a focusing calculation.
- Raises
TypeError – if not
GridCenter
object
- property coarse_grid_dimensions: GridDimensions
Dimensions of the coarse grid in a focusing finite-difference Poisson-Boltzmann calculation.
This is the starting mesh, so it should be large enough to completely enclose the biomolecule and ensure that the chosen boundary condition is appropriate.
- Raises
TypeError – if the value is not
GridDimensions
.
- property fine_grid_center: GridCenter
The center of the fine grid in a focusing calculation.
- Raises
TypeError – if not
GridCenter
object
- property fine_grid_dimensions: GridDimensions
Dimensions of the coarse grid in a focusing finite-difference Poisson-Boltzmann calculation.
This should enclose the region of interest in the biomolecule.
- Raises
TypeError – if the value is not
GridDimensions
.
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property parallel: bool
Indicate whether a parallel calculation should be performed.
If set, the
parallel_parameters()
property must also be set. Set theparallel_parameters()
property before setting this value to True (sorry).- Raises
TypeError – if set to something other than
bool
.
- property parallel_parameters: ParallelFocus
Provide parameters for a parallel focusing calculation.
This property is optional and only used if
parallel()
is True.- Raises
TypeError – if not
ParallelFocus
class
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.
- class apbs.input_file.calculate.finite_difference.GridCenter(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters for specifying the center of a finite difference grid.
Objects can be initialized with dictionary/JSON/YAML data with one of the following keys:
molecule
: use the center of the specified molecule. Seemolecule()
.position
: use a specific position (coordinates). Seeposition()
.
- from_dict(input_)[source]
Parse dictionary-format input into this object.
- Parameters
input (dict) – input dictionary
- Raises
KeyError – when input is missing
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property molecule: str
Alias for molecule used to center the finite difference grid. See Data loading input file section (required) for more information on reading molecules into APBS.
- Returns
alias for molecule at center
- Raises
TypeError – if alias is not string
- property position: list
Coordinates for the grid center.
- Returns
3-element list of
float
positions in Å units- Raises
TypeError – if input is not a list of floats
IndexError – if input is not length 3
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.
- class apbs.input_file.calculate.finite_difference.GridDimensions(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters for controlling the number of grid points and the grid spacing.
For a given direction \(i \in [x, y, z]\), the grid spacing \(h_i\) is related to the number of grid points \(n_i\) and the grid length \(l_i\) by
\[l_i = h_i (n_i - 1)\]Therefore, only two of the following three properties are needed. When all three are provided, the
spacings()
will be inferred from thecounts()
andlengths()
.counts
: the number of grid points in each direction; seecounts()
for more information.spacings
: the spacing of grid points in each direction; seespacings()
for more information.lengths
: the span of the grid in each dimension; seelengths()
for more information.
The following properties are read-only and cannot be set:
levels
: the number of multigrid levels in the calculation; seelevels()
for more information.
The number of levels \(p\) is a constant for the entire domain (i.e., it doesn’t vary by grid direction. The number of levels is related to the number of grid points \(n_i\) in the direction \(i\) by the formula
\[n_i = c \, 2^{p} + 1\]where \(c\) is a non-zero integer. The value of \(p\) is chosen as the smallest that satisfies the formula above for all \(n_i\). Calculations become more efficient for larger \(p\) so APBS will adjust the numbers of grid points \(n_i\) downwards to ensure that \(p\) is equal to or greater than
MIN_LEVEL
, likely resulting in lower grid resolution (and accuracy).The most common values for \(n_i\) are 65, 97, 129, and 161 (they can be different in each direction); these are all compatible with \(p = 4\).
- adjust_counts() bool [source]
Adjust numbers of grid points to acheive multigrid level of at least
MIN_LEVEL
.This routine alters self._counts and (re)sets self._level. The new counts will always be less than or equal to the old counts.
- Parameters
targets (list) – list of target numbers of grid points.
- Returns
True if counts were changes from targets
- property counts: list
Target number of grid points in a finite-difference Poisson-Boltzmann calculation.
Note
the actual number of grid points might be adjusted to achieve a better multigrid level. The most common values for grid dimensions are 65, 97, 129, and 161 (they can be different in each direction); these are all compatible with a
levels()
value of 4.- Returns
3-vector of integers greater than 32 indicating number of grid points in the x-, y-, and z-directions. The numbers may be different in each direction.
- Raises
IndexError – if the length of the value is not 3.
TypeError – if the counts are not integers greater than 2**``MIN_LEVEL``.
ValueError – if not enough information is present to calculate counts
- static find_count(target, min_level=4, max_level=None) tuple [source]
Find the number of grid points closest to the given target that satisfies
\[n_i = \arg \max_p c \, 2^p + 1\]where \(n_i\) is the number of grid points (always less than or equal to target), \(c\) is a positive integer constant, and \(p\) is the number of levels, greater than or equal to
MIN_LEVEL
.Note
assumes
target
is greater than or equal to 2 **MIN_LEVEL
- Parameters
target (int) – target number of grid points
max_level (int) – maximum level for multigrid
min_level (int) – minimum level for multigrid
- Returns
(\(n_i\), \(c\), \(p\))
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property lengths: list
Length of the grid in a finite-difference Poisson-Boltzmann calculation.
- Returns
3-vector of positive numbers indicating grid lengths in the x-, y-, and z-directions in Å. The lengths may be different in each direction.
- Raises
IndexError – if the length of the value is not 3.
TypeError – if the lengths are not positive numbers.
ValueError – if not enough information is available to calculate lengths
- property levels: int
Number of multigrid levels, an integer greater than 2.
- Raises
TypeError – if not an integer
ValueError – if not greater than 2
- property spacings: list
Spacings of the grid in a finite-difference Poisson-Boltzmann calculation.
- Returns
3-vector of positive numbers indicating grid spacings in the x-, y-, and z-directions in Å. The spacings may be different in each direction.
- Raises
IndexError – if the length of the value is not 3.
TypeError – if the spacings are not positive numbers.
ValueError – if not enough information is available to calculate spacings
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.
- apbs.input_file.calculate.finite_difference.MIN_LEVEL = 4
Mininum multigrid level in calculations.
- class apbs.input_file.calculate.finite_difference.Manual(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters specific to a manual finite-difference polar solvation Poisson-Boltzmann calculation.
Manually-configured finite difference multigrid Poisson-Boltzmann calculations.
This is a standard single-point multigrid PBE calculation without focusing or additional refinement. This
FiniteDifference.calculation_type()
offers the most control of parameters to the user. Several of these calculations can be strung together to perform focusing calculations by judicious choice of theFiniteDifference.boundary_condition()
property; however, the setup of the focusing is not automated as it is in theFocus
FiniteDifference.calculation_type()
. Therefore, this command should primarily be used by more experienced users.Objects can be initialized with dictionary/JSON/YAML data with the following keys:
grid center
: center of the grid, seegrid_center()
grid dimensions
: dimensions of the grid, seegrid_dimensions()
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property grid_center: GridCenter
The center of the grid in a finite difference Poisson-Boltzmann calculation.
- Raises
TypeError – if not
GridCenter
object
- property grid_dimensions: GridDimensions
Dimensions of the grid in a focusing finite-difference Poisson-Boltzmann calculation.
- Raises
TypeError – if the value is not
GridDimensions
.
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.
- class apbs.input_file.calculate.finite_difference.ParallelFocus(dict_=None, yaml=None, json=None)[source]
Bases:
InputFile
Parameters specific to a parallel focusing finite-difference polar solvation Poisson-Boltzmann calculation.
Objects can be initialized with dictionary/JSON/YAML data with the following keys:
overlap fraction
: overlap between parallel focusing subdomains; seeoverlap_fraction()
.processor array
: array of processors; seeprocessor_array()
asynchronous rank
(optional): rank of processor to behave as; seeasynchronous_rank()
- property asynchronous_rank: int
Integer rank of processor in processor array.
This should be a positive integer.
- Raises
TypeError – if not a positive integer
- from_json(input_)
Parse JSON-format input string into this object.
- Parameters
input (str) – JSON-format input string
- from_yaml(input_)
Parse YAML-format input string into this object.
- Parameters
input (str) – YAML-format input string
- property overlap_fraction: float
Fraction of size of parallel focusing domains that overlap.
This is a positive floating point number less than 1.
- Raises
TypeError – if the value is not a positive number
ValueError – if the value is greater than 1
- property processor_array: list
Distribution of processors over problem domain.
- Returns
a 3-vector of positive integers:
[npx npy npz]
the integer number of processors to be used in the x-, y- and z-directions of the system. The productnpx × npy × npz
should be less than or equal to the total number of processors with which APBS was invoked (usually via mpirun). If more processors are provided at invocation than actually used during the run, the extra processors are not used in the calculation. The processors are tiled across the domain in a Cartesian fashion with a specified amount of overlap (seeoverlap_fraction()
) between each processor to ensure continuity of the solution. Each processor’s subdomain will contain the number of grid points specified by the dime keyword. For broad spatial support of the splines, every charge included in partition needs to be at least 1 grid space (first-order spline), 2 grid spaces (third-order spline), or 3 grid spaces (fifth-order spline) away from the partition boundary.- Raises
TypeError – if not a list or list of positive integers.
IndexError – if vector doesn’t have length 3.
- to_json() str
Produce JSON representation of self.
- to_yaml() str
Produce YAML representation of self.