1 | /*
|
---|
2 | * Project: MoleCuilder
|
---|
3 | * Description: creates and alters molecular systems
|
---|
4 | * Copyright (C) 2010 University of Bonn. All rights reserved.
|
---|
5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * PrincipalAxisSystemAction.cpp
|
---|
10 | *
|
---|
11 | * Created on: May 12, 2010
|
---|
12 | * Author: heber
|
---|
13 | */
|
---|
14 |
|
---|
15 | // include config.h
|
---|
16 | #ifdef HAVE_CONFIG_H
|
---|
17 | #include <config.h>
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | #include "CodePatterns/MemDebug.hpp"
|
---|
21 |
|
---|
22 | #include "CodePatterns/Log.hpp"
|
---|
23 | #include "CodePatterns/Verbose.hpp"
|
---|
24 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
|
---|
25 | #include "LinearAlgebra/Vector.hpp"
|
---|
26 | #include "Element/element.hpp"
|
---|
27 | #include "molecule.hpp"
|
---|
28 |
|
---|
29 | #include <iostream>
|
---|
30 | #include <string>
|
---|
31 |
|
---|
32 | #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
|
---|
33 |
|
---|
34 | using namespace MoleCuilder;
|
---|
35 |
|
---|
36 | // and construct the stuff
|
---|
37 | #include "PrincipalAxisSystemAction.def"
|
---|
38 | #include "Action_impl_pre.hpp"
|
---|
39 |
|
---|
40 | /** =========== define the function ====================== */
|
---|
41 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performCall() {
|
---|
42 | LOG(0, "Evaluating prinicipal axis.");
|
---|
43 | for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
|
---|
44 | molecule *mol = iter->second;
|
---|
45 |
|
---|
46 | // get inertia tensor
|
---|
47 | RealSpaceMatrix InertiaTensor = mol->getInertiaTensor();
|
---|
48 |
|
---|
49 | // diagonalize matrix
|
---|
50 | Vector EigenValues = InertiaTensor.transformToEigenbasis();
|
---|
51 |
|
---|
52 | // print principal axis system
|
---|
53 | LOG(1, "INFO: The Principal Axis System of molecule "
|
---|
54 | << mol->getName() << " is:"
|
---|
55 | << InertiaTensor << endl
|
---|
56 | << " with eigenvalues "
|
---|
57 | << EigenValues);
|
---|
58 | }
|
---|
59 | return Action::success;
|
---|
60 | }
|
---|
61 |
|
---|
62 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performUndo(Action::state_ptr _state) {
|
---|
63 | return Action::success;
|
---|
64 | }
|
---|
65 |
|
---|
66 | Action::state_ptr AnalysisPrincipalAxisSystemAction::performRedo(Action::state_ptr _state){
|
---|
67 | return Action::success;
|
---|
68 | }
|
---|
69 |
|
---|
70 | bool AnalysisPrincipalAxisSystemAction::canUndo() {
|
---|
71 | return true;
|
---|
72 | }
|
---|
73 |
|
---|
74 | bool AnalysisPrincipalAxisSystemAction::shouldUndo() {
|
---|
75 | return true;
|
---|
76 | }
|
---|
77 | /** =========== end of function ====================== */
|
---|