votca 2024.2-dev
Loading...
Searching...
No Matches
boundarycondition.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18// Standard includes
19#include <cassert>
20#include <vector>
21
22// Local VOTCA includes
24
25namespace votca {
26namespace csg {
27
28double BoundaryCondition::BoxVolume() const noexcept {
29 return std::abs(box_.determinant());
30}
31
33 assert(getBoxType() != eBoxtype::typeOpen &&
34 "Cannot get the shortest dimension of the box because it is open");
35
36 Eigen::Vector3d box_a = box_.col(0);
37 Eigen::Vector3d box_b = box_.col(1);
38 Eigen::Vector3d box_c = box_.col(2);
39
40 // create plane normals
41 Eigen::Vector3d norm_a = box_b.cross(box_c);
42 Eigen::Vector3d norm_b = box_c.cross(box_a);
43 Eigen::Vector3d norm_c = box_a.cross(box_b);
44
45 norm_a.normalize();
46 norm_b.normalize();
47 norm_c.normalize();
48
49 double la = box_a.dot(norm_a);
50 double lb = box_b.dot(norm_b);
51 double lc = box_c.dot(norm_c);
52
53 return std::min(la, std::min(lb, lc));
54}
55
56} // namespace csg
57} // namespace votca
virtual double BoxVolume() const noexcept
double getShortestBoxDimension() const
Self explanatory gets the shortest dimension of the boundary conditions.
virtual eBoxtype getBoxType() const noexcept=0
base class for all analysis tools
Definition basebead.h:33