Crystal(API)
From EosPedia
General/Crystal is API for Crystal Structure.
Contents
constant
Crystal Structure
Use as value of CrystalInfo->SpaceGroup.
typedef enum CrystalSpaceGroup {
CrystalSpaceGroupP1=0,
CrystalSpaceGroupHelical=1
} CrystalSpaceGroup;
#ifdef __CRYSTALINIT__
char* CrystalSpaceGroupString[] = {
"P1",
"HelicalSymmmetry",
NULL
};
#else
extern char* CrystalSpaceGroupString[];
#endif
struct
typedef float CrystalParaTypeReal; typedef int CrystalParaTypeInteger;
typedef struct CrystalParaTypeRealCoord {
CrystalParaTypeReal x;
CrystalParaTypeReal y;
CrystalParaTypeReal z;
} CrystalParaTypeRealCoord;
typedef struct CrystalParaTypeIntegerCoord {
CrystalParaTypeInteger x;
CrystalParaTypeInteger y;
CrystalParaTypeInteger z;
} CrystalParaTypeIntegerCoord;
typedef struct CrystalParaTypeRealAxis {
CrystalParaTypeReal a;
CrystalParaTypeReal b;
CrystalParaTypeReal c;
} CrystalParaTypeRealAxis;
typedef struct CrystalParaTypeIntegerAxis {
CrystalParaTypeInteger a;
CrystalParaTypeInteger b;
CrystalParaTypeInteger c;
} CrystalParaTypeIntegerAxis;
typedef struct HelicalSymmetryInfo {
CrystalParaTypeInteger t; /* Turn */
CrystalParaTypeInteger u; /* Unit */
CrystalParaTypeInteger n; /* n-strands */
/*
Don't change the below variables directly,
bacause the variables can be calculated by the upper's.
*/
CrystalParaTypeReal dz; /* dz = TruePitch/unit */
CrystalParaTypeReal dphi; /* dphi = 2*PI*turn/unit */
} HelicalSymmetryInfo;
typedef struct CrystalInfo {
CrystalParaTypeRealCoord aAxis; /* Unit Cell Vector : a-axis : Length = 1 */
CrystalParaTypeRealCoord bAxis; /* Unit Cell Vector : b-axis : Length = 1 */
CrystalParaTypeRealCoord cAxis; /* Unit Cell Vector : c-axis : Length = 1 */
CrystalParaTypeRealAxis CellLength; /* Unit Cell Size a, b, c-axis [A] */
CrystalParaTypeRealCoord Origin; /* Unit Cell Origin [A] */
CrystalParaTypeIntegerAxis N; /* Number of Unit Cells a, b, c-axis */
CrystalParaTypeIntegerAxis StartN; /* Start of Unit Cells a, b, c-axis */
CrystalSpaceGroup SpaceGroup;
/* Information for Special Symmetry */
HelicalSymmetryInfo HelixInfo;
/* For HelicalSymmetry :
The filament axis (z-axis) is treated as the c-axis.
The azimuthal axis (phi-axis) is treated as the b-axis.
The radius axis (r-axis) is treated as the a-axis.
*/
} CrystalInfo;
API
Initialize
Initialize crystal.
extern void crystalInit(CrystalInfo* crystal);
File Read
Read data in file fpt, and store to linfo.
extern void crystalInfoRead(FILE* fpt, CrystalInfo* linfo, int mode);
File Write
Write data of linfo to file fpt.
extern void crystalInfoWrite(FILE* fpt, CrystalInfo* linfo, int mode);
Set length of axis
Set the length of specified axis in C.
In addition, recalculate its coordinates by using crystalAxisSetUsingCellLength.
extern void crystalCellLengthSet(CrystalInfo* C, char axis, CrystalParaTypeReal length, int mode);
Calculate coordinates of specified axis, and store to C->pAxis.x(p=a, b, c).
extern void crystalAxisSetUsingCellLength(CrystalInfo* C, char axis, int mode);
Set coordinates of axis
Set the coordinates of specified axis in C.
In addition, recalculate its length by using crystalCellLengthSetUsingAxis.
extern void crystalAxisSet(CrystalInfo* C, char axis, CrystalParaTypeReal x, CrystalParaTypeReal y, CrystalParaTypeReal z, int mode);
Calculate length of specified axis, and store to C->CellLength.p(p=a, b, c).
extern void crystalCellLengthSetUsingAxis(CrystalInfo* C, char axis, int mode);
APIInformation
Help
extern void crystalInfoFileFormat(FILE* fpt, int mode);
Output useable crystal structure to fpt.(List: CrystalSpaceGroupString)
extern void crystalSpaceGroupPrint(FILE* fpt, int mode);