本文整理汇总了C++中UnitCell::alpha方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitCell::alpha方法的具体用法?C++ UnitCell::alpha怎么用?C++ UnitCell::alpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitCell
的用法示例。
在下文中一共展示了UnitCell::alpha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getConstrainedUnitCell
/** Returns a new UnitCell-object with crystal system constraints taken into
* account
*
* This method constructs a new UnitCell-object based on the values of the
* supplied cell,
* but takes into account the constraints of the crystal system. For
* monoclinic, a unique b-axis is assumed.
*
* It's useful for "cleaning" user input.
*
* @param unitCell :: UnitCell-object which should be constrained
* @param crystalSystem :: Crystal system which is used for constraints
* @return UnitCell-object with applied constraints
*/
UnitCell PoldiCreatePeaksFromCell::getConstrainedUnitCell(
const UnitCell &unitCell, const PointGroup::CrystalSystem &crystalSystem,
const Group::CoordinateSystem &coordinateSystem) const {
switch (crystalSystem) {
case PointGroup::CrystalSystem::Cubic:
return UnitCell(unitCell.a(), unitCell.a(), unitCell.a());
case PointGroup::CrystalSystem::Tetragonal:
return UnitCell(unitCell.a(), unitCell.a(), unitCell.c());
case PointGroup::CrystalSystem::Orthorhombic:
return UnitCell(unitCell.a(), unitCell.b(), unitCell.c());
case PointGroup::CrystalSystem::Monoclinic:
return UnitCell(unitCell.a(), unitCell.b(), unitCell.c(), 90.0,
unitCell.beta(), 90.0);
case PointGroup::CrystalSystem::Trigonal:
if (coordinateSystem == Group::Orthogonal) {
return UnitCell(unitCell.a(), unitCell.a(), unitCell.a(),
unitCell.alpha(), unitCell.alpha(), unitCell.alpha());
}
// fall through to hexagonal.
case PointGroup::CrystalSystem::Hexagonal:
return UnitCell(unitCell.a(), unitCell.a(), unitCell.c(), 90.0, 90.0,
120.0);
default:
return UnitCell(unitCell);
}
}
示例2:
TEST(UnitCellTest, cellParameters)
{
Real a = static_cast<Real>(2.0);
Real b = static_cast<Real>(3.0);
Real c = static_cast<Real>(4.0);
Real alpha = static_cast<Real>(70 * DEG_TO_RAD);
Real beta = static_cast<Real>(120 * DEG_TO_RAD);
Real gamma = static_cast<Real>(85 * DEG_TO_RAD);
UnitCell unitCell;
unitCell.setCellParameters(a, b, c, alpha, beta, gamma);
EXPECT_FLOAT_EQ(static_cast<float>(a), static_cast<float>(unitCell.a()));
EXPECT_FLOAT_EQ(static_cast<float>(b), static_cast<float>(unitCell.b()));
EXPECT_FLOAT_EQ(static_cast<float>(c), static_cast<float>(unitCell.c()));
EXPECT_FLOAT_EQ(static_cast<float>(alpha),
static_cast<float>(unitCell.alpha()));
EXPECT_FLOAT_EQ(static_cast<float>(beta),
static_cast<float>(unitCell.beta()));
EXPECT_FLOAT_EQ(static_cast<float>(gamma),
static_cast<float>(unitCell.gamma()));
}