# `psize`

Get dimensions and other information from a PQR file.

Todo

This code could be combined with `inputgen`.

Todo

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)

  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)

    Initialize.

    Parameters:

      - 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(filename)

    Parse input structure file in PDB or PQR format.

    Parameters:

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

  parse_lines(lines)

    Parse the PQR/PDB lines.

    Todo

    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_string(structure)

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

    Parameters:

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

  run_psize(filename)

    Parse input PQR file and set parameters.

    Parameters:

      filename (str) – path of PQR file

  set_all()

    Set up all of the things calculated individually above.

  set_center(maxlen, minlen)

    Compute molecular center.

    Parameters:

      - maxlen ([float, float, float]) – maximum molecule lengths

      - minlen ([float, float, float]) – minimum molecule lengths

    Returns:

      center of molecule

    Return type:

      [float, float, float]

  set_coarse_grid_dims(mol_length)

    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)

    Compute fine mesh lengths.

    Parameters:

      - mol_length ([float, float, float]) – input molecule lengths

      - coarse_length ([float, float, float]) – coarse grid lengths

    Returns:

      fine grid lengths

    Return type:

      [float, float, float]

  set_fine_grid_points(fine_length)

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

    Todo

    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)

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

    Parameters:

      - fine_length ([float, float, float]) – fine grid length

      - nproc ([int, int, int]) – number of processors in each dimension

      - coarse_length ([float, float, float]) – coarse grid length

  set_length(maxlen, minlen)

    Compute molecular dimensions, adjusting for zero-length values.

    Todo

    Replace hard-coded values in this function.

    Parameters:

      - maxlen ([float, float, float]) – maximum dimensions from molecule

      - minlen ([float, float, float]) – minimum dimensions from molecule

    Returns:

      molecular dimensions

    Return type:

      [float, float, float]

  set_proc_grid(ngrid, nsmall)

    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.

    Parameters:

      - ngrid ([int, int, int]) – number of needed grid points

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

    Returns:

      number of processors needed in each direction

    Return type:

      [int, int, int]

  set_smallest(ngrid)

    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.

    Todo

    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)

pdb2pqr.psize.build_parser()

  Build argument parser.

  Returns:

    argument parser

  Return type:

    argparse.ArgumentParser