Ising_OPV  v4.0.2
Generates and analyzes model bulk heterojunction morphologies in a parallel computing environment
Ising_OPV::Lattice Class Reference

This class contains the properties of a three-dimensional lattice and the functions needed to interact with it. More...

#include <Lattice.h>

Classes

struct  Lattice_Params
 This struct contains all of the main input parameters needed by the Lattice class. More...
 

Public Member Functions

 Lattice ()
 Default constructor that creates an empty Lattice object. More...
 
void init (const Lattice_Params &params)
 Initializes the Lattice object using the provided Parameters_Lattice input parameter struct. More...
 
void calculateDestinationCoords (const Coords &coords_initial, const int i, const int j, const int k, Coords &coords_dest) const
 Calculates the destination coordinates when given the starting coordinates and the displacement vector (i,j,k). More...
 
int calculateDX (const int x, const int i) const
 Calculates a coordinate adjustment factor if the x-direction periodic boundary is crossed. More...
 
int calculateDX (const Coords &coords_initial, const Coords &coords_dest) const
 Calculates a coordinate adjustment factor if the x-direction periodic boundary is crossed. More...
 
int calculateDY (const int y, const int j) const
 Calculates a coordinate adjustment factor if the y-direction periodic boundary is crossed. More...
 
int calculateDY (const Coords &coords_initial, const Coords &coords_dest) const
 Calculates a coordinate adjustment factor if the y-direction periodic boundary is crossed. More...
 
int calculateDZ (const int z, const int k) const
 Calculates a coordinate adjustment factor if the z-direction periodic boundary is crossed. More...
 
int calculateDZ (const Coords &coords_initial, const Coords &coords_dest) const
 Calculates a coordinate adjustment factor if the z-direction periodic boundary is crossed. More...
 
int calculateLatticeDistanceSquared (const Coords &coords_start, const Coords &coords_dest) const
 Calculates the shortest distance between a pair of coordinates in squared lattice units. More...
 
bool checkMoveValidity (const Coords &coords_initial, const int i, const int j, const int k) const
 Checks to see if a generic move operation from the designated initial coordinates to a destination position specified by the displacement vector (i,j,k) is possible. More...
 
Lattice extractSublattice (const int x, const int sublength, const int y, const int subwidth, const int z, const int subheight) const
 Extracts a sub-lattice from a larger lattice. More...
 
Coords generateRandomCoords ()
 Generates the coordinates for a randomly selected site in the lattice. More...
 
int generateRandomX ()
 Generates a random x coordinate that lies within the x-dimension size of the lattice. More...
 
int generateRandomY ()
 Generates a random y coordinate that lies within the y-dimension size of the lattice. More...
 
int generateRandomZ ()
 Generates a random z coordinate that lies within the z-dimension size of the lattice. More...
 
int getHeight () const
 Gets the z-direction size of the lattice, the height. More...
 
int getLength () const
 Gets the x-direction size of the lattice, the length. More...
 
long int getNumSites () const
 Gets the number of sites contained in the lattice. More...
 
Coords getSiteCoords (long int site_index) const
 Gets the coordinates of the specified site. More...
 
long int getSiteIndex (const Coords &coords) const
 Gets the vector index for the site corresponding to the input coordinates. More...
 
long int getSiteIndex (const int x, const int y, const int z) const
 Gets the vector index for the site corresponding to the input coordinates. More...
 
char getSiteType (const long int site_index) const
 Gets the type of the site wtih the specified site index. More...
 
char getSiteType (const Coords &coords) const
 Gets the type of the site located at the specified input coordinates. More...
 
char getSiteType (const int x, const int y, const int z) const
 Gets the type of the site located at the specified input coordinates. More...
 
double getUnitSize () const
 Gets the lattice unit size, which is used to convert lattice units into real space units. More...
 
double getVolume () const
 Gets the volume of the lattice in cm^-3. More...
 
int getWidth () const
 Gets the y-direction size of the lattice, the width. More...
 
bool isXPeriodic () const
 Checks whether the x-direction periodic boundaries are enabled or not. More...
 
bool isYPeriodic () const
 Checks whether the y-direction periodic boundaries are enabled or not. More...
 
bool isZPeriodic () const
 Checks whether the z-direction periodic boundaries are enabled or not. More...
 
void resize (const int length_new, const int width_new, const int height_new)
 Resizes the lattice and clears the sites. More...
 
void setSiteType (const long int site_index, const char site_type)
 Sets the type of the site located at the specified input coordinates. More...
 
void setSiteType (const int x, const int y, const int z, const char site_type)
 Sets the type of the site located at the specified input coordinates. More...
 

Detailed Description

This class contains the properties of a three-dimensional lattice and the functions needed to interact with it.

The class makes use of the Lattice_Params struct to load the neccessary input parameters and the Coords struct to record the Cartesian coordinates of each lattice site.

Author
Michael C. Heiber
Date
2014-2019

Constructor & Destructor Documentation

◆ Lattice()

Ising_OPV::Lattice::Lattice ( )

Default constructor that creates an empty Lattice object.

Warning
An empty lattice object should not be used until initialized using the init function.

Member Function Documentation

◆ calculateDestinationCoords()

void Ising_OPV::Lattice::calculateDestinationCoords ( const Coords coords_initial,
const int  i,
const int  j,
const int  k,
Coords coords_dest 
) const

Calculates the destination coordinates when given the starting coordinates and the displacement vector (i,j,k).

When the starting coordinates are near one or more of the lattice boundaries and periodic boundary conditions are enabled, the function detemines the destination coordinates across the periodic boundary and assigns the calculated Coords struct to the input coords_dest argument.

Parameters
coords_initialis the Coords struct tht designates the starting coordinates.
iis the displacement in the x-direction.
jis the displacement in the y-direction.
kis the displacement in the z-direction.
coords_destis Coords struct that indicates the output destination coordinates.

◆ calculateDX() [1/2]

int Ising_OPV::Lattice::calculateDX ( const int  x,
const int  i 
) const

Calculates a coordinate adjustment factor if the x-direction periodic boundary is crossed.

Parameters
xis the starting x coordinate.
iis the displacement in the x-direction.
Returns
Length (the x-direction size of the lattice) if the x periodic boundary is crossed in the negative direction.
-Length if the x periodic boundary is crossed in the positive direction.
0 if the x periodic boundary is not enabled or if the x periodic boundary is not crossed.

◆ calculateDX() [2/2]

int Ising_OPV::Lattice::calculateDX ( const Coords coords_initial,
const Coords coords_dest 
) const

Calculates a coordinate adjustment factor if the x-direction periodic boundary is crossed.

Parameters
coords_initialis the Coords struct that represents the starting coordinates.
coords_destis the Coords struct that represents the destination coordinates.
Returns
Length (the x-direction size of the lattice) if the x periodic boundary is crossed in the negative direction.
-Length if the x periodic boundary is crossed in the positive direction.
0 if the x periodic boundary is not enabled or if the x periodic boundary is not crossed.

◆ calculateDY() [1/2]

int Ising_OPV::Lattice::calculateDY ( const int  y,
const int  j 
) const

Calculates a coordinate adjustment factor if the y-direction periodic boundary is crossed.

Parameters
yis the starting y coordinate.
jis the displacement in the y-direction.
Returns
Width (the y-direction size of the lattice) if the y periodic boundary is crossed in the negative direction.
-Width if the y periodic boundary is crossed in the positive direction.
0 if the y periodic boundary is not enabled or if the y periodic boundary is not crossed.

◆ calculateDY() [2/2]

int Ising_OPV::Lattice::calculateDY ( const Coords coords_initial,
const Coords coords_dest 
) const

Calculates a coordinate adjustment factor if the y-direction periodic boundary is crossed.

Parameters
coords_initialis the Coords struct that represents the starting coordinates.
coords_destis the Coords struct that represents the destination coordinates.
Returns
Width (the y-direction size of the lattice) if the y periodic boundary is crossed in the negative direction.
-Width if the y periodic boundary is crossed in the positive direction.
0 if the y periodic boundary is not enabled or if the y periodic boundary is not crossed.

◆ calculateDZ() [1/2]

int Ising_OPV::Lattice::calculateDZ ( const int  z,
const int  k 
) const

Calculates a coordinate adjustment factor if the z-direction periodic boundary is crossed.

Parameters
zis the starting z coordinate.
kis the displacement in the z-direction.
Returns
Height (the z-direction size of the lattice) if the z periodic boundary is crossed in the negative direction.
-Height if the z periodic boundary is crossed in the positive direction.
0 if the z periodic boundary is not enabled or if the z periodic boundary is not crossed.

◆ calculateDZ() [2/2]

int Ising_OPV::Lattice::calculateDZ ( const Coords coords_initial,
const Coords coords_dest 
) const

Calculates a coordinate adjustment factor if the z-direction periodic boundary is crossed.

Parameters
coords_initialis the Coords struct that represents the starting coordinates.
coords_destis the Coords struct that represents the destination coordinates.
Returns
Height (the z-direction size of the lattice) if the z periodic boundary is crossed in the negative direction.
-Height if the z periodic boundary is crossed in the positive direction.
0 if the z periodic boundary is not enabled or if the z periodic boundary is not crossed.

◆ calculateLatticeDistanceSquared()

int Ising_OPV::Lattice::calculateLatticeDistanceSquared ( const Coords coords_start,
const Coords coords_dest 
) const

Calculates the shortest distance between a pair of coordinates in squared lattice units.

Parameters
coords_startis the Coords struct that represents the starting coordinates.
coords_destis the Coords struct that represents the destination coordinates.
Returns
The distance between the two sets of coordinates in squared lattice units.

◆ checkMoveValidity()

bool Ising_OPV::Lattice::checkMoveValidity ( const Coords coords_initial,
const int  i,
const int  j,
const int  k 
) const

Checks to see if a generic move operation from the designated initial coordinates to a destination position specified by the displacement vector (i,j,k) is possible.

The main use of this function is used to check if a proposed move event crosses a non-periodic boundary.

Parameters
coords_initialis the Coords struct that represents the starting coordinates.
iis the displacement in the x-direction.
jis the displacement in the y-direction.
kis the displacement in the z-direction.
Returns
true if a move event is possible.
false if a move event is not possible.

◆ extractSublattice()

Lattice Ising_OPV::Lattice::extractSublattice ( const int  x,
const int  sublength,
const int  y,
const int  subwidth,
const int  z,
const int  subheight 
) const

Extracts a sub-lattice from a larger lattice.

Parameters
xis the starting x-coordinate of sub-lattice.
sublengthis the x-dimension of the sub-lattice.
yis the starting y-coordinate of sub-lattice.
subwidthis the y-dimension of the sub-lattice.
zis the starting z-coordinate of sub-lattice.
subheightis the z-dimension of the sub-lattice.
Returns
A new Lattice object that contains the data from the specified sub-lattice.

◆ generateRandomCoords()

Coords Ising_OPV::Lattice::generateRandomCoords ( )

Generates the coordinates for a randomly selected site in the lattice.

Returns
A Coords struct containing the coordinates of a randomly selected site from the lattice.

◆ generateRandomX()

int Ising_OPV::Lattice::generateRandomX ( )

Generates a random x coordinate that lies within the x-dimension size of the lattice.

Returns
A randomly selected x coordinate value from in the range from to 0 to Length-1.

◆ generateRandomY()

int Ising_OPV::Lattice::generateRandomY ( )

Generates a random y coordinate that lies within the y-dimension size of the lattice.

Returns
A randomly selected y coordinate value in the range from 0 to Width-1.

◆ generateRandomZ()

int Ising_OPV::Lattice::generateRandomZ ( )

Generates a random z coordinate that lies within the z-dimension size of the lattice.

Returns
A randomly selected z coordinate value in the range from 0 to Height-1.

◆ getHeight()

int Ising_OPV::Lattice::getHeight ( ) const

Gets the z-direction size of the lattice, the height.

Returns
The Height property of the lattice, which is the z-direction size.

◆ getLength()

int Ising_OPV::Lattice::getLength ( ) const

Gets the x-direction size of the lattice, the length.

Returns
The Length property of the lattice, which is the x-direction size.

◆ getNumSites()

long int Ising_OPV::Lattice::getNumSites ( ) const

Gets the number of sites contained in the lattice.

Returns
The number of sites in the lattice.

◆ getSiteCoords()

Coords Ising_OPV::Lattice::getSiteCoords ( long int  site_index) const

Gets the coordinates of the specified site.

Parameters
site_indexis the vector index of the input site
Returns
a Coords object that contains the coordinates of the site specified by the site index.

◆ getSiteIndex() [1/2]

long int Ising_OPV::Lattice::getSiteIndex ( const Coords coords) const

Gets the vector index for the site corresponding to the input coordinates.

Parameters
coordsis the Coords struct that represents the input coordinates.
Returns
The vector index for the sites vector that is associated with the site located at the input coordinates.

◆ getSiteIndex() [2/2]

long int Ising_OPV::Lattice::getSiteIndex ( const int  x,
const int  y,
const int  z 
) const

Gets the vector index for the site corresponding to the input coordinates.

Parameters
xis the x coordinate.
yis the y coordinate.
zis the z coordinate.
Returns
The vector index for the sites vector that is associated with the site located at the input coordinates.

◆ getSiteType() [1/3]

char Ising_OPV::Lattice::getSiteType ( const long int  site_index) const

Gets the type of the site wtih the specified site index.

Parameters
site_indexis the site index.
Returns
A char datatype indicator of the site type.

◆ getSiteType() [2/3]

char Ising_OPV::Lattice::getSiteType ( const Coords coords) const

Gets the type of the site located at the specified input coordinates.

Parameters
coordsis the Coords struct that represents the input coordinates.
Returns
A char datatype indicator of the site type.

◆ getSiteType() [3/3]

char Ising_OPV::Lattice::getSiteType ( const int  x,
const int  y,
const int  z 
) const

Gets the type of the site located at the specified input coordinates.

Parameters
xis the x coordinate.
yis the y coordinate.
zis the z coordinate.
Returns
A char datatype indicator of the site type.

◆ getUnitSize()

double Ising_OPV::Lattice::getUnitSize ( ) const

Gets the lattice unit size, which is used to convert lattice units into real space units.

Returns
The unit size property of the lattice.

◆ getVolume()

double Ising_OPV::Lattice::getVolume ( ) const

Gets the volume of the lattice in cm^-3.

◆ getWidth()

int Ising_OPV::Lattice::getWidth ( ) const

Gets the y-direction size of the lattice, the width.

Returns
The Width property of the lattice, which is the y-direction size.

◆ init()

void Ising_OPV::Lattice::init ( const Lattice_Params params)

Initializes the Lattice object using the provided Parameters_Lattice input parameter struct.

Parameters
paramsis a Lattice_Params struct that contains all of the required parameters to initialize the Lattice object.

◆ isXPeriodic()

bool Ising_OPV::Lattice::isXPeriodic ( ) const

Checks whether the x-direction periodic boundaries are enabled or not.

Returns
true if periodic boundaries are enabled in the x-direction.
false if periodic boundaries are disabled in the x-direction.

◆ isYPeriodic()

bool Ising_OPV::Lattice::isYPeriodic ( ) const

Checks whether the y-direction periodic boundaries are enabled or not.

Returns
true if periodic boundaries are enabled in the y-direction.
false if periodic boundaries are disabled in the y-direction.

◆ isZPeriodic()

bool Ising_OPV::Lattice::isZPeriodic ( ) const

Checks whether the z-direction periodic boundaries are enabled or not.

Returns
true if periodic boundaries are enabled in the z-direction.
false if periodic boundaries are disabled in the z-direction.

◆ resize()

void Ising_OPV::Lattice::resize ( const int  length_new,
const int  width_new,
const int  height_new 
)

Resizes the lattice and clears the sites.

Parameters
length_newis the new x-dimension of the lattice.
width_newis the new y-dimension of the lattice.
height_newis the new z-dimension of the lattice.

◆ setSiteType() [1/2]

void Ising_OPV::Lattice::setSiteType ( const long int  site_index,
const char  site_type 
)

Sets the type of the site located at the specified input coordinates.

Parameters
site_indexis the site index.
site_typeis the char datatype designation for the site type.

◆ setSiteType() [2/2]

void Ising_OPV::Lattice::setSiteType ( const int  x,
const int  y,
const int  z,
const char  site_type 
)

Sets the type of the site located at the specified input coordinates.

Parameters
xis the x coordinate.
yis the y coordinate.
zis the z coordinate.
site_typeis the char datatype designation for the site type.

The documentation for this class was generated from the following files: