37 theSpaceGroup(spacegroup)
48 cosa = std::cos(alpha), cosb = std::cos(beta), cosg = std::cos(gamma);
49 sina = std::sin(alpha), sinb = std::sin(beta), sing = std::sin(gamma);
51 cosar = (cosb * cosg - cosa) / (sinb * sing);
52 cosbr = (cosa * cosg - cosb) / (sina * sing);
53 cosgr = (cosa * cosb - cosg) / (sina * sinb);
56 theRecVolume = 1. / theVolume;
58 theRecSize[0] = sizeB * sizeC * sina / theVolume;
59 theRecSize[1] = sizeC * sizeA * sinb / theVolume;
60 theRecSize[2] = sizeA * sizeB * sing / theVolume;
81 x3 = cosa, y3 = (cosb - cosa * cosg) / sing, z3 = std::sqrt(1. - x3 * x3 - y3 * y3);
91 x3 = cosa, y3 = (cosb - cosa * cosg) / sing, z3 = std::sqrt(1. - x3 * x3 - y3 * y3);
101 for (
auto i : {0, 1, 2}) {
111 if (aGroup >= 1 && aGroup <= 2) {
114 if (aGroup >= 3 && aGroup <= 15) {
117 if (aGroup >= 16 && aGroup <= 74) {
120 if (aGroup >= 75 && aGroup <= 142) {
123 if (aGroup == 146 || aGroup == 148 || aGroup == 155 || aGroup == 160 || aGroup == 161 ||
124 aGroup == 166 || aGroup == 167)
128 if (aGroup >= 143 && aGroup <= 167) {
131 if (aGroup >= 168 && aGroup <= 194) {
134 if (aGroup >= 195 && aGroup <= 230) {
175 G4double x3 = cosa, y3 = (cosb - cosa * cosg) / sing, z3 = std::sqrt(1. - x3 * x3 - y3 * y3);
185 vecout.push_back(aaa);
186 vecout.emplace_back(2., 5., 3.);
195 for (
auto& vec : vecout) {
196 vec.setX(vec.x() *
theSize[0]);
197 vec.setY(vec.y() *
theSize[1]);
198 vec.setZ(vec.z() *
theSize[2]);
209 return FillAmorphous(Cij);
212 return FillCubic(Cij);
215 return FillTetragonal(Cij);
218 return FillOrthorhombic(Cij);
221 return FillRhombohedral(Cij);
224 return FillMonoclinic(Cij);
227 return FillTriclinic(Cij);
230 return FillHexagonal(Cij);
243 Cij[3][3] = 0.5 * (Cij[0][0] - Cij[0][1]);
251 G4double C11 = Cij[0][0], C12 = Cij[0][1], C44 = Cij[3][3];
253 for (
size_t i = 0; i < 6; i++) {
254 for (
size_t j = i; j < 6; j++) {
255 if (i < 3 && j < 3) {
256 Cij[i][j] = (i == j) ? C11 : C12;
258 else if (i == j && i >= 3) {
267 ReflectElReduced(Cij);
269 return (C11 != 0. && C12 != 0. && C44 != 0.);
276 G4double C11 = Cij[0][0], C12 = Cij[0][1], C13 = Cij[0][2], C16 = Cij[0][5];
277 G4double C33 = Cij[2][2], C44 = Cij[3][3], C66 = Cij[5][5];
284 ReflectElReduced(Cij);
287 return (C11 != 0. && C12 != 0. && C13 != 0. && C33 != 0. && C44 != 0. && C66 != 0.);
292G4bool G4CrystalUnitCell::FillOrthorhombic(
G4double Cij[6][6])
const
295 ReflectElReduced(Cij);
298 for (
size_t i = 0; i < 6; i++) {
299 for (
size_t j = i + 1; j < 3; j++) {
300 good &= (Cij[i][j] != 0);
309G4bool G4CrystalUnitCell::FillRhombohedral(
G4double Cij[6][6])
const
311 G4double C11 = Cij[0][0], C12 = Cij[0][1], C13 = Cij[0][2], C14 = Cij[0][3];
312 G4double C15 = Cij[0][4], C33 = Cij[2][2], C44 = Cij[3][3], C66 = 0.5 * (C11 - C12);
323 return (C11 != 0 && C12 != 0 && C13 != 0 && C14 != 0. && C33 != 0. && C44 != 0. && C66 != 0.);
333 return (FillOrthorhombic(Cij) && Cij[0][5] != 0. && Cij[1][5] != 0. && Cij[2][5] != 0. &&
343 ReflectElReduced(Cij);
346 for (
size_t i = 0; i < 6; i++) {
347 for (
size_t j = i; j < 6; j++) {
348 good &= (Cij[i][j] != 0);
360 Cij[4][5] = 0.5 * (Cij[0][0] - Cij[0][1]);
366G4bool G4CrystalUnitCell::ReflectElReduced(
G4double Cij[6][6])
const
368 for (
size_t i = 1; i < 6; i++) {
369 for (
size_t j = i + 1; j < 6; j++) {
370 Cij[j][i] = Cij[i][j];
396 return a * a * a * std::sqrt(1. - 3. * cosa * cosa + 2. * cosa * cosa * cosa);
399 return a * b * c * sinb;
403 std::sqrt(1. - cosa * cosa - cosb * cosb - cosg * cosg * 2. * cosa * cosb * cosg);
406 return std::sqrt(3.0) / 2. * a * a * c;
437 G4double a2 = a * a, b2 = b * b, c2 = c * c;
438 G4double h2 = h * h, k2 = k * k, l2 = l * l;
448 return a2 / (h2 + k2 + l2);
451 return 1.0 / ((h2 + k2) / a2 + l2 / c2);
454 return 1.0 / (h2 / a2 + k2 / b2 + l2 / c2);
459 T = h2 + k2 + l2 + 2. * (h * k + k * l + h * l) * ((cos2a - cosa) / sin2a);
460 R = sin2a / (1. - 3 * cos2a + 2. * cos2a * cosa);
461 return a * a / (T * R);
465 return 1. / (1. / sin2b * (h2 / a2 + l2 / c2 - 2 * h * l * cosb / (a * c)) + k2 / b2);
471 return 1. / ((4. * (h2 + k2 + h * k) / (3. * a2)) + l2 / c2);
502 G4double a2 = a * a, b2 = b * b, c2 = c * c;
503 G4double h2 = h * h, k2 = k * k, l2 = l * l;
510 return a2 * (h2 + k2 + l2);
513 return (h2 + k2) * a2 + l2 * c2;
516 return h2 * a2 + k2 + b2 + h2 * c2;
519 return (h2 + k2 + l2 + 2. * (h * k + k * l + h * l) * cosar) * a2;
522 return h2 * a2 + k2 * b2 + l2 * c2 + 2. * h * l * a * c * cosbr;
525 return h2 * a2 + k2 * b2 + l2 * c2 + 2. * k * l * b * c * cosar + 2. * l * h * c * a * cosbr +
526 2. * h * k * a * b * cosgr;
529 return (h2 + k2 + h * k) * a2 + l2 * c2;
558 G4double a2 = a * a, b2 = b * b, c2 = c * c;
565 return (h1 * h2 + k1 * k2 + l1 + l2) /
566 (std::sqrt(h1 * h1 + k1 * k1 + l1 * l1) * std::sqrt(h2 * h2 + k2 * k2 + l2 * l2));
574 return dsp1dsp2 * (h1 * h2 * a2 + k1 * k2 * a2 + l1 * l2 * c2);
579 (h1 * h2 * a2 + k1 * k2 * b2 + l1 * l2 * c2 + (k1 * l2 + k2 * l1) * b * c * cosar +
580 (h1 * l2 + h2 * l1) * a * c * cosbr + (h1 * k2 + h2 * k1) * a * b * cosgr);
585 (h1 * h2 * a2 + k1 * k2 * b2 + l1 * l2 * c2 + (k1 * l2 + k2 * l1) * b * c * cosar +
586 (h1 * l2 + h2 * l1) * a * c * cosbr + (h1 * k2 + h2 * k1) * a * b * cosgr);
591 (h1 * h2 * a2 + k1 * k2 * b2 + l1 * l2 * c2 + (k1 * l2 + k2 * l1) * b * c * cosar +
592 (h1 * l2 + h2 * l1) * a * c * cosbr + (h1 * k2 + h2 * k1) * a * b * cosgr);
596 return dsp1dsp2 * ((h1 * h2 + k1 * k2 + 0.5 * (h1 * k2 + k1 * h2)) * a2 + l1 * l2 * c2);
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector & rotateX(double)
Hep3Vector & rotateZ(double)
G4ThreeVector theBasis[3]
const G4ThreeVector & GetRecUnitBasis(G4int idx) const
G4ThreeVector GetUnitBasisTrigonal()
const G4ThreeVector & GetRecBasis(G4int idx) const
G4double GetIntSp2(G4int h, G4int k, G4int l)
G4bool FillElReduced(G4double Cij[6][6])
G4CrystalUnitCell(G4double sizeA, G4double sizeB, G4double sizeC, G4double alpha, G4double beta, G4double gamma, G4int spacegroup)
G4bool FillAtomicPos(G4ThreeVector &pos, std::vector< G4ThreeVector > &vecout)
const G4ThreeVector & GetUnitBasis(G4int idx) const
G4ThreeVector theRecUnitBasis[3]
G4double GetRecIntSp2(G4int h, G4int k, G4int l)
G4ThreeVector theRecBasis[3]
G4bool FillAtomicUnitPos(G4ThreeVector &pos, std::vector< G4ThreeVector > &vecout)
G4ThreeVector theUnitBasis[3]
G4double ComputeCellVolume()
G4ThreeVector theRecAngle
theLatticeSystemType GetLatticeSystem()
const G4ThreeVector & GetBasis(G4int idx) const
G4double GetIntCosAng(G4int h1, G4int k1, G4int l1, G4int h2, G4int k2, G4int l2)
DLL_API const Hep3Vector HepZHat
DLL_API const Hep3Vector HepXHat
DLL_API const Hep3Vector HepYHat