votca 2024.2-dev
Loading...
Searching...
No Matches
triclinicbox.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// Local VOTCA includes
20
21namespace votca {
22namespace csg {
23
24/*
25 This way of determining the shortest distance is only working for a set of
26 triclinic boxes, in particular
27 a_y = a_z = b_z = 0
28 a_x > 0, b_y > 0, c_z > 0
29 b_x < 0.5 a_x, c_x < 0.5 a_x, c_y < 0.5 b_y
30 GROMACS checks if these conditions are satisfied.
31 If a simple search algorithm is used to determine if a particle
32 is a within cutoff r_c, make sure that r_c < 0.5 min(a_x, b_y, c_z)
33 */
35 const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const {
36 Eigen::Vector3d r_tp = r_j - r_i;
37 Eigen::Vector3d r_dp = r_tp - box_.col(2) * std::round(r_tp.z() / box_(2, 2));
38 Eigen::Vector3d r_sp = r_dp - box_.col(1) * std::round(r_dp.y() / box_(1, 1));
39 return r_sp - box_.col(0) * std::round(r_sp.x() / box_(0, 0));
40}
41
42} // namespace csg
43} // namespace votca
Eigen::Vector3d BCShortestConnection(const Eigen::Vector3d &r_i, const Eigen::Vector3d &r_j) const final
base class for all analysis tools
Definition basebead.h:33