lm#
Lattice Microbes Python Bindings
Functions
|
create(filename, initializeModel, numberSpecies=0) |
|
isValidFile(filename) -> bool |
|
runSimulation(simulationFilename, replicate, solverClass, cudaDevices, checkpointInterval) |
|
runSolver(simulationFilename, replicate, solver, cudaDevices, checkpointInterval) |
Classes
|
A Lattice that is based on packed bytes of memory, i.e. one byte per lattice site to hold particles. |
|
C++ includes: CMESolver.h |
|
A Shape representing a cylinder with hemispherical ends. |
|
A capsule shell Shape with a hollow inside. |
|
A Shape that represents a Cone. |
|
A cube-like Shape. |
|
C++ includes: CudaByteLattice.h |
|
C++ includes: CudaIntLattice.h |
|
A Shape representing a cylinder. |
|
A Shape that represents a Difference between the first and second object. |
|
C++ includes: Ellipse.h |
C++ includes: GillespieDSolver.h |
|
|
A hemisphere Shape. |
|
A Lattice that is based on one particle per word, with sites strided per particle. |
C++ includes: IntMpdRdmeSolver.h |
|
|
A Shape that represents a Intersection of two shapes. |
|
Base class for lattice type objects. |
|
A class that defines regions of a lattice based on a set of geometries defined by shapes. |
|
An abstract base class for all Master Equation solvers, this is essentially a representation of "the simulation instance". |
C++ includes: MGPUIntMpdRdmeSolver.h |
|
C++ includes: MGPUMpdRdmeSolver.h |
|
C++ includes: MpdRdmeSolver.h |
|
|
C++ includes: NextReactionSolver.h |
|
Abstract base class for all the shapes in Lattice Microbes simulation builder. |
|
A representation of the simulation that is used to input or output from an HDF5 file. |
|
A Shape that represents a Sphere. |
|
|
|
A Shape that represents a Torus. |
|
A Shape that represents a Union between two shapes. |
|
A Shape that represents a Union of many shapes. |
|
The bounds for a shape represented as a rectangular box. |
|
Type to store a position in space. |
|
|
|
A vector which points in a direction. |
- class lm.ByteLattice(*args)[source]#
Bases:
Lattice
A Lattice that is based on packed bytes of memory, i.e. one byte per lattice site to hold particles.
C++ includes: ByteLattice.h
ByteLattice(xSize, ySize, zSize, spacing, particlesPerSite)
- addParticle(x, y, z, particle)[source]#
addParticle(index, particle)
Add a particle to the specified site.
- findParticles(minParticleType, maxParticleType)[source]#
findParticles(minParticleType, maxParticleType) -> std::vector< particle_loc_t >
Get the number of the specified particles types in the lattice.
- getMaxOccupancy()#
getMaxOccupancy() -> site_size_t
Get the maximum number of particles that can live in a site.
- getNumberSites()#
getNumberSites() -> lattice_size_t
Get total number of sites in the Lattice.
- getOccupancy(x, y, z)[source]#
getOccupancy(index) -> site_size_t
Get the number of particles in the specified lattice site.
- getParticle(x, y, z, particleIndex)[source]#
getParticle(index, particleIndex) -> particle_t
Get the particle at the specified site with at the specified number in the particle list.
- getParticleCounts()[source]#
getParticleCounts() -> std::map< particle_t, uint >
Get the number of each particle type in the lattice.
Particle searching methods.
- getSiteType(x, y, z)[source]#
getSiteType(index) -> site_t
Get the site type at the specified location.
- getSize()#
getSize() -> lattice_coord_t
Get size of the Lattice.
- getSpacing()#
getSpacing() -> si_dist_t
Get spacing between lattice sites.
- getXSize()#
getXSize() -> lattice_size_t
Get x dimension of the Lattice.
- getYSize()#
getYSize() -> lattice_size_t
Get y dimension of the Lattice.
- getZSize()#
getZSize() -> lattice_size_t
Get z dimension of the Lattice.
- setSiteType(x, y, z, siteType)[source]#
setSiteType(index, site)
Set the site type at the specified location.
- property thisown#
The membership flag
- class lm.CMESolver(*args, **kwargs)[source]#
Bases:
MESolver
C++ includes: CMESolver.h
- getReactionRateConstantsView(reactionNumber)[source]#
getReactionRateConstantsView(reactionNumber, rates, rateConstantCount)
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- property thisown#
The membership flag
- class lm.Capsule(p1, p2, radius, type)[source]#
Bases:
Shape
A Shape representing a cylinder with hemispherical ends.
C++ includes: Capsule.h
Capsule(p1, p2, radius, type)
Create a Capsule.
- Parameters:
p1 (*) – Point of first end of cylinder
p2 (*) – Point of second end of cylinder
radius (*) – Radius of the capsule cylinder/hemispheres ends
type (*) – Site type of the capsule
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.CapsuleShell(p1, p2, innerRadius, outerRadius, type)[source]#
Bases:
Shape
A capsule shell Shape with a hollow inside.
C++ includes: CapsuleShell.h
CapsuleShell(p1, p2, innerRadius, outerRadius, type)
Create a Capsule.
- Parameters:
p1 (*) – Point of first end of cylinder
p2 (*) – Point of second end of cylinder
innerRadius (*) – Inner radius of the capsule shell
outerRadius (*) – Outer radius of the capsule shell
type (*) – Type of the sites in the capsule shell
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.Cone(*args)[source]#
Bases:
Shape
A Shape that represents a Cone.
C++ includes: Cone.h
Cone(center, radius, height, type, normal=vector(1.0, 0.0, 0.0))
Create a Cone.
- Parameters:
center (*) – Point center of the circle of the base
radius (*) – Radius of the base
height (*) – Height of the cone
type (*) – The type of the sites within the cone
normal (*) – Normal to the center of the cone base
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.Cuboid(*args)[source]#
Bases:
Shape
A cube-like Shape.
C++ includes: Cuboid.h
Cuboid(center, w, h, d, type, at=vector(1.0, 0.0, 0.0), up=vector(0.0, 1.0, 0.0))
Create a Cuboid based on two orientations, and a width, height, depth.
center The definition of the center of the cuboid
- Parameters:
w (*) – Width (along x axis when unrotated)
h (*) – Height (along y axis when unrotated)
d (*) – Depth (along z axis when unrotated)
at (*) – A vector representing where the cuboid is pointing (default along x axis)
at – A vector representing where the cuboid up is (default along y axis)
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.CudaByteLattice(*args)[source]#
Bases:
ByteLattice
C++ includes: CudaByteLattice.h
CudaByteLattice(xSize, ySize, zSize, spacing, particlesPerSite)
- addParticle(x, y, z, particle)#
addParticle(index, particle)
Add a particle to the specified site.
- findParticles(minParticleType, maxParticleType)#
findParticles(minParticleType, maxParticleType) -> std::vector< particle_loc_t >
Get the number of the specified particles types in the lattice.
- getMaxOccupancy()#
getMaxOccupancy() -> site_size_t
Get the maximum number of particles that can live in a site.
- getNumberSites()#
getNumberSites() -> lattice_size_t
Get total number of sites in the Lattice.
- getOccupancy(x, y, z)#
getOccupancy(index) -> site_size_t
Get the number of particles in the specified lattice site.
- getParticle(x, y, z, particleIndex)#
getParticle(index, particleIndex) -> particle_t
Get the particle at the specified site with at the specified number in the particle list.
- getParticleCounts()[source]#
getParticleCounts() -> std::map< particle_t, uint >
Get the number of each particle type in the lattice.
Particle searching methods.
- getParticleLatticeView()#
getParticleLatticeView(particleLattice, Nw, Nz, Ny, Nx, Np)
- getSiteLatticeView()#
getSiteLatticeView(siteLattice, Nz, Ny, Nx)
- getSiteType(x, y, z)#
getSiteType(index) -> site_t
Get the site type at the specified location.
- getSize()#
getSize() -> lattice_coord_t
Get size of the Lattice.
- getSpacing()#
getSpacing() -> si_dist_t
Get spacing between lattice sites.
- getXSize()#
getXSize() -> lattice_size_t
Get x dimension of the Lattice.
- getYSize()#
getYSize() -> lattice_size_t
Get y dimension of the Lattice.
- getZSize()#
getZSize() -> lattice_size_t
Get z dimension of the Lattice.
- removeParticles(x, y, z)#
removeParticles(index)
Remove a particle to the specified site.
- setSiteType(x, y, z, siteType)#
setSiteType(index, site)
Set the site type at the specified location.
- property thisown#
The membership flag
- class lm.CudaIntLattice(*args)[source]#
Bases:
IntLattice
C++ includes: CudaIntLattice.h
CudaIntLattice(xSize, ySize, zSize, spacing, particlesPerSite)
- addParticle(x, y, z, particle)#
addParticle(index, particle)
Add a particle to the specified site.
- findParticles(minParticleType, maxParticleType)#
findParticles(minParticleType, maxParticleType) -> std::vector< particle_loc_t >
Get the number of the specified particles types in the lattice.
- getMaxOccupancy()#
getMaxOccupancy() -> site_size_t
Get the maximum number of particles that can live in a site.
- getNumberSites()#
getNumberSites() -> lattice_size_t
Get total number of sites in the Lattice.
- getOccupancy(x, y, z)#
getOccupancy(index) -> site_size_t
Get the number of particles in the specified lattice site.
- getParticle(x, y, z, particleIndex)#
getParticle(index, particleIndex) -> particle_t
Get the particle at the specified site with at the specified number in the particle list.
- getParticleCounts()#
getParticleCounts() -> std::map< particle_t, uint >
Get the number of each particle type in the lattice.
Particle searching methods.
- getParticleLatticeView()#
getParticleLatticeView(particleLattice, Nw, Nz, Ny, Nx, Np)
- getSiteLatticeView()#
getSiteLatticeView(siteLattice, Nz, Ny, Nx)
- getSiteType(x, y, z)#
getSiteType(index) -> site_t
Get the site type at the specified location.
- getSize()#
getSize() -> lattice_coord_t
Get size of the Lattice.
- getSpacing()#
getSpacing() -> si_dist_t
Get spacing between lattice sites.
- getXSize()#
getXSize() -> lattice_size_t
Get x dimension of the Lattice.
- getYSize()#
getYSize() -> lattice_size_t
Get y dimension of the Lattice.
- getZSize()#
getZSize() -> lattice_size_t
Get z dimension of the Lattice.
- removeParticles(x, y, z)#
removeParticles(index)
Remove a particle to the specified site.
- setSiteType(x, y, z, siteType)#
setSiteType(index, site)
Set the site type at the specified location.
- property thisown#
The membership flag
- class lm.Cylinder(p1, p2, radius, type)[source]#
Bases:
Shape
A Shape representing a cylinder.
C++ includes: Cylinder.h
Cylinder(p1, p2, radius, type)
Create a Cylinder.
- Parameters:
p1 (*) – Point of first end of cylinder
p2 (*) – Point of second end of cylinder
radius (*) – Radius of the capsule cylinder/hemispheres ends
type (*) – Site type of the capsule
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.Difference(s1, s2, type, symmetric=False)[source]#
Bases:
Shape
A Shape that represents a Difference between the first and second object.
C++ includes: Difference.h
Difference(s1, s2, type, symmetric=false)
Create a Difference.
- Parameters:
s1 (*) – The first shape to Difference
s2 (*) – The second shape to Difference
type (*) – The type of the sites within the difference
symmetric (*) – Determine if the difference is symmetric. If false, difference is the 1st shape minus the second shape
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.Ellipse(*args)[source]#
Bases:
Shape
C++ includes: Ellipse.h
Ellipse(center, r1, r2, r3, type, orientation1=vector(0.0, 0.0, 1.0), orientation2=vector(0.0, 1.0, 0.0))
Create a Ellipse.
- Parameters:
center (*) – Point center of the circle of the slice plane through the sphere
r1 (*) – First axis radius of the Ellipse
r2 (*) – Second axis radius of the Ellipse
r3 (*) – Third axis radius of the Ellipse
type (*) – The type of the sites within the sphere
orientation1 (*) – The direction along which to lay the first axis, default: along the z-axis
orientation2 (*) – The direction along which to lay the second axis, default: along the y-axis
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- setCenter(center)[source]#
setCenter(center)
Set the center of the sphere.
- Parameters:
center (*) – Point of the center
- property thisown#
The membership flag
- class lm.GillespieDSolver[source]#
Bases:
CMESolver
C++ includes: GillespieDSolver.h
GillespieDSolver()
- getReactionRateConstantsView(reactionNumber)[source]#
getReactionRateConstantsView(reactionNumber, rates, rateConstantCount)
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.Hemisphere(center, radius, orientation, type)[source]#
Bases:
Shape
A hemisphere Shape.
C++ includes: Hemisphere.h
Hemisphere(center, radius, orientation, type)
Create a Hemisphere.
- Parameters:
center (*) – Point center of the circle of the slice plane through the Hemisphere
radius (*) – Radius of the Hemisphere
orientation (*) – Orientation normal to the center point of the center point in the direction of the curved part of the hemisphere
type (*) – The type of the sites within the hemisphere
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.IntLattice(*args)[source]#
Bases:
Lattice
A Lattice that is based on one particle per word, with sites strided per particle.
C++ includes: IntLattice.h
IntLattice(xSize, ySize, zSize, spacing, particlesPerSite)
- addParticle(x, y, z, particle)[source]#
addParticle(index, particle)
Add a particle to the specified site.
- findParticles(minParticleType, maxParticleType)[source]#
findParticles(minParticleType, maxParticleType) -> std::vector< particle_loc_t >
Get the number of the specified particles types in the lattice.
- getMaxOccupancy()#
getMaxOccupancy() -> site_size_t
Get the maximum number of particles that can live in a site.
- getNumberSites()#
getNumberSites() -> lattice_size_t
Get total number of sites in the Lattice.
- getOccupancy(x, y, z)[source]#
getOccupancy(index) -> site_size_t
Get the number of particles in the specified lattice site.
- getParticle(x, y, z, particleIndex)[source]#
getParticle(index, particleIndex) -> particle_t
Get the particle at the specified site with at the specified number in the particle list.
- getParticleCounts()[source]#
getParticleCounts() -> std::map< particle_t, uint >
Get the number of each particle type in the lattice.
Particle searching methods.
- getSiteType(x, y, z)[source]#
getSiteType(index) -> site_t
Get the site type at the specified location.
- getSize()#
getSize() -> lattice_coord_t
Get size of the Lattice.
- getSpacing()#
getSpacing() -> si_dist_t
Get spacing between lattice sites.
- getXSize()#
getXSize() -> lattice_size_t
Get x dimension of the Lattice.
- getYSize()#
getYSize() -> lattice_size_t
Get y dimension of the Lattice.
- getZSize()#
getZSize() -> lattice_size_t
Get z dimension of the Lattice.
- setSiteType(x, y, z, siteType)[source]#
setSiteType(index, site)
Set the site type at the specified location.
- property thisown#
The membership flag
- class lm.IntMpdRdmeSolver[source]#
Bases:
MESolver
C++ includes: IntMpdRdmeSolver.h
IntMpdRdmeSolver()
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.Intersection(s1, s2, type)[source]#
Bases:
Shape
A Shape that represents a Intersection of two shapes.
C++ includes: Intersection.h
Intersection(s1, s2, type)
Create a Intersection.
- Parameters:
s1 (*) – The first shape to Intersection
s2 (*) – The second shape to Intersection
type (*) – The type of the sites within the intersection
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.Lattice(*args, **kwargs)[source]#
Bases:
object
Base class for lattice type objects.
C++ includes: Lattice.h
- addParticle(x, y, z, particle)[source]#
addParticle(index, particle)
Add a particle to the specified site.
- findParticles(minParticleType, maxParticleType)[source]#
findParticles(minParticleType, maxParticleType) -> std::vector< particle_loc_t >
Get the number of the specified particles types in the lattice.
- getMaxOccupancy()[source]#
getMaxOccupancy() -> site_size_t
Get the maximum number of particles that can live in a site.
- getNumberSites()[source]#
getNumberSites() -> lattice_size_t
Get total number of sites in the Lattice.
- getOccupancy(x, y, z)[source]#
getOccupancy(index) -> site_size_t
Get the number of particles in the specified lattice site.
- getParticle(x, y, z, particleIndex)[source]#
getParticle(index, particleIndex) -> particle_t
Get the particle at the specified site with at the specified number in the particle list.
- getParticleCounts()[source]#
getParticleCounts() -> std::map< particle_t, uint >
Get the number of each particle type in the lattice.
Particle searching methods.
- getSiteType(x, y, z)[source]#
getSiteType(index) -> site_t
Get the site type at the specified location.
- setSiteType(x, y, z, siteType)[source]#
setSiteType(index, site)
Set the site type at the specified location.
- property thisown#
The membership flag
- class lm.LatticeBuilder(xLen, yLen, zLen, collisionGridSpacing, seedTop, seedBottom)[source]#
Bases:
object
A class that defines regions of a lattice based on a set of geometries defined by shapes. It also allows packing different types of particles into different regions.
C++ includes: LatticeBuilder.h
LatticeBuilder(xLen, yLen, zLen, collisionGridSpacing, seedTop, seedBottom=0)
Create a Lattice Builder.
- Parameters:
xLen (*) – Length of the domain along x-axis
yLen (*) – Length of the domain along y-axis
zLen (*) – Length of the domain along z-axis
collisionGridSpacing (*) – The spacing for collision objects
seedTop (*) – High 32 bits of the seed (allows a constant seed for debugging)
seedBottom (*) – Low 32 bits of the seed
- addParticles(particleType, siteType, count)[source]#
addParticles(particleType, siteType, count)
Add particles of a given type.
- Parameters:
particleType (*) – The type of particles to randomly place in the lattice
siteType (*) – Type of lattice site into which to place
count (*) – Number of particles to place
- addRegion(shape)[source]#
addRegion(shape)
Add a region to the lattice.
- Parameters:
shape (*) – A Shape object to add as a region
- discretizeTo(lattice, obstacleSiteType, fractionObstacleSitesOccupied)[source]#
discretizeTo(lattice, obstacleSiteType, fractionObstacleSitesOccupied)
Discretizes the regions to a square lattice.
- Parameters:
lattice (*) – Lattice object into which to place
obstacleSiteType (*) – An identifier for obstacle sites in the lattice
fractionObstacleSitesOccupied (*) – Percentage of obstacle sites to be filled
- fillWithRandomSpheres(volumeFraction, radius, type, region)[source]#
fillWithRandomSpheres(volumeFraction, radius, type, region)
Fill a region with random spheres to a specified volume fraction.
- Parameters:
volumeFraction (*) – Total fraction of volume that should be filled with spheres
radius (*) – Radius of spheres
type (*) – The type of site to fill (i.e. the type of site to exclude other objects from)
region (*) – The region of the lattice to place spheres into
- getSpatialModel(model)[source]#
getSpatialModel(spatialModel)
Gets a spatial model of the lattice for interface with python. NOTE: this operation clears the object passed in from python.
- Parameters:
spatialModel (*) – An object of a spatial model for interaction in python or HDF5. The model will be filled with the current lattice
- placeRandomSphere(radius, type, region)[source]#
placeRandomSphere(radius, type, region) -> uint
Place a sphere randomly in the lattice (for obstacles)
- Parameters:
radius (*) – Radius of the sphere obstacle
type (*) – The type of site in which to place sphere
region (*) – The region in which to place obstacle randomly
- Return type:
number of times a placement operation occured
- placeRandomSpheres(count, radius, type, region)[source]#
placeRandomSpheres(count, radius, type, region)
Place many spheres randomly in the lattice (for obstacles)
- Parameters:
radius (*) – Radius of the sphere obstacle
type (*) – The type of site in which to place sphere
region (*) – The region in which to place obstacle randomly
- Return type:
number of times a placement operation occured
- placeSphere(position, radius, type)[source]#
placeSphere(center, radius, type) -> bool
Place a sphere in the lattice (for obstacles)
- Parameters:
center (*) – The center point of sphere obstacle
radius (*) – Radius of the sphere obstacle
type (*) – The type of site in which to place sphere
- Return type:
true if the sphere did not intersect
- removeSphere(position, radius, type)[source]#
removeSphere(center, radius, type)
Remove a sphere in the lattice (for obstacles)
- Parameters:
center (*) – The center point of sphere obstacle
radius (*) – Radius of the sphere obstacle
type (*) – The type of site in which to place sphere
- property thisown#
The membership flag
- class lm.MESolver(*args, **kwargs)[source]#
Bases:
object
An abstract base class for all Master Equation solvers, this is essentially a representation of “the simulation instance”.
C++ includes: MESolver.h
- property thisown#
The membership flag
- class lm.MGPUIntMpdRdmeSolver[source]#
Bases:
MESolver
C++ includes: MGPUIntMpdRdmeSolver.h
MGPUIntMpdRdmeSolver()
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.MGPUMpdRdmeSolver[source]#
Bases:
MESolver
C++ includes: MGPUMpdRdmeSolver.h
MGPUMpdRdmeSolver()
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.MpdRdmeSolver[source]#
Bases:
MESolver
C++ includes: MpdRdmeSolver.h
MpdRdmeSolver()
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.NextReactionSolver(*args)[source]#
Bases:
CMESolver
C++ includes: NextReactionSolver.h
NextReactionSolver(neededDists)
- getReactionRateConstantsView(reactionNumber)[source]#
getReactionRateConstantsView(reactionNumber, rates, rateConstantCount)
- initialize(replicate, parameters, resources)[source]#
initialize(replicate, parameters, resources)
Initialize the simulation.
- Parameters:
replicate (*) – Replicate number out of total replicates
parameters (*) – A map of all the parameters for the simulation
A (*) – list of resources assigned to the simulation
- needsDiffusionModel()[source]#
needsDiffusionModel() -> bool
Tells whether the solver needs a reaction model.
- needsReactionModel()[source]#
needsReactionModel() -> bool
Tells whether the solver needs a reaction model.
- property thisown#
The membership flag
- class lm.Shape(*args, **kwargs)[source]#
Bases:
object
Abstract base class for all the shapes in Lattice Microbes simulation builder.
C++ includes: Shape.h
- boundingBoxesIntersect(query)[source]#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.SimulationFile(filename)[source]#
Bases:
object
A representation of the simulation that is used to input or output from an HDF5 file.
C++ includes: SimulationFile.h
SimulationFile(filename)
Create a SimulationFile with the specified filename.
- static create(filename)[source]#
create(filename, initializeModel, numberSpecies=0)
Create an HDF5 file and initialize the model with an optional number of species.
- getDiffusionModel(model)[source]#
getDiffusionModel(diffusionModel)
Pops the diffusion model from the HDF5 file.
- Parameters:
diffusionModel (*) – Memory at which to place the diffusionModel
- getDiffusionModelLattice(m, lattice)[source]#
getDiffusionModelLattice(diffusionModel, lattice)
Pops the diffusion lattice from the HDF5 file.
- Parameters:
diffusionModel (*) – Memoryfrom which to get the lattice
lattice (*) – Memory at which to place the lattice
- getLattice(replicate, latticeIndex, lattice)[source]#
getLattice(replicate, latticeIndex, lattice)
Get the lattice for the replicate.
- Parameters:
replicate (*) – Replicate number
latticeIndex (*) – Seems to be unused…
lattice (*) – The lattice object in which to store the data
- getLatticeTimes(replicate)[source]#
getLatticeTimes(replicate) -> vector< double >
Get the timestep times for the replicate.
- Parameters:
replicate (*) – Replicate number
- Return type:
A set of timestep times
- getParameter(key)[source]#
getParameter(key, defaultValue=””) -> string
Get the specified parameter from the current replicate.
- getReactionModel(model)[source]#
getReactionModel(reactionModel)
Pops the reaction model from the HDF5 file.
- Parameters:
reactionModel (*) – Memory at which to place the reactionModel
- getSpatialModel(model)[source]#
getSpatialModel(model)
Pops the spacial model (i.e. obstacles) from the HDF5 file.
- Parameters:
model (*) – The model in which to store the object
- getSpeciesCounts(replicate)[source]#
getSpeciesCounts(replicate) -> std::map< double, vector< int > >
- static isValidFile(filename)[source]#
isValidFile(filename) -> bool
Check that the HDF5 file is valid.
- setDiffusionModel(diffusionModel)[source]#
setDiffusionModel(diffusionModel)
Pushes the diffusion model into the HDF5 file.
- Parameters:
diffusionModel (*) – Memory from which to place the diffusionModel
- setDiffusionModelLattice(*args)[source]#
setDiffusionModelLattice(m, lattice)
Pushes the diffusion lattice into the HDF5 file.
- Parameters:
diffusionModel (*) – Memory from which to get the lattice
lattice (*) – Memory from which to place the lattice
- setReactionModel(reactionModel)[source]#
setReactionModel(reactionModel)
Pushes the reaction model into the HDF5 file.
- Parameters:
reactionModel (*) – Memory from which to place the reactionModel
- setSpatialModel(model)[source]#
setSpatialModel(model)
Pushes the spacial model (i.e. obstacles) into the HDF5 file.
- Parameters:
model (*) – The model object
- property thisown#
The membership flag
- class lm.Sphere(center, radius, type)[source]#
Bases:
Shape
A Shape that represents a Sphere.
C++ includes: Sphere.h
Sphere(center, radius, type)
Create a Sphere.
- Parameters:
center (*) – Point center of the circle of the slice plane through the sphere
radius (*) – Radius of the sphere
type (*) – The type of the sites within the sphere
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- setCenter(center)[source]#
setCenter(center)
Set the center of the sphere.
- Parameters:
center (*) – Point of the center
- property thisown#
The membership flag
- class lm.SwigPyIterator(*args, **kwargs)[source]#
Bases:
object
- property thisown#
The membership flag
- class lm.Torus(*args)[source]#
Bases:
Shape
A Shape that represents a Torus.
C++ includes: Torus.h
Torus(center, r1, r2, type, orientation=vector(0.0, 0.0, 1.0), up=vector(0.0, 1.0, 0.0))
Create a Torus.
- Parameters:
center (*) – Point center of the circle of the slice plane through the sphere
r1 (*) – Large radius of the Torus
r2 (*) – Small radius of the Torus
type (*) – The type of the sites within the sphere
orientation (*) – The direction vector around which the ring is made, default: (0,0,1)
up (*) – A vector to define the y axis of the object’s coordinate system , default: (0,1,0)
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- setCenter(center)[source]#
setCenter(center)
Set the center of the sphere.
- Parameters:
center (*) – Point of the center
- property thisown#
The membership flag
- class lm.Union(s1, s2, type)[source]#
Bases:
Shape
A Shape that represents a Union between two shapes.
C++ includes: Union.h
Union(s1, s2, type)
Create a Union.
- Parameters:
s1 (*) – The first shape to Union
s2 (*) – The second shape to Union
type (*) – The type of the sites within the union
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.UnionSet(type)[source]#
Bases:
Shape
A Shape that represents a Union of many shapes.
C++ includes: UnionSet.h
UnionSet(type)
Create a UnionSet.
- Parameters:
type (*) – The type of the sites within the union
- boundingBoxesIntersect(query)#
boundingBoxesIntersect(query) -> bool
Checks if another shape’s bounding box interstects with this shape’s bounding box.
- Parameters:
query (*) – The other shape to test
- Return type:
true/false
- contains(query)[source]#
contains(query) -> bool
Determine if the shape contains the specified shape.
- Parameters:
query (*) – Shape to test
- Return type:
true/false
- getBoundingBox()#
getBoundingBox() -> bounding_box
Get the bounding box.
- getType()#
getType() -> site_t
Get the site type associated with the shape.
- getVolume()#
getVolume() -> double
Get the total internal volume of the shape.
- intersects(query)[source]#
intersects(query) -> bool
Check if two shapes intersect.
- Parameters:
query (*) – The other shape to check
- Return type:
true/false
- property thisown#
The membership flag
- class lm.bounding_box(*args)[source]#
Bases:
object
The bounds for a shape represented as a rectangular box.
C++ includes: Shape.h
bounding_box(min, max)
Create a bounding box from points.
- Parameters:
min (*) – Minimum coordinate
max (*) – Maximum coordinate
- joinWith(j)[source]#
joinWith(j) -> bounding_box
Return a bounding box spanning the two bounding boxes.
- Parameters:
j (*) – Other bounding box
- Return type:
new bounding box
- property max#
- property min#
- property thisown#
The membership flag
- class lm.point(x=0.0, y=0.0, z=0.0)[source]#
Bases:
object
Type to store a position in space.
C++ includes: Shape.h
point(p2)
Create a point from another point.
- Parameters:
p2 (*) – The point to copy
- distance(p2)[source]#
distance(p2) -> si_dist_t
Determine the distance to another point.
- Parameters:
p2 (*) – Second point
- Return type:
scalar distance
- distanceSquared(p2)[source]#
distanceSquared(p2) -> si_dist_t
Determine the distance squared between two points.
- Parameters:
p2 (*) – Second point
- Return type:
scalar distance squared
- property thisown#
The membership flag
- property x#
- property y#
- property z#
- class lm.vector(x=0.0, y=0.0, z=0.0)[source]#
Bases:
object
A vector which points in a direction.
C++ includes: Shape.h
vector(p)
Construct a vector from a point.
- Parameters:
p (*) – The point to cast
- property thisown#
The membership flag
- property x#
- property y#
- property z#
- lm.SimulationFile_create(filename)[source]#
create(filename, initializeModel, numberSpecies=0)
Create an HDF5 file and initialize the model with an optional number of species.
- lm.SimulationFile_isValidFile(filename)[source]#
isValidFile(filename) -> bool
Check that the HDF5 file is valid.
- lm.runSimulation(simulationFilename, replicate, solverClass, cudaDevices, checkpointInterval)[source]#
runSimulation(simulationFilename, replicate, solverClass, cudaDevices, checkpointInterval)