DirectSolver

class DirectSolver(boundary_conditions=None, solvent_dielectric_constant=None, workspace_path=None)

The direct Poisson solver.

The solver’s required virtual memory can be reduced by allocating workspace on disk. Usage of a disk workspace has a small negative impact on the solver’s performance.

Parameters:
  • boundary_conditions (list of DirichletBoundaryCondition | NeumannBoundaryCondition | PeriodicBoundaryCondition | MultipoleBoundaryCondition) –

    A list of shape (3,2) specifying the boundary conditions on the 6 surfaces of the unit cell for the configuration.
    Default:

    • MoleculeConfiguration: [[MultipoleBoundaryCondition()] * 2] * 3
    • BulkConfiguration: [[PeriodicBoundaryCondition()] * 2] * 3
    • SurfaceConfiguration:
      [[PeriodicBoundaryCondition()] * 2,
       [PeriodicBoundaryCondition()] * 2,
       [DirichletBoundaryCondition(), NeumannBoundaryCondition()]]
      
    • DeviceConfiguration:
      [[PeriodicBoundaryCondition()] * 2,
       [PeriodicBoundaryCondition()] * 2,
       [DirichletBoundaryCondition()] * 2]
      
  • solvent_dielectric_constant (float) – The dielectric constant of the media surrounding the configuration. Must be a number larger than 0.
    Default: 1.0
  • workspace_path (str of maximum length 255) – Path to an existing directory usable as workspace.
    Default: Disk workspace disabled.
boundaryConditions()
Returns:The boundary conditions for the solver.
Return type:list of DirichletBoundaryCondition | NeumannBoundaryCondition | PeriodicBoundaryCondition | MultipoleBoundaryCondition
solventDielectricConstant()
Returns:The solvent dielectric constant.
Return type:float
workspacePath()
Returns:The workspace path.
Return type:str

Usage Examples

Define a DirectSolver with specified boundary conditions on the 6 faces:

poisson_solver = DirectSolver(
    boundary_conditions=[
        [DirichletBoundaryCondition(), NeumannBoundaryCondition()],
        [DirichletBoundaryCondition(), DirichletBoundaryCondition()],
        [PeriodicBoundaryCondition(), PeriodicBoundaryCondition()]
    ]
)

calculator = LCAOCalculator(
    poisson_solver=poisson_solver
)

Define a DirectSolver with specified boundary conditions in the A, B, and C-direction, but similar boundary conditions on opposite faces:

poisson_solver = DirectSolver(
    boundary_conditions=[
        [NeumannBoundaryCondition(), NeumannBoundaryCondition()],
        [DirichletBoundaryCondition(), DirichletBoundaryCondition()],
        [PeriodicBoundaryCondition(), PeriodicBoundaryCondition()]
    ]
)

calculator = LCAOCalculator(
    poisson_solver=poisson_solver
)

Notes

  • By setting the solvent_dielectric_constant it is possible to perform calculations of solvents. In this case the volume of the configuration is defined by inscribing each atom in a sphere of size given by the van der Waals radius of the element. Inside the volume of the configuration the dielectric constant is 1, outside the volume of the configuration the dielectric constant is equal to the value of solvent_dielectric_constant.
  • The direct solver requires a significant amount of memory. When called in an environment with multiple MPI processes, the required memory will however be distributed over all available processes.
  • See also The Hartree Potential.