Grid¶
This class is a base class to perform neighbor search between structural particles (i.e. atoms or pseudo-atoms). Internally, the neighbor search algorithm uses a grid to efficiently determine neighbors.
You can get a neighbor list for a structural particle:
# get a neighbor list for a structural particle with an index 0
neighborIndexer = grid.getNeighborIndexer(0)
# get a neighbor list for a structural particle structuralParticle
neighborIndexer = grid.getNeighborIndexer(structuralParticle)
To update the neighbor list execute:
grid.update()
See also
SAMSON API: SBMStructuralModelGrid
- class samson.Modeling.StructuralModel.Grid(self: samson.Modeling.StructuralModel.Grid, arg0: samson.DataModel.DataGraph.NodeIndexer, arg1: samson.DataModel.Quantity.unitsSI) None ¶
Bases:
samson.Core.Reference.ReferenceTarget
This class describes a grid-based neighbor search algorithm that can be applied to structural particles (atoms or pseudo-atoms).
- areNeighbors(*args, **kwargs)¶
Overloaded function.
areNeighbors(self: samson.Modeling.StructuralModel.Grid, i: int, j: int) -> bool
Returns whether particles with indices i and j are neighbors
areNeighbors(self: samson.Modeling.StructuralModel.Grid, structuralParticleI: SBMStructuralModelNodeParticle, structuralParticleJ: SBMStructuralModelNodeParticle) -> bool
Returns whether structural particles structuralParticleI and structuralParticleJ are neighbors
- getMemoryFootprint(self: samson.Core.Reference.ReferenceTarget) int ¶
Returns the memory footprint
- getNeighborVector(*args, **kwargs)¶
Overloaded function.
getNeighborVector(self: samson.Modeling.StructuralModel.Grid, i: int) -> std::vector<SBMStructuralModelNodeParticle*, std::allocator<SBMStructuralModelNodeParticle*> >
Returns the neighbor indexer of structural particle i
getNeighborVector(self: samson.Modeling.StructuralModel.Grid, structuralParticle: SBMStructuralModelNodeParticle) -> std::vector<SBMStructuralModelNodeParticle*, std::allocator<SBMStructuralModelNodeParticle*> >
Returns the neighbor indexer of structural particle structuralParticle
- getNeighbors(*args, **kwargs)¶
Overloaded function.
getNeighbors(self: samson.Modeling.StructuralModel.Grid, position: samson.DataModel.Type.vector3, radius: samson.DataModel.Quantity.unitsSI) -> std::vector<SBMStructuralModelNodeParticle*, std::allocator<SBMStructuralModelNodeParticle*> >
Returns vector of all structural particles that are at a distance smaller than or equal to radius from the specified position
getNeighbors(self: samson.Modeling.StructuralModel.Grid, box: samson.DataModel.Type.intervalVector3) -> std::vector<SBMStructuralModelNodeParticle*, std::allocator<SBMStructuralModelNodeParticle*> >
Returns vector of all structural particles inside the box
- update(self: samson.Modeling.StructuralModel.Grid) None ¶
Updates the grid and neighbor lists