本文整理汇总了C++中UnitCell::matmult3x3方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitCell::matmult3x3方法的具体用法?C++ UnitCell::matmult3x3怎么用?C++ UnitCell::matmult3x3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitCell
的用法示例。
在下文中一共展示了UnitCell::matmult3x3方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
UnitCell cell;
cout << " orthorhombic cell: " << endl;
cell.set(D3vector(4.,0.,0.),D3vector(0.,5.,0.),D3vector(0.,0.,7.));
cout << cell << endl;
D3vector v;
const int n = 100000;
const double d = 10.0;
int count;
count = 0;
for ( int i = 0; i < n; i++ )
{
// generate a random vector in a box of size d x d x d
double x0 = drand48() - 0.5;
double x1 = drand48() - 0.5;
double x2 = drand48() - 0.5;
v = d * D3vector(x0,x1,x2);
if ( cell.in_ws(v) )
count++;
cell.fold_in_ws(v);
if ( !cell.in_ws(v) )
cout << v << endl;
}
cout << " volume ratio: " << cell.volume() / (d*d*d)
<< " computed: " << count/((double) n) << endl << endl;;
cout << " FCC cell: " << endl;
cell.set(D3vector(4,4,0),D3vector(0,4,4),D3vector(4,0,4));
cout << cell << endl;
count = 0;
for ( int i = 0; i < n; i++ )
{
// generate a random vector in a box of size d x d x d
double x0 = drand48() - 0.5;
double x1 = drand48() - 0.5;
double x2 = drand48() - 0.5;
v = d * D3vector(x0,x1,x2);
if ( cell.in_ws(v) )
count++;
cell.fold_in_ws(v);
if ( !cell.in_ws(v) )
cout << v << endl;
}
cout << " volume ratio: " << cell.volume() / (d*d*d)
<< " computed: " << count/((double) n) << endl << endl;;
cout << " BCC cell: " << endl;
cell.set(D3vector(4,4,-4),D3vector(-4, 4,4),D3vector(4,-4,4));
cout << cell << endl;
count = 0;
for ( int i = 0; i < n; i++ )
{
// generate a random vector in a box of size d x d x d
double x0 = drand48() - 0.5;
double x1 = drand48() - 0.5;
double x2 = drand48() - 0.5;
v = d * D3vector(x0,x1,x2);
if ( cell.in_ws(v) )
count++;
cell.fold_in_ws(v);
if ( !cell.in_ws(v) )
cout << v << endl;
}
cout << " volume ratio: " << cell.volume() / (d*d*d)
<< " computed: " << count/((double) n) << endl << endl;;
cout << " Monoclinic cell: " << endl;
cell.set(D3vector(4,0,0.1),D3vector(0.2, 4,0),D3vector(0.1,0.3,4));
cout << cell << endl;
// Check matrix multiplication function
double ztest[9];
cell.matmult3x3(cell.amat(),cell.amat_inv(),ztest);
for ( int i = 0; i < 9; i++ )
cout << " ztest[" << i << "]=" << ztest[i] << endl;
count = 0;
for ( int i = 0; i < n; i++ )
{
// generate a random vector in a box of size d x d x d
double x0 = drand48() - 0.5;
double x1 = drand48() - 0.5;
double x2 = drand48() - 0.5;
v = d * D3vector(x0,x1,x2);
if ( cell.in_ws(v) )
count++;
cell.fold_in_ws(v);
if ( !cell.in_ws(v) )
cout << v << endl;
//.........这里部分代码省略.........