~ubuntu-branches/ubuntu/trusty/travis/trusty-proposed

« back to all changes in this revision

Viewing changes to src/interface.cpp

  • Committer: Package Import Robot
  • Author(s): Daniel Leidert
  • Date: 2014-01-18 20:07:16 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20140118200716-whsmcg7fa1eyqecq
Tags: 140117-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
    TRAVIS - Trajectory Analyzer and Visualizer 
3
 
    http://www.travis-analyzer.de/ 
4
 
 
5
 
    Copyright (c) 2009-2013 Martin Brehm 
6
 
                  2012-2013 Martin Thomas 
7
 
 
8
 
    This file written by Martin Brehm and Martin Thomas. 
9
 
 
10
 
    This program is free software: you can redistribute it and/or modify 
11
 
    it under the terms of the GNU General Public License as published by 
12
 
    the Free Software Foundation, either version 3 of the License, or 
13
 
    (at your option) any later version. 
14
 
 
15
 
    This program is distributed in the hope that it will be useful, 
16
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
17
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
18
 
    GNU General Public License for more details. 
19
 
 
20
 
    You should have received a copy of the GNU General Public License 
21
 
    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
22
 
*****************************************************************************/ 
23
 
 
24
 
#include "interface.h"
25
 
 
26
 
//#include "normalcoordinate.h"
27
 
#include "normalmode.h"
28
 
#include "pdf.h"
29
 
#include "raman.h"
30
 
#include "region.h"
31
 
#include "structurefactor.h"
32
 
 
33
 
void Interface_DefaultConf() {
34
 
        /*      g_pDatabase->AddString("/BLA/BLUBB/PLOEPP/STRING1","String 1 Content");
35
 
        g_pDatabase->AddInt("/BLA/BLUBB/PLOEPP/INT1",123456);
36
 
        g_pDatabase->AddFloat("/BLA/BLUBB/PLOEPP/FLOAT1",1.23456);
37
 
        g_pDatabase->AddBool("/BLA/BLUBB/PLOEPP/BOOL1",true);*/
38
 
}
39
 
 
40
 
bool Interface_BeforeAnalysis() {
41
 
        if(g_bRegionAnalysis)
42
 
                if(!gatherRegionAnalysis())
43
 
                        return false;
44
 
        if(g_bRaman)
45
 
                if(!gatherRaman())
46
 
                        return false;
47
 
        if(g_bPDF)
48
 
                if(!gatherPDF())
49
 
                        return false;
50
 
/*      if(g_bNormalCoordinate)
51
 
                if(!gatherNormalCoordinate())
52
 
                        return false;*/
53
 
        if(g_bSFac)
54
 
                if(!gatherStructureFactor())
55
 
                        return false;
56
 
        return true;
57
 
}
58
 
 
59
 
bool Interface_Initialization() {
60
 
        if(g_bRaman)
61
 
                if(!initializeRaman())
62
 
                        return false;
63
 
        if(g_bPDF)
64
 
                if(!initializePDF())
65
 
                        return false;
66
 
/*      if(g_bNormalCoordinate)
67
 
                if(!initializeNormalCoordinate())
68
 
                        return false;*/
69
 
        if(g_bSFac)
70
 
                if(!initializeStructureFactor())
71
 
                        return false;
72
 
        return true;
73
 
}
74
 
 
75
 
void Interface_ProcessStep(CTimeStep *ts) {
76
 
        if(g_bRegionAnalysis)
77
 
                processRegionAnalysis(ts);
78
 
        if(g_bRaman)
79
 
                processRaman(ts);
80
 
        if(g_bPDF)
81
 
                processPDF(ts);
82
 
/*      if(g_bNormalCoordinate)
83
 
                processNormalCoordinate(ts);*/
84
 
        if(g_bSFac)
85
 
                processStructureFactor(ts);
86
 
}
87
 
 
88
 
void Interface_AfterAnalysis() {
89
 
        if(g_bRegionAnalysis)
90
 
                finalizeRegionAnalysis();
91
 
        if(g_bRaman)
92
 
                finalizeRaman();
93
 
        if(g_bPDF)
94
 
                finalizePDF();
95
 
/*      if(g_bNormalCoordinate)
96
 
                finalizeNormalCoordinate();*/
97
 
        if(g_bSFac)
98
 
                finalizeStructureFactor();
99
 
}
100
 
 
101
 
void Interface_DecomposeModes(int n, CxObArray *ccr_matrix) {
102
 
        normalModeAnalysis(n, ccr_matrix);
103
 
}
104
 
 
105
 
/************************************************ 
106
 
 
107
 
  Output: 
108
 
 
109
 
  mprintf( [Color,] ... ) 
110
 
 
111
 
#define GREY 8 
112
 
#define BLUE 9 
113
 
#define GREEN 10 
114
 
#define CYAN 11 
115
 
#define RED 12 
116
 
#define PINK 13 
117
 
#define YELLOW 14 
118
 
#define WHITE 15 
119
 
 
120
 
 
121
 
  A list of useful global variables: 
122
 
 
123
 
  g_bAdvanced2 
124
 
 
125
 
  g_fTimestepLength 
126
 
 
127
 
  g_iTrajSteps  // -1 means no information 
128
 
 
129
 
  g_fBoxX, g_fBoxY, g_fBoxZ  -  The cell vector in pm 
130
 
 
131
 
  g_oaMolecules              -  Array of all molecule kinds (members of type CMolecule) 
132
 
   
133
 
  g_oaSingleMolecules        -  Array of all molecules (members of type CSingleMolecule) 
134
 
 
135
 
 
136
 
 
137
 
                for (z=0;z<g_oaMolecules.GetSize();z++) 
138
 
                { 
139
 
                        m = (CMolecule*)g_oaMolecules[z]; 
140
 
                        if (m->m_bPseudo) 
141
 
                                continue; 
142
 
                        for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++) 
143
 
                        { 
144
 
                                sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[z2]]; 
145
 
                                for (z3=0;z3<m->m_baAtomIndex.GetSize();z3++) 
146
 
                                { 
147
 
                                        if ((!g_bSaveVirtAtoms) && (m->m_baAtomIndex[z3] == g_iVirtAtomType)) 
148
 
                                                continue; 
149
 
                                        for (z4=0;z4<((CxIntArray*)sm->m_oaAtomOffset[z3])->GetSize();z4++) 
150
 
                                                mfprintf(a,"  %s  %8.5f  %8.5f  %8.5f\n",((CAtom*)g_oaAtoms[m->m_baAtomIndex[z3]])->m_sName,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][0]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][1]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][2]/100.0f); 
151
 
                                } 
152
 
                        } 
153
 
                } 
154
 
 
155
 
 
 
1
/*****************************************************************************
 
2
    TRAVIS - Trajectory Analyzer and Visualizer 
 
3
    http://www.travis-analyzer.de/ 
 
4
 
 
5
    Copyright (c) 2009-2014 Martin Brehm 
 
6
                  2012-2014 Martin Thomas 
 
7
 
 
8
    This file written by Martin Brehm and Martin Thomas. 
 
9
 
 
10
    This program is free software: you can redistribute it and/or modify 
 
11
    it under the terms of the GNU General Public License as published by 
 
12
    the Free Software Foundation, either version 3 of the License, or 
 
13
    (at your option) any later version. 
 
14
 
 
15
    This program is distributed in the hope that it will be useful, 
 
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 
18
    GNU General Public License for more details. 
 
19
 
 
20
    You should have received a copy of the GNU General Public License 
 
21
    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 
22
*****************************************************************************/ 
 
23
 
 
24
#include "interface.h"
 
25
 
 
26
//#include "normalcoordinate.h"
 
27
#include "normalmode.h"
 
28
#include "pdf.h"
 
29
#include "raman.h"
 
30
#include "region.h"
 
31
#include "structurefactor.h"
 
32
 
 
33
void Interface_DefaultConf() {
 
34
        /*      g_pDatabase->AddString("/BLA/BLUBB/PLOEPP/STRING1","String 1 Content");
 
35
        g_pDatabase->AddInt("/BLA/BLUBB/PLOEPP/INT1",123456);
 
36
        g_pDatabase->AddFloat("/BLA/BLUBB/PLOEPP/FLOAT1",1.23456);
 
37
        g_pDatabase->AddBool("/BLA/BLUBB/PLOEPP/BOOL1",true);*/
 
38
}
 
39
 
 
40
bool Interface_BeforeAnalysis() {
 
41
        if(g_bRegionAnalysis)
 
42
                if(!gatherRegionAnalysis())
 
43
                        return false;
 
44
        if(g_bRaman)
 
45
                if(!gatherRaman())
 
46
                        return false;
 
47
        if(g_bPDF)
 
48
                if(!gatherPDF())
 
49
                        return false;
 
50
/*      if(g_bNormalCoordinate)
 
51
                if(!gatherNormalCoordinate())
 
52
                        return false;*/
 
53
        if(g_bSFac)
 
54
                if(!gatherStructureFactor())
 
55
                        return false;
 
56
        return true;
 
57
}
 
58
 
 
59
bool Interface_Initialization() {
 
60
        if(g_bRaman)
 
61
                if(!initializeRaman())
 
62
                        return false;
 
63
        if(g_bPDF)
 
64
                if(!initializePDF())
 
65
                        return false;
 
66
/*      if(g_bNormalCoordinate)
 
67
                if(!initializeNormalCoordinate())
 
68
                        return false;*/
 
69
        if(g_bSFac)
 
70
                if(!initializeStructureFactor())
 
71
                        return false;
 
72
        return true;
 
73
}
 
74
 
 
75
void Interface_ProcessStep(CTimeStep *ts) {
 
76
        if(g_bRegionAnalysis)
 
77
                processRegionAnalysis(ts);
 
78
        if(g_bRaman)
 
79
                processRaman(ts);
 
80
        if(g_bPDF)
 
81
                processPDF(ts);
 
82
/*      if(g_bNormalCoordinate)
 
83
                processNormalCoordinate(ts);*/
 
84
        if(g_bSFac)
 
85
                processStructureFactor(ts);
 
86
}
 
87
 
 
88
void Interface_AfterAnalysis() {
 
89
        if(g_bRegionAnalysis)
 
90
                finalizeRegionAnalysis();
 
91
        if(g_bRaman)
 
92
                finalizeRaman();
 
93
        if(g_bPDF)
 
94
                finalizePDF();
 
95
/*      if(g_bNormalCoordinate)
 
96
                finalizeNormalCoordinate();*/
 
97
        if(g_bSFac)
 
98
                finalizeStructureFactor();
 
99
}
 
100
 
 
101
void Interface_DecomposeModes(int n, CxObArray *ccr_matrix) {
 
102
        normalModeAnalysis(n, ccr_matrix);
 
103
}
 
104
 
 
105
/************************************************ 
 
106
 
 
107
  Output: 
 
108
 
 
109
  mprintf( [Color,] ... ) 
 
110
 
 
111
#define GREY 8 
 
112
#define BLUE 9 
 
113
#define GREEN 10 
 
114
#define CYAN 11 
 
115
#define RED 12 
 
116
#define PINK 13 
 
117
#define YELLOW 14 
 
118
#define WHITE 15 
 
119
 
 
120
 
 
121
  A list of useful global variables: 
 
122
 
 
123
  g_bAdvanced2 
 
124
 
 
125
  g_fTimestepLength 
 
126
 
 
127
  g_iTrajSteps  // -1 means no information 
 
128
 
 
129
  g_fBoxX, g_fBoxY, g_fBoxZ  -  The cell vector in pm 
 
130
 
 
131
  g_oaMolecules              -  Array of all molecule kinds (members of type CMolecule) 
 
132
   
 
133
  g_oaSingleMolecules        -  Array of all molecules (members of type CSingleMolecule) 
 
134
 
 
135
 
 
136
 
 
137
                for (z=0;z<g_oaMolecules.GetSize();z++) 
 
138
                { 
 
139
                        m = (CMolecule*)g_oaMolecules[z]; 
 
140
                        if (m->m_bPseudo) 
 
141
                                continue; 
 
142
                        for (z2=0;z2<m->m_laSingleMolIndex.GetSize();z2++) 
 
143
                        { 
 
144
                                sm = (CSingleMolecule*)g_oaSingleMolecules[m->m_laSingleMolIndex[z2]]; 
 
145
                                for (z3=0;z3<m->m_baAtomIndex.GetSize();z3++) 
 
146
                                { 
 
147
                                        if ((!g_bSaveVirtAtoms) && (m->m_baAtomIndex[z3] == g_iVirtAtomType)) 
 
148
                                                continue; 
 
149
                                        for (z4=0;z4<((CxIntArray*)sm->m_oaAtomOffset[z3])->GetSize();z4++) 
 
150
                                                mfprintf(a,"  %s  %8.5f  %8.5f  %8.5f\n",((CAtom*)g_oaAtoms[m->m_baAtomIndex[z3]])->m_sName,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][0]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][1]/100.0f,m_vaCoords[((CxIntArray*)sm->m_oaAtomOffset[z3])->GetAt(z4)][2]/100.0f); 
 
151
                                } 
 
152
                        } 
 
153
                } 
 
154
 
 
155
 
156
156
*************************************************/
 
 
b'\\ No newline at end of file'