IPCC  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CKNGeometricShape Class Reference

Class for Geometric shape. More...

#include "KNGeometricShape.h"

Collaboration diagram for CKNGeometricShape:
Collaboration graph

Public Member Functions

 CKNGeometricShape ()
 
 ~CKNGeometricShape ()
 
void SetOriginCoordination (double x, double y, double z)
 Building Geometric part. More...
 
void SetDirection (double x_axis, double y_axis, double z_axis)
 Set direciton of shape. More...
 
void SetLength (double lx, double ly, double lz)
 Set length of shape. More...
 
MATERIAL_INDEX GetMaterialType ()
 
void SetMaterialType (MATERIAL_INDEX type)
 Get maetrial typpe of shap. More...
 
void SetMaterialType (char *pszType)
 Set maetrial type of shape. More...
 
unsigned int GetShapeForm ()
 
void SetShapeForm (unsigned int form)
 Get form type of shape. More...
 
void SetShapeForm (char *pszForm)
 Get form type of shape. More...
 
bool GetConsideringBoundaryCondition (AXIS_DEFINE direction)
 
void SetConsideringBoundaryCondition (bool bConsider, AXIS_DEFINE direction)
 Get bondary condition of shape. More...
 
bool FillUnitcell (CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Set bondary condition of shape. More...
 
void BuildNeighborInformation ()
 Find neighbor of each atom. More...
 
bool IsFrontFace ()
 
void SetFrontFace (bool bFrontFace)
 Check is this front face side in MPI running enviroment. More...
 
bool IsBackendFace ()
 Set front face side mark to shape object. More...
 
void SetBackendFace (bool bBackendFace)
 Check is this back end face side in MPI running enviroment. More...
 
bool ConstructMapInfo (LPNEIGHBOR_MAP_INFO lpMapInfo, CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Extract atom information from runtime objects. More...
 
void ShiftAtomID (double fShift)
 Shift atom id in MPI running enviroment. More...
 
void PeriodicUnitCellNumbering (bool bXAxis=false)
 Numbering to periodic unitcell. More...
 
void InitMapInfo (LPNEIGHBOR_MAP_INFO lpMapInfo)
 Intilize map info data. More...
 
bool RefillPeriodicBinding (CKNMatrixOperation::CKNCSR *pResult, CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, unsigned int nRepeatIndex, double fKValue[3])
 Applying phase to Hamiltonian. More...
 
double GetTotalAtomCount ()
 
void SetTotalAtomCount (double fTotalAtomCountinMPI)
 Get total valid atom count in shape. More...
 
double GetAtomStartID ()
 Set total valid atom count in shape. More...
 
void ExchangeAtomInfoBetweenNode ()
 Get start index of atom in shape, using in MPI running enviroment. More...
 
void FinalShape ()
 Finalize Shape variable. More...
 
std::vector< CKNGeometricAtom * > * GetSurfaceAtomList ()
 

Static Public Member Functions

static void SetShapeInformation (CKNGeometricShape &shape, CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Set shape information(Length, material, bondary condition and so on) More...
 
static bool SetAtomAndNeighborInformation (CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Set neighbor information to AtomFactory. More...
 
static void FreeMapInfo (LPNEIGHBOR_MAP_INFO lpMapInfo)
 Release mapinfo data. More...
 

Public Attributes

unsigned int m_nAtomFirstLayer
 Get Surface atom list. More...
 
unsigned int m_nAtomLastLayer
 Last layer information for sending to next node. More...
 

Static Public Attributes

static
CKNGeometricUnitCellInfo_zincblende 
m_UnitCellInfo_zincblende
 
static
CKNGeometricUnitCellInfo_cubic 
m_UnitCellInfo_cubic
 
static IKNGeometricUnitCellInfom_pUnitCellInfo
 Unitcell information pointer for using in class internal. More...
 
static
CKNMatrixOperation::CKNDMatrix 
m_rotationMatrix
 Rotation matrix for given direction. More...
 

Private Member Functions

bool IsInBoundaryCondition (int x, int y, int z, int maxX, int maxY, int maxZ)
 Check unitcell is in the bondary area or not. More...
 
void FreeUnitCellList ()
 Relase unitcell list. More...
 
void InitShape ()
 Initialize Shape variable. More...
 
void RotateMatrix (CKNMatrixOperation::CKNDMatrix *pMatrixNbr, CKNMatrixOperation::CKNDMatrix *pMatrixResult, double fDegree[2])
 Rotate matrix with calculated degree. More...
 
CKNGeometricAtomGetAtomByIndex (double fID)
 Get atom instance by ID. More...
 
double GetKPhaseSign (double fAtomPos, double fPeriodicAtomPos)
 Calculating Phase sign. More...
 
int GetPeriodicDirection (int x, int y, int z, int maxX, int maxY, int maxZ)
 Get periodic direction information. More...
 
bool CalculateUnitcellCount ()
 Calculating unitcell count in shape. More...
 
void ArrangeUnitCell (CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Arranging unitcell into shape. More...
 
void CheckingNeighborCandiate ()
 Checking neighbor unitcell by calculating index. More...
 
double * Serialize (double fXLayer)
 Serialize unitcells with specific later index to double array. More...
 
void Deserialize (std::vector< CKNGeometricUnitCell > *pVectUnitCell, double *pBuffer, bool bFrontSide)
 Deerialize unitcells from double array. More...
 
void BuildGeoFileName (char *pszFileName, CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Make atom map naming. More...
 
bool SetMapInfoSize (LPNEIGHBOR_MAP_INFO lpMapInfo, double fSize)
 Building Hamiltonian part. More...
 

Static Private Member Functions

static void BuildRotationMatrix (double fDegree[2])
 Build rotation matrix for given direction. More...
 
static void CalculateDegree (CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Calculating degree from direction information. More...
 

Private Attributes

double m_fLength [3]
 Building Geometric part. More...
 
double m_fAssignedCount [3]
 Unitcell assigend count in shape for each direction. More...
 
unsigned int m_ShapeForm
 Shape form. More...
 
bool m_bConsiderBoundaryCondition [3]
 Bondary condition for each driection. More...
 
bool m_bFrontFace
 Flag of front face or not. More...
 
bool m_bBackendFace
 Flag of back end face or not. More...
 
double m_fTotalAtomCountinMPI
 Total valid atom count in shape. More...
 
double m_fAtomIDStartIndex
 Start atom index in current Shape. More...
 
MATERIAL_INDEX m_MaterialType
 Material type of shape. More...
 
std::vector< CKNGeometricUnitCellm_vectUnitCell
 Array of unitcell in shape. More...
 
std::vector< CKNGeometricUnitCellm_vectPrevUnitCell
 Front edge unit cell that copy from previous side node. More...
 
std::vector< CKNGeometricUnitCellm_vectNextUnitCell
 Back end edge unit cell that copy from next side node. More...
 
std::vector< CKNGeometricAtom * > m_vectSurfaceAtom
 
CKNGeometricCoordination m_originCoordination
 Orign coordination of shape. More...
 
CKNGeometricDirection m_shapDirection
 Direction of shape. More...
 

Detailed Description

Class for Geometric shape.

Date
03/Oct/2014
Author
Kyu Nam Cho(mysto.nosp@m.us@k.nosp@m.orea..nosp@m.ac.k.nosp@m.r), Hoon Ryu(elec1.nosp@m.020@.nosp@m.gmail.nosp@m..com)

Definition at line 27 of file KNGeometricShape.h.

Constructor & Destructor Documentation

CKNGeometricShape::CKNGeometricShape ( )

Definition at line 33 of file KNGeometricShape.cpp.

References InitShape().

34 {
35  InitShape();
36 }
void InitShape()
Initialize Shape variable.

Here is the call graph for this function:

CKNGeometricShape::~CKNGeometricShape ( )

Definition at line 38 of file KNGeometricShape.cpp.

References FinalShape().

39 {
40  FinalShape();
41 }
void FinalShape()
Finalize Shape variable.

Here is the call graph for this function:

Member Function Documentation

void CKNGeometricShape::ArrangeUnitCell ( CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
private

Arranging unitcell into shape.

Parameters
lpParamInput parameters parsing from command file

Definition at line 393 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNGeometricUnitCell::ArrangeAtom(), CKNGeometricCoordination::GetCoordination(), CKNGeometricCoordination::GetCoordinationAll(), CKNMPIManager::GetCurrentRank(), CKNGeometricUnitCell::GetLength(), GetPeriodicDirection(), CKNMPIManager::GetTotalNodeCount(), IsInBoundaryCondition(), m_bConsiderBoundaryCondition, m_bFrontFace, m_fAssignedCount, m_fLength, m_nAtomFirstLayer, m_nAtomLastLayer, m_originCoordination, m_vectNextUnitCell, m_vectPrevUnitCell, m_vectUnitCell, CKNGeometricAtom::NONE, CKNCommandFileParser::INPUT_CMD_PARAM::nShape, CKNGeometricUnitCell::NumberingSubElement(), CKNGeometricUnitCell::ResetSubElementID(), CKNGeometricUnitCell::SetAssignIndex(), CKNGeometricCoordination::SetCoordination(), CKNGeometricUnitCell::SetCoordination(), CKNGeometricUnitCell::SetID(), CKNGeometricCoordination::SetOffset(), CKNGeometricUnitCell::SetPeriodic(), CKNGeometricUnitCell::SetSubDomainMaterial(), CKNGeometricUnitCell::SetUnitcellList(), and CKNCommandFileParser::INPUT_CMD_PARAM::szDomainMat.

Referenced by FillUnitcell().

394 {
395  int x, y, z, maxX, maxY, maxZ;
396  CKNGeometricCoordination currentPos, refPos;
397  double fUnitcellLength[3];
398  double fUnitcellID = 0;
399 
400  fUnitcellLength[_X] = CKNGeometricUnitCell::GetLength(_X);
401  fUnitcellLength[_Y] = CKNGeometricUnitCell::GetLength(_Y);
402  fUnitcellLength[_Z] = CKNGeometricUnitCell::GetLength(_Z);
403 
405 
406  double fOffset[3] = { 0, };
407 
409  {
410  if (m_bFrontFace)
411  fOffset[_X] = -fUnitcellLength[_X];
412  }
413 
415  fOffset[_Y] = -fUnitcellLength[_Y];
416 
418  fOffset[_Z] = -fUnitcellLength[_Z];
419 
420  currentPos.SetOffset(fOffset[_X], fOffset[_Y], fOffset[_Z]);
421  refPos.SetCoordination(currentPos.GetCoordinationAll());
422 
423  maxX = (int)floor(m_fAssignedCount[_X]);
424  maxY = (int)floor(m_fAssignedCount[_Y]);
425  maxZ = (int)floor(m_fAssignedCount[_Z]);
426 
428  for (x = 0; x < maxX; ++x)
429  {
430  currentPos.SetCoordination(currentPos.GetCoordination(_X), refPos.GetCoordination(_Y), refPos.GetCoordination(_Z));
431  for (y = 0; y < maxY; ++y)
432  {
433  currentPos.SetCoordination(currentPos.GetCoordination(_X), currentPos.GetCoordination(_Y), refPos.GetCoordination(_Z));
434  for (z = 0; z < maxZ; ++z)
435  {
436  CKNGeometricUnitCell UnitCell;
437 
438  UnitCell.SetCoordination(currentPos);
439  UnitCell.SetID(fUnitcellID++);
440  UnitCell.ArrangeAtom(lpParam);
441 
442  if (IsInBoundaryCondition(x, y, z, maxX, maxY, maxZ))
443  {
444  //printf("[%03d] %10.10f, %10.10f, %10.10f\n", (int)(fUnitcellID - 1), currentPos.GetCoordination(CKNGeometricCoordination::X), currentPos.GetCoordination(CKNGeometricCoordination::Y), currentPos.GetCoordination(CKNGeometricCoordination::Z));
445  unsigned int nAtom = UnitCell.NumberingSubElement(m_originCoordination, m_fLength, lpParam->nShape[0], lpParam->szDomainMat[0]);
446  if (x == 0)
447  m_nAtomFirstLayer += nAtom;
448  if (x == 1 && m_bConsiderBoundaryCondition[_X])
449  m_nAtomFirstLayer += nAtom;
451  {
452  if (x == maxX - 2)
453  m_nAtomLastLayer += nAtom;
454  }
455  else
456  {
457  if (x == maxX - 1)
458  m_nAtomLastLayer += nAtom;
459  }
460  }
461  else
462  {
463  int periodicDirection = CKNGeometricAtom::NONE;
464 
465  periodicDirection = GetPeriodicDirection(x, y, z, maxX, maxY, maxZ);
466  UnitCell.SetPeriodic(true, periodicDirection);
467  }
468 
469  UnitCell.SetSubDomainMaterial(lpParam);
470  UnitCell.SetAssignIndex(x, y, z);
472  m_vectUnitCell.push_back(UnitCell);
473 
474  currentPos.SetOffset(0, 0, fUnitcellLength[_Z]);
475  }
476  currentPos.SetOffset(0, fUnitcellLength[_Y], 0);
477  }
478  currentPos.SetOffset(fUnitcellLength[_X], 0, 0);
479  }
480 }
std::vector< CKNGeometricUnitCell > m_vectNextUnitCell
Back end edge unit cell that copy from next side node.
Class for coordination.
Class for Geometric unit cell.
Definition: CKNGlobal.h:105
static void ResetSubElementID()
Get unit cell length.
std::vector< CKNGeometricUnitCell > m_vectPrevUnitCell
Front edge unit cell that copy from previous side node.
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
int nShape[NMAXDOMAIN]
Geometric Shape.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
void ArrangeAtom(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set atoms information(coordination, type) in unit cell.
void SetOffset(CKNGeometricCoordination coord)
To offset coordination.
Definition: CKNGlobal.h:105
bool IsInBoundaryCondition(int x, int y, int z, int maxX, int maxY, int maxZ)
Check unitcell is in the bondary area or not.
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
void SetAssignIndex(double fXAssignIndex, double fYAssignIndex, double fZAssignIndex)
Get Assign index.
CKNGeometricCoordination m_originCoordination
Orign coordination of shape.
Definition: CKNGlobal.h:105
void SetPeriodic(bool bPeriodic, int periodicDirection)
To mark unit cell is periodic condition.
double m_fLength[3]
Building Geometric part.
unsigned int NumberingSubElement(CKNGeometricCoordination ShapeCoordination, double fLength[3], int nShapeType, char *pszDomainMatName)
Assign atom ID to sub element(atoms in unit cell)
char szDomainMat[NMAXDOMAIN][1024]
Material type.
void SetID(double fID)
int GetPeriodicDirection(int x, int y, int z, int maxX, int maxY, int maxZ)
Get periodic direction information.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static int GetCurrentRank()
Definition: KNMPIManager.h:42
void SetSubDomainMaterial(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set atoms information(coordination, type) in unit cell.
bool m_bFrontFace
Flag of front face or not.
static double GetLength(AXIS_DEFINE index)
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination of unit cell.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination with double buffer.
unsigned int m_nAtomLastLayer
Last layer information for sending to next node.
void SetUnitcellList(std::vector< CKNGeometricUnitCell > *pVect, std::vector< CKNGeometricUnitCell > *pVectPrev, std::vector< CKNGeometricUnitCell > *pVectNext)
Set unit cell list of shape to each unit cell.
unsigned int m_nAtomFirstLayer
Get Surface atom list.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::BuildGeoFileName ( char *  pszFileName,
CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam 
)
private

Make atom map naming.

Parameters
[out]pszFileNameGeometric information file name
lpParamInput parameter parsing from command file

Definition at line 1291 of file KNGeometricShape.cpp.

References CKNCommandFileParser::INPUT_CMD_PARAM::bConsiderBoundaryCondition, CKNCommandFileParser::INPUT_CMD_PARAM::nDirectionSingle, CKNCommandFileParser::INPUT_CMD_PARAM::nSubDomainNumber, and CKNCommandFileParser::INPUT_CMD_PARAM::szShape.

Referenced by ConstructMapInfo().

1292 {
1293  char szTemp[1024];
1294  unsigned int i;
1295 
1296 
1297  sprintf(pszFileName, "Geo_%d_%d%d%d_", lpParam->nDirectionSingle, lpParam->bConsiderBoundaryCondition[0] ? 1 : 0, lpParam->bConsiderBoundaryCondition[1] ? 1 : 0, lpParam->bConsiderBoundaryCondition[2] ? 1 : 0);
1298 
1299  if (!strcmp(lpParam->szShape[0], "Box"))
1300  strcpy(szTemp, "B");
1301  else if (!strcmp(lpParam->szShape[0], "Cylinder"))
1302  strcpy(szTemp, "C");
1303 
1304  strcat(pszFileName, szTemp);
1305 
1306  for (i = 0; i < (unsigned int)lpParam->nSubDomainNumber; ++i)
1307  {
1308  if (!strcmp(lpParam->szShape[i + 1], "Box"))
1309  strcpy(szTemp, "B");
1310  else if (!strcmp(lpParam->szShape[i + 1], "Cylinder"))
1311  strcpy(szTemp, "C");
1312 
1313  strcat(pszFileName, szTemp);
1314  }
1315 }
int nSubDomainNumber
Numbers of Subdomain, except main domain.
char szShape[NMAXDOMAIN][1024]
Geometric Shape.
bool bConsiderBoundaryCondition[3]
Considering bondary condition or not x, y, z direction.

Here is the caller graph for this function:

void CKNGeometricShape::BuildNeighborInformation ( )

Find neighbor of each atom.

Definition at line 117 of file KNGeometricShape.cpp.

References GetSurfaceAtomList(), m_fAssignedCount, and m_vectUnitCell.

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver().

118 {
119  int i, nSize = m_vectUnitCell.size();
120 
121  for (i = 0; i < nSize; ++i)
122  {
123  if( !m_vectUnitCell[i].IsPeriodicUnitCell() )
124  m_vectUnitCell[i].BuildNeighborInformation(m_fAssignedCount, GetSurfaceAtomList());
125  }
126 }
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
std::vector< CKNGeometricAtom * > * GetSurfaceAtomList()

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::BuildRotationMatrix ( double  fDegree[2])
staticprivate

Build rotation matrix for given direction.

Parameters
fDegreeGiven degree of theta and phi

Definition at line 1268 of file KNGeometricShape.cpp.

References CKNMatrixOperation::CKNDMatrix::BuildMatrixFirst(), m_rotationMatrix, PHI_DEGREE, CKNMatrixOperation::CKNDMatrix::SetElement(), THETA_DEGREE, and CKNMatrixOperation::CKNDMatrix::TrnasPos().

Referenced by SetAtomAndNeighborInformation().

1269 {
1271 
1272  m_rotationMatrix.SetElement(0, 0, cos(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
1273  m_rotationMatrix.SetElement(0, 1, -sin(fDegree[THETA_DEGREE]), 0);
1274  m_rotationMatrix.SetElement(0, 2, -cos(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
1275 
1276  m_rotationMatrix.SetElement(1, 0, sin(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
1277  m_rotationMatrix.SetElement(1, 1, cos(fDegree[THETA_DEGREE]), 0);
1278  m_rotationMatrix.SetElement(1, 2, -sin(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
1279 
1280  m_rotationMatrix.SetElement(2, 0, sin(fDegree[PHI_DEGREE]), 0);
1281  m_rotationMatrix.SetElement(2, 1, 0, 0);
1282  m_rotationMatrix.SetElement(2, 2, cos(fDegree[PHI_DEGREE]), 0);
1283 
1285 }
#define PHI_DEGREE
Definition: CKNGlobal.h:80
#define THETA_DEGREE
Definition: CKNGlobal.h:79
bool TrnasPos()
Transpos matrix.
bool SetElement(unsigned int nRow, unsigned int nColumn, CKNComplex element)
Set matrix elements value.
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
static CKNMatrixOperation::CKNDMatrix m_rotationMatrix
Rotation matrix for given direction.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::CalculateDegree ( CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
staticprivate

Calculating degree from direction information.

Parameters
lpParamInput parameters parsing from command file

Definition at line 696 of file KNGeometricShape.cpp.

References CKNCommandFileParser::INPUT_CMD_PARAM::fDegree, CKNCommandFileParser::INPUT_CMD_PARAM::fDirection, PHI_DEGREE, PI_VALUE, and THETA_DEGREE.

Referenced by SetAtomAndNeighborInformation().

697 {
698  /*TODO: changing input parameter sqrtf -> sqrt(from all source code)*/
699  double fR = sqrt(lpParam->fDirection[0] * lpParam->fDirection[0] + lpParam->fDirection[1] * lpParam->fDirection[1] + lpParam->fDirection[2] * lpParam->fDirection[2]);
700 
701  lpParam->fDegree[PHI_DEGREE] = PI_VALUE/2 - acos(lpParam->fDirection[2] / fR);
702  lpParam->fDegree[THETA_DEGREE] = atan(lpParam->fDirection[1] / lpParam->fDirection[0]);
703 }
#define PHI_DEGREE
Definition: CKNGlobal.h:80
#define THETA_DEGREE
Definition: CKNGlobal.h:79
double fDegree[2]
Rotation degree, this variable isn't input by command file. It is calculated by module.
double fDirection[3]
Direction x, y, z.
#define PI_VALUE
Pi definition.
Definition: CKNGlobal.h:77

Here is the caller graph for this function:

bool CKNGeometricShape::CalculateUnitcellCount ( )
private

Calculating unitcell count in shape.

< Only for Show unitcell count

< Only for Show unitcell count

Definition at line 254 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNMPIManager::AllReduceDouble(), CKNGeometricCoordination::GetCoordination(), CKNMPIManager::GetCurrentRank(), CKNGeometricUnitCell::GetLength(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), m_bBackendFace, m_bConsiderBoundaryCondition, m_bFrontFace, m_fAssignedCount, m_fLength, m_originCoordination, CKNGeometricCoordination::SetOffset(), and CKNIPCCUtility::ShowMsg().

Referenced by FillUnitcell().

255 {
256  double fXTotalCount;
257  double fXAssignCount, fYAssignCount, fZAssignCount;
258  double fUnitcellLength[3];
259  bool bRtn = false;
260  bool bPaddingUnitCell = false;
261  char szMsg[1024];
262 
263  fUnitcellLength[_X] = CKNGeometricUnitCell::GetLength(_X);
264  fUnitcellLength[_Y] = CKNGeometricUnitCell::GetLength(_Y);
265  fUnitcellLength[_Z] = CKNGeometricUnitCell::GetLength(_Z);
266 
267  fXTotalCount = floor(m_fLength[_X] / fUnitcellLength[_X]);
269  bPaddingUnitCell = true;
270 
272  fYAssignCount = floor(m_fLength[_Y] / fUnitcellLength[_Y]) + 2;
273  else
274  fYAssignCount = ceil(m_fLength[_Y] / fUnitcellLength[_Y]);
275 
277  fZAssignCount = floor(m_fLength[_Z] / fUnitcellLength[_Z]) + 2;
278  else
279  fZAssignCount = ceil(m_fLength[_Z] / fUnitcellLength[_Z]);
280 
281 #ifdef DISABLE_MPI_ROUTINE
282  fXAssignCount = fXTotalCount;
283 
284  if (bPaddingUnitCell)
285  {
286  fXAssignCount++;
287  fXTotalCount++;
288  }
289 
290 #else
292  {
293  fXAssignCount = fXTotalCount;
294  if (bPaddingUnitCell)
295  {
296  fXAssignCount++;
297  fXTotalCount++;
298  }
299  }
300  else
301  {
302  int nNodeCount = CKNMPIManager::GetTotalNodeCount();
303  unsigned int nRank = (unsigned int)CKNMPIManager::GetCurrentRank();
304 
305  if( 1 > fXTotalCount / nNodeCount )
306  return bRtn;
307 
308  unsigned int nBaseCount, nRestCount;
309 
310  nBaseCount = (unsigned int)floor(fXTotalCount / nNodeCount);
311  nRestCount = (unsigned int)floor(fXTotalCount) - nBaseCount * nNodeCount;
312 
313  fXAssignCount = nBaseCount;
314  if( nRank < nRestCount )
315  fXAssignCount += 1;
316 
317  if( true == bPaddingUnitCell && CKNMPIManager::GetCurrentRank() == CKNMPIManager::GetTotalNodeCount() - 1 )
318  fXAssignCount += 1;
319 
320  //m_fLength[LX] = fXAssignCount * fUnitcellLength[LX];
321 
322  unsigned int nExtraAdding = 0;
323 #ifdef _WIN32
324  nExtraAdding = min(nRestCount, nRank);
325 #else
326  nExtraAdding = std::min(nRestCount, nRank);
327 #endif
328 
329  if (nRank > 0)
330  {
331  double cx;
332 
333  cx = (nBaseCount * nRank + nExtraAdding) * fUnitcellLength[_X];
335  }
336 
337  if( fXAssignCount * fUnitcellLength[_X] + m_originCoordination.GetCoordination(_X) > m_fLength[_X] )
339  else
340  m_fLength[_X] = fXAssignCount * fUnitcellLength[_X];
341 
342 #ifdef SHOW_DEBUG_STRING
343 
345  {
346  sprintf(szMsg, "TotalAssignCount: %7f\n", fXTotalCount);
348  }
349 
350  sprintf(szMsg, "%d rank: Xoffset: %7f, LX: %7f, Assign Count: %7f\n", CKNMPIManager::GetCurrentRank(), m_originCoordination.GetCoordination(_X), m_fLength[_X], fXAssignCount);
352 
353 #endif //SHOW_DEBUG_STRING
354  }
355 #endif //DISABLE_MPI_ROUTINE
356 
358  {
359  if (m_bFrontFace)
360  fXAssignCount++;
361 
362  if (true == m_bBackendFace)
363  fXAssignCount++;
364  }
365 
366  m_fAssignedCount[_X] = fXAssignCount;
367  m_fAssignedCount[_Y] = fYAssignCount;
368  m_fAssignedCount[_Z] = fZAssignCount;
369 
370 
371 
372 
373 #ifndef _WIN32
375  {
376  fXAssignCount = CKNMPIManager::AllReduceDouble(fXAssignCount);
377 #endif //_WIN32
378  sprintf(szMsg, "-Unitcell counts: X-axis[%2.1f], Y-axis[%2.1f], Z-axis[%2.1f]\n", fXAssignCount, fYAssignCount, fZAssignCount);
380 #ifndef _WIN32
381  }
382  else
383  fXAssignCount = CKNMPIManager::AllReduceDouble(fXAssignCount);
384 #endif //_WIN32
385 
386  bRtn = true;
387  return bRtn;
388 }
static void ShowMsg(char *pszBuffer)
Show message.
Definition: CKNGlobal.h:105
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
void SetOffset(CKNGeometricCoordination coord)
To offset coordination.
Definition: CKNGlobal.h:105
static double AllReduceDouble(double fNumber)
Do all reduce function with CKNComplex.
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
CKNGeometricCoordination m_originCoordination
Orign coordination of shape.
bool m_bBackendFace
Flag of back end face or not.
Definition: CKNGlobal.h:105
double m_fLength[3]
Building Geometric part.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static int GetCurrentRank()
Definition: KNMPIManager.h:42
bool m_bFrontFace
Flag of front face or not.
static double GetLength(AXIS_DEFINE index)
static bool IsRootRank()
Get Total node count.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::CheckingNeighborCandiate ( )
private

Checking neighbor unitcell by calculating index.

Definition at line 735 of file KNGeometricShape.cpp.

References m_bBackendFace, m_bFrontFace, m_fAssignedCount, and m_vectUnitCell.

Referenced by FillUnitcell().

736 {
737  int i, nSize = m_vectUnitCell.size();
738 
739  for (i = 0; i < nSize; ++i)
740  {
741  m_vectUnitCell[i].CheckingNeighborCandiate(m_fAssignedCount, m_bFrontFace, m_bBackendFace);
742  }
743 }
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
bool m_bBackendFace
Flag of back end face or not.
bool m_bFrontFace
Flag of front face or not.

Here is the caller graph for this function:

bool CKNGeometricShape::ConstructMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo,
CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam 
)

Extract atom information from runtime objects.

Parameters
lpMapInfoAtom map information
bFileWriteOption for save file or not
Returns
Operation success return true, else return false

Definition at line 750 of file KNGeometricShape.cpp.

References _X, _Y, _Z, ATOM_DEFAULT_INDEX, CKNCommandFileParser::INPUT_CMD_PARAM::bSaveMapFile, BuildGeoFileName(), NEIGHBOR_MAP_INFO::fItemCount, FreeMapInfo(), CKNGeometricCoordination::GetCoordination(), CKNGeometricAtom::GetCoordination(), CKNMPIManager::GetCurrentRank(), CKNGeometricAtom::GetDomainMaterialNumber(), CKNGeometricAtom::GetID(), CKNGeometricAtom::GetMaterialMaterialNumber(), CKNGeometricAtom::GetMaterialNumber(), CKNGeometricAtom::GetNeighborAtomID(), CKNGeometricAtom::GetNeighborCount(), CKNGeometricUnitCell::GetSubElementID(), CKNMPIManager::GetTotalNodeCount(), CKNGeometricAtom::GetType(), InitMapInfo(), CKNMPIManager::IsDeflationRoot(), CKNGeometricAtom::IsPeriodicAtom(), CKNGeometricAtom::IsPeriodicCoupling(), CKNMPIManager::IsRootRank(), m_vectUnitCell, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pDomainMaterialNumber, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, NEIGHBOR_MAP_INFO::pMaterialNumber, NEIGHBOR_MAP_INFO::pNeighborMaterial, CKNMPIManager::ReceiveDoubleBufferSync(), CKNMPIManager::SendDoubleBufferSync(), SetMapInfoSize(), and CKNIPCCUtility::ShowMsg().

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver().

751 {
752  bool bRtn = false;
753  char szMsg[1024], szAdditional[1024];
754  unsigned int i, j, k, nSize, nAtomSize, nNeighborSize, nMapIndex = 0;;
755  FILE *out = NULL;
756  char szFileName[1024];
757  double fNeighborAtomID = ATOM_DEFAULT_INDEX;
758  bool bPeriodic = false;
759  char szTemp[1024], szMaterial[1024], szTemp2[1024];
760 #ifndef DISABLE_MPI_ROUTINE
761  MPI_Request req;
762  double fTemp = 1;
763 #endif //DISABLE_MPI_ROUTINE
764 
765  BuildGeoFileName(szTemp, lpParam);
766 
767  InitMapInfo(lpMapInfo);
768  if (true == lpParam->bSaveMapFile)
769  {
770 #ifdef _WIN32
771  _mkdir("result");
772  sprintf(szFileName, "result\\%s", szTemp);
773 #else
774  mkdir("result", 0777);
775  sprintf(szFileName, "result/%s", szTemp);
776 #endif
777 
778 
779 #ifdef DISABLE_MPI_ROUTINE
780  out = fopen(szFileName, "wt");
781 #else //DISABLE_MPI_ROUTINE
782 
784  {
785  CKNIPCCUtility::ShowMsg("-Save atom map to file.\n");
786  out = fopen(szFileName, "wt");
787  }
788  else
789  {
791  out = fopen(szFileName, "at");
792  }
793 #endif //DISABLE_MPI_ROUTINE
794  }
795 
796  nSize = m_vectUnitCell.size();
797 
799  {
800  if (NULL != out)
801  fclose(out);
803  return bRtn;
804  }
805 
806 #ifdef SHOW_ATOM_MAP_RESULT_ON_SCREEN
808  CKNIPCCUtility::ShowMsg("Atom list--------------------------------------\n");
809 #endif //SHOW_ATOM_MAP_RESULT_ON_SCREEN
810  for (i = 0; i < nSize; ++i)
811  {
812  double fIDForDebug;
813  nAtomSize = m_vectUnitCell[i].GetSubElementSize();
814 
815  for (j = 0; j < nAtomSize; ++j)
816  {
817  CKNGeometricAtom *pAtom = m_vectUnitCell[i].GetSubElementAt(j);
818  if (ATOM_DEFAULT_INDEX == pAtom->GetID() || true == pAtom->IsPeriodicAtom())
819  continue;
820 
821  CKNGeometricCoordination coord = pAtom->GetCoordination();
822  fIDForDebug = pAtom->GetID();
823 
824  sprintf(szAdditional, "");
825  sprintf(szMaterial, "");
826  nNeighborSize = pAtom->GetNeighborCount();
827  for (k = 0; k < nNeighborSize; ++k)
828  {
829  fNeighborAtomID = pAtom->GetNeighborAtomID(k);
830 
831  if (ATOM_DEFAULT_INDEX == fNeighborAtomID)
832  bPeriodic = false;
833  else
834  bPeriodic = pAtom->IsPeriodicCoupling(k);
835 
836 #ifdef NOSHOW_MINORS_ONE
837  if (ATOM_DEFAULT_INDEX == pAtom->GetNeighborAtom(k))
838  {
839  sprintf(szTemp, "\t");
840  sprintf(szTemp2, "\t", (int)pAtom->GetMaterialMaterialNumber(k));
841  }
842  else
843 #endif //NOSHOW_MINORS_ONE
844  {
845  sprintf(szTemp, "\t%7.0f", fNeighborAtomID);
846  if (-1 == fNeighborAtomID)
847  sprintf(szTemp2, "\t%7.0d", -1);
848  else
849  sprintf(szTemp2, "\t%7.0d", (int)pAtom->GetMaterialMaterialNumber(k));
850  }
851  strcat(szAdditional, szTemp);
852  strcat(szMaterial, szTemp2);
853 
854  lpMapInfo->pfNeighbor[k][nMapIndex] = fNeighborAtomID;
855  lpMapInfo->pbPeriodicCondition[k][nMapIndex] = bPeriodic;
856  lpMapInfo->pNeighborMaterial[k][nMapIndex] = pAtom->GetMaterialMaterialNumber(k);
857  }
858 
859  sprintf(szMsg, "%-7.0f\t%d\t%d\t%15.6f\t%15.6f\t%15.6f%s%s\n", pAtom->GetID(), (int)pAtom->GetType(), (int)pAtom->GetMaterialNumber(),
860  coord.GetCoordination(_X),
861  coord.GetCoordination(_Y),
862  coord.GetCoordination(_Z),
863  szAdditional, szMaterial);
864 
865  lpMapInfo->fItemCount++;
866  lpMapInfo->pAtomType[nMapIndex] = pAtom->GetType();
867  lpMapInfo->pMaterialNumber[nMapIndex] = pAtom->GetMaterialNumber();
868  lpMapInfo->pDomainMaterialNumber[nMapIndex] = pAtom->GetDomainMaterialNumber();
869  lpMapInfo->pfID[nMapIndex] = pAtom->GetID();
870  lpMapInfo->pfX_Coordination[nMapIndex] = coord.GetCoordination(_X);
871  lpMapInfo->pfY_Coordination[nMapIndex] = coord.GetCoordination(_Y);
872  lpMapInfo->pfZ_Coordination[nMapIndex] = coord.GetCoordination(_Z);
873  nMapIndex++;
874 
875  if (true == lpParam->bSaveMapFile && NULL != out)
876  fputs(szMsg, out);
877 #ifdef SHOW_ATOM_MAP_RESULT_ON_SCREEN
879 #endif //SHOW_ATOM_MAP_RESULT_ON_SCREEN
880 
881  }
882  }
883 
884  if (true == lpParam->bSaveMapFile && NULL != out)
885  {
886  fclose(out);
887 #ifndef DISABLE_MPI_ROUTINE
890 #endif //DISABLE_MPI_ROUTINE
891  }
892 
893  bRtn = true;
894  return bRtn;
895 }
double * pfZ_Coordination
An array of Z coordination.
bool SetMapInfoSize(LPNEIGHBOR_MAP_INFO lpMapInfo, double fSize)
Building Hamiltonian part.
static void ShowMsg(char *pszBuffer)
Show message.
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
MATERIAL_INDEX GetDomainMaterialNumber()
Get atom material type.
ATOM_TYPE GetType()
Class for coordination.
unsigned int GetNeighborCount()
double * pfX_Coordination
An array of X coordination.
Definition: CKNGlobal.h:105
static void FreeMapInfo(LPNEIGHBOR_MAP_INFO lpMapInfo)
Release mapinfo data.
MATERIAL_INDEX GetMaterialMaterialNumber(unsigned int nIndex)
Get Neighbor material type.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
An array of Neighbor material Number.
Definition: CKNGlobal.h:105
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
Definition: CKNGlobal.h:105
double * pfY_Coordination
An array of Y coordination.
double fItemCount
Item count at atom map.
static double GetSubElementID()
Reset SubElement ID to Zero.
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: CKNGlobal.h:53
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
bool bSaveMapFile
Save atom map or not.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
bool IsPeriodicAtom()
Set atom is periodic.
static int GetCurrentRank()
Definition: KNMPIManager.h:42
Class for Atom.
double * pfID
An array of atom ID.
bool IsPeriodicCoupling(int nIndex)
Check is this periodic atom.
MATERIAL_INDEX GetMaterialNumber()
Get atom typpe.
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
CKNGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
CKNGeometricCoordination GetCoordination()
Get Domain atom material type.
static bool IsRootRank()
Get Total node count.
void BuildGeoFileName(char *pszFileName, CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Make atom map naming.
static void SendDoubleBufferSync(int nTargetRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Sending buffer for double data array with sync.
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.
double GetNeighborAtomID(unsigned int nIndex)
Get neighbor atom count.
void InitMapInfo(LPNEIGHBOR_MAP_INFO lpMapInfo)
Intilize map info data.
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: KNMPIManager.h:72
static void ReceiveDoubleBufferSync(int nSourceRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Receivinging buffer for double data array with sync.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::Deserialize ( std::vector< CKNGeometricUnitCell > *  pVectUnitCell,
double *  pBuffer,
bool  bFrontSide 
)
private

Deerialize unitcells from double array.

Parameters
[out]pVectUnitCellBuffer for saving deserializing result
pBufferSource data buffer
bFrontSideOption is fornt side or not

Definition at line 1241 of file KNGeometricShape.cpp.

References _Y, _Z, CKNGeometricUnitCell::Deserialize(), CKNGeometricAtomFactory::GetAtomCountInUnitcell(), m_fAssignedCount, m_vectUnitCell, CKNGeometricUnitCell::SetID(), and UNITCELL_WRITING_BLOCK_SIZE.

Referenced by ExchangeAtomInfoBetweenNode().

1242 {
1243  double fReceivingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1244  int i, nSize = m_vectUnitCell.size();
1245  int fPos = 0;
1246  int nAtomCountInCell = CKNGeometricAtomFactory::GetAtomCountInUnitcell();
1247  double fID;
1248 
1249  if( bFrontSide )
1250  fID = -fReceivingCount;
1251  else
1252  fID = m_vectUnitCell[m_vectUnitCell.size()-1].GetID() + 1;
1253 
1254  for (i = 0 ; i < floor(fReceivingCount); ++i)
1255  {
1256  CKNGeometricUnitCell unitcell;
1257 
1258  unitcell.SetID(fID++);
1259  unitcell.Deserialize(pBuffer + fPos);
1260  pVectUnitCell->push_back(unitcell);
1261  fPos += nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE;
1262  }
1263 }
Class for Geometric unit cell.
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: CKNGlobal.h:66
void SetID(double fID)
void Deserialize(double *pBuffer)
Convert double buffer to unit cell data.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::ExchangeAtomInfoBetweenNode ( )

Get start index of atom in shape, using in MPI running enviroment.

Exchange edge information between MPI nodes

< Exchange bondary atom layer to back side

< Exchange bondary atom layer to front side

Definition at line 1096 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNMPIManager::BroadcastDouble(), Deserialize(), FREE_MEM, CKNGeometricAtomFactory::GetAtomCountInUnitcell(), CKNMPIManager::GetCurrentRank(), CKNGeometricUnitCell::GetSubElementID(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), m_bConsiderBoundaryCondition, m_fAssignedCount, m_fAtomIDStartIndex, m_fTotalAtomCountinMPI, m_vectNextUnitCell, m_vectPrevUnitCell, m_vectUnitCell, CKNMPIManager::ReceiveDoubleBufferSync(), CKNMPIManager::SendDoubleBufferSync(), Serialize(), ShiftAtomID(), and UNITCELL_WRITING_BLOCK_SIZE.

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver(), and CKNGeometricConstructionLaunch::LaunchingGeometricConstructionMPI().

1097 {
1098  double fShift = CKNMPIManager::GetCurrentRank() * floor(m_fAssignedCount[0]) * floor(m_fAssignedCount[1]) * floor(m_fAssignedCount[2]);
1099  int i, nSize = m_vectUnitCell.size();
1100  double fSendingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1101  double *pSendBuffer = NULL;
1102  int nAtomCountInCell = CKNGeometricAtomFactory::GetAtomCountInUnitcell();
1103  double *pReceiveBuffer = (double*)malloc(sizeof(double)*(fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell));
1104  MPI_Request req[2];
1105  double fAtomID = 0;
1106 
1108  {
1110  FREE_MEM(pReceiveBuffer);
1111  return;
1112  }
1113 
1114 
1117  {
1119  CKNMPIManager::SendDoubleBufferSync(1, &fAtomID, 1, &req[0]);
1120  }
1121  else
1122  {
1124  m_fAtomIDStartIndex = fAtomID;
1125  for (i = 0; i < nSize; ++i)
1126  m_vectUnitCell[i].ShiftAtomID(fAtomID);
1127 
1129  {
1132  }
1134  {
1136  m_fTotalAtomCountinMPI = fAtomID;
1137  }
1138  }
1139 
1142 
1143 
1146  {
1147  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-1);
1148  CKNMPIManager::SendDoubleBufferSync(CKNMPIManager::GetCurrentRank() + 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1149  }
1150  else
1151  {
1152  CKNMPIManager::ReceiveDoubleBufferSync(CKNMPIManager::GetCurrentRank() -1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1153  Deserialize(&m_vectPrevUnitCell, pReceiveBuffer, true);
1154 
1156  {
1157  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-1);
1158  CKNMPIManager::SendDoubleBufferSync(CKNMPIManager::GetCurrentRank() + 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1159  }
1160  else
1161  {
1163  {
1164  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-2);
1165  CKNMPIManager::SendDoubleBufferSync(0, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1166  }
1167  }
1168  }
1169 
1171  {
1172  CKNMPIManager::ReceiveDoubleBufferSync(CKNMPIManager::GetTotalNodeCount() - 1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1173  Deserialize(&m_vectPrevUnitCell, pReceiveBuffer, true);
1174  }
1175  FREE_MEM(pSendBuffer);
1176 
1179  {
1180  pSendBuffer = Serialize(0);
1181  CKNMPIManager::SendDoubleBufferSync(CKNMPIManager::GetCurrentRank() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1182  }
1183  else
1184  {
1185  CKNMPIManager::ReceiveDoubleBufferSync(CKNMPIManager::GetCurrentRank() + 1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1186  Deserialize(&m_vectNextUnitCell, pReceiveBuffer, false);
1187 
1189  {
1190  pSendBuffer = Serialize(0);
1191  CKNMPIManager::SendDoubleBufferSync(CKNMPIManager::GetCurrentRank() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1192  }
1193  else
1194  {
1196  {
1197  pSendBuffer = Serialize(1);
1198  CKNMPIManager::SendDoubleBufferSync(CKNMPIManager::GetTotalNodeCount() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1199  }
1200  }
1201  }
1202 
1204  {
1205  CKNMPIManager::ReceiveDoubleBufferSync(0, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1206  Deserialize(&m_vectNextUnitCell, pReceiveBuffer, false);
1207  }
1208 
1209  FREE_MEM(pSendBuffer);
1210  FREE_MEM(pReceiveBuffer);
1211 }
std::vector< CKNGeometricUnitCell > m_vectNextUnitCell
Back end edge unit cell that copy from next side node.
static void BroadcastDouble(double *pValue, unsigned int nSize, int nRootRank=0, MPI_Comm comm=MPI_COMM_NULL)
Broadcst boolean value.
Definition: CKNGlobal.h:105
void Deserialize(std::vector< CKNGeometricUnitCell > *pVectUnitCell, double *pBuffer, bool bFrontSide)
Deerialize unitcells from double array.
std::vector< CKNGeometricUnitCell > m_vectPrevUnitCell
Front edge unit cell that copy from previous side node.
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
Definition: CKNGlobal.h:105
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
double * Serialize(double fXLayer)
Serialize unitcells with specific later index to double array.
Definition: CKNGlobal.h:105
static double GetSubElementID()
Reset SubElement ID to Zero.
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: CKNGlobal.h:66
static int GetCurrentRank()
Definition: KNMPIManager.h:42
double m_fTotalAtomCountinMPI
Total valid atom count in shape.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: CKNGlobal.h:20
double m_fAtomIDStartIndex
Start atom index in current Shape.
static bool IsRootRank()
Get Total node count.
static void SendDoubleBufferSync(int nTargetRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Sending buffer for double data array with sync.
void ShiftAtomID(double fShift)
Shift atom id in MPI running enviroment.
static void ReceiveDoubleBufferSync(int nSourceRank, double *pBuffer, int nSize, MPI_Request *req, MPI_Comm commWorld=MPI_COMM_NULL)
Receivinging buffer for double data array with sync.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNGeometricShape::FillUnitcell ( CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam)

Set bondary condition of shape.

Spreading atom into shape

Parameters
lpParamInput parameter parsing from command file
Returns
Function working success or not

Definition at line 103 of file KNGeometricShape.cpp.

References ArrangeUnitCell(), CalculateUnitcellCount(), and CheckingNeighborCandiate().

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver(), CKNGeometricConstructionLaunch::LaunchingGeometricConstruction(), and CKNGeometricConstructionLaunch::LaunchingGeometricConstructionMPI().

104 {
105  bool bRtn;
106 
107  bRtn = CalculateUnitcellCount();
108  if( !bRtn )
109  return bRtn;
110 
111  ArrangeUnitCell(lpParam);
113 
114  return bRtn;
115 }
bool CalculateUnitcellCount()
Calculating unitcell count in shape.
void CheckingNeighborCandiate()
Checking neighbor unitcell by calculating index.
void ArrangeUnitCell(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Arranging unitcell into shape.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::FinalShape ( )

Finalize Shape variable.

Definition at line 249 of file KNGeometricShape.cpp.

References FreeUnitCellList().

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver(), and ~CKNGeometricShape().

250 {
252 }
void FreeUnitCellList()
Relase unitcell list.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::FreeMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo)
static

Release mapinfo data.

Parameters
lpMapInfoAtom map information

Definition at line 1043 of file KNGeometricShape.cpp.

References FREE_MEM, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pDomainMaterialNumber, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, NEIGHBOR_MAP_INFO::pMaterialNumber, and NEIGHBOR_MAP_INFO::pNeighborMaterial.

Referenced by ConstructMapInfo(), CKNTBMS_Solver::FinalEvn(), and CKNGeometricConstructionLaunch::LaunchingGeometricConstruction().

1044 {
1045  unsigned int i;
1046 
1047  FREE_MEM(lpMapInfo->pfID);
1048  FREE_MEM(lpMapInfo->pAtomType);
1049  FREE_MEM(lpMapInfo->pMaterialNumber);
1050  FREE_MEM(lpMapInfo->pDomainMaterialNumber);
1051  FREE_MEM(lpMapInfo->pfX_Coordination);
1052  FREE_MEM(lpMapInfo->pfY_Coordination);
1053  FREE_MEM(lpMapInfo->pfZ_Coordination);
1054 
1055  for (i = 0; i < MAX_NEIGHBOR; ++i)
1056  {
1057  FREE_MEM(lpMapInfo->pfNeighbor[i]);
1058  FREE_MEM(lpMapInfo->pbPeriodicCondition[i]);
1059  FREE_MEM(lpMapInfo->pNeighborMaterial[i]);
1060  }
1061 }
double * pfZ_Coordination
An array of Z coordination.
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
double * pfX_Coordination
An array of X coordination.
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
An array of Neighbor material Number.
#define MAX_NEIGHBOR
Definition: CKNGlobal.h:86
double * pfY_Coordination
An array of Y coordination.
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
double * pfID
An array of atom ID.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: CKNGlobal.h:20
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
CKNGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.

Here is the caller graph for this function:

void CKNGeometricShape::FreeUnitCellList ( )
private

Relase unitcell list.

Definition at line 220 of file KNGeometricShape.cpp.

References m_vectNextUnitCell, m_vectPrevUnitCell, m_vectSurfaceAtom, and m_vectUnitCell.

Referenced by FinalShape().

221 {
222  m_vectUnitCell.clear();
223  m_vectPrevUnitCell.clear();
224  m_vectNextUnitCell.clear();
225  m_vectSurfaceAtom.clear();
226 }
std::vector< CKNGeometricUnitCell > m_vectNextUnitCell
Back end edge unit cell that copy from next side node.
std::vector< CKNGeometricAtom * > m_vectSurfaceAtom
std::vector< CKNGeometricUnitCell > m_vectPrevUnitCell
Front edge unit cell that copy from previous side node.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.

Here is the caller graph for this function:

CKNGeometricAtom * CKNGeometricShape::GetAtomByIndex ( double  fID)
private

Get atom instance by ID.

Parameters
fIDAtom ID
Returns
Atom instance pointer

Definition at line 677 of file KNGeometricShape.cpp.

References CKNGeometricAtom::IsPeriodicAtom(), and m_vectUnitCell.

Referenced by RefillPeriodicBinding().

678 {
679  CKNGeometricAtom *pRtn = NULL;
680  int nSize, i;
681 
682  nSize = m_vectUnitCell.size();
683  for( i = 0; i < nSize ; ++ i)
684  {
685  pRtn = m_vectUnitCell[i].GetSubElementByID(fID);
686  if( NULL != pRtn && false == pRtn->IsPeriodicAtom())
687  return pRtn;
688  }
689 
690  return pRtn;
691 }
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
bool IsPeriodicAtom()
Set atom is periodic.
Class for Atom.

Here is the call graph for this function:

Here is the caller graph for this function:

double CKNGeometricShape::GetAtomStartID ( )
inline

Set total valid atom count in shape.

Definition at line 57 of file KNGeometricShape.h.

References m_fAtomIDStartIndex.

Referenced by CKNTBMS_Solver::AllocateCSR(), and CKNTBMS_Solver::Launching_TBMS_Solver().

57 { return m_fAtomIDStartIndex; };
double m_fAtomIDStartIndex
Start atom index in current Shape.

Here is the caller graph for this function:

bool CKNGeometricShape::GetConsideringBoundaryCondition ( AXIS_DEFINE  direction)
inline

Definition at line 42 of file KNGeometricShape.h.

References m_bConsiderBoundaryCondition.

42 { return m_bConsiderBoundaryCondition[direction]; };
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
double CKNGeometricShape::GetKPhaseSign ( double  fAtomPos,
double  fPeriodicAtomPos 
)
private

Calculating Phase sign.

Parameters
fAtomPosAtom coordination
fPeriodicAtomPosPeriodic atom coordination
Returns
sign of Phase

Definition at line 663 of file KNGeometricShape.cpp.

Referenced by RefillPeriodicBinding().

664 {
665  double fRtn = 1.;
666 
667  if( fPeriodicAtomPos - fAtomPos > 0 )
668  fRtn = -1.;
669 
670  return fRtn;
671 }

Here is the caller graph for this function:

MATERIAL_INDEX CKNGeometricShape::GetMaterialType ( )
inline

Definition at line 36 of file KNGeometricShape.h.

References m_MaterialType.

36 { return m_MaterialType; };
MATERIAL_INDEX m_MaterialType
Material type of shape.
int CKNGeometricShape::GetPeriodicDirection ( int  x,
int  y,
int  z,
int  maxX,
int  maxY,
int  maxZ 
)
private

Get periodic direction information.

Parameters
xx direction unitcell index
yy direction unitcall index
zz direction unitcell index
maxXx direction max index of unitcell
maxYy direction max index of unitcell
maxZz direction max index of unitcell

Definition at line 136 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), m_bConsiderBoundaryCondition, CKNGeometricAtom::NONE, CKNGeometricAtom::X_DIRECTION, CKNGeometricAtom::Y_DIRECTION, and CKNGeometricAtom::Z_DIRECTION.

Referenced by ArrangeUnitCell().

137 {
138  int nRtn = CKNGeometricAtom::NONE;
139 
140  if (0 == x && true == m_bConsiderBoundaryCondition[_X])
141 #ifndef DISABLE_MPI_ROUTINE
144 #else //DISABLE_MPI_ROUTINE
146 #endif //DISABLE_MPI_ROUTINE
147 
148  if (0 == y && true == m_bConsiderBoundaryCondition[_Y])
150 
151  if (0 == z && true == m_bConsiderBoundaryCondition[_Z])
153 
154  if (maxX - 1 == x && true == m_bConsiderBoundaryCondition[_X])
155 #ifndef DISABLE_MPI_ROUTINE
158 #else //DISABLE_MPI_ROUTINE
160 #endif //DISABLE_MPI_ROUTINE
161 
162  if (maxY - 1 == y && true == m_bConsiderBoundaryCondition[_Y])
164 
165  if (maxZ - 1 == z && true == m_bConsiderBoundaryCondition[_Z])
167 
168  return nRtn;
169 }
Definition: CKNGlobal.h:105
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
static int GetCurrentRank()
Definition: KNMPIManager.h:42
static bool IsRootRank()
Get Total node count.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int CKNGeometricShape::GetShapeForm ( )
inline

Definition at line 39 of file KNGeometricShape.h.

References m_ShapeForm.

39 { return m_ShapeForm; };
unsigned int m_ShapeForm
Shape form.
std::vector<CKNGeometricAtom*>* CKNGeometricShape::GetSurfaceAtomList ( )
inline

Definition at line 60 of file KNGeometricShape.h.

Referenced by BuildNeighborInformation(), and CKNTBMS_Solver::Launching_TBMS_Solver().

60 { return &m_vectSurfaceAtom; };
std::vector< CKNGeometricAtom * > m_vectSurfaceAtom

Here is the caller graph for this function:

double CKNGeometricShape::GetTotalAtomCount ( )
inline

Definition at line 55 of file KNGeometricShape.h.

References m_fTotalAtomCountinMPI.

Referenced by CKNTBMS_Solver::AllocateCSR().

55 { return m_fTotalAtomCountinMPI;};
double m_fTotalAtomCountinMPI
Total valid atom count in shape.

Here is the caller graph for this function:

void CKNGeometricShape::InitMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo)

Intilize map info data.

Parameters
lpMapInfoAtom map information

Definition at line 1066 of file KNGeometricShape.cpp.

References NEIGHBOR_MAP_INFO::fItemCount, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, and NEIGHBOR_MAP_INFO::pNeighborMaterial.

Referenced by ConstructMapInfo().

1067 {
1068  unsigned int i;
1069 
1070  lpMapInfo->pfID = NULL;
1071  lpMapInfo->pAtomType = NULL;
1072  lpMapInfo->pfX_Coordination = NULL;
1073  lpMapInfo->pfY_Coordination = NULL;
1074  lpMapInfo->pfZ_Coordination = NULL;
1075  lpMapInfo->fItemCount = 0;
1076 
1077  for (i = 0; i < MAX_NEIGHBOR; ++i)
1078  {
1079  lpMapInfo->pfNeighbor[i] = NULL;
1080  lpMapInfo->pbPeriodicCondition[i] = NULL;
1081  lpMapInfo->pNeighborMaterial[i] = NULL;
1082  }
1083 }
double * pfZ_Coordination
An array of Z coordination.
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
double * pfX_Coordination
An array of X coordination.
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
An array of Neighbor material Number.
#define MAX_NEIGHBOR
Definition: CKNGlobal.h:86
double * pfY_Coordination
An array of Y coordination.
double fItemCount
Item count at atom map.
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
double * pfID
An array of atom ID.
CKNGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.

Here is the caller graph for this function:

void CKNGeometricShape::InitShape ( )
private

Initialize Shape variable.

Definition at line 228 of file KNGeometricShape.cpp.

References _X, _Y, _Z, BOX_SHAPE, m_bBackendFace, m_bConsiderBoundaryCondition, m_bFrontFace, m_fAtomIDStartIndex, m_fLength, m_fTotalAtomCountinMPI, m_MaterialType, m_nAtomFirstLayer, m_nAtomLastLayer, m_originCoordination, m_pUnitCellInfo, m_shapDirection, m_ShapeForm, CKNGeometricCoordination::SetCoordination(), CKNGeometricDirection::SetDirection(), and Si.

Referenced by CKNGeometricShape().

229 {
230  m_originCoordination.SetCoordination(0.0, 0.0, 0.0);
231  m_shapDirection.SetDirection(1, 0, 0);
232  m_fLength[_X] = 0;
233  m_fLength[_Y] = 0;
234  m_fLength[_Z] = 0;
235  m_MaterialType = Si;
240  m_bFrontFace = false;
241  m_bBackendFace = false;
244  m_pUnitCellInfo = NULL;
245  m_nAtomFirstLayer = 0;
246  m_nAtomLastLayer = 0;
247 }
unsigned int m_ShapeForm
Shape form.
MATERIAL_INDEX m_MaterialType
Material type of shape.
void SetDirection(double *fDirection)
Set direciton information.
CKNGeometricDirection m_shapDirection
Direction of shape.
Definition: CKNGlobal.h:105
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static IKNGeometricUnitCellInfo * m_pUnitCellInfo
Unitcell information pointer for using in class internal.
Definition: CKNGlobal.h:105
CKNGeometricCoordination m_originCoordination
Orign coordination of shape.
bool m_bBackendFace
Flag of back end face or not.
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:106
double m_fLength[3]
Building Geometric part.
#define BOX_SHAPE
Definition: CKNGlobal.h:88
double m_fTotalAtomCountinMPI
Total valid atom count in shape.
bool m_bFrontFace
Flag of front face or not.
double m_fAtomIDStartIndex
Start atom index in current Shape.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination with double buffer.
unsigned int m_nAtomLastLayer
Last layer information for sending to next node.
unsigned int m_nAtomFirstLayer
Get Surface atom list.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNGeometricShape::IsBackendFace ( )
inline

Set front face side mark to shape object.

Definition at line 48 of file KNGeometricShape.h.

References m_bBackendFace.

48 { return m_bBackendFace; };
bool m_bBackendFace
Flag of back end face or not.
bool CKNGeometricShape::IsFrontFace ( )
inline

Definition at line 46 of file KNGeometricShape.h.

References m_bFrontFace.

46 { return m_bFrontFace; };
bool m_bFrontFace
Flag of front face or not.
bool CKNGeometricShape::IsInBoundaryCondition ( int  x,
int  y,
int  z,
int  maxX,
int  maxY,
int  maxZ 
)
private

Check unitcell is in the bondary area or not.

Parameters
xx direction unitcell index
yy direction unitcall index
zz direction unitcell index
maxXx direction max index of unitcell
maxYy direction max index of unitcell
maxZz direction max index of unitcell
Returns
If it is in bondary condition return true, else return false

Definition at line 180 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), and m_bConsiderBoundaryCondition.

Referenced by ArrangeUnitCell().

181 {
182  bool bRtn = false;
183 
184  if (0 == x && true == m_bConsiderBoundaryCondition[_X])
185 #ifndef DISABLE_MPI_ROUTINE
186  {
188  return bRtn;
189  }
190 #else //DISABLE_MPI_ROUTINE
191  return bRtn;
192 #endif //DISABLE_MPI_ROUTINE
193 
194  if (0 == y && true == m_bConsiderBoundaryCondition[_Y])
195  return bRtn;
196 
197  if (0 == z && true == m_bConsiderBoundaryCondition[_Z])
198  return bRtn;
199 
200  if (maxX - 1 == x && true == m_bConsiderBoundaryCondition[_X])
201 #ifndef DISABLE_MPI_ROUTINE
202  {
204  return bRtn;
205  }
206 #else //DISABLE_MPI_ROUTINE
207  return bRtn;
208 #endif //DISABLE_MPI_ROUTINE
209 
210  if (maxY - 1 == y && true == m_bConsiderBoundaryCondition[_Y])
211  return bRtn;
212 
213  if (maxZ - 1 == z && true == m_bConsiderBoundaryCondition[_Z])
214  return bRtn;
215 
216  bRtn = true;
217  return bRtn;
218 }
Definition: CKNGlobal.h:105
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
static int GetCurrentRank()
Definition: KNMPIManager.h:42
static bool IsRootRank()
Get Total node count.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::PeriodicUnitCellNumbering ( bool  bXAxis = false)

Numbering to periodic unitcell.

Parameters
bXAxisDo operation to x axis or not

Definition at line 498 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNGeometricUnitCell::CalculatingIndex(), FIND_TARGET_INDEX, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), m_bConsiderBoundaryCondition, m_fAssignedCount, m_vectNextUnitCell, m_vectPrevUnitCell, and m_vectUnitCell.

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver(), CKNGeometricConstructionLaunch::LaunchingGeometricConstruction(), and CKNGeometricConstructionLaunch::LaunchingGeometricConstructionMPI().

499 {
500  int i, nSize = m_vectUnitCell.size();
501  int maxX, maxY, maxZ;
502  double targetCx, targetCy, targetCz;
503  double *pfAssignIndex = NULL;
504  double fCopyIndex = -1;
505 
507  return;
508 
509  maxX = (int)floor(m_fAssignedCount[_X]);
510  maxY = (int)floor(m_fAssignedCount[_Y]);
511  maxZ = (int)floor(m_fAssignedCount[_Z]);
512 
513  for (i = 0; i < nSize; ++i)
514  {
515  if (m_vectUnitCell[i].IsPeriodicUnitCell())
516  {
517  pfAssignIndex = m_vectUnitCell[i].GetAssignedIndex();
518  targetCx = pfAssignIndex[_X];
519  targetCy = pfAssignIndex[_Y];
520  targetCz = pfAssignIndex[_Z];
521 
522  FIND_TARGET_INDEX(targetCy, pfAssignIndex, m_fAssignedCount, _Y);
523  FIND_TARGET_INDEX(targetCz, pfAssignIndex, m_fAssignedCount, _Z);
524 
526  {
527 #ifdef DISABLE_MPI_ROUTINE
528  FIND_TARGET_INDEX(targetCx, pfAssignIndex, m_fAssignedCount, _X);
529 #else //DISABLE_MPI_ROUTINE
531  {
532  FIND_TARGET_INDEX(targetCx, pfAssignIndex, m_fAssignedCount, _X);
533  }
534  else
535  {
536  if( 0 == pfAssignIndex[_X] && CKNMPIManager::IsRootRank())
537  {
538  targetCx = -1;
539  if( false == bXAxis)
540  continue;
541  }
542  else if (m_fAssignedCount[_X] - 1 == pfAssignIndex[_X]
544  {
545  targetCx = pfAssignIndex[_X]+1;
546  if( false == bXAxis)
547  continue;
548  }
549  }
550 #endif //DISABLE_MPI_ROUTINE
551  }
552 
553  fCopyIndex = CKNGeometricUnitCell::CalculatingIndex(targetCx, targetCy, targetCz, m_fAssignedCount);
554 #ifndef DISABLE_MPI_ROUTINE
556  {
557  if( false == bXAxis )
558  m_vectUnitCell[i].CopyInnerAtomIndex(m_vectUnitCell[(unsigned int)fCopyIndex]);
559  }
560  else
561  {
562  if (fCopyIndex < 0 && m_vectPrevUnitCell.size() > 0)
563  {
564  m_vectUnitCell[i].CopyInnerAtomIndex(m_vectPrevUnitCell[(unsigned int)(fCopyIndex + m_fAssignedCount[_Y] * m_fAssignedCount[_Z])]);
565  }
566  else if (fCopyIndex >= maxX * maxY * maxZ && m_vectNextUnitCell.size() > 0)
567  {
568  m_vectUnitCell[i].CopyInnerAtomIndex(m_vectNextUnitCell[(unsigned int)(fCopyIndex - m_fAssignedCount[_X] * m_fAssignedCount[_Y] * m_fAssignedCount[_Z])]);
569  }
570  else
571  {
572  if( false == bXAxis )
573  m_vectUnitCell[i].CopyInnerAtomIndex(m_vectUnitCell[(unsigned int)fCopyIndex]);
574  }
575  }
576 #else //DISABLE_MPI_ROUTINE
577  {
578  if( false == bXAxis )
579  m_vectUnitCell[i].CopyInnerAtomIndex(m_vectUnitCell[(unsigned int)fCopyIndex]);
580  }
581 #endif //DISABLE_MPI_ROUTINE
582  }
583  }
584 }
std::vector< CKNGeometricUnitCell > m_vectNextUnitCell
Back end edge unit cell that copy from next side node.
Definition: CKNGlobal.h:105
std::vector< CKNGeometricUnitCell > m_vectPrevUnitCell
Front edge unit cell that copy from previous side node.
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
Definition: CKNGlobal.h:105
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
Definition: CKNGlobal.h:105
static int GetCurrentRank()
Definition: KNMPIManager.h:42
#define FIND_TARGET_INDEX(targetC, AssignIndex, AssigneCount, direction)
static double CalculatingIndex(double fXAssignedIndex, double fYAssignedIndex, double fZAssignedIndex, double fAssignedCount[3])
Calulating unit cell index.
static bool IsRootRank()
Get Total node count.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNGeometricShape::RefillPeriodicBinding ( CKNMatrixOperation::CKNCSR pResult,
CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
unsigned int  nRepeatIndex,
double  fKValue[3] 
)

Applying phase to Hamiltonian.

Parameters
[out]CKNMatrixOperationCSR instance
lpParamInput parameters parsing from command file
lpMapInfoAtom map information
nRepeatIndexRepeat index, means k points
fKValuek value for x, y, z direction
Returns
Operatoin success return true, else return false

Definition at line 596 of file KNGeometricShape.cpp.

References CKNMatrixOperation::CKNCSR::AreaScalarMultiple(), ATOM_DEFAULT_INDEX, NEIGHBOR_MAP_INFO::fItemCount, GetAtomByIndex(), CKNGeometricCoordination::GetCoordination(), CKNGeometricAtom::GetCoordination(), CKNGeometricDirection::GetDirectionAll(), GetKPhaseSign(), CKNGeometricAtom::GetNeighborCoordination(), CKNGeometricAtom::GetNeighborPeriodicDirection(), CKNGeometricAtom::IsPeriodicCoupling(), m_shapDirection, ORBITALS, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, PI_VALUE, and CKNComplex::SetComplexNumber().

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver().

597 {
598  unsigned int i, j, k;
599  double *pDirection = m_shapDirection.GetDirectionAll();
600  double kTotal = 0;
601  CKNComplex calcuResult;
602  double fNeighborIndex[4];
603  bool bRtn = false;
604 
605  if( 0 == fKValue[0] && 0 == fKValue[1] && 0 == fKValue[2] )
606  {
607  bRtn = true;
608  return bRtn;
609  }
610 
611  for (i = 0; i < lpMapInfo->fItemCount; ++i)
612  {
613  int nMatrixIndex = 0;
614  double kkTotal = kTotal;
615  CKNGeometricAtom* pCurrentAtom = GetAtomByIndex(lpMapInfo->pfID[i]);
616 
617  for (j = 0; j < 4; ++j)
618  fNeighborIndex[j] = lpMapInfo->pfNeighbor[j][i];
619  //fNeighborIndex[0] = lpMapInfo->pfNeighbor_1[i]; fNeighborIndex[1] = lpMapInfo->pfNeighbor_2[i]; fNeighborIndex[2] = lpMapInfo->pfNeighbor_3[i]; fNeighborIndex[3] = lpMapInfo->pfNeighbor_4[i];
620 
621  /* if (CKNGeometricAtom::C == lpMapInfo->pAtomType[i])
622  nMatrixIndex = 4;*/
623 
624  for (j = 0; j < 4; j++)
625  {
626  double kTotal = 0;
627 
628  if (ATOM_DEFAULT_INDEX != fNeighborIndex[j] && true == pCurrentAtom->IsPeriodicCoupling(j))
629  {
630  CKNGeometricCoordination coupleCoordination = pCurrentAtom->GetNeighborCoordination(j);
631  int periodicDirection = pCurrentAtom->GetNeighborPeriodicDirection(j);
632 
633  if (coupleCoordination == pCurrentAtom->GetCoordination())
634  continue;
635 
636  for (k = 0; k < 3; k++)
637  {
638  int nPeriodic = periodicDirection & (int)pow((double)2, (int)k);
639 
640  if (0 != nPeriodic)
641  {
642  double fPhase = GetKPhaseSign(pCurrentAtom->GetCoordination().GetCoordination((AXIS_DEFINE)k),
643  coupleCoordination.GetCoordination((AXIS_DEFINE)k));
644  kTotal += (fPhase * fKValue[k] * PI_VALUE);
645  }
646  }
647  calcuResult.SetComplexNumber(cos(kTotal), sin(kTotal));
648 
649  pResult->AreaScalarMultiple(i * ORBITALS, ORBITALS, (unsigned int)fNeighborIndex[j] * ORBITALS, ORBITALS, calcuResult);
650  }
651  }
652  }
653 
654  bRtn = true;
655  return bRtn;
656 }
CKNGeometricDirection m_shapDirection
Direction of shape.
int GetNeighborPeriodicDirection(int nIndex)
Get neighbor coupling periodic direction if has coupling with periodic atom.
Class for coordination.
double * GetDirectionAll()
Get direction information all.
bool AreaScalarMultiple(unsigned int nRowStart, unsigned int nRowCount, unsigned int nColumnStart, unsigned int nColumnCount, CKNComplex Scalar)
Scalar multiple operation to specific area.
double GetKPhaseSign(double fAtomPos, double fPeriodicAtomPos)
Calculating Phase sign.
AXIS_DEFINE
Definition: CKNGlobal.h:105
double fItemCount
Item count at atom map.
CKNGeometricCoordination GetNeighborCoordination(int nIndex)
Get neighbor coordination.
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: CKNGlobal.h:53
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
CKNGeometricAtom * GetAtomByIndex(double fID)
Get atom instance by ID.
Class for Atom.
double * pfID
An array of atom ID.
#define PI_VALUE
Pi definition.
Definition: CKNGlobal.h:77
bool IsPeriodicCoupling(int nIndex)
Check is this periodic atom.
This class for complex operation and saving value.
Definition: KNComplex.h:18
CKNGeometricCoordination GetCoordination()
Get Domain atom material type.
#define ORBITALS
At Hamiltonian matrix one atom inserted 10 * 10.
Definition: CKNGlobal.h:54
void SetComplexNumber(double fReal, double fImaginaray)
Set Complex number using real part and imaginary part.
Definition: KNComplex.cpp:59

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::RotateMatrix ( CKNMatrixOperation::CKNDMatrix pMatrixNbr,
CKNMatrixOperation::CKNDMatrix pMatrixResult,
double  fDegree[2] 
)
private

Rotate matrix with calculated degree.

Parameters
pMatrixNbrSource matrix
pMatrixResultRotated matrix
paramterGeometric parameters

Definition at line 710 of file KNGeometricShape.cpp.

References CKNMatrixOperation::CKNDMatrix::BuildMatrixFirst(), CKNMatrixOperation::MMMul(), PHI_DEGREE, CKNMatrixOperation::CKNDMatrix::SetElement(), THETA_DEGREE, and CKNMatrixOperation::CKNDMatrix::TrnasPos().

711 {
712  CKNMatrixOperation::CKNDMatrix matrixRotate;
713 
714  matrixRotate.BuildMatrixFirst(3, 3);
715 
716  matrixRotate.SetElement(0, 0, cos(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
717  matrixRotate.SetElement(0, 1, -sin(fDegree[THETA_DEGREE]), 0);
718  matrixRotate.SetElement(0, 2, -cos(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
719 
720  matrixRotate.SetElement(1, 0, sin(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
721  matrixRotate.SetElement(1, 1, cos(fDegree[THETA_DEGREE]), 0);
722  matrixRotate.SetElement(1, 2, -sin(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
723 
724  matrixRotate.SetElement(2, 0, sin(fDegree[PHI_DEGREE]), 0);
725  matrixRotate.SetElement(2, 1, 0, 0);
726  matrixRotate.SetElement(2, 2, cos(fDegree[PHI_DEGREE]), 0);
727 
728  matrixRotate.TrnasPos();
729 
730  pMatrixNbr->TrnasPos();
731  CKNMatrixOperation::MMMul(&matrixRotate, pMatrixNbr, pMatrixResult);
732  pMatrixResult->TrnasPos();
733 }
#define PHI_DEGREE
Definition: CKNGlobal.h:80
Data and operation representation of Matrix.
#define THETA_DEGREE
Definition: CKNGlobal.h:79
static void MMMul(CKNDMatrix *pMatrix, CKNDMatrix *pMatrixOperand, CKNDMatrix *pResult)
Matrix and matrix multiple operation.
bool TrnasPos()
Transpos matrix.
bool SetElement(unsigned int nRow, unsigned int nColumn, CKNComplex element)
Set matrix elements value.
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.

Here is the call graph for this function:

double * CKNGeometricShape::Serialize ( double  fXLayer)
private

Serialize unitcells with specific later index to double array.

Parameters
fXLayerTarget x layer index

Definition at line 1216 of file KNGeometricShape.cpp.

References _Y, _Z, CKNGeometricAtomFactory::GetAtomCountInUnitcell(), m_fAssignedCount, m_vectUnitCell, and UNITCELL_WRITING_BLOCK_SIZE.

Referenced by ExchangeAtomInfoBetweenNode().

1217 {
1218  double *pBuffer = NULL;
1219  double fSendingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1220  int i, nSize = m_vectUnitCell.size();
1221  int fPos = 0;
1222  int nAtomCountInCell = CKNGeometricAtomFactory::GetAtomCountInUnitcell();
1223 
1224  pBuffer = (double*)malloc(sizeof(double)*(fSendingCount*nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE));
1225 
1226  for (i = (int)(fXLayer * floor(fSendingCount)); i < fXLayer * fSendingCount + floor(fSendingCount); ++i)
1227  {
1228 
1229  m_vectUnitCell[i].Serialize(pBuffer + fPos);
1230  fPos += nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE;
1231  }
1232 
1233  return pBuffer;
1234 }
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: CKNGlobal.h:66

Here is the call graph for this function:

Here is the caller graph for this function:

bool CKNGeometricShape::SetAtomAndNeighborInformation ( CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
static

Set neighbor information to AtomFactory.

Parameters
lpParamInput parameters parsing from command file
Returns
Success or fail

Definition at line 927 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNGeometricAtom::A, CKNGeometricAtom::A2C, CKNCommandFileParser::INPUT_CMD_PARAM::bNeedRotate, BuildRotationMatrix(), CKNGeometricAtom::C, CKNGeometricAtom::C2A, CalculateDegree(), CUBIC, CKNCommandFileParser::INPUT_CMD_PARAM::fDegree, CKNCommandFileParser::INPUT_CMD_PARAM::fUnitcellLength, IKNGeometricUnitCellInfo::GetA2CNeighborCount(), IKNGeometricUnitCellInfo::GetAnionCount(), IKNGeometricUnitCellInfo::GetAtomCoordination(), IKNGeometricUnitCellInfo::GetC2ANeighborCount(), IKNGeometricUnitCellInfo::GetCationCount(), CKNGeometricCoordination::GetCoordination(), IKNGeometricUnitCellInfo::GetNeighborCoordination(), IKNGeometricUnitCellInfo::GetUnitcCellSize(), CKNGeometricAtomFactory::InitAtomList(), IKNGeometricUnitCellInfo::InitCoordination(), CKNGeometricAtomFactory::InitNeighborList(), m_pUnitCellInfo, m_UnitCellInfo_cubic, m_UnitCellInfo_zincblende, CKNCommandFileParser::INPUT_CMD_PARAM::nDirectionSingle, IKNGeometricUnitCellInfo::RotateNeighbor(), IKNGeometricUnitCellInfo::SetAtomCoordination(), CKNGeometricAtomFactory::SetAtomCoordination(), CKNGeometricUnitCellInfo_zincblende::SetDireciton(), CKNGeometricUnitCell::SetLength(), IKNGeometricUnitCellInfo::SetNeighborCoordination(), CKNGeometricAtomFactory::SetNeighborCoordination(), CKNGeometricAtom::SetNeighborNumber(), IKNGeometricUnitCellInfo::SetUnitCellSize(), CKNCommandFileParser::INPUT_CMD_PARAM::szStructureType, and ZB.

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver().

928 {
929  unsigned int i;
930  CKNGeometricCoordination coordination;
931 
934 
935 
936  if (!strcmp(lpParam->szStructureType, CUBIC))
937  {
940  lpParam->bNeedRotate = false;
941  }
942  else if (!strcmp(lpParam->szStructureType, ZB))
943  {
944  lpParam->bNeedRotate = true;
948 
949  if (100 == lpParam->nDirectionSingle)
950  lpParam->bNeedRotate = false;
951  }
952 
953  if (NULL != m_pUnitCellInfo)
954  {
959 
960  if (lpParam->bNeedRotate)
961  {
962  CalculateDegree(lpParam);
963  BuildRotationMatrix(lpParam->fDegree);
965  }
966  }
967  else
968  return false;
969 
970  for (i = 0; i < m_pUnitCellInfo->GetAnionCount(); ++i)
971  {
974  coordination.GetCoordination(_X),
975  coordination.GetCoordination(_Y),
976  coordination.GetCoordination(_Z));
977  }
978 
979  for (i = 0; i < m_pUnitCellInfo->GetCationCount(); ++i)
980  {
983  coordination.GetCoordination(_X),
984  coordination.GetCoordination(_Y),
985  coordination.GetCoordination(_Z));
986  }
987 
988  for (i = 0; i < (unsigned int)m_pUnitCellInfo->GetA2CNeighborCount(); ++i)
989  {
992  coordination.GetCoordination(_X),
993  coordination.GetCoordination(_Y),
994  coordination.GetCoordination(_Z));
995 
996  }
997 
998  for (i = 0; i < (unsigned int)m_pUnitCellInfo->GetC2ANeighborCount(); i++)
999  {
1002  coordination.GetCoordination(_X),
1003  coordination.GetCoordination(_Y),
1004  coordination.GetCoordination(_Z));
1005  }
1006 
1008 
1009  return true;
1010 }
static CKNGeometricUnitCellInfo_cubic m_UnitCellInfo_cubic
static void SetNeighborCoordination(CKNGeometricAtom::NEIGHOR_RELATION type, double x, double y, double z)
Setting neighbor coordination.
Class for coordination.
Definition: CKNGlobal.h:105
static void BuildRotationMatrix(double fDegree[2])
Build rotation matrix for given direction.
static IKNGeometricUnitCellInfo * m_pUnitCellInfo
Unitcell information pointer for using in class internal.
void SetDireciton(int nDirectionSingle)
Set direction information.
virtual void SetAtomCoordination()=0
Atom coordination setting.
static void SetAtomCoordination(CKNGeometricAtom::ATOM_TYPE type, double x, double y, double z)
Setting atom coordination.
Definition: CKNGlobal.h:105
virtual void SetNeighborCoordination()=0
Neighbor atom coordiantion setting.
bool bNeedRotate
Calculation parameter that need to apply rotation matrix.
void InitCoordination()
Initial Coordination information.
Definition: CKNGlobal.h:105
virtual void SetUnitCellSize(double fUnitcellSize[3])=0
Unitcell size setting.
double fDegree[2]
Rotation degree, this variable isn't input by command file. It is calculated by module.
double fUnitcellLength[3]
Unitcell length x, y, z direction.
static void SetLength(double fLength[3], double fOriginLength[3])
Set unit cell length.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
char szStructureType[1024]
Structure type.
unsigned int GetCationCount()
Get anion count in Unitcell.
int GetC2ANeighborCount()
Get neigbhor relation count.
void RotateNeighbor(CKNMatrixOperation::CKNDMatrix *pRotationMatrix)
Rotating neighbor coordination.
#define CUBIC
Definition: CKNGlobal.h:83
static void CalculateDegree(CKNCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Calculating degree from direction information.
#define ZB
Definition: CKNGlobal.h:82
CKNGeometricCoordination GetNeighborCoordination(CKNGeometricAtom::NEIGHOR_RELATION neighborType, unsigned int nIndex)
Get neigbhor atom coordination from Unitcell.
int GetA2CNeighborCount()
Get neigbhor relation count.
CKNGeometricCoordination GetAtomCoordination(CKNGeometricAtom::ATOM_TYPE atomType, unsigned int nIndex)
Get Unitcell size x, y, z direction axis.
double * GetUnitcCellSize()
Get cation count in Unitcell.
static CKNMatrixOperation::CKNDMatrix m_rotationMatrix
Rotation matrix for given direction.
static void SetNeighborNumber(unsigned int nNeighborNumber)
Get periodic direction information.
static CKNGeometricUnitCellInfo_zincblende m_UnitCellInfo_zincblende

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::SetBackendFace ( bool  bBackendFace)
inline

Check is this back end face side in MPI running enviroment.

Set back end side mark to shape object

Definition at line 49 of file KNGeometricShape.h.

References m_bBackendFace.

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

Here is the caller graph for this function:

void CKNGeometricShape::SetConsideringBoundaryCondition ( bool  bConsider,
AXIS_DEFINE  direction 
)
inline

Get bondary condition of shape.

Definition at line 43 of file KNGeometricShape.h.

References m_bConsiderBoundaryCondition.

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

43 { m_bConsiderBoundaryCondition[direction] = bConsider; };
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.

Here is the caller graph for this function:

void CKNGeometricShape::SetDirection ( double  x_axis,
double  y_axis,
double  z_axis 
)

Set direciton of shape.

Parameters
x_axisx direction information
y_axisy direction information
z_axisz direction information

Definition at line 58 of file KNGeometricShape.cpp.

References m_shapDirection, and CKNGeometricDirection::SetDirection().

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

59 {
60  m_shapDirection.SetDirection(x_axis, y_axis, z_axis);
61 }
void SetDirection(double *fDirection)
Set direciton information.
CKNGeometricDirection m_shapDirection
Direction of shape.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::SetFrontFace ( bool  bFrontFace)
inline

Check is this front face side in MPI running enviroment.

Definition at line 47 of file KNGeometricShape.h.

References m_bFrontFace.

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

47 { m_bFrontFace = bFrontFace; };
bool m_bFrontFace
Flag of front face or not.

Here is the caller graph for this function:

void CKNGeometricShape::SetLength ( double  lx,
double  ly,
double  lz 
)

Set length of shape.

Parameters
lxx direction length
lyy direction length
lzz direction length

Definition at line 68 of file KNGeometricShape.cpp.

References _X, _Y, _Z, and m_fLength.

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

69 {
70  m_fLength[_X] = lx;
71  m_fLength[_Y] = ly;
72  m_fLength[_Z] = lz;
73 }
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
double m_fLength[3]
Building Geometric part.

Here is the caller graph for this function:

bool CKNGeometricShape::SetMapInfoSize ( LPNEIGHBOR_MAP_INFO  lpMapInfo,
double  fSize 
)
private

Building Hamiltonian part.

Set map info size, size that means aton count in map info

Parameters
lpMapInfoAtom map information
fSizeSize of map

Definition at line 1016 of file KNGeometricShape.cpp.

References ALLOC_WITH_NULL_INIT, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pDomainMaterialNumber, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, NEIGHBOR_MAP_INFO::pMaterialNumber, and NEIGHBOR_MAP_INFO::pNeighborMaterial.

Referenced by ConstructMapInfo().

1017 {
1018  bool bRtn = false;
1019  unsigned int i;
1020 
1021  ALLOC_WITH_NULL_INIT(lpMapInfo->pfID, double, (size_t)fSize);
1022  ALLOC_WITH_NULL_INIT(lpMapInfo->pAtomType, CKNGeometricAtom::ATOM_TYPE, (size_t)fSize);
1023  ALLOC_WITH_NULL_INIT(lpMapInfo->pMaterialNumber, MATERIAL_INDEX, (size_t)fSize);
1024  ALLOC_WITH_NULL_INIT(lpMapInfo->pDomainMaterialNumber, MATERIAL_INDEX, (size_t)fSize);
1025  ALLOC_WITH_NULL_INIT(lpMapInfo->pfX_Coordination, double, (size_t)fSize);
1026  ALLOC_WITH_NULL_INIT(lpMapInfo->pfY_Coordination, double, (size_t)fSize);
1027  ALLOC_WITH_NULL_INIT(lpMapInfo->pfZ_Coordination, double, (size_t)fSize);
1028 
1029  for (i = 0; i < MAX_NEIGHBOR; ++i)
1030  {
1031  ALLOC_WITH_NULL_INIT(lpMapInfo->pfNeighbor[i], double, (size_t)fSize);
1032  ALLOC_WITH_NULL_INIT(lpMapInfo->pbPeriodicCondition[i], bool, (size_t)fSize);
1033  ALLOC_WITH_NULL_INIT(lpMapInfo->pNeighborMaterial[i], MATERIAL_INDEX, (size_t)fSize);
1034  }
1035 
1036  bRtn = true;
1037  return bRtn;
1038 }
double * pfZ_Coordination
An array of Z coordination.
MATERIAL_INDEX
Definition: CKNGlobal.h:106
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
double * pfX_Coordination
An array of X coordination.
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
An array of Neighbor material Number.
#define MAX_NEIGHBOR
Definition: CKNGlobal.h:86
double * pfY_Coordination
An array of Y coordination.
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
double * pfID
An array of atom ID.
#define ALLOC_WITH_NULL_INIT(pointer, data_type, data_size)
Definition: CKNGlobal.h:35
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
CKNGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.

Here is the caller graph for this function:

void CKNGeometricShape::SetMaterialType ( MATERIAL_INDEX  type)
inline

Get maetrial typpe of shap.

Definition at line 37 of file KNGeometricShape.h.

References m_MaterialType.

Referenced by SetMaterialType(), CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

37 { m_MaterialType = type; };
MATERIAL_INDEX m_MaterialType
Material type of shape.

Here is the caller graph for this function:

void CKNGeometricShape::SetMaterialType ( char *  pszType)

Set maetrial type of shape.

Set maetrial type of shape

Parameters
pszTypeMaterial type information

Definition at line 78 of file KNGeometricShape.cpp.

References GaAs, InAs, SetMaterialType(), and Si.

79 {
80  if (!strcmp(pszType, "Si"))
82  else if (!strcmp(pszType, "GaAs"))
84  else if (!strcmp(pszType, "InAs"))
86 }
void SetMaterialType(MATERIAL_INDEX type)
Get maetrial typpe of shap.
Definition: CKNGlobal.h:106

Here is the call graph for this function:

void CKNGeometricShape::SetOriginCoordination ( double  x,
double  y,
double  z 
)

Building Geometric part.

Set origin coordination of shape

Parameters
xx coordination
yy coordination
zz coordination

Definition at line 48 of file KNGeometricShape.cpp.

References m_originCoordination, and CKNGeometricCoordination::SetCoordination().

Referenced by CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

49 {
51 }
CKNGeometricCoordination m_originCoordination
Orign coordination of shape.
void SetCoordination(CKNGeometricCoordination coordination)
Get coordination with double buffer.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::SetShapeForm ( unsigned int  form)
inline

Get form type of shape.

Definition at line 40 of file KNGeometricShape.h.

References m_ShapeForm.

Referenced by SetShapeForm(), CKNGeometricConstructionLaunch::SetShapeInformation(), and SetShapeInformation().

40 { m_ShapeForm = form; };
unsigned int m_ShapeForm
Shape form.

Here is the caller graph for this function:

void CKNGeometricShape::SetShapeForm ( char *  pszForm)

Get form type of shape.

Get form type of shape

Parameters
pszFormShape form

Definition at line 91 of file KNGeometricShape.cpp.

References BOX_SHAPE, CYLINDER_SHAPE, and SetShapeForm().

92 {
93  if (!strcmp(pszForm, "Box"))
95  else if (!strcmp(pszForm, "Cylinder"))
97 }
#define CYLINDER_SHAPE
Definition: CKNGlobal.h:89
#define BOX_SHAPE
Definition: CKNGlobal.h:88
void SetShapeForm(unsigned int form)
Get form type of shape.

Here is the call graph for this function:

void CKNGeometricShape::SetShapeInformation ( CKNGeometricShape shape,
CKNCommandFileParser::LPINPUT_CMD_PARAM  lpParam 
)
static

Set shape information(Length, material, bondary condition and so on)

Parameters
shapeGeometric Shape
lpParamInput parameters parsing from command file

Definition at line 901 of file KNGeometricShape.cpp.

References _X, _Y, _Z, CKNCommandFileParser::INPUT_CMD_PARAM::bConsiderBoundaryCondition, CKNCommandFileParser::INPUT_CMD_PARAM::fOrigin, CKNCommandFileParser::INPUT_CMD_PARAM::fShapeLength, CKNMPIManager::GetCurrentRank(), CKNMPIManager::GetTotalNodeCount(), CKNMPIManager::IsRootRank(), SetBackendFace(), SetConsideringBoundaryCondition(), SetDirection(), SetFrontFace(), SetLength(), SetMaterialType(), SetOriginCoordination(), SetShapeForm(), CKNCommandFileParser::INPUT_CMD_PARAM::szDomainMat, and CKNCommandFileParser::INPUT_CMD_PARAM::szShape.

Referenced by CKNTBMS_Solver::Launching_TBMS_Solver().

902 {
903 
904  shape.SetDirection(1, 0, 0);
905  shape.SetLength(lpParam->fShapeLength[0][_X], lpParam->fShapeLength[0][_Y], lpParam->fShapeLength[0][_Z]);
906  shape.SetOriginCoordination(lpParam->fOrigin[0][_X], lpParam->fOrigin[0][_Y], lpParam->fOrigin[0][_Z]);
907  shape.SetMaterialType(lpParam->szDomainMat[0]);
908  shape.SetShapeForm(lpParam->szShape[0]);
912 #ifdef DISABLE_MPI_ROUTINE
913  shape.SetFrontFace(true);
914  shape.SetBackendFace(true);
915 #else //DISABLE_MPI_ROUTINE
917  shape.SetFrontFace(true);
919  shape.SetBackendFace(true);
920 #endif //DISABLE_MPI_ROUTINE
921 }
void SetMaterialType(MATERIAL_INDEX type)
Get maetrial typpe of shap.
void SetConsideringBoundaryCondition(bool bConsider, AXIS_DEFINE direction)
Get bondary condition of shape.
Definition: CKNGlobal.h:105
void SetOriginCoordination(double x, double y, double z)
Building Geometric part.
void SetDirection(double x_axis, double y_axis, double z_axis)
Set direciton of shape.
void SetLength(double lx, double ly, double lz)
Set length of shape.
static int GetTotalNodeCount()
Definition: KNMPIManager.h:44
Definition: CKNGlobal.h:105
Definition: CKNGlobal.h:105
double fShapeLength[NMAXDOMAIN][3]
Shap length x, y, z, direction.
char szDomainMat[NMAXDOMAIN][1024]
Material type.
void SetBackendFace(bool bBackendFace)
Check is this back end face side in MPI running enviroment.
void SetShapeForm(unsigned int form)
Get form type of shape.
void SetFrontFace(bool bFrontFace)
Check is this front face side in MPI running enviroment.
static int GetCurrentRank()
Definition: KNMPIManager.h:42
static bool IsRootRank()
Get Total node count.
char szShape[NMAXDOMAIN][1024]
Geometric Shape.
bool bConsiderBoundaryCondition[3]
Considering bondary condition or not x, y, z direction.
double fOrigin[NMAXDOMAIN][3]
Coordinator original coordinate.

Here is the call graph for this function:

Here is the caller graph for this function:

void CKNGeometricShape::SetTotalAtomCount ( double  fTotalAtomCountinMPI)
inline

Get total valid atom count in shape.

Definition at line 56 of file KNGeometricShape.h.

References m_fTotalAtomCountinMPI.

56 { m_fTotalAtomCountinMPI = fTotalAtomCountinMPI;};
double m_fTotalAtomCountinMPI
Total valid atom count in shape.
void CKNGeometricShape::ShiftAtomID ( double  fShift)

Shift atom id in MPI running enviroment.

Parameters
fShiftIncreasing count of ID

Definition at line 1088 of file KNGeometricShape.cpp.

References m_vectUnitCell.

Referenced by ExchangeAtomInfoBetweenNode().

1089 {
1090  int i, nSize = m_vectUnitCell.size();
1091 
1092  for (i = 0; i < nSize; ++i)
1093  m_vectUnitCell[i].ShiftAtomID(fShift);
1094 }
std::vector< CKNGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
void ShiftAtomID(double fShift)
Shift atom id in MPI running enviroment.

Here is the caller graph for this function:

Member Data Documentation

bool CKNGeometricShape::m_bBackendFace
private

Flag of back end face or not.

Definition at line 74 of file KNGeometricShape.h.

Referenced by CalculateUnitcellCount(), CheckingNeighborCandiate(), InitShape(), IsBackendFace(), and SetBackendFace().

bool CKNGeometricShape::m_bConsiderBoundaryCondition[3]
private
bool CKNGeometricShape::m_bFrontFace
private

Flag of front face or not.

Definition at line 73 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), CalculateUnitcellCount(), CheckingNeighborCandiate(), InitShape(), IsFrontFace(), and SetFrontFace().

double CKNGeometricShape::m_fAssignedCount[3]
private
double CKNGeometricShape::m_fAtomIDStartIndex
private

Start atom index in current Shape.

Definition at line 76 of file KNGeometricShape.h.

Referenced by ExchangeAtomInfoBetweenNode(), GetAtomStartID(), and InitShape().

double CKNGeometricShape::m_fLength[3]
private

Building Geometric part.

Length of shape

Definition at line 69 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), CalculateUnitcellCount(), InitShape(), and SetLength().

double CKNGeometricShape::m_fTotalAtomCountinMPI
private

Total valid atom count in shape.

Definition at line 75 of file KNGeometricShape.h.

Referenced by ExchangeAtomInfoBetweenNode(), GetTotalAtomCount(), InitShape(), and SetTotalAtomCount().

MATERIAL_INDEX CKNGeometricShape::m_MaterialType
private

Material type of shape.

Definition at line 77 of file KNGeometricShape.h.

Referenced by GetMaterialType(), InitShape(), and SetMaterialType().

unsigned int CKNGeometricShape::m_nAtomFirstLayer

Get Surface atom list.

Building Hamiltonian part First layer information for sending to previous node

Definition at line 60 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), InitShape(), and CKNTBMS_Solver::Launching_TBMS_Solver().

unsigned int CKNGeometricShape::m_nAtomLastLayer

Last layer information for sending to next node.

Definition at line 64 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), InitShape(), and CKNTBMS_Solver::Launching_TBMS_Solver().

CKNGeometricCoordination CKNGeometricShape::m_originCoordination
private

Orign coordination of shape.

Definition at line 82 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), CalculateUnitcellCount(), InitShape(), and SetOriginCoordination().

IKNGeometricUnitCellInfo * CKNGeometricShape::m_pUnitCellInfo
static

Unitcell information pointer for using in class internal.

Definition at line 108 of file KNGeometricShape.h.

Referenced by InitShape(), and SetAtomAndNeighborInformation().

CKNMatrixOperation::CKNDMatrix CKNGeometricShape::m_rotationMatrix
static
CKNGeometricDirection CKNGeometricShape::m_shapDirection
private

Direction of shape.

Definition at line 83 of file KNGeometricShape.h.

Referenced by InitShape(), RefillPeriodicBinding(), and SetDirection().

unsigned int CKNGeometricShape::m_ShapeForm
private

Shape form.

Definition at line 71 of file KNGeometricShape.h.

Referenced by GetShapeForm(), InitShape(), and SetShapeForm().

CKNGeometricUnitCellInfo_cubic CKNGeometricShape::m_UnitCellInfo_cubic
static

Definition at line 107 of file KNGeometricShape.h.

Referenced by SetAtomAndNeighborInformation().

CKNGeometricUnitCellInfo_zincblende CKNGeometricShape::m_UnitCellInfo_zincblende
static

Definition at line 106 of file KNGeometricShape.h.

Referenced by SetAtomAndNeighborInformation().

std::vector<CKNGeometricUnitCell> CKNGeometricShape::m_vectNextUnitCell
private

Back end edge unit cell that copy from next side node.

Definition at line 80 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), ExchangeAtomInfoBetweenNode(), FreeUnitCellList(), and PeriodicUnitCellNumbering().

std::vector<CKNGeometricUnitCell> CKNGeometricShape::m_vectPrevUnitCell
private

Front edge unit cell that copy from previous side node.

Definition at line 79 of file KNGeometricShape.h.

Referenced by ArrangeUnitCell(), ExchangeAtomInfoBetweenNode(), FreeUnitCellList(), and PeriodicUnitCellNumbering().

std::vector<CKNGeometricAtom*> CKNGeometricShape::m_vectSurfaceAtom
private

Definition at line 81 of file KNGeometricShape.h.

Referenced by FreeUnitCellList().


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