Package schrodinger :: Package application :: Package matsci :: Module amorphous :: Class Box
[hide private]
[frames] | no frames]

Class Box

object --+
         |
        Box
Known Subclasses:

Class that defines the region a new structure may be placed in

Instance Methods [hide private]
 
__init__(self, vertices)
Create a box object
(float, float)
getMinMax(self, axis)
Get the min and max values for axis
float
getLargestSpan(self)
Get the largest span of the box in the X, Y or Z direction
numpy.array
getCentroid(self)
Get the centroid of the box
list
getPointInBox(self)
Get a point in a random position in the box
bool
isPointInBox(self, point)
Is the given point inside the box
list
getTranslationToBox(self, point)
Return a vector that translates the mirror image of a point inside the box
 
isValidPoint(self, point)
Check if point is a valid point - the default implementation just returns True.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  AXES = [0, 1, 2]
  X = 0
hash(x)
  Y = 1
  Z = 2
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, vertices)
(Constructor)

 

Create a box object

Parameters:
  • vertices (list) - A six item list that defines the min and max value of X, Y and Z. The six values in order are: Xmin, Xmax, Ymin, Ymax, Zmin, Zmax
Overrides: object.__init__

getMinMax(self, axis)

 

Get the min and max values for axis

Parameters:
  • axis (int) - One of the class constants X, Y or Z
Returns: (float, float)
The min and max value for the requested axis

getLargestSpan(self)

 

Get the largest span of the box in the X, Y or Z direction

Returns: float
The largest span (delta between the min and max value)

getCentroid(self)

 

Get the centroid of the box

Returns: numpy.array
The centoid of the box - a numpy array of 3 items (x, y, z)

getPointInBox(self)

 

Get a point in a random position in the box

Returns: list
[x, y, z] coordinates of a random point in the box

isPointInBox(self, point)

 

Is the given point inside the box

Parameters:
  • point (iterable) - An iterable of length 3 floats that gives the x, y and z values of the point in question
Returns: bool
Whether the point falls within the box

getTranslationToBox(self, point)

 

Return a vector that translates the mirror image of a point inside the box

Parameters:
  • point (iterable) - An iterable of length 3 floats that gives the x, y and z values of the point in question
Returns: list
A list of 3 floats that gives the x, y and z coordinates of the mirror image of point that lies within the box

isValidPoint(self, point)

 

Check if point is a valid point - the default implementation just returns True. Subclasses may use this to weed out points that violate custom box conditions