votca 2024.2-dev
Loading...
Searching...
No Matches
nematicorder.cc
Go to the documentation of this file.
1/*
2 * Copyright 2009-2021 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
24using namespace std;
25
26void NematicOrder::Process(Topology &top, const string &filter) {
27 mu_ = Eigen::Matrix3d::Zero();
28 mv_ = Eigen::Matrix3d::Zero();
29 mw_ = Eigen::Matrix3d::Zero();
30 Index N = 0;
31 bool bU, bV, bW;
32 bU = bV = bW = false;
33
34 for (const auto &bead : top.Beads()) {
35
36 if (!tools::wildcmp(filter, bead.getName())) {
37 continue;
38 }
39
40 if (bead.getSymmetry() == 1) {
41 continue;
42 }
43
44 if (bead.HasU()) {
45 mu_ += bead.getU() * bead.getU().transpose();
46 mu_.diagonal().array() -= 1. / 3.;
47 bU = true;
48 }
49
50 if (bead.HasV()) {
51 mu_ += bead.getV() * bead.getV().transpose();
52 mu_.diagonal().array() -= 1. / 3.;
53 bV = true;
54 }
55
56 if (bead.HasW()) {
57 mu_ += bead.getW() * bead.getW().transpose();
58 mu_.diagonal().array() -= 1. / 3.;
59 bW = true;
60 }
61 N++;
62 }
63
64 double f = 1. / (double)N * 3. / 2.;
65 mu_ = f * mu_;
66 mv_ = f * mv_;
67 mw_ = f * mw_;
68
69 if (bU) {
70 nemat_u_.computeDirect(mu_);
71 }
72 if (bV) {
73 nemat_v_.computeDirect(mv_);
74 }
75 if (bW) {
76 nemat_w_.computeDirect(mw_);
77 }
78}
79
80} // namespace csg
81} // namespace votca
Eigen::SelfAdjointEigenSolver< Eigen::Matrix3d > nemat_v_
Eigen::SelfAdjointEigenSolver< Eigen::Matrix3d > nemat_w_
void Process(Topology &top, const std::string &filter="*")
Eigen::SelfAdjointEigenSolver< Eigen::Matrix3d > nemat_u_
topology of the whole system
Definition topology.h:81
BeadContainer & Beads()
Definition topology.h:169
STL namespace.
int wildcmp(const char *wild, const char *string)
Definition tokenizer.cc:28
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26