Get dimensions and other information from a PQR file.


This code could be combined with inputgen.


This code should be moved to the APBS code base.

Code author: Dave Sept

Code author: Nathan Baker

Code author: Todd Dolinksy

Code author: Yong Huang

pdb2pqr.psize.CFAC = 1.7

The fine grid dimensions are multiplied by this constant to calculate the coarse grid dimensions

pdb2pqr.psize.FADD = 20.0

The number of Angstroms added to the molecular dimensions to determine the find grid dimensions

pdb2pqr.psize.GMEMCEIL = 400

Maxmimum memory (in MB) to be used for a calculation

pdb2pqr.psize.GMEMFAC = 200

Approximate memory usage (in bytes) can be estimated by multiplying the number of grid points by this constant

pdb2pqr.psize.OFRAC = 0.1

The fractional overlap between grid partitions in a parallel focusing calculation

class pdb2pqr.psize.Psize(cfac=1.7, fadd=20.0, space=0.5, gmemfac=200, gmemceil=400, ofrac=0.1, redfac=0.25)[source]

Class for parsing input files and suggesting settings.

__init__(cfac=1.7, fadd=20.0, space=0.5, gmemfac=200, gmemceil=400, ofrac=0.1, redfac=0.25)[source]


  • cfac (float) – factor by which to expand molecular dimensions to get coarse grid dimensions
  • fadd (float) – amount (in Angstroms) to add to molecular dimensions to get the fine grid dimensions
  • space (float) – desired fine mesh resolution (in Angstroms)
  • gmemfac (float) – number of bytes per grid point required for a sequential multigrid calculation
  • gmemceil (float) – maximum memory (in MB) allowed for sequential multigrid calculation. Adjust this value to force the script to perform faster calculations (which require more parallelism).
  • ofrac (float) – overlap factor between mesh partitions in parallel focusing calculation
  • redfac (float) – the maximum factor by which a domain dimension can be reduced during focusing

Parse input structure file in PDB or PQR format.

Parameters:filename (str) – string with path to PDB- or PQR-format file.

Parse the PQR/PDB lines.


This is messed up. Why are we parsing the PQR manually here when we already have other routines to do that? This function should be replaced by a call to existing routines.

Parameters:lines ([str]) – PDB/PQR lines to parse

Parse the input structure as a string in PDB or PQR format.

Parameters:structure (str) – input structure as string in PDB or PQR format.

Parse input PQR file and set parameters.

Parameters:filename (str) – path of PQR file

Set up all of the things calculated individually above.

set_center(maxlen, minlen)[source]

Compute molecular center.


center of molecule

Return type:

[float, float, float]


Compute coarse mesh lengths.

Parameters:mol_length ([float, float, float]) – input molecule lengths
Returns:coarse grid dimensions
Return type:[float, float, float]
set_fine_grid_dims(mol_length, coarse_length)[source]

Compute fine mesh lengths.


fine grid lengths

Return type:

[float, float, float]


Compute mesh grid points, assuming 4 levels in multigrid hierarchy.


remove hard-coded values from this function.

Parameters:fine_length ([float, float, float]) – lengths of the fine grid
Returns:number of grid points in each direction
Return type:[int, int, int]
set_focus(fine_length, nproc, coarse_length)[source]

Calculate the number of levels of focusing required for each processor subdomain.

set_length(maxlen, minlen)[source]

Compute molecular dimensions, adjusting for zero-length values.


Replace hard-coded values in this function.


molecular dimensions

Return type:

[float, float, float]

set_proc_grid(ngrid, nsmall)[source]

Calculate the number of processors required in a parallel focusing calculation to span each dimension of the grid given the grid size suitable for memory constraints.

  • ngrid ([int, int, int]) – number of needed grid points
  • nsmall ([int, int, int]) – number of grid points that will fit in memory

number of processors needed in each direction

Return type:

[int, int, int]


Set smallest dimensions.

Compute parallel division of domain in case the memory requirements for the calculation are above the memory ceiling. Find the smallest dimension and see if the number of grid points in that dimension will fit below the memory ceiling Reduce nsmall until an nsmall^3 domain will fit into memory.


Remove hard-coded values from this function.

Parameters:ngrid ([int, int, int]) – number of grid points
Returns:smallest number of grid points in each direction to fit in memory
Return type:[int, int, int]
pdb2pqr.psize.REDFAC = 0.25

The maximum factor by which a domain can be “shrunk” during a focusing calculation

pdb2pqr.psize.SPACE = 0.5

Desired fine grid spacing (in Angstroms)


Build argument parser.

Returns:argument parser
Return type:argparse.ArgumentParser