pygbe.util package

Submodules

pygbe.util.an_solution module

It contains the functions to compute the cases that presents an analytical solutions. All functions output the analytical solution in kcal/mol

pygbe.util.an_solution.Cext_analytical(radius, wavelength, diel_out, diel_in)[source]

Calculates the analytical solution of the extinction cross section. This solution is valid when the nano particle involved is a sphere.

Parameters:
  • radius (float, radius of the sphere in [nm]) –
  • wavelength (float/array of floats, wavelength of the incident) – electric field in [nm].
  • diel_out (complex/array of complex, dielectric constant inside surface.) –
  • diel_in (complex/array of complex, dielectric constant inside surface.) –
Returns:

Cext_an

Return type:

float/array of floats, extinction cross section.

pygbe.util.an_solution.an_P(q, xq, E_1, E_2, R, kappa, a, N)[source]

It computes the solvation energy according to Kirkwood-1934.

Parameters:
  • q (array, charges.) –
  • xq (array, positions of the charges.) –
  • E_1 (float, dielectric constant inside the sphere.) –
  • E_2 (float, dielectric constant outside the sphere.) –
  • R (float, radius of the sphere.) –
  • kappa (float, reciprocal of Debye length.) –
  • a (float, radius of the Stern Layer.) –
  • N (int, number of terms desired in the polinomial expansion.) –
Returns:

E_P

Return type:

float, solvation energy.

pygbe.util.an_solution.an_spherical(q, xq, E_1, E_2, E_0, R, N)[source]

It computes the analytical solution of the potential of a sphere with Nq charges inside. Took from Kirkwood (1934).

Parameters:
  • q (array, charges.) –
  • xq (array, positions of the charges.) –
  • E_1 (float, dielectric constant inside the sphere.) –
  • E_2 (float, dielectric constant outside the sphere.) –
  • E_0 (float, dielectric constant of vacuum.) –
  • R (float, radius of the sphere.) –
  • N (int, number of terms desired in the spherical harmonic expansion.) –
Returns:

PHI

Return type:

array, reaction potential.

pygbe.util.an_solution.constant_charge_single_energy(sigma0, r1, kappa, epsilon)[source]

It computes the total energy of a single sphere at constant charge, inmmersed in water.

Parameters:
  • sigma0 (float, constant charge on the surface of the sphere.) –
  • r1 (float, radius of sphere.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E

Return type:

float, total energy.

pygbe.util.an_solution.constant_charge_single_point(sigma0, a, r, kappa, epsilon)[source]

It computes the potential in a point ‘r’ due to a spherical surface with constant charge sigma0 immersed in water. Solution to the Poisson-Boltzmann problem. .

Parameters:
  • sigma0 (float, constant charge on the surface of the sphere.) –
  • a (float, radius of the sphere.) –
  • r (float, distance from the center of the sphere to the evaluation) – point.
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

phi

Return type:

float, potential.

pygbe.util.an_solution.constant_charge_single_potential(sigma0, radius, kappa, epsilon)[source]

It computes the surface potential on a sphere at constant charged, immersed in water.

Parameters:
  • sigma0 (float, constant charge on the surface of the sphere.) –
  • radius (float, radius of the sphere.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

phi

Return type:

float, potential.

pygbe.util.an_solution.constant_charge_twosphere_dissimilar(sigma01, sigma02, r1, r2, R, kappa, epsilon)[source]

It computes the interaction energy between two dissimilar spheres at constant charge, immersed in water.

Parameters:
  • sigma01 (float, constant charge on the surface of the sphere 1.) –
  • sigma02 (float, constant charge on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.constant_charge_twosphere_identical(sigma, a, R, kappa, epsilon)[source]

It computes the interaction energy for two spheres at constants surface charge, according to Carnie&Chan-1993.

Parameters:
  • sigma (float, constant charge on the surface of the spheres.) –
  • a (float, radius of spheres.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.constant_potential_single_charge(phi0, radius, kappa, epsilon)[source]

It computes the surface charge of a sphere at constant potential, immersed in water.

Parameters:
  • phi0 (float, constant potential on the surface of the sphere.) –
  • radius (float, radius of the sphere.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant .) –
Returns:

sigma

Return type:

float, surface charge.

pygbe.util.an_solution.constant_potential_single_energy(phi0, r1, kappa, epsilon)[source]

It computes the total energy of a single sphere at constant potential, inmmersed in water.

Parameters:
  • phi0 (float, constant potential on the surface of the sphere.) –
  • r1 (float, radius of sphere.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E

Return type:

float, total energy.

pygbe.util.an_solution.constant_potential_single_point(phi0, a, r, kappa)[source]

It computes the potential in a point ‘r’ due to a spherical surface with constant potential phi0, immersed in water. Solution to the Poisson-Boltzmann problem.

Parameters:
  • phi0 (float, constant potential on the surface of the sphere.) –
  • a (float, radius of the sphere.) –
  • r (float, distance from the center of the sphere to the evaluation) – point.
  • kappa (float, reciprocal of Debye length.) –
Returns:

phi

Return type:

float, potential.

pygbe.util.an_solution.constant_potential_twosphere(phi01, phi02, r1, r2, R, kappa, epsilon)[source]

It computes the solvation energy of two spheres at constant potential, immersed in water.

Parameters:
  • phi01 (float, constant potential on the surface of the sphere 1.) –
  • phi02 (float, constant potential on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E_solv

Return type:

float, solvation energy.

pygbe.util.an_solution.constant_potential_twosphere_2(phi01, phi02, r1, r2, R, kappa, epsilon)[source]

It computes the solvation energy of two spheres at constant potential, immersed in water.

Parameters:
  • phi01 (float, constant potential on the surface of the sphere 1.) –
  • phi02 (float, constant potential on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E_solv

Return type:

float, solvation energy.

pygbe.util.an_solution.constant_potential_twosphere_dissimilar(phi01, phi02, r1, r2, R, kappa, epsilon)[source]

It computes the interaction energy for dissimilar spheres at constant potential, immersed in water.

Parameters:
  • phi01 (float, constant potential on the surface of the sphere 1.) –
  • phi02 (float, constant potential on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.constant_potential_twosphere_identical(phi01, phi02, r1, r2, R, kappa, epsilon)[source]

It computes the interaction energy for two spheres at constants surface potential, according to Carnie&Chan-1993.

Parameters:
  • phi01 (float, constant potential on the surface of the sphere 1.) –
  • phi02 (float, constant potential on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • epsilon (float, water dielectric constant.) –
  • Note – Even though it admits phi01 and phi02, they should be identical; and the same is applicable to r1 and r2.
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.get_K(x, n)[source]

It computes the polinomials K needed for Kirkwood-1934 solutions. K_n(x) in Equation 4 in Kirkwood 1934.

Parameters:
  • x (float, evaluation point of K.) –
  • n (int, number of terms desired in the expansion.) –
Returns:

K

Return type:

float, polinomials K.

pygbe.util.an_solution.molecule_constant_charge(q, sigma02, r1, r2, R, kappa, E_1, E_2)[source]

It computes the interaction energy between a molecule (sphere with point-charge in the center) and a sphere at constant charge, immersed in water.

Parameters:
  • q (float, number of qe to be asigned to the charge.) –
  • sigma02 (float, constant charge on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1, i.e the molecule.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • E_1 (float, dielectric constant inside the sphere/molecule.) –
  • E_2 (float, dielectric constant outside the sphere/molecule.) –
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.molecule_constant_potential(q, phi02, r1, r2, R, kappa, E_1, E_2)[source]

It computes the interaction energy between a molecule (sphere with point-charge in the center) and a sphere at constant potential, immersed in water.

Parameters:
  • q (float, number of qe to be asigned to the charge.) –
  • phi02 (float, constant potential on the surface of the sphere 2.) –
  • r1 (float, radius of sphere 1, i.e the molecule.) –
  • r2 (float, radius of sphere 2.) –
  • R (float, distance center to center.) –
  • kappa (float, reciprocal of Debye length.) –
  • E_1 (float, dielectric constant inside the sphere/molecule.) –
  • E_2 (float, dielectric constant outside the sphere/molecule.) –
Returns:

E_inter

Return type:

float, interaction energy.

pygbe.util.an_solution.two_sphere(a, R, kappa, E_1, E_2, q)[source]

It computes the analytical solution of a spherical surface and a spherical molecule with a center charge, both of radius R. Follows Cooper&Barba 2016

Parameters:
  • a (float, center to center distance.) –
  • R (float, radius of surface and molecule.) –
  • kappa (float, reciprocal of Debye length.) –
  • E_1 (float, dielectric constant inside the sphere.) –
  • E_2 (float, dielectric constant outside the sphere.) –
  • q (float, number of qe to be asigned to the charge.) –
Returns:

  • Einter (float, interaction energy.)
  • E1sphere (float, solvation energy of one sphere.)
  • E2sphere (float, solvation energy of two spheres together.)
  • Note
  • Einter should match (E2sphere - 2xE1sphere)

pygbe.util.read_data module

It contains the functions to read the all the data from the meshes files, its parameters and charges files.

pygbe.util.read_data.readCheck(aux, REAL)[source]

It checks if it is not reading more than one term. We use this function to check we are not missing ‘-‘ signs in the .pqr files, when we read the lines.

Parameters:
  • aux (str, string to be checked.) –
  • REAL (data type.) –
Returns:

X

Return type:

array, array with the correct ‘-‘ signs assigned.

pygbe.util.read_data.read_electric_field(param, filename)[source]

It reads the information about the incident electric field.

Parameters:
  • param (class, parameters related to the surface.) –
  • filename (name of the file that contains the infromation of the incident) – electric field. (filname.config)
Returns:

  • electric_field (float, electric field intensity, it is in the ‘z’) – direction, ‘-‘ indicates ‘-z’.
  • wavelength (float, wavelength of the incident electric field.)

pygbe.util.read_data.read_fields(filename)[source]

Read the physical parameters from the configuration file for each region in the surface

Parameters:filename (name of the file that contains the physical parameters of each) – region. (filename.config)
Returns:
  • Dictionary containing
  • LorY (list, it contains integers, Laplace (1) or Yukawa (2),) – corresponding to each region.
  • pot (list, it contains integers indicating to calculate (1) or not (2)) – the energy in this region.
  • E (list, it contains floats with the dielectric constant of each) – region.
  • kappa (list, it contains floats with the reciprocal of Debye length value) – of each region.
  • charges (list, it contains integers indicating if there are (1) or not (0)) – charges in this region.
  • coulomb (list, it contains integers indicating to calculate (1) or not (2)) – the coulomb energy in this region.
  • qfile (list, location of the ‘.pqr’ file with the location of the charges.)
  • Nparent (list, it contains integers indicating the number of ‘parent’) – surfaces (surface containing this region)
  • parent (list, it contains the file of the parent surface mesh, according) – to their position in the FILE list, starting from 0 (eg. if the mesh file for the parent is the third one specified in the FILE section, parent=2)
  • Nchild (list, it contains integers indicating number of child surfaces) – (surfaces completely contained in this region).
  • child (list, it contains position of the mesh files for the children) – surface in the FILE section.
pygbe.util.read_data.read_parameters(param, filename)[source]

It populates the attributes from the Parameters class with the information read from the .param file.

Parameters:
  • param (class, parameters related to the surface.) –
  • filename (name of the file that contains the parameters information.) – (filename.param)
Returns:

dataType – other fucntions.

Return type:

we return the dataType of each attributes because we need it for

pygbe.util.read_data.read_surface(filename)[source]

It reads the type of surface of each region on the surface from the configuration file.

Parameters:filename (name of the file that contains the surface type of each region.) – (filename.config).
Returns:
  • files (list, it contains the files corresponding to each region in the) – surface.
  • surf_type (list, it contains the type of surface of each region.)
  • phi0_file (list, it contains the constant potential/surface charge for the) – cases where it applies. (dirichlet or neumann surfaces)
pygbe.util.read_data.read_triangle(filename, surf_type)[source]

It reads the triangles from the mesh file and it stores them on an array.

Parameters:
  • filename (name of the file that contains the surface information.) – (filename.faces)
  • surf_type (str, type of surface.) –
Returns:

triangle

Return type:

array, triangles indices.

pygbe.util.read_data.read_vertex(filename, REAL)[source]

It reads the vertex of the triangles from the mesh file and it stores them on an array.

Parameters:
  • filename (name of the file that contains the surface information.) – (filename.vert)
  • REAL (data type.) –
Returns:

vertex

Return type:

array, vertices of the triangles.

pygbe.util.read_data.readcrd(filename, REAL)[source]

It reads the crd file, file that contains the charges information.

Parameters:
  • filename (name of the file that contains the surface information.) –
  • REAL (data type.) –
Returns:

  • pos ((Nqx3) array, positions of the charges.)
  • q ((Nqx1) array, value of the charges.)
  • Nq (int, number of charges.)

pygbe.util.read_data.readpqr(filename, REAL)[source]

Read charge information from pqr file

Parameters:
  • filename (name of the file that contains the surface information.) – (filename.pqr)
  • REAL (data type.) –
Returns:

  • pos ((Nqx3) array, positions of the charges.)
  • q ((Nqx1) array, value of the charges.)

pygbe.util.semi_analytical module

pygbe.util.semi_analyticalwrap module

Module contents