Skip to content

class_occupancy.py

Contains a class with strategy to trim a grid based on occupancy.

StrategyOccupancyTrimming

Bases: StrategyTrimming

A class to define strategies to trim a grid based on occupancy.

Inheritance

This class is the child of StrategyTrimming. Check this one for other
attributes and methods definitions.

Attributes

self.__kernel : OccpancyKernel
The occupancy boolean kernel.

Source code in src/smiffer/grid/trimming_strategy/class_occupancy.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class StrategyOccupancyTrimming(StrategyTrimming):
    """A class to define strategies to trim a grid based on occupancy.

    Inheritance
    -----------
    This class is the child of `StrategyTrimming`. Check this one for other
    **attributes** and **methods** definitions.

    Attributes
    ----------
    self.__kernel : `OccpancyKernel`
        The occupancy boolean kernel.
    """

    def __init__(self, kernel):
        """Trim a grid based on occupancy.

        Parameters
        ----------
        kernel : `OccupancyKernel`
            The occupancy boolean kernel.
        """
        self.__kernel = kernel

    def trim_box(self, grid_object):
        """Trim a grid mask based on occupancy trimming method.

        Parameters
        ----------
        grid_object : `Grid`
            The grid object to access all attributes.
        """
        stamp: Stamp = Stamp(
            grid=grid_object.mask,
            grid_origin=grid_object.coord[0],
            delta=grid_object.delta,
            kernel=self.__kernel,
        )

        for atom in grid_object.molecule_broad:
            stamp.stamp_kernel(center=atom.position)

__init__(kernel)

Trim a grid based on occupancy.

Parameters

kernel : OccupancyKernel
The occupancy boolean kernel.

Source code in src/smiffer/grid/trimming_strategy/class_occupancy.py
31
32
33
34
35
36
37
38
39
def __init__(self, kernel):
    """Trim a grid based on occupancy.

    Parameters
    ----------
    kernel : `OccupancyKernel`
        The occupancy boolean kernel.
    """
    self.__kernel = kernel

trim_box(grid_object)

Trim a grid mask based on occupancy trimming method.

Parameters

grid_object : Grid
The grid object to access all attributes.

Source code in src/smiffer/grid/trimming_strategy/class_occupancy.py
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
def trim_box(self, grid_object):
    """Trim a grid mask based on occupancy trimming method.

    Parameters
    ----------
    grid_object : `Grid`
        The grid object to access all attributes.
    """
    stamp: Stamp = Stamp(
        grid=grid_object.mask,
        grid_origin=grid_object.coord[0],
        delta=grid_object.delta,
        kernel=self.__kernel,
    )

    for atom in grid_object.molecule_broad:
        stamp.stamp_kernel(center=atom.position)