-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcell.cpp
More file actions
89 lines (73 loc) · 1.51 KB
/
Copy pathcell.cpp
File metadata and controls
89 lines (73 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <iostream>
#include <iomanip>
#include <cmath>
#include "cell.h"
const double conv=3.1415926535897932384626433832795029/180.0;
Cell::Cell(double pa, double pb, double pc, double pal, double pbe,
double pga)
{
aa=pa; ba=pb; ca=pc;
al=pal*conv; be=pbe*conv; ga=pga*conv;
V=sqrt(1-cos(al)*cos(al)-cos(be)*cos(be)-cos(ga)*cos(ga)+2*cos(al)*cos(be)*cos(ga))*aa*ba*ca;
om=Matrix3(aa, ba*cos(ga), ca*cos(be),
0.0, ba*sin(ga), ca*(cos(al)-cos(be)*cos(ga))/sin(ga),
0.0, 0.0, V/(aa*ba*sin(ga)));
}
Cell::~Cell()
{
}
std::ostream& operator << (std::ostream& s, Cell & cell)
{
s << "#CELL: ";
s << std::setw(8) << std::setprecision(7) << cell.aa << " ";
s << std::setw(8) << std::setprecision(7) << cell.ba << " ";
s << std::setw(8) << std::setprecision(7) << cell.ca << " ";
s << std::setw(7) << std::setprecision(6) << cell.al/conv << " ";
s << std::setw(7) << std::setprecision(6) << cell.be/conv << " ";
s << std::setw(7) << std::setprecision(6) << cell.ga/conv << std::endl;
return s;
}
double Cell::volume() const
{
return V;
}
Matrix3 Cell::orthmat() const
{
return om;
}
double Cell::a() const
{
return aa;
}
double Cell::b() const
{
return ba;
}
double Cell::c() const
{
return ca;
}
double Cell::alpha() const
{
return al/conv;
}
double Cell::beta() const
{
return be/conv;
}
double Cell::gamma() const
{
return ga/conv;
}
double Cell::astar() const
{
return ba*ca*sin(al)/V;
}
double Cell::bstar() const
{
return aa*ca*sin(be)/V;
}
double Cell::cstar() const
{
return aa*ba*sin(ga)/V;
}