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

Class for Geometric shape. More...

#include "GeometricShape.h"

Collaboration diagram for CGeometricShape:
Collaboration graph

Public Member Functions

 CGeometricShape ()
 
 ~CGeometricShape ()
 
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 (CCommandFileParser::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, CCommandFileParser::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 (CMatrixOperation::CCSR *pResult, CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, unsigned int nRepeatIndex, double fKValue[3], unsigned int nBandSize, bool bRecover)
 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< CGeometricAtom * > * GetSurfaceAtomList ()
 
unsigned int ConstructBasicGeometric (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, bool bMPI)
 Get Surface atom list. More...
 
void SetupPEBoundaryCondition (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LP_CONTACT_GROUP_INFO *lpContactGroup)
 <Added by="" jhkang>=""> More...
 
bool BuildPEHamiltonian (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, CMatrixOperation::CCSR *pCSRResult)
 Build PE Hamiltonian matrix from mapinfo data. More...
 
void BuildPEBiasVector (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, LP_CONTACT_GROUP_INFO *lpContactGroup, CMatrixOperation::CVector *pVecResult)
 
void BuildPEWaveVector (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, CMatrixOperation::CVector *pVecResult)
 
int IsCoordinateMatched (double fa, double fb)
 
void MapElecAtomOnPoissonGrid (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo)
 
void ConstructContactRegionOnPoissonGrid (CCommandFileParser::LPINPUT_CMD_PARAM lpParam, LPNEIGHBOR_MAP_INFO lpMapInfo, LP_CONTACT_GROUP_INFO *lpContactGroup)
 
bool GetNeumannBoundaryCondition (AXIS_DEFINE direction)
 
void SetNeumannBoundaryCondition (bool bConsider, AXIS_DEFINE direction)
 Get Neumann boundary condition of shape. More...
 
double * GetUnitCellLength ()
 
void SetShapeInformation (CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
 Set shape information(Length, material, bondary condition and so on) More...
 
void SetMatchingUnitcellCount (int nCount)
 

Static Public Member Functions

static bool SetAtomAndNeighborInformation (CCommandFileParser::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
 <Added by="" jhkang="" end>=""> More...
 
unsigned int m_nAtomLastLayer
 Last layer information for sending to next node. More...
 

Static Public Attributes

static
CGeometricUnitCellInfo_zincblende 
m_UnitCellInfo_zincblende
 
static CGeometricUnitCellInfo_cubic m_UnitCellInfo_cubic
 
static IGeometricUnitCellInfom_pUnitCellInfo
 Unitcell information pointer for using in class internal. More...
 
static CMatrixOperation::CDMatrix 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)
 <Added by="" jhkang="" end>=""> More...
 
void FreeUnitCellList ()
 Relase unitcell list. More...
 
void InitShape ()
 Initialize Shape variable. More...
 
void RotateMatrix (CMatrixOperation::CDMatrix *pMatrixNbr, CMatrixOperation::CDMatrix *pMatrixResult, double fDegree[2])
 Rotate matrix with calculated degree. More...
 
CGeometricAtomGetAtomByIndex (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 (CCommandFileParser::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< CGeometricUnitCell > *pVectUnitCell, double *pBuffer, bool bFrontSide)
 Deerialize unitcells from double array. More...
 
void BuildGeoFileName (char *pszFileName, CCommandFileParser::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 (CCommandFileParser::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< CGeometricUnitCellm_vectUnitCell
 Array of unitcell in shape. More...
 
std::vector< CGeometricUnitCellm_vectPrevUnitCell
 Front edge unit cell that copy from previous side node. More...
 
std::vector< CGeometricUnitCellm_vectNextUnitCell
 Back end edge unit cell that copy from next side node. More...
 
std::vector< CGeometricAtom * > m_vectSurfaceAtom
 
CGeometricCoordination m_originCoordination
 Orign coordination of shape. More...
 
CGeometricDirection m_shapDirection
 
int m_nContactNumber
 <Added by="" jhkang>=""> More...
 
std::vector< double > m_waveFunctionValue
 
bool m_bNeumannBoundaryCondition [3]
 
int m_nHandlingUnitcellCount
 
double m_fUnitCellLength [3]
 

Detailed Description

Class for Geometric shape.

Date
03/Oct/2014

Definition at line 27 of file GeometricShape.h.

Constructor & Destructor Documentation

CGeometricShape::CGeometricShape ( )

Definition at line 32 of file GeometricShape.cpp.

References InitShape().

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

Here is the call graph for this function:

CGeometricShape::~CGeometricShape ( )

Definition at line 37 of file GeometricShape.cpp.

References FinalShape().

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

Here is the call graph for this function:

Member Function Documentation

void CGeometricShape::ArrangeUnitCell ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
private

Arranging unitcell into shape.

Parameters
lpParamInput parameters parsing from command file

Definition at line 403 of file GeometricShape.cpp.

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

Referenced by FillUnitcell().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::BuildGeoFileName ( char *  pszFileName,
CCommandFileParser::LPINPUT_CMD_PARAM  lpParam 
)
private

Make atom map naming.

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

Definition at line 1343 of file GeometricShape.cpp.

References CCommandFileParser::INPUT_CMD_PARAM::bConsiderBoundaryCondition, CCommandFileParser::INPUT_CMD_PARAM::nDirectionSingle, CCommandFileParser::INPUT_CMD_PARAM::nSubDomainNumber, CCommandFileParser::INPUT_CMD_PARAM::szShape, and CCommandFileParser::INPUT_CMD_PARAM::szStructureType.

Referenced by ConstructMapInfo().

1344 {
1345  char szTemp[1024];
1346  unsigned int i;
1347 
1348 
1349  sprintf(pszFileName, "Geo_%d_%d%d%d_%s_", lpParam->nDirectionSingle, lpParam->bConsiderBoundaryCondition[0] ? 1 : 0, lpParam->bConsiderBoundaryCondition[1] ? 1 : 0, lpParam->bConsiderBoundaryCondition[2] ? 1 : 0, lpParam->szStructureType);
1350 
1351  if (!strcmp(lpParam->szShape[0], "Box"))
1352  strcpy(szTemp, "B");
1353  else if (!strcmp(lpParam->szShape[0], "Cylinder"))
1354  strcpy(szTemp, "C");
1355 
1356  strcat(pszFileName, szTemp);
1357 
1358  for (i = 0; i < (unsigned int)lpParam->nSubDomainNumber; ++i)
1359  {
1360  if (!strcmp(lpParam->szShape[i + 1], "Box"))
1361  strcpy(szTemp, "B");
1362  else if (!strcmp(lpParam->szShape[i + 1], "Cylinder"))
1363  strcpy(szTemp, "C");
1364 
1365  strcat(pszFileName, szTemp);
1366  }
1367 }
char szShape[NMAXDOMAIN][1024]
Geometric Shape.
bool bConsiderBoundaryCondition[3]
Considering bondary condition or not x, y, z direction.
char szStructureType[1024]
Structure type.
int nSubDomainNumber
Numbers of Subdomain, except main domain.

Here is the caller graph for this function:

void CGeometricShape::BuildNeighborInformation ( )

Find neighbor of each atom.

Definition at line 116 of file GeometricShape.cpp.

References GetSurfaceAtomList(), m_fAssignedCount, and m_vectUnitCell.

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::BuildPEBiasVector ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
LP_CONTACT_GROUP_INFO lpContactGroup,
CMatrixOperation::CVector pVecResult 
)

Definition at line 2187 of file GeometricShape.cpp.

References ATOM_DEFAULT_INDEX, CCommandFileParser::INPUT_CMD_PARAM::bSaveContactBiasVector, CMaterialParam::BuildMaterialParam(), CONTACT_GROUP_INFO::ContactList, EPSILON0, CONTACT_GROUP_INFO::fContactBiasValue, GEO_PARAMETER::feips, NEIGHBOR_MAP_INFO::fItemCount, CCommandFileParser::INPUT_CMD_PARAM::fUnitcellLength, CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentRank(), CGeometricAtomFactory::GetMaterialNumber(), CComplex::GetRealNumber(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), m_nContactNumber, CONTACT_GROUP_INFO::nContactDirection, NM, NMAXDOMAIN, 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, CMPIManager::ReceiveDoubleBufferSync(), CMPIManager::SendDoubleBufferSync(), CMatrixOperation::CVector::SetAt(), CMatrixOperation::CVector::SetSize(), CUtility::ShowMsg(), and CCommandFileParser::INPUT_CMD_PARAM::szDomainMat.

Referenced by CSPLoop::ConstructionGeometric().

2188 {
2189  unsigned int i, ia;
2190  int nContactAtom, nContactDirection;
2191  double *fBiasVectorGroup[6], fBiasSum;
2192  double fGridSpacingSq[6];
2193  double fEpsilon[NMAXDOMAIN];
2194  double fNeighborEps;
2195  bool bRtn;
2196  MATERIAL_INDEX nMaterialType;
2197  CMaterialParam materialParam;
2198 
2199  FILE *out = NULL;
2200  char szFileName[1024];
2201  char szMsg[1024], szTemp[1024];
2202 
2203  for (i = 0; i < 6; i++)
2204  {
2205  fBiasVectorGroup[i] = (double*)malloc(sizeof(double)* (unsigned int)lpMapInfo->fItemCount);
2206  memset(fBiasVectorGroup[i], 0, sizeof(double)* (unsigned int)lpMapInfo->fItemCount);
2207  }
2208 
2209  for (i = 0; i < NMAXDOMAIN; i++)
2210  {
2211  nMaterialType = CGeometricAtomFactory::GetMaterialNumber(lpParam->szDomainMat[i], CGeometricAtom::ATOM_TYPE::A);
2212  fEpsilon[nMaterialType] = materialParam.BuildMaterialParam(lpParam->szDomainMat[i], bRtn).feips * EPSILON0;
2213  }
2214 
2215  // Grid spacing and material property
2216  fGridSpacingSq[0] = 1.0 / (lpParam->fUnitcellLength[0] * lpParam->fUnitcellLength[0]) / NM / NM;
2217  fGridSpacingSq[1] = fGridSpacingSq[0];
2218  fGridSpacingSq[2] = 1.0 / (lpParam->fUnitcellLength[1] * lpParam->fUnitcellLength[1]) / NM / NM;
2219  fGridSpacingSq[3] = fGridSpacingSq[2];
2220  fGridSpacingSq[4] = 1.0 / (lpParam->fUnitcellLength[2] * lpParam->fUnitcellLength[2]) / NM / NM;
2221  fGridSpacingSq[5] = fGridSpacingSq[4];
2222 
2223  for (i = 0; i < m_nContactNumber; i++)
2224  {
2225  for (ia = 0; ia < lpContactGroup[i]->ContactList.size(); ia++)
2226  {
2227  nContactAtom = lpContactGroup[i]->ContactList[ia];
2228  nContactDirection = lpContactGroup[i]->nContactDirection;
2229 
2230  if (lpContactGroup[i]->nContactDirection == 6)
2231  {
2232  if (lpMapInfo->pfNeighbor[2][nContactAtom] == ATOM_DEFAULT_INDEX)
2233  {
2234  fBiasVectorGroup[2][nContactAtom] = lpContactGroup[i]->fContactBiasValue * fGridSpacingSq[2] * fEpsilon[(int)lpMapInfo->pMaterialNumber[nContactAtom]];
2235  }
2236  if (lpMapInfo->pfNeighbor[3][nContactAtom] == ATOM_DEFAULT_INDEX)
2237  {
2238  fBiasVectorGroup[3][nContactAtom] = lpContactGroup[i]->fContactBiasValue * fGridSpacingSq[3] * fEpsilon[(int)lpMapInfo->pMaterialNumber[nContactAtom]];
2239  }
2240  if (lpMapInfo->pfNeighbor[4][nContactAtom] == ATOM_DEFAULT_INDEX)
2241  {
2242  fBiasVectorGroup[4][nContactAtom] = lpContactGroup[i]->fContactBiasValue * fGridSpacingSq[4] * fEpsilon[(int)lpMapInfo->pMaterialNumber[nContactAtom]];
2243  }
2244  if (lpMapInfo->pfNeighbor[5][nContactAtom] == ATOM_DEFAULT_INDEX)
2245  {
2246  fBiasVectorGroup[5][nContactAtom] = lpContactGroup[i]->fContactBiasValue * fGridSpacingSq[5] * fEpsilon[(int)lpMapInfo->pMaterialNumber[nContactAtom]];
2247  }
2248  }
2249  else
2250  {
2251  fBiasVectorGroup[nContactDirection][nContactAtom] = lpContactGroup[i]->fContactBiasValue * fGridSpacingSq[nContactDirection] * fEpsilon[(int)lpMapInfo->pMaterialNumber[nContactAtom]];
2252  }
2253  }
2254  }
2255 
2256  pVecResult->SetSize((unsigned int)lpMapInfo->fItemCount);
2257 
2258  for (ia = 0; ia < lpMapInfo->fItemCount; ia++)
2259  {
2260  fBiasSum = 0.0;
2261  for (i = 0; i < 6; i++)
2262  {
2263  fBiasSum += fBiasVectorGroup[i][ia];
2264  }
2265  pVecResult->SetAt(ia, fBiasSum, 0.0);
2266  }
2267 
2268  // Dump bias vector construction result
2269 #ifndef DISABLE_MPI_ROUTINE
2270  MPI_Request req;
2271  double fTemp = 1;
2272 #endif //DISABLE_MPI_ROUTINE
2273 
2274  if (true == lpParam->bSaveContactBiasVector)
2275  {
2276  strcpy(szTemp, "ContactBiasVector.dat");
2277 #ifdef _WIN32
2278  sprintf(szFileName, "result\\%s", szTemp);
2279 #else
2280  sprintf(szFileName, "result/%s", szTemp);
2281 #endif
2282 
2283 #ifdef DISABLE_MPI_ROUTINE
2284  out = fopen(szFileName, "wt");
2285 #else //DISABLE_MPI_ROUTINE
2286 
2288  {
2289  CUtility::ShowMsg("-Save contact bias vector info. to file.\n");
2290  out = fopen(szFileName, "wt");
2291  }
2292  else
2293  {
2295  out = fopen(szFileName, "at");
2296  }
2297 #endif //DISABLE_MPI_ROUTINE
2298  }
2299 
2300  if (true == lpParam->bSaveContactBiasVector && NULL != out)
2301  {
2302  for (i = 0; i < lpMapInfo->fItemCount; i++)
2303  {
2304  sprintf(szMsg, "%6d (%11.8f %11.8f%11.8f )%12.3f %12.3f %12.3f %12.3f %12.3f %12.3f %12.3f\n", (int)lpMapInfo->pfID[i], lpMapInfo->pfX_Coordination[i], lpMapInfo->pfY_Coordination[i], lpMapInfo->pfZ_Coordination[i],
2305  fBiasVectorGroup[0][i], fBiasVectorGroup[1][i], fBiasVectorGroup[2][i], fBiasVectorGroup[3][i], fBiasVectorGroup[4][i], fBiasVectorGroup[5][i], pVecResult->GetAt(i).GetRealNumber());
2306  fputs(szMsg, out);
2307  }
2308 
2309  fclose(out);
2310 #ifndef DISABLE_MPI_ROUTINE
2313 #endif //DISABLE_MPI_ROUTINE
2314  }
2315  for (i = 0; i < 6; i++)
2316  free(fBiasVectorGroup[i]);
2317 
2318 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
int nContactDirection
Contact direction, 0: Xp, 1: Xm, 2: Yp, 3: Ym, 4: Zp, 5: Zm.
static MATERIAL_INDEX GetMaterialNumber(char *pszMaterialName, CGeometricAtom::ATOM_TYPE type)
Get total atom counts in unit cell.
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
std::vector< int > ContactList
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.
Definition: MPIManager.cpp:712
Class for Material Parameter.
Definition: MaterialParam.h:19
bool bSaveContactBiasVector
Save contact bias vector or not.
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
int m_nContactNumber
="">
#define EPSILON0
Definition: Global.h:80
#define NM
Definition: Global.h:81
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
#define NMAXDOMAIN
For multi material.
Definition: Global.h:89
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
MATERIAL_INDEX
Definition: Global.h:114
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.
Definition: MPIManager.cpp:685
double fUnitcellLength[3]
Unitcell length x, y, z direction.
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
GEO_PARAMETER BuildMaterialParam(char *pszMaterialName, bool &bResult)
Load material parameter.
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
Definition: AtomMapInfo.h:19
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.
char szDomainMat[NMAXDOMAIN][1024]
Material type.
void SetSize(unsigned int nSize)
Set Vector elements size.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::BuildPEHamiltonian ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
CMatrixOperation::CCSR pCSRResult 
)

Build PE Hamiltonian matrix from mapinfo data.

Definition at line 1480 of file GeometricShape.cpp.

References _X, _Y, _Z, ATOM_CONTACT_INDEX, ATOM_DEFAULT_INDEX, CCommandFileParser::INPUT_CMD_PARAM::bConsiderNeumannBoundaryCondition, CMaterialParam::BuildMaterialParam(), CMatrixOperation::CDMatrix::BuildMatrixFirst(), EPSILON0, GEO_PARAMETER::feips, CCommandFileParser::INPUT_CMD_PARAM::fUnitcellLength, CMPIManager::GetCurrentRank(), CGeometricAtomFactory::GetMaterialNumber(), CMatrixOperation::CCSR::GetRowCount(), CMPIManager::IsRootRank(), m_fAtomIDStartIndex, CMatrixOperation::FILL_MATRIX_DATA::nColumnIndex, NM, NMAXDOMAIN, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pMaterialNumber, CMatrixOperation::FILL_MATRIX_DATA::pMatrix, NEIGHBOR_MAP_INFO::pNeighborMaterial, CMatrixOperation::CCSR::PushMatrixConcurrentPE(), CMatrixOperation::CDMatrix::SetElement(), and CCommandFileParser::INPUT_CMD_PARAM::szDomainMat.

Referenced by CSPLoop::BuildHamiltonian().

1481 {
1482  bool bRtn = false;
1483  double fNeighborEps;
1484  double fGridSpacingSq[6];
1485  double fOffDiagonalValue, fDiagonalValue;
1486  double fEpsilon[NMAXDOMAIN];
1487  MATERIAL_INDEX nMaterialType;
1488  int nCountNeumann = 0, nCountContact = 0, nCountZeroContact = 0, nCountNeumannSum = 0, nCountContactSum = 0, nCountZeroContactSum = 0;
1489 
1490  unsigned int i, j, nRowSize;
1491  CMatrixOperation::CDMatrix matrixOnSite;
1492  CMatrixOperation::CDMatrix matrixNbr[6]; //0: Xp, 1: Xm, 2: Yp, 3: Ym, 4: Zp, 5: Zm
1493  CMaterialParam materialParam;
1494  CMatrixOperation::FILL_MATRIX_DATA elementData[7];
1495 
1496  // Diagonal element setting arbitrarily
1497  matrixOnSite.BuildMatrixFirst(1, 1);
1498 
1499  // Offdiagonal element setting arbitrarily
1500  for (i = 0; i < 6; i++)
1501  {
1502  matrixNbr[i].BuildMatrixFirst(1, 1);
1503  }
1504 
1505  // Grid spacing and material property
1506  fGridSpacingSq[0] = 1.0 / (lpParam->fUnitcellLength[0] * lpParam->fUnitcellLength[0]) / NM / NM;
1507  fGridSpacingSq[1] = fGridSpacingSq[0];
1508  fGridSpacingSq[2] = 1.0 / (lpParam->fUnitcellLength[1] * lpParam->fUnitcellLength[1]) / NM / NM;
1509  fGridSpacingSq[3] = fGridSpacingSq[2];
1510  fGridSpacingSq[4] = 1.0 / (lpParam->fUnitcellLength[2] * lpParam->fUnitcellLength[2]) / NM / NM;
1511  fGridSpacingSq[5] = fGridSpacingSq[4];
1512 
1513  for (i = 0; i < NMAXDOMAIN; i++)
1514  {
1515  nMaterialType = CGeometricAtomFactory::GetMaterialNumber(lpParam->szDomainMat[i], CGeometricAtom::ATOM_TYPE::A);
1516  fEpsilon[nMaterialType] = materialParam.BuildMaterialParam(lpParam->szDomainMat[i], bRtn).feips * EPSILON0;
1517  if (CMPIManager::IsRootRank() && nMaterialType > 0)
1518  {
1519  printf("-material[%d] : nMaterialType = %d, episilon = %e, material name = %s\n", i, nMaterialType, fEpsilon[nMaterialType], lpParam->szDomainMat[i]);
1520  }
1521  }
1522 
1523  nRowSize = pCSRResult->GetRowCount();
1524 
1525  for (i = 0; i < nRowSize; i++)
1526  {
1527  fDiagonalValue = 0.0;
1528 
1529  for (j = 0; j < 6; j++)
1530  {
1531 
1532  if (ATOM_DEFAULT_INDEX == lpMapInfo->pfNeighbor[j][i])
1533  {
1534  fNeighborEps = -fEpsilon[(int)lpMapInfo->pMaterialNumber[i]];
1535  fOffDiagonalValue = fNeighborEps * fGridSpacingSq[j];
1536  fDiagonalValue += -fOffDiagonalValue;
1537 
1538  if (lpParam->bConsiderNeumannBoundaryCondition[_X] && (j / 2 == 0))
1539  {
1540  fDiagonalValue += fOffDiagonalValue;
1541  nCountNeumann++;
1542  }
1543  if (lpParam->bConsiderNeumannBoundaryCondition[_Y] && (j / 2 == 1))
1544  {
1545  fDiagonalValue += fOffDiagonalValue;
1546  nCountNeumann++;
1547  }
1548  if (lpParam->bConsiderNeumannBoundaryCondition[_Z] && (j / 2 == 2))
1549  {
1550  fDiagonalValue += fOffDiagonalValue;
1551  nCountNeumann++;
1552  }
1553  nCountZeroContact++;
1554 
1555  elementData[j + 1].nColumnIndex = ATOM_DEFAULT_INDEX;
1556  elementData[j + 1].pMatrix = NULL;
1557  }
1558  else if (ATOM_CONTACT_INDEX == lpMapInfo->pfNeighbor[j][i])
1559  {
1560  fNeighborEps = -fEpsilon[(int)lpMapInfo->pMaterialNumber[i]];
1561  fOffDiagonalValue = fNeighborEps * fGridSpacingSq[j];
1562  fDiagonalValue += -fOffDiagonalValue;
1563 
1564  elementData[j + 1].nColumnIndex = ATOM_DEFAULT_INDEX;
1565  elementData[j + 1].pMatrix = NULL;
1566  nCountContact++;
1567  }
1568  else
1569  {
1570  fNeighborEps = -fEpsilon[(int)lpMapInfo->pNeighborMaterial[j][i]];
1571  fOffDiagonalValue = fNeighborEps * fGridSpacingSq[j];
1572  fDiagonalValue += -fOffDiagonalValue;
1573 
1574  matrixNbr[j].SetElement(0, 0, fOffDiagonalValue, 0.0);
1575  elementData[j + 1].nColumnIndex = (int)lpMapInfo->pfNeighbor[j][i];
1576  elementData[j + 1].pMatrix = &matrixNbr[j];
1577  }
1578  }
1579 
1580  matrixOnSite.SetElement(0, 0, fDiagonalValue, 0.0);
1581 
1582  elementData[0].nColumnIndex = i + (unsigned int)m_fAtomIDStartIndex;
1583  elementData[0].pMatrix = &matrixOnSite;
1584 
1585  pCSRResult->PushMatrixConcurrentPE(i, &elementData[0], false);
1586 
1587  }
1588  nCountZeroContact -= nCountNeumann;
1589  printf("[Rank:%3d] Neumann atom = %d, Default Contact atom = %d, Contact group atom = %d \n", CMPIManager::GetCurrentRank(), nCountNeumann, nCountZeroContact, nCountContact);
1590 
1591  MPI_Reduce(&nCountNeumann, &nCountNeumannSum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
1592  MPI_Reduce(&nCountZeroContact, &nCountZeroContactSum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
1593  MPI_Reduce(&nCountContact, &nCountContactSum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
1594 
1596  printf("-Total Neumann atom = %d, Total contact atom = %d \n", nCountNeumannSum, nCountContactSum + nCountZeroContactSum);
1597 
1598  bRtn = true;
1599  return bRtn;
1600 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
static MATERIAL_INDEX GetMaterialNumber(char *pszMaterialName, CGeometricAtom::ATOM_TYPE type)
Get total atom counts in unit cell.
unsigned int GetRowCount()
Definition: Global.h:113
Class for Material Parameter.
Definition: MaterialParam.h:19
Definition: Global.h:113
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
Definition: AtomMapInfo.h:27
double m_fAtomIDStartIndex
Start atom index in current Shape.
#define EPSILON0
Definition: Global.h:80
#define ATOM_CONTACT_INDEX
Atom index default value that contact atom instance.
Definition: Global.h:53
#define NM
Definition: Global.h:81
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
#define NMAXDOMAIN
For multi material.
Definition: Global.h:89
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
MATERIAL_INDEX
Definition: Global.h:114
double fUnitcellLength[3]
Unitcell length x, y, z direction.
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.
Definition: Global.h:113
GEO_PARAMETER BuildMaterialParam(char *pszMaterialName, bool &bResult)
Load material parameter.
Data and operation representation of Matrix.
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
Definition: AtomMapInfo.h:19
CMatrixOperation::CDMatrix * pMatrix
Hamiltonian building data.
char szDomainMat[NMAXDOMAIN][1024]
Material type.
bool bConsiderNeumannBoundaryCondition[3]
Neumann bc in xyz direction.
bool PushMatrixConcurrentPE(unsigned int nRow, CMatrixOperation::LPFILL_MATRIX_DATA lpData, bool bCopyZeroOnSite)
="">

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::BuildPEWaveVector ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
CMatrixOperation::CVector pVecResult 
)

Definition at line 1751 of file GeometricShape.cpp.

References _X, _Y, _Z, ATOM_DEFAULT_INDEX, CCommandFileParser::INPUT_CMD_PARAM::bSaveWaveVector, NEIGHBOR_MAP_INFO::fItemCount, CCommandFileParser::INPUT_CMD_PARAM::fUnitcellLength, CMatrixOperation::CVector::GetAt(), CMPIManager::GetCurrentRank(), CComplex::GetRealNumber(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), m_waveFunctionValue, NM, NEIGHBOR_MAP_INFO::pfAtomOnGrid, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, Qo, CMPIManager::ReceiveDoubleBufferSync(), CMPIManager::SendDoubleBufferSync(), CMatrixOperation::CVector::SetAt(), CMatrixOperation::CVector::SetSize(), and CUtility::ShowMsg().

1752 {
1753  unsigned int i, nCount = 0, nParamSize = 4;
1754  FILE *waveIn = NULL, *out = NULL;
1755  char szWaveFileName[1024];
1756  char szOutFileName[1024], szMsg[1024], szTemp[1024];
1757  char strSperate[] = " ";
1758  char *token = NULL;
1759  double fParam[4], ax, ay, az;
1760 
1761  pVecResult->SetSize((unsigned int)lpMapInfo->fItemCount);
1762 
1763  sprintf(szWaveFileName, "./testset/reference1_zb_rhs_unscaled_at_iter1.dat");
1764  waveIn = fopen(szWaveFileName, "rt");
1765 
1766  ax = lpParam->fUnitcellLength[_X] * NM;
1767  ay = lpParam->fUnitcellLength[_Y] * NM;
1768  az = lpParam->fUnitcellLength[_Z] * NM;
1769 
1770  while (fgets(szTemp, 1024, waveIn))
1771  {
1772  token = strtok(szTemp, strSperate);
1773  while (token)
1774  {
1775  fParam[nCount++] = atof(token);
1776  if (nParamSize == nCount)
1777  break;
1778  token = strtok(NULL, strSperate);
1779  }
1780  m_waveFunctionValue.push_back(fParam[3] / ax / ay / az * Qo);
1781  nCount = 0;
1782  }
1783  fclose(waveIn);
1784 
1785  for (i = 0; i < lpMapInfo->fItemCount; i++)
1786  {
1787  if ((int)lpMapInfo->pfAtomOnGrid[i] == ATOM_DEFAULT_INDEX)
1788  pVecResult->SetAt(i, 0.0, 0.0);
1789  else
1790  pVecResult->SetAt(i, m_waveFunctionValue[(int)lpMapInfo->pfAtomOnGrid[i]], 0.0);
1791  }
1792 
1793  // Dump wave vector construction result
1794 #ifndef DISABLE_MPI_ROUTINE
1795  MPI_Request req;
1796  double fTemp = 1;
1797 #endif //DISABLE_MPI_ROUTINE
1798 
1799  if (true == lpParam->bSaveWaveVector)
1800  {
1801  strcpy(szTemp, "WaveVector.dat");
1802 #ifdef _WIN32
1803  sprintf(szOutFileName, "result\\%s", szTemp);
1804 #else
1805  sprintf(szOutFileName, "result/%s", szTemp);
1806 #endif
1807 
1808 #ifdef DISABLE_MPI_ROUTINE
1809  out = fopen(szOutFileName, "wt");
1810 #else //DISABLE_MPI_ROUTINE
1811 
1813  {
1814  CUtility::ShowMsg("-Save wave vector info. to file.\n");
1815  out = fopen(szOutFileName, "wt");
1816  }
1817  else
1818  {
1820  out = fopen(szOutFileName, "at");
1821  }
1822 #endif //DISABLE_MPI_ROUTINE
1823  }
1824 
1825  if (true == lpParam->bSaveWaveVector && NULL != out)
1826  {
1827  for (i = 0; i < lpMapInfo->fItemCount; i++)
1828  {
1829  sprintf(szMsg, "%6d %11.8f %11.8f%11.8f %18.12f\n", (int)lpMapInfo->pfID[i], lpMapInfo->pfX_Coordination[i], lpMapInfo->pfY_Coordination[i], lpMapInfo->pfZ_Coordination[i],
1830  pVecResult->GetAt(i).GetRealNumber());
1831  fputs(szMsg, out);
1832  }
1833 
1834  fclose(out);
1835 #ifndef DISABLE_MPI_ROUTINE
1838 #endif //DISABLE_MPI_ROUTINE
1839  }
1840 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
Definition: Global.h:113
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
bool bSaveWaveVector
Save wave vector or not.
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.
Definition: MPIManager.cpp:712
Definition: Global.h:113
CComplex GetAt(unsigned int nIndex)
Get element value from specific index.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
#define NM
Definition: Global.h:81
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
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.
Definition: MPIManager.cpp:685
double fUnitcellLength[3]
Unitcell length x, y, z direction.
Definition: Global.h:113
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
#define Qo
Definition: Global.h:79
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
void SetAt(unsigned int nIndex, CComplex value)
Set element value in specific index, Call by value.
double * pfAtomOnGrid
="">
Definition: AtomMapInfo.h:29
std::vector< double > m_waveFunctionValue
void SetSize(unsigned int nSize)
Set Vector elements size.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

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

Build rotation matrix for given direction.

Parameters
fDegreeGiven degree of theta and phi

Definition at line 1320 of file GeometricShape.cpp.

References CMatrixOperation::CDMatrix::BuildMatrixFirst(), m_rotationMatrix, PHI_DEGREE, CMatrixOperation::CDMatrix::SetElement(), THETA_DEGREE, and CMatrixOperation::CDMatrix::TrnasPos().

Referenced by SetAtomAndNeighborInformation().

1321 {
1323 
1324  m_rotationMatrix.SetElement(0, 0, cos(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
1325  m_rotationMatrix.SetElement(0, 1, -sin(fDegree[THETA_DEGREE]), 0);
1326  m_rotationMatrix.SetElement(0, 2, -cos(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
1327 
1328  m_rotationMatrix.SetElement(1, 0, sin(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
1329  m_rotationMatrix.SetElement(1, 1, cos(fDegree[THETA_DEGREE]), 0);
1330  m_rotationMatrix.SetElement(1, 2, -sin(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
1331 
1332  m_rotationMatrix.SetElement(2, 0, sin(fDegree[PHI_DEGREE]), 0);
1333  m_rotationMatrix.SetElement(2, 1, 0, 0);
1334  m_rotationMatrix.SetElement(2, 2, cos(fDegree[PHI_DEGREE]), 0);
1335 
1337 }
static CMatrixOperation::CDMatrix m_rotationMatrix
Rotation matrix for given direction.
bool TrnasPos()
Transpos matrix.
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
#define THETA_DEGREE
Definition: Global.h:83
#define PHI_DEGREE
Definition: Global.h:84
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::CalculateDegree ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
staticprivate

Calculating degree from direction information.

Parameters
lpParamInput parameters parsing from command file

Definition at line 715 of file GeometricShape.cpp.

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

Referenced by SetAtomAndNeighborInformation().

716 {
717  /*TODO: changing input parameter sqrtf -> sqrt(from all source code)*/
718  double fR = sqrt(lpParam->fDirection[0] * lpParam->fDirection[0] + lpParam->fDirection[1] * lpParam->fDirection[1] + lpParam->fDirection[2] * lpParam->fDirection[2]);
719 
720  lpParam->fDegree[PHI_DEGREE] = PI_VALUE/2 - acos(lpParam->fDirection[2] / fR);
721  lpParam->fDegree[THETA_DEGREE] = atan(lpParam->fDirection[1] / lpParam->fDirection[0]);
722 }
double fDirection[3]
Direction x, y, z.
double fDegree[2]
Rotation degree, this variable isn't input by command file. It is calculated by module.
#define THETA_DEGREE
Definition: Global.h:83
#define PHI_DEGREE
Definition: Global.h:84
#define PI_VALUE
Pi definition.
Definition: Global.h:78

Here is the caller graph for this function:

bool CGeometricShape::CalculateUnitcellCount ( )
private

Calculating unitcell count in shape.

< Only for Show unitcell count

< Only for Show unitcell count

Definition at line 257 of file GeometricShape.cpp.

References _X, _Y, _Z, CMPIManager::AllReduceDouble(), CGeometricCoordination::GetCoordination(), CMPIManager::GetCurrentRank(), CGeometricUnitCell::GetLength(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), m_bBackendFace, m_bConsiderBoundaryCondition, m_bFrontFace, m_fAssignedCount, m_fLength, m_fUnitCellLength, m_nHandlingUnitcellCount, m_originCoordination, CGeometricCoordination::SetOffset(), and CUtility::ShowMsg().

Referenced by FillUnitcell().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::CheckingNeighborCandiate ( )
private

Checking neighbor unitcell by calculating index.

Definition at line 754 of file GeometricShape.cpp.

References m_bBackendFace, m_bFrontFace, m_fAssignedCount, and m_vectUnitCell.

Referenced by FillUnitcell().

755 {
756  int i, nSize = m_vectUnitCell.size();
757 
758  for (i = 0; i < nSize; ++i)
759  {
760  m_vectUnitCell[i].CheckingNeighborCandiate(m_fAssignedCount, m_bFrontFace, m_bBackendFace);
761  }
762 }
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
bool m_bFrontFace
Flag of front face or not.
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
bool m_bBackendFace
Flag of back end face or not.

Here is the caller graph for this function:

unsigned int CGeometricShape::ConstructBasicGeometric ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
bool  bMPI 
)

Get Surface atom list.

< Setting shape parameters

< Setting unitcell parameters

< Arranging unitcell

< Numbering unitcell in periodic bonding layer

< Exchanging front and back side layer information between node

< Numbering unitcell in periodic bonding layer for exchanging layer

< Find Neighbor of each atom

< Make mapinfo runtime strcuture and writting into file

Definition at line 1369 of file GeometricShape.cpp.

References BuildNeighborInformation(), CALCULATION_SUCCESS, CAN_NOT_ALLOC_RANK, ConstructMapInfo(), ExchangeAtomInfoBetweenNode(), FillUnitcell(), FREE_MEM, PeriodicUnitCellNumbering(), SetAtomAndNeighborInformation(), SetShapeInformation(), and SHOW_SIMPLE_MSG.

Referenced by CSPLoop::ConstructionGeometric().

1370 {
1371  unsigned int nRtnCode = CALCULATION_SUCCESS;
1372  char szMsg[1024];
1373 
1374  SetShapeInformation(lpParam);
1376  {
1377  SHOW_SIMPLE_MSG("Terminated program. Direction information doesn't existed.\n");
1378  nRtnCode = CAN_NOT_ALLOC_RANK;
1379  FREE_MEM(lpParam);
1380  return nRtnCode;
1381  }
1382  if(!FillUnitcell(lpParam))
1383  {
1384  SHOW_SIMPLE_MSG("Terminated program. Node counts should be smaller than assigend unitcell count with X axis.\n");
1385  nRtnCode = CAN_NOT_ALLOC_RANK;
1386  FREE_MEM(lpParam);
1387  return nRtnCode;
1388  }
1389 
1391  if (bMPI)
1392  {
1395  }
1397  ConstructMapInfo(lpMapInfo, lpParam);
1398 
1399  return nRtnCode;
1400 }
bool FillUnitcell(CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set bondary condition of shape.
#define CALCULATION_SUCCESS
Return code at main loop, every steps completed.
Definition: Global.h:70
void BuildNeighborInformation()
Find neighbor of each atom.
static bool SetAtomAndNeighborInformation(CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set neighbor information to AtomFactory.
bool ConstructMapInfo(LPNEIGHBOR_MAP_INFO lpMapInfo, CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Extract atom information from runtime objects.
#define CAN_NOT_ALLOC_RANK
Return code at main loop, there is fail assign unit cell to MPI ranks.
Definition: Global.h:71
void SetShapeInformation(CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Set shape information(Length, material, bondary condition and so on)
void ExchangeAtomInfoBetweenNode()
Get start index of atom in shape, using in MPI running enviroment.
void PeriodicUnitCellNumbering(bool bXAxis=false)
Numbering to periodic unitcell.
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19
#define SHOW_SIMPLE_MSG(message)
Definition: Global.h:40

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::ConstructContactRegionOnPoissonGrid ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
LP_CONTACT_GROUP_INFO lpContactGroup 
)

Definition at line 1842 of file GeometricShape.cpp.

References _X, _Y, _Z, ATOM_CONTACT_INDEX, ATOM_DEFAULT_INDEX, BOX_CONTACT, BOX_SHAPE, CCommandFileParser::INPUT_CMD_PARAM::bSaveContactBiasVector, CIRCLE_CONTACT, CONTACT_GROUP_INFO::ContactList, CYLINDER_SHAPE, CCommandFileParser::INPUT_CMD_PARAM::fContactBias, CONTACT_GROUP_INFO::fContactBiasValue, CONTACT_GROUP_INFO::fContactLength, CCommandFileParser::INPUT_CMD_PARAM::fContactLength, CONTACT_GROUP_INFO::fContactOrigin, CCommandFileParser::INPUT_CMD_PARAM::fContactOrigin, NEIGHBOR_MAP_INFO::fItemCount, CGeometricCoordination::GetCoordination(), CMPIManager::GetCurrentRank(), CMPIManager::GetTotalNodeCount(), CMPIManager::IsRootRank(), m_bBackendFace, m_bFrontFace, m_fLength, m_nContactNumber, m_originCoordination, m_ShapeForm, CONTACT_GROUP_INFO::nContactDirection, CCommandFileParser::INPUT_CMD_PARAM::nContactNumber, CONTACT_GROUP_INFO::nContactShape, CCommandFileParser::INPUT_CMD_PARAM::nContactShape, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, CMPIManager::ReceiveDoubleBufferSync(), CMPIManager::SendDoubleBufferSync(), CUtility::ShowMsg(), CCommandFileParser::INPUT_CMD_PARAM::szContactMaterial, and CCommandFileParser::INPUT_CMD_PARAM::szContactShape.

Referenced by CSPLoop::ConstructionGeometric().

1843 {
1844  unsigned int i, j, ia;
1845  double ax, ay, az;
1846  double ox, oy, oz;
1847  double lx, ly, lz;
1848 
1849  FILE *out = NULL;
1850  char szFileName[1024];
1851  char szMsg[1024], szTemp[1024];
1852 
1853  m_nContactNumber = lpParam->nContactNumber;
1854 
1855  for (i = 0; i < m_nContactNumber; i++)
1856  {
1857  lpContactGroup[i]->nContactDirection = -1;
1858 
1859  lpContactGroup[i]->fContactOrigin[0] = lpParam->fContactOrigin[i][0];
1860  lpContactGroup[i]->fContactOrigin[1] = lpParam->fContactOrigin[i][1];
1861  lpContactGroup[i]->fContactOrigin[2] = lpParam->fContactOrigin[i][2];
1862 
1863  lpContactGroup[i]->fContactLength[0] = lpParam->fContactLength[i][0];
1864  lpContactGroup[i]->fContactLength[1] = lpParam->fContactLength[i][1];
1865  lpContactGroup[i]->fContactLength[2] = lpParam->fContactLength[i][2];
1866 
1867  lpContactGroup[i]->nContactShape = lpParam->nContactShape[i];
1868 
1869  lpContactGroup[i]->fContactBiasValue = lpParam->fContactBias[i];
1870 
1871  strcpy(lpContactGroup[i]->szContactMaterial, lpParam->szContactMaterial[i]);
1872  strcpy(lpContactGroup[i]->szContactShape, lpParam->szContactShape[i]);
1873  }
1874 
1875  if (m_ShapeForm == BOX_SHAPE)
1876  {
1877  for (i = 0; i < m_nContactNumber; i++)
1878  {
1879  if (lpContactGroup[i]->fContactLength[0] == 0.0)
1880  {
1881  if (m_bFrontFace)
1882  {
1883  if (lpContactGroup[i]->fContactOrigin[0] == m_originCoordination.GetCoordination(_X))
1884  {
1885  lpContactGroup[i]->nContactDirection = 1;
1887  printf("-Contact group[%3d] is on X left end\n", i + 1);
1888  }
1889  }
1890 
1891  if (m_bBackendFace)
1892  {
1893  if (lpContactGroup[i]->fContactOrigin[0] == m_fLength[0] + m_originCoordination.GetCoordination(_X))
1894  {
1895  lpContactGroup[i]->nContactDirection = 0;
1897  printf("-Contact group[%3d] is on X right end\n", i + 1);
1898  }
1899  }
1900  }
1901  else if (lpContactGroup[i]->fContactLength[1] == 0.0)
1902  {
1903  if (lpContactGroup[i]->fContactOrigin[1] == m_originCoordination.GetCoordination(_Y))
1904  {
1905  lpContactGroup[i]->nContactDirection = 3;
1907  printf("-Contact group[%3d] is on Y left end\n", i + 1);
1908  }
1909  else if (lpContactGroup[i]->fContactOrigin[1] == m_fLength[1] + m_originCoordination.GetCoordination(_Y))
1910  {
1911  lpContactGroup[i]->nContactDirection = 2;
1913  printf("-Contact group[%3d] is on Y right end\n", i + 1);
1914  }
1915  else
1916  {
1917  printf("-Error: Contact group[%3d] origin in y-direction does not match to one of the boundaries.\n", i + 1);
1918  exit(1);
1919  }
1920  }
1921  else if (lpContactGroup[i]->fContactLength[2] == 0.0)
1922  {
1923  if (lpContactGroup[i]->fContactOrigin[2] == m_originCoordination.GetCoordination(_Z))
1924  {
1925  lpContactGroup[i]->nContactDirection = 5;
1927  printf("-Contact group[%3d] is on Z left end\n", i + 1);
1928  }
1929  else if (lpContactGroup[i]->fContactOrigin[2] == m_fLength[2] + m_originCoordination.GetCoordination(_Z))
1930  {
1931  lpContactGroup[i]->nContactDirection = 4;
1933  printf("-Contact group[%3d] is on Z right end\n", i + 1);
1934  }
1935  else
1936  {
1937  printf("-Error: Contact group[%3d] origin in z-direction does not match to one of the boundaries.\n", i + 1);
1938  exit(1);
1939  }
1940  }
1941  else
1942  {
1943  printf("-Error: Contact size in an direction should be zero for box shape.\n");
1944  }
1945  }
1946 
1947  for (ia = 0; ia < lpMapInfo->fItemCount; ia++)
1948  {
1949  ax = lpMapInfo->pfX_Coordination[ia];
1950  ay = lpMapInfo->pfY_Coordination[ia];
1951  az = lpMapInfo->pfZ_Coordination[ia];
1952 
1953  for (i = 0; i < m_nContactNumber; i++)
1954  {
1955  ox = lpContactGroup[i]->fContactOrigin[0];
1956  oy = lpContactGroup[i]->fContactOrigin[1];
1957  oz = lpContactGroup[i]->fContactOrigin[2];
1958 
1959  lx = lpContactGroup[i]->fContactLength[0];
1960  ly = lpContactGroup[i]->fContactLength[1];
1961  lz = lpContactGroup[i]->fContactLength[2];
1962 
1963  if (lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] == ATOM_DEFAULT_INDEX)
1964  {
1965  switch ((int)(lpContactGroup[i]->nContactDirection / 2))
1966  {
1967  case 0:
1968  switch (lpContactGroup[i]->nContactShape)
1969  {
1970  case BOX_CONTACT:
1971  if (((ay > oy) && (ay < oy + ly)) && ((az > oz) && (az < oz + lz)))
1972  {
1973  lpContactGroup[i]->ContactList.push_back(ia);
1974  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
1975  }
1976  break;
1977  case CIRCLE_CONTACT:
1978  if ((ay - oy - ly / 2)*(ay - oy - ly / 2) / (ly / 2) / (ly / 2) + (az - oz - lz / 2)*(az - oz - lz / 2) / (lz / 2) / (lz / 2) < 1.0)
1979  {
1980  lpContactGroup[i]->ContactList.push_back(ia);
1981  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
1982  }
1983  break;
1984  }
1985  break;
1986  case 1:
1987  switch (lpContactGroup[i]->nContactShape)
1988  {
1989  case BOX_CONTACT:
1990  if (((ax > ox) && (ax < ox + lx)) && ((az > oz) && (az < oz + lz)))
1991  {
1992  lpContactGroup[i]->ContactList.push_back(ia);
1993  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
1994  }
1995  break;
1996  case CIRCLE_CONTACT:
1997  if ((ax - ox - lx / 2)*(ax - ox - lx / 2) / (lx / 2) / (lx / 2) + (az - oz - lz / 2)*(az - oz - lz / 2) / (lz / 2) / (lz / 2) < 1.0)
1998  {
1999  lpContactGroup[i]->ContactList.push_back(ia);
2000  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
2001  }
2002  break;
2003  }
2004  break;
2005  case 2:
2006  switch (lpContactGroup[i]->nContactShape)
2007  {
2008  case BOX_CONTACT:
2009  if (((ax > ox) && (ax < ox + lx)) && ((ay > oy) && (ay < oy + ly)))
2010  {
2011  lpContactGroup[i]->ContactList.push_back(ia);
2012  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
2013  }
2014  break;
2015  case CIRCLE_CONTACT:
2016  if ((ax - ox - lx / 2)*(ax - ox - lx / 2) / (lx / 2) / (lx / 2) + (ay - oy - ly / 2)*(ay - oy - ly / 2) / (ly / 2) / (ly / 2) < 1.0)
2017  {
2018  lpContactGroup[i]->ContactList.push_back(ia);
2019  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
2020  }
2021  break;
2022  break;
2023  }
2024  }
2025  }
2026  }
2027  }
2028  }
2029 
2030  if (m_ShapeForm == CYLINDER_SHAPE)
2031  {
2032  for (i = 0; i < m_nContactNumber; i++)
2033  {
2034  if (lpContactGroup[i]->fContactLength[0] == 0.0)
2035  {
2036  if (m_bFrontFace)
2037  {
2038  if (lpContactGroup[i]->fContactOrigin[0] == m_originCoordination.GetCoordination(_X))
2039  {
2040  lpContactGroup[i]->nContactDirection = 1;
2042  printf("-Contact group[%3d] is on X left end for cylinder shape\n", i + 1);
2043  }
2044  }
2045 
2046  if (m_bBackendFace)
2047  {
2048  if (lpContactGroup[i]->fContactOrigin[0] == m_fLength[0] + m_originCoordination.GetCoordination(_X))
2049  {
2050  lpContactGroup[i]->nContactDirection = 0;
2052  printf("-Contact group[%3d] is on X right end for cylinder shape\n", i + 1);
2053  }
2054  }
2055  }
2056  else if (lpContactGroup[i]->fContactLength[0] > 0.0)
2057  {
2058  lpContactGroup[i]->nContactDirection = 6;
2060  printf("-Contact group[%3d] is on cylinderical surface\n", i + 1);
2061  }
2062  else
2063  {
2064  printf("-Error: Contact size in x-direction should be greater than or equal to zero.\n");
2065  }
2066  }
2067 
2068  for (ia = 0; ia < lpMapInfo->fItemCount; ia++)
2069  {
2070  ax = lpMapInfo->pfX_Coordination[ia];
2071  ay = lpMapInfo->pfY_Coordination[ia];
2072  az = lpMapInfo->pfZ_Coordination[ia];
2073 
2074  for (i = 0; i < m_nContactNumber; i++)
2075  {
2076  ox = lpContactGroup[i]->fContactOrigin[0];
2077  oy = lpContactGroup[i]->fContactOrigin[1];
2078  oz = lpContactGroup[i]->fContactOrigin[2];
2079 
2080  lx = lpContactGroup[i]->fContactLength[0];
2081  ly = lpContactGroup[i]->fContactLength[1];
2082  lz = lpContactGroup[i]->fContactLength[2];
2083 
2084  switch ((int)(lpContactGroup[i]->nContactDirection / 2))
2085  {
2086  case 0:
2087  if (lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] == ATOM_DEFAULT_INDEX)
2088  {
2089  switch (lpContactGroup[i]->nContactShape)
2090  {
2091  case BOX_CONTACT:
2092  if (((ay > oy) && (ay < oy + ly)) && ((az > oz) && (az < oz + lz)))
2093  {
2094  lpContactGroup[i]->ContactList.push_back(ia);
2095  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
2096  }
2097  break;
2098  case CIRCLE_CONTACT:
2099  if ((ay - oy - ly / 2)*(ay - oy - ly / 2) / (ly / 2) / (ly / 2) + (az - oz - lz / 2)*(az - oz - lz / 2) / (lz / 2) / (lz / 2) < 1.0)
2100  {
2101  lpContactGroup[i]->ContactList.push_back(ia);
2102  lpMapInfo->pfNeighbor[lpContactGroup[i]->nContactDirection][ia] = ATOM_CONTACT_INDEX;
2103  }
2104  break;
2105  }
2106  }
2107  break;
2108 
2109  case 3:
2110  for (j = 2; j < 6; j++)
2111  {
2112  if ((lpMapInfo->pfNeighbor[j][ia] == ATOM_DEFAULT_INDEX))
2113  {
2114  switch (lpContactGroup[i]->nContactShape)
2115  {
2116  case BOX_CONTACT:
2117  if ((ax > ox) && (ax < ox + lx))
2118  {
2119  lpContactGroup[i]->ContactList.push_back(ia);
2120  lpMapInfo->pfNeighbor[j][ia] = ATOM_CONTACT_INDEX;
2121  }
2122  break;
2123  }
2124  }
2125  }
2126  break;
2127  }
2128  }
2129  }
2130  }
2131 
2132  // Dump contact group info
2133 #ifndef DISABLE_MPI_ROUTINE
2134  MPI_Request req;
2135  double fTemp = 1;
2136 #endif //DISABLE_MPI_ROUTINE
2137 
2138  if (true == lpParam->bSaveContactBiasVector)
2139  {
2140  strcpy(szTemp, "ContactGroupInfo.dat");
2141 #ifdef _WIN32
2142  sprintf(szFileName, "result\\%s", szTemp);
2143 #else
2144  sprintf(szFileName, "result/%s", szTemp);
2145 #endif
2146 
2147 #ifdef DISABLE_MPI_ROUTINE
2148  out = fopen(szFileName, "wt");
2149 #else //DISABLE_MPI_ROUTINE
2150 
2152  {
2153  CUtility::ShowMsg("-Save contact group info. to file.\n");
2154  out = fopen(szFileName, "wt");
2155  }
2156  else
2157  {
2159  out = fopen(szFileName, "at");
2160  }
2161 #endif //DISABLE_MPI_ROUTINE
2162  }
2163 
2164  if (true == lpParam->bSaveContactBiasVector && NULL != out)
2165  {
2166  for (i = 0; i < m_nContactNumber; i++)
2167  {
2168  for (j = 0; j < lpContactGroup[i]->ContactList.size(); j++)
2169  {
2170  ia = lpContactGroup[i]->ContactList[j];
2171  sprintf(szMsg, "Contact group [ %3d ] %3d %5s %5.3f, atom[ %6d ] (%11.8f, %11.8f, %11.8f) \n",
2172  i + 1, lpContactGroup[i]->nContactDirection, lpContactGroup[i]->szContactShape, lpContactGroup[i]->fContactBiasValue,
2173  (int)lpMapInfo->pfID[ia], lpMapInfo->pfX_Coordination[ia], lpMapInfo->pfY_Coordination[ia], lpMapInfo->pfZ_Coordination[ia]);
2174 
2175  fputs(szMsg, out);
2176  }
2177  }
2178 
2179  fclose(out);
2180 #ifndef DISABLE_MPI_ROUTINE
2183 #endif //DISABLE_MPI_ROUTINE
2184  }
2185 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
double fContactLength[3]
For contact.
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
double m_fLength[3]
Building Geometric part.
int nContactDirection
Contact direction, 0: Xp, 1: Xm, 2: Yp, 3: Ym, 4: Zp, 5: Zm.
char szContactMaterial[NMAXCONTACT][1024]
Contact Material type.
bool m_bFrontFace
Flag of front face or not.
double fContactOrigin[NMAXCONTACT][3]
For contact.
Definition: Global.h:113
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
std::vector< int > ContactList
#define CIRCLE_CONTACT
Definition: Global.h:97
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.
Definition: MPIManager.cpp:712
bool bSaveContactBiasVector
Save contact bias vector or not.
Definition: Global.h:113
#define BOX_SHAPE
Definition: Global.h:93
CGeometricCoordination m_originCoordination
Orign coordination of shape.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
char szContactShape[NMAXCONTACT][1024]
Contact Shape.
bool m_bBackendFace
Flag of back end face or not.
int m_nContactNumber
="">
int nContactShape
Contact Shape.
#define ATOM_CONTACT_INDEX
Atom index default value that contact atom instance.
Definition: Global.h:53
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fContactBias[NMAXCONTACT]
Contact bias.
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
#define BOX_CONTACT
Definition: Global.h:96
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
double fContactOrigin[3]
For contact.
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.
Definition: MPIManager.cpp:685
Definition: Global.h:113
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
unsigned int m_ShapeForm
Shape form.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
#define CYLINDER_SHAPE
Definition: Global.h:94
int nContactShape[NMAXCONTACT]
Contact Shape.
double fContactLength[NMAXCONTACT][3]
For contact.

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::ConstructMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo,
CCommandFileParser::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 769 of file GeometricShape.cpp.

References _X, _Y, _Z, ATOM_DEFAULT_INDEX, CCommandFileParser::INPUT_CMD_PARAM::bSaveMapFile, BuildGeoFileName(), NEIGHBOR_MAP_INFO::fItemCount, FreeMapInfo(), CGeometricCoordination::GetCoordination(), CGeometricAtom::GetCoordination(), CMPIManager::GetCurrentRank(), CGeometricAtom::GetDomainMaterialNumber(), CGeometricAtom::GetDomainNumber(), CGeometricAtom::GetID(), CGeometricAtom::GetMaterialMaterialNumber(), CGeometricAtom::GetMaterialNumber(), CGeometricAtom::GetNeighborAtomID(), CGeometricAtom::GetNeighborCount(), CGeometricUnitCell::GetSubElementID(), CMPIManager::GetTotalNodeCount(), CGeometricAtom::GetType(), InitMapInfo(), CMPIManager::IsDeflationRoot(), CGeometricAtom::IsPeriodicAtom(), CGeometricAtom::IsPeriodicCoupling(), CMPIManager::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::pnDomainNumber, NEIGHBOR_MAP_INFO::pNeighborMaterial, CMPIManager::ReceiveDoubleBufferSync(), CMPIManager::SendDoubleBufferSync(), SetMapInfoSize(), and CUtility::ShowMsg().

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

770 {
771  bool bRtn = false;
772  char szMsg[1024], szAdditional[1024];
773  unsigned int i, j, k, nSize, nAtomSize, nNeighborSize, nMapIndex = 0;;
774  FILE *out = NULL;
775  char szFileName[1024];
776  double fNeighborAtomID = ATOM_DEFAULT_INDEX;
777  bool bPeriodic = false;
778  char szTemp[1024], szMaterial[1024], szTemp2[1024], szOpt[1024];
779 #ifndef DISABLE_MPI_ROUTINE
780  MPI_Request req;
781  double fTemp = 1;
782 #endif //DISABLE_MPI_ROUTINE
783 
784  BuildGeoFileName(szTemp, lpParam);
785 
786  InitMapInfo(lpMapInfo);
787 
788  //printf("Save ConstructMapInfo: %s\n", lpParam->bSaveMapFile ? "true" : "false");
789  if (true == lpParam->bSaveMapFile && CMPIManager::IsDeflationRoot())
790  {
791 #ifdef _WIN32
792  _mkdir("result");
793  sprintf(szFileName, "result\\%s", szTemp);
794 #else
795  mkdir("result", 0777);
796  sprintf(szFileName, "result/%s", szTemp);
797 #endif
798 
799 
800 #ifdef DISABLE_MPI_ROUTINE
801  out = fopen(szFileName, "wt");
802 #else //DISABLE_MPI_ROUTINE
803 
805  {
806  CUtility::ShowMsg("-Save atom map to file.\n");
807  out = fopen(szFileName, "wt");
808  }
809  else
810  {
812  out = fopen(szFileName, "at");
813  }
814 #endif //DISABLE_MPI_ROUTINE
815  }
816 
817  nSize = m_vectUnitCell.size();
818 
820  {
821  if (NULL != out)
822  fclose(out);
823  CGeometricShape::FreeMapInfo(lpMapInfo);
824  return bRtn;
825  }
826 
827 #ifdef SHOW_ATOM_MAP_RESULT_ON_SCREEN
828  CUtility::ShowMsg("\n");
829  CUtility::ShowMsg("Atom list--------------------------------------\n");
830 #endif //SHOW_ATOM_MAP_RESULT_ON_SCREEN
831  for (i = 0; i < nSize; ++i)
832  {
833  double fIDForDebug;
834  nAtomSize = m_vectUnitCell[i].GetSubElementSize();
835 
836  for (j = 0; j < nAtomSize; ++j)
837  {
838  CGeometricAtom *pAtom = m_vectUnitCell[i].GetSubElementAt(j);
839  if (ATOM_DEFAULT_INDEX == pAtom->GetID() || true == pAtom->IsPeriodicAtom())
840  continue;
841 
842  CGeometricCoordination coord = pAtom->GetCoordination();
843  fIDForDebug = pAtom->GetID();
844 
845  sprintf(szAdditional, "");
846  sprintf(szMaterial, "");
847  sprintf(szOpt, "");
848  nNeighborSize = pAtom->GetNeighborCount();
849  for (k = 0; k < nNeighborSize; ++k)
850  {
851  fNeighborAtomID = pAtom->GetNeighborAtomID(k);
852 
853  if (ATOM_DEFAULT_INDEX == fNeighborAtomID)
854  bPeriodic = false;
855  else
856  bPeriodic = pAtom->IsPeriodicCoupling(k);
857 
858 #ifdef NOSHOW_MINORS_ONE
859  if (ATOM_DEFAULT_INDEX == pAtom->GetNeighborAtom(k))
860  {
861  sprintf(szTemp, "\t");
862  sprintf(szTemp2, "\t", (int)pAtom->GetMaterialMaterialNumber(k));
863  }
864  else
865 #endif //NOSHOW_MINORS_ONE
866  {
867  sprintf(szTemp, "\t%7.0f", fNeighborAtomID);
868  if (-1 == fNeighborAtomID)
869  sprintf(szTemp2, "\t%7.0d", -1);
870  else
871  sprintf(szTemp2, "\t%7.0d", (int)pAtom->GetMaterialMaterialNumber(k));
872  }
873  strcat(szAdditional, szTemp);
874  strcat(szMaterial, szTemp2);
875  sprintf(szOpt, "\t%7d", pAtom->GetDomainNumber());
876 
877  lpMapInfo->pfNeighbor[k][nMapIndex] = fNeighborAtomID;
878  lpMapInfo->pbPeriodicCondition[k][nMapIndex] = bPeriodic;
879  lpMapInfo->pNeighborMaterial[k][nMapIndex] = pAtom->GetMaterialMaterialNumber(k);
880  }
881 
882  sprintf(szMsg, "%-7.0f\t%d\t%d\t%15.6f\t%15.6f\t%15.6f%s%s%s\n", pAtom->GetID(), (int)pAtom->GetType(), (int)pAtom->GetMaterialNumber(),
883  coord.GetCoordination(_X),
884  coord.GetCoordination(_Y),
885  coord.GetCoordination(_Z),
886  szAdditional, szMaterial, szOpt);
887  //printf("%s", szMsg);
888 
889  lpMapInfo->fItemCount++;
890  lpMapInfo->pAtomType[nMapIndex] = pAtom->GetType();
891  lpMapInfo->pMaterialNumber[nMapIndex] = pAtom->GetMaterialNumber();
892  lpMapInfo->pDomainMaterialNumber[nMapIndex] = pAtom->GetDomainMaterialNumber();
893  lpMapInfo->pnDomainNumber[nMapIndex] = pAtom->GetDomainNumber();
894  lpMapInfo->pfID[nMapIndex] = pAtom->GetID();
895  lpMapInfo->pfX_Coordination[nMapIndex] = coord.GetCoordination(_X);
896  lpMapInfo->pfY_Coordination[nMapIndex] = coord.GetCoordination(_Y);
897  lpMapInfo->pfZ_Coordination[nMapIndex] = coord.GetCoordination(_Z);
898  nMapIndex++;
899 
900  if (true == lpParam->bSaveMapFile && NULL != out)
901  fputs(szMsg, out);
902 #ifdef SHOW_ATOM_MAP_RESULT_ON_SCREEN
903  CUtility::ShowMsg(szMsg);
904 #endif //SHOW_ATOM_MAP_RESULT_ON_SCREEN
905 
906  }
907  }
908 
909  if (true == lpParam->bSaveMapFile && NULL != out)
910  {
911  fclose(out);
912 #ifndef DISABLE_MPI_ROUTINE
915 #endif //DISABLE_MPI_ROUTINE
916  }
917 
918  bRtn = true;
919  return bRtn;
920 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
MATERIAL_INDEX GetDomainMaterialNumber()
Get atom material type.
Definition: GeometricAtom.h:35
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
Definition: AtomMapInfo.h:26
MATERIAL_INDEX GetMaterialNumber()
Get atom typpe.
Definition: GeometricAtom.h:34
Definition: Global.h:113
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
double GetID()
Definition: GeometricAtom.h:27
double GetNeighborAtomID(unsigned int nIndex)
Get neighbor atom count.
CGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
Definition: AtomMapInfo.h:18
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.
Definition: MPIManager.cpp:712
Definition: Global.h:113
void BuildGeoFileName(char *pszFileName, CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Make atom map naming.
void InitMapInfo(LPNEIGHBOR_MAP_INFO lpMapInfo)
Intilize map info data.
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
Definition: AtomMapInfo.h:27
bool IsPeriodicAtom()
Set atom is periodic.
Definition: GeometricAtom.h:47
static int GetTotalNodeCount()
Definition: MPIManager.h:42
unsigned int * pnDomainNumber
Definition: AtomMapInfo.h:21
static bool IsDeflationRoot()
Checking is root rank of Lanczos computation.
Definition: MPIManager.h:69
Class for coordination.
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
static void FreeMapInfo(LPNEIGHBOR_MAP_INFO lpMapInfo)
Release mapinfo data.
static double GetSubElementID()
Reset SubElement ID to Zero.
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
unsigned int GetNeighborCount()
Definition: GeometricAtom.h:42
Class for Atom.
Definition: GeometricAtom.h:15
bool SetMapInfoSize(LPNEIGHBOR_MAP_INFO lpMapInfo, double fSize)
Building Hamiltonian part.
unsigned int GetDomainNumber()
Get Domain atom material type.
Definition: GeometricAtom.h:36
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
MATERIAL_INDEX GetMaterialMaterialNumber(unsigned int nIndex)
Get Neighbor material type.
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.
Definition: MPIManager.cpp:685
Definition: Global.h:113
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
Definition: AtomMapInfo.h:19
ATOM_TYPE GetType()
Definition: GeometricAtom.h:33
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
CGeometricCoordination GetCoordination()
Definition: GeometricAtom.h:37
bool bSaveMapFile
Save atom map or not.
bool IsPeriodicCoupling(int nIndex)
Check is this periodic atom.
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.
Definition: AtomMapInfo.h:20

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::Deserialize ( std::vector< CGeometricUnitCell > *  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 1293 of file GeometricShape.cpp.

References _Y, _Z, CGeometricUnitCell::Deserialize(), CGeometricAtomFactory::GetAtomCountInUnitcell(), m_fAssignedCount, m_vectUnitCell, CGeometricUnitCell::SetID(), and UNITCELL_WRITING_BLOCK_SIZE.

Referenced by ExchangeAtomInfoBetweenNode().

1294 {
1295  double fReceivingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1296  int i, nSize = m_vectUnitCell.size();
1297  int fPos = 0;
1298  int nAtomCountInCell = CGeometricAtomFactory::GetAtomCountInUnitcell();
1299  double fID;
1300 
1301  if( bFrontSide )
1302  fID = -fReceivingCount;
1303  else
1304  fID = m_vectUnitCell[m_vectUnitCell.size()-1].GetID() + 1;
1305 
1306  for (i = 0 ; i < floor(fReceivingCount); ++i)
1307  {
1308  CGeometricUnitCell unitcell;
1309 
1310  unitcell.SetID(fID++);
1311  unitcell.Deserialize(pBuffer + fPos);
1312  pVectUnitCell->push_back(unitcell);
1313  fPos += nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE;
1314  }
1315 }
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
Definition: Global.h:113
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
void SetID(double fID)
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: Global.h:66
Definition: Global.h:113
static int GetAtomCountInUnitcell()
void Deserialize(double *pBuffer)
Convert double buffer to unit cell data.
Class for Geometric unit cell.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::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 1148 of file GeometricShape.cpp.

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

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

1149 {
1150  double fShift = CMPIManager::GetCurrentRank() * floor(m_fAssignedCount[0]) * floor(m_fAssignedCount[1]) * floor(m_fAssignedCount[2]);
1151  int i, nSize = m_vectUnitCell.size();
1152  double fSendingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1153  double *pSendBuffer = NULL;
1154  int nAtomCountInCell = CGeometricAtomFactory::GetAtomCountInUnitcell();
1155  double *pReceiveBuffer = (double*)malloc(sizeof(double)*(fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell));
1156  MPI_Request req[2];
1157  double fAtomID = 0;
1158 
1159  if (1 == CMPIManager::GetTotalNodeCount())
1160  {
1162  FREE_MEM(pReceiveBuffer);
1163  return;
1164  }
1165 
1166 
1169  {
1171  CMPIManager::SendDoubleBufferSync(1, &fAtomID, 1, &req[0]);
1172  }
1173  else
1174  {
1176  m_fAtomIDStartIndex = fAtomID;
1177  for (i = 0; i < nSize; ++i)
1178  m_vectUnitCell[i].ShiftAtomID(fAtomID);
1179 
1181  {
1184  }
1186  {
1188  m_fTotalAtomCountinMPI = fAtomID;
1189  }
1190  }
1191 
1194 
1195 
1198  {
1199  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-1);
1200  CMPIManager::SendDoubleBufferSync(CMPIManager::GetCurrentRank() + 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1201  }
1202  else
1203  {
1204  CMPIManager::ReceiveDoubleBufferSync(CMPIManager::GetCurrentRank() - 1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1205  Deserialize(&m_vectPrevUnitCell, pReceiveBuffer, true);
1206 
1208  {
1209  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-1);
1210  CMPIManager::SendDoubleBufferSync(CMPIManager::GetCurrentRank() + 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1211  }
1212  else
1213  {
1215  {
1216  pSendBuffer = Serialize(floor(m_fAssignedCount[_X])-2);
1217  CMPIManager::SendDoubleBufferSync(0, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1218  }
1219  }
1220  }
1221 
1223  {
1224  CMPIManager::ReceiveDoubleBufferSync(CMPIManager::GetTotalNodeCount() - 1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1225  Deserialize(&m_vectPrevUnitCell, pReceiveBuffer, true);
1226  }
1227  FREE_MEM(pSendBuffer);
1228 
1231  {
1232  pSendBuffer = Serialize(0);
1233  CMPIManager::SendDoubleBufferSync(CMPIManager::GetCurrentRank() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1234  }
1235  else
1236  {
1237  CMPIManager::ReceiveDoubleBufferSync(CMPIManager::GetCurrentRank() + 1, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1238  Deserialize(&m_vectNextUnitCell, pReceiveBuffer, false);
1239 
1240  if (!CMPIManager::IsRootRank())
1241  {
1242  pSendBuffer = Serialize(0);
1243  CMPIManager::SendDoubleBufferSync(CMPIManager::GetCurrentRank() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1244  }
1245  else
1246  {
1248  {
1249  pSendBuffer = Serialize(1);
1250  CMPIManager::SendDoubleBufferSync(CMPIManager::GetTotalNodeCount() - 1, pSendBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[1]);
1251  }
1252  }
1253  }
1254 
1256  {
1257  CMPIManager::ReceiveDoubleBufferSync(0, pReceiveBuffer, (int)fSendingCount*UNITCELL_WRITING_BLOCK_SIZE*nAtomCountInCell, &req[0]);
1258  Deserialize(&m_vectNextUnitCell, pReceiveBuffer, false);
1259  }
1260 
1261  FREE_MEM(pSendBuffer);
1262  FREE_MEM(pReceiveBuffer);
1263 }
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
void Deserialize(std::vector< CGeometricUnitCell > *pVectUnitCell, double *pBuffer, bool bFrontSide)
Deerialize unitcells from double array.
Definition: Global.h:113
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.
Definition: MPIManager.cpp:712
Definition: Global.h:113
double m_fAtomIDStartIndex
Start atom index in current Shape.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
double m_fTotalAtomCountinMPI
Total valid atom count in shape.
std::vector< CGeometricUnitCell > m_vectPrevUnitCell
Front edge unit cell that copy from previous side node.
static int GetCurrentRank()
Definition: MPIManager.h:40
static double GetSubElementID()
Reset SubElement ID to Zero.
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: Global.h:66
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.
Definition: MPIManager.cpp:685
Definition: Global.h:113
std::vector< CGeometricUnitCell > m_vectNextUnitCell
Back end edge unit cell that copy from next side node.
static int GetAtomCountInUnitcell()
double * Serialize(double fXLayer)
Serialize unitcells with specific later index to double array.
void ShiftAtomID(double fShift)
Shift atom id in MPI running enviroment.
static void BroadcastDouble(double *pValue, unsigned int nSize, int nRootRank=0, MPI_Comm comm=MPI_COMM_NULL)
Broadcst boolean value.
Definition: MPIManager.cpp:486
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::FillUnitcell ( CCommandFileParser::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 102 of file GeometricShape.cpp.

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

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

103 {
104  bool bRtn;
105 
106  bRtn = CalculateUnitcellCount();
107  if( !bRtn )
108  return bRtn;
109 
110  ArrangeUnitCell(lpParam);
112 
113  return bRtn;
114 }
bool CalculateUnitcellCount()
Calculating unitcell count in shape.
void CheckingNeighborCandiate()
Checking neighbor unitcell by calculating index.
void ArrangeUnitCell(CCommandFileParser::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 CGeometricShape::FinalShape ( )

Finalize Shape variable.

Definition at line 252 of file GeometricShape.cpp.

References FreeUnitCellList().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), and ~CGeometricShape().

253 {
255 }
void FreeUnitCellList()
Relase unitcell list.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::FreeMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo)
static

Release mapinfo data.

Parameters
lpMapInfoAtom map information

<Added by="" jhkang>="">

<Added by="" jhkang="" end>="">

Definition at line 1086 of file GeometricShape.cpp.

References FREE_MEM, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pDomainMaterialNumber, NEIGHBOR_MAP_INFO::pfAtomOnGrid, 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::pnDomainNumber, and NEIGHBOR_MAP_INFO::pNeighborMaterial.

Referenced by ConstructMapInfo(), CTBMS_Solver::FinalEvn(), and CSPLoop::Finalize().

1087 {
1088  unsigned int i;
1089 
1090  FREE_MEM(lpMapInfo->pfID);
1091  FREE_MEM(lpMapInfo->pAtomType);
1092  FREE_MEM(lpMapInfo->pMaterialNumber);
1093  FREE_MEM(lpMapInfo->pDomainMaterialNumber);
1094  FREE_MEM(lpMapInfo->pnDomainNumber);
1095  FREE_MEM(lpMapInfo->pfX_Coordination);
1096  FREE_MEM(lpMapInfo->pfY_Coordination);
1097  FREE_MEM(lpMapInfo->pfZ_Coordination);
1098 
1099  for (i = 0; i < MAX_NEIGHBOR; ++i)
1100  {
1101  FREE_MEM(lpMapInfo->pfNeighbor[i]);
1102  FREE_MEM(lpMapInfo->pbPeriodicCondition[i]);
1103  FREE_MEM(lpMapInfo->pNeighborMaterial[i]);
1104  }
1105 
1107  FREE_MEM(lpMapInfo->pfAtomOnGrid);
1109 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
Definition: AtomMapInfo.h:26
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
CGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
Definition: AtomMapInfo.h:18
#define MAX_NEIGHBOR
Definition: Global.h:91
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
Definition: AtomMapInfo.h:27
unsigned int * pnDomainNumber
Definition: AtomMapInfo.h:21
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
Definition: AtomMapInfo.h:19
double * pfAtomOnGrid
="">
Definition: AtomMapInfo.h:29
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.
Definition: AtomMapInfo.h:20
#define FREE_MEM(pointer)
Macro for memory allocation and assign null value.
Definition: Global.h:19

Here is the caller graph for this function:

void CGeometricShape::FreeUnitCellList ( )
private

Relase unitcell list.

Definition at line 219 of file GeometricShape.cpp.

References m_vectNextUnitCell, m_vectPrevUnitCell, m_vectSurfaceAtom, and m_vectUnitCell.

Referenced by FinalShape().

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

Here is the caller graph for this function:

CGeometricAtom * CGeometricShape::GetAtomByIndex ( double  fID)
private

Get atom instance by ID.

Parameters
fIDAtom ID
Returns
Atom instance pointer

Definition at line 696 of file GeometricShape.cpp.

References CGeometricAtom::IsPeriodicAtom(), and m_vectUnitCell.

Referenced by RefillPeriodicBinding().

697 {
698  CGeometricAtom *pRtn = NULL;
699  int nSize, i;
700 
701  nSize = m_vectUnitCell.size();
702  for( i = 0; i < nSize ; ++ i)
703  {
704  pRtn = m_vectUnitCell[i].GetSubElementByID(fID);
705  if( NULL != pRtn && false == pRtn->IsPeriodicAtom())
706  return pRtn;
707  }
708 
709  return pRtn;
710 }
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
bool IsPeriodicAtom()
Set atom is periodic.
Definition: GeometricAtom.h:47
Class for Atom.
Definition: GeometricAtom.h:15

Here is the call graph for this function:

Here is the caller graph for this function:

double CGeometricShape::GetAtomStartID ( )
inline

Set total valid atom count in shape.

Definition at line 57 of file GeometricShape.h.

References m_fAtomIDStartIndex.

Referenced by CTBMS_Solver::AllocateCSR(), CSPLoop::AllocateCSR(), CSPLoop::BuildHamiltonian(), and CTBMS_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 CGeometricShape::GetConsideringBoundaryCondition ( AXIS_DEFINE  direction)
inline

Definition at line 42 of file GeometricShape.h.

References m_bConsiderBoundaryCondition.

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

Calculating Phase sign.

Parameters
fAtomPosAtom coordination
fPeriodicAtomPosPeriodic atom coordination
Returns
sign of Phase

Definition at line 682 of file GeometricShape.cpp.

Referenced by RefillPeriodicBinding().

683 {
684  double fRtn = 1.;
685 
686  if( fPeriodicAtomPos - fAtomPos > 0 )
687  fRtn = -1.;
688 
689  return fRtn;
690 }

Here is the caller graph for this function:

MATERIAL_INDEX CGeometricShape::GetMaterialType ( )
inline

Definition at line 36 of file GeometricShape.h.

References m_MaterialType.

36 { return m_MaterialType; };
MATERIAL_INDEX m_MaterialType
Material type of shape.
bool CGeometricShape::GetNeumannBoundaryCondition ( AXIS_DEFINE  direction)
inline

Definition at line 70 of file GeometricShape.h.

References m_bNeumannBoundaryCondition.

70 { return m_bNeumannBoundaryCondition[direction]; };
bool m_bNeumannBoundaryCondition[3]
int CGeometricShape::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 135 of file GeometricShape.cpp.

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

Referenced by ArrangeUnitCell().

136 {
137  int nRtn = CGeometricAtom::NONE;
138 
139  if (0 == x && true == m_bConsiderBoundaryCondition[_X])
140 #ifndef DISABLE_MPI_ROUTINE
143 #else //DISABLE_MPI_ROUTINE
145 #endif //DISABLE_MPI_ROUTINE
146 
147  if (0 == y && true == m_bConsiderBoundaryCondition[_Y])
149 
150  if (0 == z && true == m_bConsiderBoundaryCondition[_Z])
152 
153  if (maxX - 1 == x && true == m_bConsiderBoundaryCondition[_X])
154 #ifndef DISABLE_MPI_ROUTINE
157 #else //DISABLE_MPI_ROUTINE
159 #endif //DISABLE_MPI_ROUTINE
160 
161  if (maxY - 1 == y && true == m_bConsiderBoundaryCondition[_Y])
163 
164  if (maxZ - 1 == z && true == m_bConsiderBoundaryCondition[_Z])
166 
167  return nRtn;
168 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
Definition: Global.h:113
Definition: Global.h:113
static int GetTotalNodeCount()
Definition: MPIManager.h:42
static int GetCurrentRank()
Definition: MPIManager.h:40
Definition: Global.h:113

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int CGeometricShape::GetShapeForm ( )
inline

Definition at line 39 of file GeometricShape.h.

References m_ShapeForm.

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

Definition at line 60 of file GeometricShape.h.

References m_vectSurfaceAtom.

Referenced by BuildNeighborInformation(), CSPLoop::ConstructionGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

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

Here is the caller graph for this function:

double CGeometricShape::GetTotalAtomCount ( )
inline

Definition at line 55 of file GeometricShape.h.

References m_fTotalAtomCountinMPI.

Referenced by CTBMS_Solver::AllocateCSR(), and CSPLoop::AllocateCSR().

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

Here is the caller graph for this function:

double* CGeometricShape::GetUnitCellLength ( )
inline

Definition at line 77 of file GeometricShape.h.

Referenced by CSPLoop::executeSPLoop().

77 { return m_fUnitCellLength; };
double m_fUnitCellLength[3]

Here is the caller graph for this function:

void CGeometricShape::InitMapInfo ( LPNEIGHBOR_MAP_INFO  lpMapInfo)

Intilize map info data.

Parameters
lpMapInfoAtom map information

<Added by="" jhkang>="">

<Added by="" jhkang="" end>="">

Definition at line 1114 of file GeometricShape.cpp.

References NEIGHBOR_MAP_INFO::fItemCount, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pfAtomOnGrid, 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().

1115 {
1116  unsigned int i;
1117 
1118  lpMapInfo->pfID = NULL;
1119  lpMapInfo->pAtomType = NULL;
1120  lpMapInfo->pfX_Coordination = NULL;
1121  lpMapInfo->pfY_Coordination = NULL;
1122  lpMapInfo->pfZ_Coordination = NULL;
1123  lpMapInfo->fItemCount = 0;
1124 
1125  for (i = 0; i < MAX_NEIGHBOR; ++i)
1126  {
1127  lpMapInfo->pfNeighbor[i] = NULL;
1128  lpMapInfo->pbPeriodicCondition[i] = NULL;
1129  lpMapInfo->pNeighborMaterial[i] = NULL;
1130  }
1131 
1133  lpMapInfo->pfAtomOnGrid = NULL;
1135 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
Definition: AtomMapInfo.h:26
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
CGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
Definition: AtomMapInfo.h:18
#define MAX_NEIGHBOR
Definition: Global.h:91
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
Definition: AtomMapInfo.h:27
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
double * pfAtomOnGrid
="">
Definition: AtomMapInfo.h:29

Here is the caller graph for this function:

void CGeometricShape::InitShape ( )
private

Initialize Shape variable.

Definition at line 227 of file GeometricShape.cpp.

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

Referenced by CGeometricShape().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::IsBackendFace ( )
inline

Set front face side mark to shape object.

Definition at line 48 of file GeometricShape.h.

References m_bBackendFace.

48 { return m_bBackendFace; };
bool m_bBackendFace
Flag of back end face or not.
int CGeometricShape::IsCoordinateMatched ( double  fa,
double  fb 
)

Definition at line 1602 of file GeometricShape.cpp.

Referenced by MapElecAtomOnPoissonGrid().

1603 {
1604  double criteria = 0.001, criteria2 = criteria * criteria;
1605 
1606  if ((fa - fb)*(fa - fb) < criteria2)
1607  return (1);
1608  else return(0);
1609 }

Here is the caller graph for this function:

bool CGeometricShape::IsFrontFace ( )
inline

Definition at line 46 of file GeometricShape.h.

References m_bFrontFace.

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

<Added by="" jhkang="" end>="">

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 179 of file GeometricShape.cpp.

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

Referenced by ArrangeUnitCell().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::MapElecAtomOnPoissonGrid ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo 
)

Definition at line 1611 of file GeometricShape.cpp.

References _X, ATOM_DEFAULT_INDEX, CCommandFileParser::INPUT_CMD_PARAM::bSaveContactBiasVector, CCommandFileParser::INPUT_CMD_PARAM::bSaveWaveVector, NEIGHBOR_MAP_INFO::fItemCount, CGeometricCoordination::GetCoordination(), CMPIManager::GetCurrentRank(), CMPIManager::GetTotalNodeCount(), IGeometricUnitCellInfo::GetUnitcCellSize(), IsCoordinateMatched(), CMPIManager::IsRootRank(), m_fLength, m_originCoordination, m_pUnitCellInfo, NEIGHBOR_MAP_INFO::pfAtomOnGrid, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfX_Coordination, NEIGHBOR_MAP_INFO::pfY_Coordination, NEIGHBOR_MAP_INFO::pfZ_Coordination, CMPIManager::ReceiveDoubleBufferSync(), CMPIManager::SendDoubleBufferSync(), and CUtility::ShowMsg().

1612 {
1613  unsigned int i;
1614  int nCount = 0, nElecAtomID = 0, nParamSize = 4, nPoissonGridID = -1, nMatchedGrid = 0, nMatchedGridSum = 0;
1615  bool bMappingError = 0;
1616  double fParam[4], fPoissonGridID;
1617  double *fUnitcellLength;
1618  char szAtomFileName[1024];
1619  char szOutFileName[1024], szMsg[1024], szTemp[1024];
1620  FILE *atomIn = NULL, *out = NULL;
1621  char *token = NULL;
1622  char strSperate[] = " ";
1623  double tol = 1.0e-6;
1624 
1625  for (i = 0; i < lpMapInfo->fItemCount; i++)
1626  lpMapInfo->pfAtomOnGrid[i] = ATOM_DEFAULT_INDEX;
1627 
1628  sprintf(szAtomFileName, "./testset/reference1_zb_rhs_unscaled_at_iter1.dat");
1629 
1630 #ifdef DISABLE_MPI_ROUTINE
1631  out = fopen(szOutFileName, "wt");
1632 #else //DISABLE_MPI_ROUTINE
1633  MPI_Request req;
1634  double fTemp = 1.0;
1635  MPI_Status status;
1636 
1638  {
1639  atomIn = fopen(szAtomFileName, "rt");
1640  }
1641  else
1642  {
1644  atomIn = fopen(szAtomFileName, "rt");
1645  }
1646 #endif //DISABLE_MPI_ROUTINE
1647 
1648  fUnitcellLength = m_pUnitCellInfo->GetUnitcCellSize();
1649 
1650  while (fgets(szTemp, 1024, atomIn))
1651  {
1652  token = strtok(szTemp, strSperate);
1653 
1654  while (token)
1655  {
1656  fParam[nCount++] = atof(token);
1657  if (nParamSize == nCount)
1658  break;
1659  token = strtok(NULL, strSperate);
1660  }
1661 
1662  if ((fParam[0] > m_originCoordination.GetCoordination(_X) + tol) && (fParam[0] <= m_fLength[0] + m_originCoordination.GetCoordination(_X) + tol))
1663  {
1664  for (i = 0; i < lpMapInfo->fItemCount; i++)
1665  {
1666  if (IsCoordinateMatched(fParam[0], lpMapInfo->pfX_Coordination[i]))
1667  if (IsCoordinateMatched(fParam[1], lpMapInfo->pfY_Coordination[i]))
1668  if (IsCoordinateMatched(fParam[2], lpMapInfo->pfZ_Coordination[i]))
1669  {
1670  nPoissonGridID = i;
1671  nMatchedGrid++;
1672  }
1673  }
1674 
1675  if (nPoissonGridID >= 0 && nPoissonGridID < lpMapInfo->fItemCount)
1676  lpMapInfo->pfAtomOnGrid[nPoissonGridID] = nElecAtomID;
1677  else
1678  {
1679  printf("[Rank:%3d] Error: Elec grid cannot be mapped to Poisson grid, Elec grid = %d, Poisson grid = %d, ( %15.12f %15.12f %15.12f )\n", CMPIManager::GetCurrentRank(), nElecAtomID, nPoissonGridID, fParam[0], fParam[1], fParam[2]);
1680  bMappingError = 1;
1681  }
1682 
1683  nPoissonGridID = ATOM_DEFAULT_INDEX;
1684  }
1685  nElecAtomID++;
1686  nCount = 0;
1687  }
1688 
1689  fclose(atomIn);
1690 #ifndef DISABLE_MPI_ROUTINE
1693 
1694 #endif //DISABLE_MPI_ROUTINE
1695 
1696  if (bMappingError)
1697  exit(1);
1698  else
1699  {
1700  printf("[Rank:%3d] Number of elec atoms matched to Poisson grid = %5d \n", CMPIManager::GetCurrentRank(), nMatchedGrid);
1701 
1702  MPI_Reduce(&nMatchedGrid, &nMatchedGridSum, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
1704  printf("-Total number of elec atoms matched to Poisson grid = %5d \n", nMatchedGridSum);
1705  }
1706 
1707  // Dump zb to cb mapping result
1708  if (true == lpParam->bSaveWaveVector)
1709  {
1710  strcpy(szTemp, "PEGrid_ElecGrid_Map.dat");
1711 #ifdef _WIN32
1712  sprintf(szOutFileName, "result\\%s", szTemp);
1713 #else
1714  sprintf(szOutFileName, "result/%s", szTemp);
1715 #endif
1716 
1717 #ifdef DISABLE_MPI_ROUTINE
1718  out = fopen(szOutFileName, "wt");
1719 #else //DISABLE_MPI_ROUTINE
1720 
1722  {
1723  CUtility::ShowMsg("-Save wave vector info. to file.\n");
1724  out = fopen(szOutFileName, "wt");
1725  }
1726  else
1727  {
1729  out = fopen(szOutFileName, "at");
1730  }
1731 #endif //DISABLE_MPI_ROUTINE
1732  }
1733 
1734  if (true == lpParam->bSaveContactBiasVector && NULL != out)
1735  {
1736  for (unsigned int i = 0; i < lpMapInfo->fItemCount; i++)
1737  {
1738  sprintf(szMsg, "Grid ID = %10.0f, Elec. atom ID on Grid = %10.0f\n", lpMapInfo->pfID[i], lpMapInfo->pfAtomOnGrid[i]);
1739  fputs(szMsg, out);
1740  }
1741 
1742  fclose(out);
1743 #ifndef DISABLE_MPI_ROUTINE
1746 #endif //DISABLE_MPI_ROUTINE
1747  }
1748 
1749 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
double m_fLength[3]
Building Geometric part.
Definition: Global.h:113
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
static IGeometricUnitCellInfo * m_pUnitCellInfo
Unitcell information pointer for using in class internal.
bool bSaveWaveVector
Save wave vector or not.
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.
Definition: MPIManager.cpp:712
bool bSaveContactBiasVector
Save contact bias vector or not.
CGeometricCoordination m_originCoordination
Orign coordination of shape.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
int IsCoordinateMatched(double fa, double fb)
static int GetCurrentRank()
Definition: MPIManager.h:40
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
double * GetUnitcCellSize()
Get cation count in Unitcell.
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
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.
Definition: MPIManager.cpp:685
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static void ShowMsg(char *pszBuffer)
Show message.
Definition: Utility.cpp:34
double * pfAtomOnGrid
="">
Definition: AtomMapInfo.h:29

Here is the call graph for this function:

void CGeometricShape::PeriodicUnitCellNumbering ( bool  bXAxis = false)

Numbering to periodic unitcell.

Parameters
bXAxisDo operation to x axis or not

Definition at line 508 of file GeometricShape.cpp.

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

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::RefillPeriodicBinding ( CMatrixOperation::CCSR pResult,
CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LPNEIGHBOR_MAP_INFO  lpMapInfo,
unsigned int  nRepeatIndex,
double  fKValue[3],
unsigned int  nBandSize,
bool  bRecover 
)

Applying phase to Hamiltonian.

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

Definition at line 607 of file GeometricShape.cpp.

References CMatrixOperation::CCSR::AreaScalarMultiple(), ATOM_DEFAULT_INDEX, NEIGHBOR_MAP_INFO::fItemCount, GetAtomByIndex(), CGeometricCoordination::GetCoordination(), CGeometricAtom::GetCoordination(), CGeometricDirection::GetDirectionAll(), CComplex::GetImaginaryNumber(), GetKPhaseSign(), CGeometricAtom::GetNeighborCoordination(), CGeometricAtom::GetNeighborPeriodicDirection(), CComplex::GetRealNumber(), CGeometricAtom::IsPeriodicCoupling(), m_shapDirection, NEIGHBOR_MAP_INFO::pfID, NEIGHBOR_MAP_INFO::pfNeighbor, PI_VALUE, and CComplex::SetComplexNumber().

Referenced by CTBMS_Solver::Launching_TBMS_Solver(), and CSPLoop::SolveSchroedinger().

608 {
609  unsigned int i, j, k;
610  double *pDirection = m_shapDirection.GetDirectionAll();
611  double kTotal = 0;
612  CComplex calcuResult;
613  double fNeighborIndex[4];
614  bool bRtn = false;
615 
616  if( 0 == fKValue[0] && 0 == fKValue[1] && 0 == fKValue[2] )
617  {
618  bRtn = true;
619  return bRtn;
620  }
621 
622  for (i = 0; i < lpMapInfo->fItemCount; ++i)
623  {
624  int nMatrixIndex = 0;
625  double kkTotal = kTotal;
626  CGeometricAtom* pCurrentAtom = GetAtomByIndex(lpMapInfo->pfID[i]);
627 
628  for (j = 0; j < 4; ++j)
629  fNeighborIndex[j] = lpMapInfo->pfNeighbor[j][i];
630  //fNeighborIndex[0] = lpMapInfo->pfNeighbor_1[i]; fNeighborIndex[1] = lpMapInfo->pfNeighbor_2[i]; fNeighborIndex[2] = lpMapInfo->pfNeighbor_3[i]; fNeighborIndex[3] = lpMapInfo->pfNeighbor_4[i];
631 
632  /* if (CGeometricAtom::C == lpMapInfo->pAtomType[i])
633  nMatrixIndex = 4;*/
634 
635  for (j = 0; j < 4; j++)
636  {
637  double kTotal = 0;
638 
639  if (ATOM_DEFAULT_INDEX != fNeighborIndex[j] && true == pCurrentAtom->IsPeriodicCoupling(j))
640  {
641  CGeometricCoordination coupleCoordination = pCurrentAtom->GetNeighborCoordination(j);
642  int periodicDirection = pCurrentAtom->GetNeighborPeriodicDirection(j);
643 
644  if (coupleCoordination == pCurrentAtom->GetCoordination())
645  continue;
646 
647  for (k = 0; k < 3; k++)
648  {
649  int nPeriodic = periodicDirection & (int)pow((double)2, (int)k);
650 
651  if (0 != nPeriodic)
652  {
653  double fPhase = GetKPhaseSign(pCurrentAtom->GetCoordination().GetCoordination((AXIS_DEFINE)k),
654  coupleCoordination.GetCoordination((AXIS_DEFINE)k));
655  kTotal += (fPhase * fKValue[k] * PI_VALUE);
656  }
657  }
658  calcuResult.SetComplexNumber(cos(kTotal), sin(kTotal));
659 
660  if( bRecover )
661  {
662  double fReal = calcuResult.GetRealNumber(), fImaginary = calcuResult.GetImaginaryNumber();
663  double fTemp = fReal * fReal + fImaginary * fImaginary;
664 
665  calcuResult.SetComplexNumber(fReal / fTemp, -1 * (fImaginary/fTemp));
666  }
667 
668  pResult->AreaScalarMultiple(i * nBandSize, nBandSize, (unsigned int)fNeighborIndex[j] * nBandSize, nBandSize, calcuResult);
669  }
670  }
671  }
672 
673  bRtn = true;
674  return bRtn;
675 }
CGeometricAtom * GetAtomByIndex(double fID)
Get atom instance by ID.
bool AreaScalarMultiple(unsigned int nRowStart, unsigned int nRowCount, unsigned int nColumnStart, unsigned int nColumnCount, CComplex Scalar)
Scalar multiple operation to specific area.
CGeometricDirection m_shapDirection
CGeometricCoordination GetNeighborCoordination(int nIndex)
Get neighbor coordination.
Class for coordination.
double GetKPhaseSign(double fAtomPos, double fPeriodicAtomPos)
Calculating Phase sign.
double fItemCount
Item count at atom map.
Definition: AtomMapInfo.h:16
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
Class for Atom.
Definition: GeometricAtom.h:15
#define PI_VALUE
Pi definition.
Definition: Global.h:78
#define ATOM_DEFAULT_INDEX
Atom index default value that empty atom instance.
Definition: Global.h:52
void SetComplexNumber(double fReal, double fImaginaray)
Set Complex number using real part and imaginary part.
Definition: Complex.cpp:58
AXIS_DEFINE
Definition: Global.h:113
This class for complex operation and saving value.
Definition: Complex.h:16
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
double GetImaginaryNumber() const
Get imaginary part.
Definition: Complex.h:25
double * GetDirectionAll()
Get direction information all.
int GetNeighborPeriodicDirection(int nIndex)
Get neighbor coupling periodic direction if has coupling with periodic atom.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
CGeometricCoordination GetCoordination()
Definition: GeometricAtom.h:37
bool IsPeriodicCoupling(int nIndex)
Check is this periodic atom.
double GetRealNumber() const
Get real part.
Definition: Complex.h:24

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::RotateMatrix ( CMatrixOperation::CDMatrix pMatrixNbr,
CMatrixOperation::CDMatrix pMatrixResult,
double  fDegree[2] 
)
private

Rotate matrix with calculated degree.

Parameters
pMatrixNbrSource matrix
pMatrixResultRotated matrix
paramterGeometric parameters

Definition at line 729 of file GeometricShape.cpp.

References CMatrixOperation::CDMatrix::BuildMatrixFirst(), CMatrixOperation::MMMul(), PHI_DEGREE, CMatrixOperation::CDMatrix::SetElement(), THETA_DEGREE, and CMatrixOperation::CDMatrix::TrnasPos().

730 {
731  CMatrixOperation::CDMatrix matrixRotate;
732 
733  matrixRotate.BuildMatrixFirst(3, 3);
734 
735  matrixRotate.SetElement(0, 0, cos(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
736  matrixRotate.SetElement(0, 1, -sin(fDegree[THETA_DEGREE]), 0);
737  matrixRotate.SetElement(0, 2, -cos(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
738 
739  matrixRotate.SetElement(1, 0, sin(fDegree[THETA_DEGREE]) * cos(fDegree[PHI_DEGREE]), 0);
740  matrixRotate.SetElement(1, 1, cos(fDegree[THETA_DEGREE]), 0);
741  matrixRotate.SetElement(1, 2, -sin(fDegree[THETA_DEGREE])*sin(fDegree[PHI_DEGREE]), 0);
742 
743  matrixRotate.SetElement(2, 0, sin(fDegree[PHI_DEGREE]), 0);
744  matrixRotate.SetElement(2, 1, 0, 0);
745  matrixRotate.SetElement(2, 2, cos(fDegree[PHI_DEGREE]), 0);
746 
747  matrixRotate.TrnasPos();
748 
749  pMatrixNbr->TrnasPos();
750  CMatrixOperation::MMMul(&matrixRotate, pMatrixNbr, pMatrixResult);
751  pMatrixResult->TrnasPos();
752 }
bool TrnasPos()
Transpos matrix.
bool BuildMatrixFirst(unsigned int nRow, unsigned int nColumn)
Building matrix elements.
#define THETA_DEGREE
Definition: Global.h:83
static void MMMul(CDMatrix *pMatrix, CDMatrix *pMatrixOperand, CDMatrix *pResult)
Matrix and matrix multiple operation.
#define PHI_DEGREE
Definition: Global.h:84
bool SetElement(unsigned int nRow, unsigned int nColumn, CComplex element)
Set matrix elements value.
Data and operation representation of Matrix.

Here is the call graph for this function:

double * CGeometricShape::Serialize ( double  fXLayer)
private

Serialize unitcells with specific later index to double array.

Parameters
fXLayerTarget x layer index

Definition at line 1268 of file GeometricShape.cpp.

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

Referenced by ExchangeAtomInfoBetweenNode().

1269 {
1270  double *pBuffer = NULL;
1271  double fSendingCount = floor(m_fAssignedCount[_Y]) * floor(m_fAssignedCount[_Z]);
1272  int i, nSize = m_vectUnitCell.size();
1273  int fPos = 0;
1274  int nAtomCountInCell = CGeometricAtomFactory::GetAtomCountInUnitcell();
1275 
1276  pBuffer = (double*)malloc(sizeof(double)*(fSendingCount*nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE));
1277 
1278  for (i = (int)(fXLayer * floor(fSendingCount)); i < fXLayer * fSendingCount + floor(fSendingCount); ++i)
1279  {
1280 
1281  m_vectUnitCell[i].Serialize(pBuffer + fPos);
1282  fPos += nAtomCountInCell*UNITCELL_WRITING_BLOCK_SIZE;
1283  }
1284 
1285  return pBuffer;
1286 }
std::vector< CGeometricUnitCell > m_vectUnitCell
Array of unitcell in shape.
Definition: Global.h:113
double m_fAssignedCount[3]
Unitcell assigend count in shape for each direction.
#define UNITCELL_WRITING_BLOCK_SIZE
When serialize or deserialize how many data block converting.
Definition: Global.h:66
Definition: Global.h:113
static int GetAtomCountInUnitcell()

Here is the call graph for this function:

Here is the caller graph for this function:

bool CGeometricShape::SetAtomAndNeighborInformation ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam)
static

Set neighbor information to AtomFactory.

Parameters
lpParamInput parameters parsing from command file
Returns
Success or fail

Definition at line 952 of file GeometricShape.cpp.

References _X, _Y, _Z, CGeometricAtom::A, CGeometricAtom::A2C, CCommandFileParser::INPUT_CMD_PARAM::bNeedRotate, BuildRotationMatrix(), CGeometricAtom::C, CGeometricAtom::C2A, CalculateDegree(), CUBIC, CCommandFileParser::INPUT_CMD_PARAM::fDegree, CCommandFileParser::INPUT_CMD_PARAM::fUnitcellLength, IGeometricUnitCellInfo::GetA2CNeighborCount(), IGeometricUnitCellInfo::GetAnionCount(), IGeometricUnitCellInfo::GetAtomCoordination(), IGeometricUnitCellInfo::GetC2ANeighborCount(), IGeometricUnitCellInfo::GetCationCount(), CGeometricCoordination::GetCoordination(), IGeometricUnitCellInfo::GetNeighborCoordination(), IGeometricUnitCellInfo::GetUnitcCellSize(), CGeometricAtomFactory::InitAtomList(), IGeometricUnitCellInfo::InitCoordination(), CGeometricAtomFactory::InitNeighborList(), m_pUnitCellInfo, m_UnitCellInfo_cubic, m_UnitCellInfo_zincblende, CCommandFileParser::INPUT_CMD_PARAM::nDirectionSingle, IGeometricUnitCellInfo::RotateNeighbor(), IGeometricUnitCellInfo::SetAtomCoordination(), CGeometricAtomFactory::SetAtomCoordination(), CGeometricUnitCellInfo_zincblende::SetDireciton(), CGeometricUnitCell::SetLength(), IGeometricUnitCellInfo::SetNeighborCoordination(), CGeometricAtomFactory::SetNeighborCoordination(), CGeometricAtom::SetNeighborNumber(), IGeometricUnitCellInfo::SetUnitCellSize(), CCommandFileParser::INPUT_CMD_PARAM::szStructureType, and ZB.

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

953 {
954  unsigned int i;
955  CGeometricCoordination coordination;
956 
959 
960 
961  if (!strcmp(lpParam->szStructureType, CUBIC))
962  {
965  lpParam->bNeedRotate = false;
966  switch( lpParam->nDirectionSingle )
967  {
968  case 100:
969  lpParam->fUnitcellLength[0] /= 4;
970  lpParam->fUnitcellLength[1] /= 4;
971  lpParam->fUnitcellLength[2] /= 4;
972  break;
973  case 110:
974  break;
975  case 111:
976  break;
977  }
978  }
979  else if (!strcmp(lpParam->szStructureType, ZB))
980  {
981  lpParam->bNeedRotate = true;
985 
986  if (100 == lpParam->nDirectionSingle)
987  lpParam->bNeedRotate = false;
988  }
989 
990  if (NULL != m_pUnitCellInfo)
991  {
996 
997  if (lpParam->bNeedRotate)
998  {
999  CalculateDegree(lpParam);
1000  BuildRotationMatrix(lpParam->fDegree);
1002  }
1003  }
1004  else
1005  return false;
1006 
1007  for (i = 0; i < m_pUnitCellInfo->GetAnionCount(); ++i)
1008  {
1011  coordination.GetCoordination(_X),
1012  coordination.GetCoordination(_Y),
1013  coordination.GetCoordination(_Z));
1014  }
1015 
1016  for (i = 0; i < m_pUnitCellInfo->GetCationCount(); ++i)
1017  {
1020  coordination.GetCoordination(_X),
1021  coordination.GetCoordination(_Y),
1022  coordination.GetCoordination(_Z));
1023  }
1024 
1025  for (i = 0; i < (unsigned int)m_pUnitCellInfo->GetA2CNeighborCount(); ++i)
1026  {
1029  coordination.GetCoordination(_X),
1030  coordination.GetCoordination(_Y),
1031  coordination.GetCoordination(_Z));
1032 
1033  }
1034 
1035  for (i = 0; i < (unsigned int)m_pUnitCellInfo->GetC2ANeighborCount(); i++)
1036  {
1039  coordination.GetCoordination(_X),
1040  coordination.GetCoordination(_Y),
1041  coordination.GetCoordination(_Z));
1042  }
1043 
1045 
1046  return true;
1047 }
static CMatrixOperation::CDMatrix m_rotationMatrix
Rotation matrix for given direction.
static void CalculateDegree(CCommandFileParser::LPINPUT_CMD_PARAM lpParam)
Calculating degree from direction information.
virtual void SetAtomCoordination()=0
Atom coordination setting.
CGeometricCoordination GetAtomCoordination(CGeometricAtom::ATOM_TYPE atomType, unsigned int nIndex)
Get Unitcell size x, y, z direction axis.
static CGeometricUnitCellInfo_zincblende m_UnitCellInfo_zincblende
int GetC2ANeighborCount()
Get neigbhor relation count.
double fDegree[2]
Rotation degree, this variable isn't input by command file. It is calculated by module.
Definition: Global.h:113
virtual void SetUnitCellSize(double fUnitcellSize[3])=0
Unitcell size setting.
static IGeometricUnitCellInfo * m_pUnitCellInfo
Unitcell information pointer for using in class internal.
void SetDireciton(int nDirectionSingle)
Set direction information.
CGeometricCoordination GetNeighborCoordination(CGeometricAtom::NEIGHOR_RELATION neighborType, unsigned int nIndex)
Get neigbhor atom coordination from Unitcell.
virtual void SetNeighborCoordination()=0
Neighbor atom coordiantion setting.
Definition: Global.h:113
static void BuildRotationMatrix(double fDegree[2])
Build rotation matrix for given direction.
static void SetNeighborCoordination(CGeometricAtom::NEIGHOR_RELATION type, double x, double y, double z)
Setting neighbor coordination.
#define ZB
Definition: Global.h:86
unsigned int GetCationCount()
Get anion count in Unitcell.
Class for coordination.
static CGeometricUnitCellInfo_cubic m_UnitCellInfo_cubic
static void SetAtomCoordination(CGeometricAtom::ATOM_TYPE type, double x, double y, double z)
Setting atom coordination.
void RotateNeighbor(CMatrixOperation::CDMatrix *pRotationMatrix)
Rotating neighbor coordination.
static void SetLength(double fLength[3], double fOriginLength[3])
Set unit cell length.
int GetA2CNeighborCount()
Get neigbhor relation count.
double * GetUnitcCellSize()
Get cation count in Unitcell.
void InitCoordination()
Initial Coordination information.
double fUnitcellLength[3]
Unitcell length x, y, z direction.
Definition: Global.h:113
char szStructureType[1024]
Structure type.
bool bNeedRotate
Calculation parameter that need to apply rotation matrix.
double GetCoordination(AXIS_DEFINE coord)
Get coordination specific axis.
static void SetNeighborNumber(unsigned int nNeighborNumber)
Get periodic direction information.
Definition: GeometricAtom.h:54
#define CUBIC
Definition: Global.h:87

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::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 GeometricShape.h.

References m_bBackendFace.

Referenced by SetShapeInformation().

Here is the caller graph for this function:

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

Get bondary condition of shape.

Definition at line 43 of file GeometricShape.h.

References m_bConsiderBoundaryCondition.

Referenced by SetShapeInformation().

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

Here is the caller graph for this function:

void CGeometricShape::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 57 of file GeometricShape.cpp.

References m_shapDirection, and CGeometricDirection::SetDirection().

Referenced by SetShapeInformation().

58 {
59  m_shapDirection.SetDirection(x_axis, y_axis, z_axis);
60 }
CGeometricDirection m_shapDirection
void SetDirection(double *fDirection)
Set direciton information.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::SetFrontFace ( bool  bFrontFace)
inline

Check is this front face side in MPI running enviroment.

Definition at line 47 of file GeometricShape.h.

References m_bFrontFace.

Referenced by SetShapeInformation().

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

Here is the caller graph for this function:

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

Set length of shape.

Parameters
lxx direction length
lyy direction length
lzz direction length

Definition at line 67 of file GeometricShape.cpp.

References _X, _Y, _Z, and m_fLength.

Referenced by SetShapeInformation().

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

Here is the caller graph for this function:

bool CGeometricShape::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

<Added by="" jhkang>="">

<Added by="" jhkang="" end>="">

Definition at line 1053 of file GeometricShape.cpp.

References ALLOC_WITH_NULL_INIT, MAX_NEIGHBOR, NEIGHBOR_MAP_INFO::pAtomType, NEIGHBOR_MAP_INFO::pbPeriodicCondition, NEIGHBOR_MAP_INFO::pDomainMaterialNumber, NEIGHBOR_MAP_INFO::pfAtomOnGrid, 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::pnDomainNumber, and NEIGHBOR_MAP_INFO::pNeighborMaterial.

Referenced by ConstructMapInfo().

1054 {
1055  bool bRtn = false;
1056  unsigned int i;
1057 
1058  ALLOC_WITH_NULL_INIT(lpMapInfo->pfID, double, (size_t)fSize);
1059  ALLOC_WITH_NULL_INIT(lpMapInfo->pAtomType, CGeometricAtom::ATOM_TYPE, (size_t)fSize);
1060  ALLOC_WITH_NULL_INIT(lpMapInfo->pMaterialNumber, MATERIAL_INDEX, (size_t)fSize);
1061  ALLOC_WITH_NULL_INIT(lpMapInfo->pDomainMaterialNumber, MATERIAL_INDEX, (size_t)fSize);
1062  ALLOC_WITH_NULL_INIT(lpMapInfo->pnDomainNumber, unsigned int, (size_t)fSize);
1063  ALLOC_WITH_NULL_INIT(lpMapInfo->pfX_Coordination, double, (size_t)fSize);
1064  ALLOC_WITH_NULL_INIT(lpMapInfo->pfY_Coordination, double, (size_t)fSize);
1065  ALLOC_WITH_NULL_INIT(lpMapInfo->pfZ_Coordination, double, (size_t)fSize);
1066 
1067  for (i = 0; i < MAX_NEIGHBOR; ++i)
1068  {
1069  ALLOC_WITH_NULL_INIT(lpMapInfo->pfNeighbor[i], double, (size_t)fSize);
1070  ALLOC_WITH_NULL_INIT(lpMapInfo->pbPeriodicCondition[i], bool, (size_t)fSize);
1071  ALLOC_WITH_NULL_INIT(lpMapInfo->pNeighborMaterial[i], MATERIAL_INDEX, (size_t)fSize);
1072  }
1073 
1075  ALLOC_WITH_NULL_INIT(lpMapInfo->pfAtomOnGrid, double, (size_t)fSize);
1077 
1078 
1079  bRtn = true;
1080  return bRtn;
1081 }
double * pfZ_Coordination
An array of Z coordination.
Definition: AtomMapInfo.h:24
bool * pbPeriodicCondition[MAX_NEIGHBOR]
An array of Neighbor no 1 bondary condition.
Definition: AtomMapInfo.h:26
double * pfX_Coordination
An array of X coordination.
Definition: AtomMapInfo.h:22
#define ALLOC_WITH_NULL_INIT(pointer, data_type, data_size)
Definition: Global.h:34
CGeometricAtom::ATOM_TYPE * pAtomType
An array of atom type 0:A, 1:C.
Definition: AtomMapInfo.h:18
#define MAX_NEIGHBOR
Definition: Global.h:91
MATERIAL_INDEX * pNeighborMaterial[MAX_NEIGHBOR]
Definition: AtomMapInfo.h:27
unsigned int * pnDomainNumber
Definition: AtomMapInfo.h:21
double * pfY_Coordination
An array of Y coordination.
Definition: AtomMapInfo.h:23
double * pfNeighbor[MAX_NEIGHBOR]
An array of Neighbor no 1 index.
Definition: AtomMapInfo.h:25
MATERIAL_INDEX
Definition: Global.h:114
double * pfID
An array of atom ID.
Definition: AtomMapInfo.h:17
MATERIAL_INDEX * pMaterialNumber
An array of Atom number.
Definition: AtomMapInfo.h:19
double * pfAtomOnGrid
="">
Definition: AtomMapInfo.h:29
MATERIAL_INDEX * pDomainMaterialNumber
An array of Domain Atom number.
Definition: AtomMapInfo.h:20

Here is the caller graph for this function:

void CGeometricShape::SetMatchingUnitcellCount ( int  nCount)
inline

Definition at line 128 of file GeometricShape.h.

References m_nHandlingUnitcellCount.

Referenced by CSPLoop::ConstructionGeometric().

128 { m_nHandlingUnitcellCount = nCount; }

Here is the caller graph for this function:

void CGeometricShape::SetMaterialType ( MATERIAL_INDEX  type)
inline

Get maetrial typpe of shap.

Definition at line 37 of file GeometricShape.h.

References m_MaterialType.

Referenced by SetMaterialType(), and SetShapeInformation().

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

Here is the caller graph for this function:

void CGeometricShape::SetMaterialType ( char *  pszType)

Set maetrial type of shape.

Set maetrial type of shape

Parameters
pszTypeMaterial type information

Definition at line 77 of file GeometricShape.cpp.

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

78 {
79  if (!strcmp(pszType, "Si"))
81  else if (!strcmp(pszType, "GaAs"))
83  else if (!strcmp(pszType, "InAs"))
85 }
Definition: Global.h:114
void SetMaterialType(MATERIAL_INDEX type)
Get maetrial typpe of shap.
Definition: Global.h:114
Definition: Global.h:114

Here is the call graph for this function:

void CGeometricShape::SetNeumannBoundaryCondition ( bool  bConsider,
AXIS_DEFINE  direction 
)
inline

Get Neumann boundary condition of shape.

Definition at line 71 of file GeometricShape.h.

References m_bNeumannBoundaryCondition.

71 { m_bNeumannBoundaryCondition[direction] = bConsider; };
bool m_bNeumannBoundaryCondition[3]
void CGeometricShape::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 47 of file GeometricShape.cpp.

References m_originCoordination, and CGeometricCoordination::SetCoordination().

Referenced by SetShapeInformation().

48 {
50 }
CGeometricCoordination m_originCoordination
Orign coordination of shape.
void SetCoordination(CGeometricCoordination coordination)
Get coordination with double buffer.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::SetShapeForm ( unsigned int  form)
inline

Get form type of shape.

Definition at line 40 of file GeometricShape.h.

References m_ShapeForm.

Referenced by SetShapeForm(), and SetShapeInformation().

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

Here is the caller graph for this function:

void CGeometricShape::SetShapeForm ( char *  pszForm)

Get form type of shape.

Get form type of shape

Parameters
pszFormShape form

Definition at line 90 of file GeometricShape.cpp.

References BOX_SHAPE, CYLINDER_SHAPE, and SetShapeForm().

91 {
92  if (!strcmp(pszForm, "Box"))
94  else if (!strcmp(pszForm, "Cylinder"))
96 }
void SetShapeForm(unsigned int form)
Get form type of shape.
#define BOX_SHAPE
Definition: Global.h:93
#define CYLINDER_SHAPE
Definition: Global.h:94

Here is the call graph for this function:

void CGeometricShape::SetShapeInformation ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam)

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

Parameters
shapeGeometric Shape
lpParamInput parameters parsing from command file

Definition at line 926 of file GeometricShape.cpp.

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

Referenced by ConstructBasicGeometric(), and CTBMS_Solver::Launching_TBMS_Solver().

927 {
928 
929  SetDirection(1, 0, 0);
930  SetLength(lpParam->fShapeLength[0][_X], lpParam->fShapeLength[0][_Y], lpParam->fShapeLength[0][_Z]);
931  SetOriginCoordination(lpParam->fOrigin[0][_X], lpParam->fOrigin[0][_Y], lpParam->fOrigin[0][_Z]);
932  SetMaterialType(lpParam->szDomainMat[0]);
933  SetShapeForm(lpParam->szShape[0]);
937 #ifdef DISABLE_MPI_ROUTINE
938  SetFrontFace(true);
939  SetBackendFace(true);
940 #else //DISABLE_MPI_ROUTINE
942  SetFrontFace(true);
944  SetBackendFace(true);
945 #endif //DISABLE_MPI_ROUTINE
946 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
char szShape[NMAXDOMAIN][1024]
Geometric Shape.
double fOrigin[NMAXDOMAIN][3]
Coordinator original coordinate.
Definition: Global.h:113
void SetShapeForm(unsigned int form)
Get form type of shape.
void SetBackendFace(bool bBackendFace)
Check is this back end face side in MPI running enviroment.
void SetConsideringBoundaryCondition(bool bConsider, AXIS_DEFINE direction)
Get bondary condition of shape.
double fShapeLength[NMAXDOMAIN][3]
Shap length x, y, z, direction.
bool bConsiderBoundaryCondition[3]
Considering bondary condition or not x, y, z direction.
Definition: Global.h:113
void SetOriginCoordination(double x, double y, double z)
Building Geometric part.
static int GetTotalNodeCount()
Definition: MPIManager.h:42
void SetLength(double lx, double ly, double lz)
Set length of shape.
static int GetCurrentRank()
Definition: MPIManager.h:40
Definition: Global.h:113
void SetFrontFace(bool bFrontFace)
Check is this front face side in MPI running enviroment.
void SetMaterialType(MATERIAL_INDEX type)
Get maetrial typpe of shap.
char szDomainMat[NMAXDOMAIN][1024]
Material type.
void SetDirection(double x_axis, double y_axis, double z_axis)
Set direciton of shape.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::SetTotalAtomCount ( double  fTotalAtomCountinMPI)
inline

Get total valid atom count in shape.

Definition at line 56 of file GeometricShape.h.

References m_fTotalAtomCountinMPI.

56 { m_fTotalAtomCountinMPI = fTotalAtomCountinMPI;};
double m_fTotalAtomCountinMPI
Total valid atom count in shape.
void CGeometricShape::SetupPEBoundaryCondition ( CCommandFileParser::LPINPUT_CMD_PARAM  lpParam,
LP_CONTACT_GROUP_INFO lpContactGroup 
)

<Added by="" jhkang>="">

<Added by jhkang, Poisson equation hamiltonian construct>

Definition at line 1403 of file GeometricShape.cpp.

References _X, _Y, _Z, CCommandFileParser::INPUT_CMD_PARAM::bConsiderNeumannBoundaryCondition, BOX_SHAPE, CYLINDER_SHAPE, CMPIManager::IsRootRank(), m_bConsiderBoundaryCondition, m_bNeumannBoundaryCondition, m_ShapeForm, and CCommandFileParser::INPUT_CMD_PARAM::nContactNumber.

Referenced by CSPLoop::ConstructionGeometric().

1404 {
1405  unsigned int i;
1406  bool bErrorCheck = 0;
1407 
1411 
1413  {
1415  {
1416  printf("-Error: Applying neumann BC to all directions makes A matrix singular! Program terminated!\n");
1417  exit(1);
1418  }
1419  }
1420 
1422  {
1424  {
1425  printf("-Error: Applying periodic BC to all directions makes A matrix singular! Program terminated!\n");
1426  exit(1);
1427  }
1428  }
1429 
1433  {
1435  {
1436  printf("-Error: Applying neumann BC with periodic BC to same direction is not allowed! Program terminated!\n");
1437  exit(1);
1438  }
1439  }
1440 
1441  if (lpContactGroup == NULL && CMPIManager::IsRootRank())
1442  {
1443  printf("-No contact boundary condition \n");
1444  }
1445  else
1446  {
1447  for (i = 0; i < lpParam->nContactNumber; i++)
1448  {
1449  if ((lpContactGroup[i]->nContactDirection == 0 || lpContactGroup[i]->nContactDirection == 1) && m_bConsiderBoundaryCondition[0])
1450  {
1451  printf("-Error: Applying periodic BC with contact group[%3d] boundary in same x-direction is not allowed. Program terminated!\n", i + 1);
1452  bErrorCheck = 1;
1453  }
1454  if (m_ShapeForm == BOX_SHAPE)
1455  {
1456  if ((lpContactGroup[i]->nContactDirection == 2 || lpContactGroup[i]->nContactDirection == 3) && m_bConsiderBoundaryCondition[1])
1457  {
1458  printf("-Error: Applying periodic BC with contact group[%3d] boundary in same y-direction is not allowed. Program terminated!\n", i + 1);
1459  bErrorCheck = 1;
1460  }
1461  if ((lpContactGroup[i]->nContactDirection == 4 || lpContactGroup[i]->nContactDirection == 5) && m_bConsiderBoundaryCondition[2])
1462  {
1463  printf("-Error: Applying periodic BC with contact group[%3d] boundary in same z-direction is not allowed. Program terminated!\n", i + 1);
1464  bErrorCheck = 1;
1465  }
1466  }
1467  if (m_ShapeForm == CYLINDER_SHAPE)
1468  {
1469  if (lpContactGroup[i]->nContactDirection == 6 && (m_bConsiderBoundaryCondition[1] == 1 || m_bConsiderBoundaryCondition[2] == 1))
1470  {
1471  printf("-Error: Applying periodic BC in cylinder shape with contact group[%3d] boundary is not allowed. Program terminated!\n", i + 1);
1472  bErrorCheck = 1;
1473  }
1474  }
1475  }
1476  if (bErrorCheck) exit(1);
1477  }
1478 }
static bool IsRootRank()
Get Total node count.
Definition: MPIManager.cpp:182
bool m_bConsiderBoundaryCondition[3]
Bondary condition for each driection.
bool m_bNeumannBoundaryCondition[3]
Definition: Global.h:113
Definition: Global.h:113
#define BOX_SHAPE
Definition: Global.h:93
Definition: Global.h:113
unsigned int m_ShapeForm
Shape form.
#define CYLINDER_SHAPE
Definition: Global.h:94
bool bConsiderNeumannBoundaryCondition[3]
Neumann bc in xyz direction.

Here is the call graph for this function:

Here is the caller graph for this function:

void CGeometricShape::ShiftAtomID ( double  fShift)

Shift atom id in MPI running enviroment.

Parameters
fShiftIncreasing count of ID

Definition at line 1140 of file GeometricShape.cpp.

References m_vectUnitCell.

Referenced by ExchangeAtomInfoBetweenNode().

1141 {
1142  int i, nSize = m_vectUnitCell.size();
1143 
1144  for (i = 0; i < nSize; ++i)
1145  m_vectUnitCell[i].ShiftAtomID(fShift);
1146 }
std::vector< CGeometricUnitCell > 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 CGeometricShape::m_bBackendFace
private
bool CGeometricShape::m_bFrontFace
private
bool CGeometricShape::m_bNeumannBoundaryCondition[3]
private

Neumann bondary condition for each driection

Definition at line 100 of file GeometricShape.h.

Referenced by GetNeumannBoundaryCondition(), SetNeumannBoundaryCondition(), and SetupPEBoundaryCondition().

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

Start atom index in current Shape.

Definition at line 89 of file GeometricShape.h.

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

double CGeometricShape::m_fLength[3]
private

Building Geometric part.

Length of shape

Definition at line 77 of file GeometricShape.h.

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

double CGeometricShape::m_fTotalAtomCountinMPI
private

Total valid atom count in shape.

Definition at line 88 of file GeometricShape.h.

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

double CGeometricShape::m_fUnitCellLength[3]
private

Definition at line 134 of file GeometricShape.h.

Referenced by CalculateUnitcellCount(), and InitShape().

MATERIAL_INDEX CGeometricShape::m_MaterialType
private

Material type of shape.

Definition at line 90 of file GeometricShape.h.

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

unsigned int CGeometricShape::m_nAtomFirstLayer

<Added by="" jhkang="" end>="">

Set Neumann boundary condition of shapeBuilding Hamiltonian part First layer information for sending to previous node

Definition at line 71 of file GeometricShape.h.

Referenced by ArrangeUnitCell(), CSPLoop::BuildHamiltonian(), InitShape(), and CTBMS_Solver::Launching_TBMS_Solver().

unsigned int CGeometricShape::m_nAtomLastLayer

Last layer information for sending to next node.

Definition at line 76 of file GeometricShape.h.

Referenced by ArrangeUnitCell(), CSPLoop::BuildHamiltonian(), InitShape(), and CTBMS_Solver::Launching_TBMS_Solver().

int CGeometricShape::m_nContactNumber
private

<Added by="" jhkang>="">

Definition at line 98 of file GeometricShape.h.

Referenced by BuildPEBiasVector(), and ConstructContactRegionOnPoissonGrid().

int CGeometricShape::m_nHandlingUnitcellCount
private

Definition at line 133 of file GeometricShape.h.

Referenced by CalculateUnitcellCount(), InitShape(), and SetMatchingUnitcellCount().

CGeometricCoordination CGeometricShape::m_originCoordination
private
IGeometricUnitCellInfo * CGeometricShape::m_pUnitCellInfo
static

Unitcell information pointer for using in class internal.

Definition at line 126 of file GeometricShape.h.

Referenced by InitShape(), MapElecAtomOnPoissonGrid(), and SetAtomAndNeighborInformation().

CMatrixOperation::CDMatrix CGeometricShape::m_rotationMatrix
static

Rotation matrix for given direction.

Definition at line 127 of file GeometricShape.h.

Referenced by CHamiltonianBuilder::BuildACCANeighborFor10Band(), BuildRotationMatrix(), and CHamiltonianBuilder::RotateTransMatrixFor10Band().

CGeometricDirection CGeometricShape::m_shapDirection
private

Direction of shape

Definition at line 96 of file GeometricShape.h.

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

unsigned int CGeometricShape::m_ShapeForm
private
CGeometricUnitCellInfo_cubic CGeometricShape::m_UnitCellInfo_cubic
static

Definition at line 125 of file GeometricShape.h.

Referenced by SetAtomAndNeighborInformation().

CGeometricUnitCellInfo_zincblende CGeometricShape::m_UnitCellInfo_zincblende
static

Definition at line 124 of file GeometricShape.h.

Referenced by SetAtomAndNeighborInformation().

std::vector<CGeometricUnitCell> CGeometricShape::m_vectNextUnitCell
private

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

Definition at line 93 of file GeometricShape.h.

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

std::vector<CGeometricUnitCell> CGeometricShape::m_vectPrevUnitCell
private

Front edge unit cell that copy from previous side node.

Definition at line 92 of file GeometricShape.h.

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

std::vector<CGeometricAtom*> CGeometricShape::m_vectSurfaceAtom
private

Definition at line 94 of file GeometricShape.h.

Referenced by FreeUnitCellList(), and GetSurfaceAtomList().

std::vector<double> CGeometricShape::m_waveFunctionValue
private

Definition at line 99 of file GeometricShape.h.

Referenced by BuildPEWaveVector().


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