-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmaterial.cc
204 lines (159 loc) · 7.02 KB
/
material.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/* Functions of the MATERIAL class
* (some fragments taken from main()
* Added by M. Haranczyk, Feb 2014
*
*/
#include <vector>
#include <voro++.hh>
#include "network.h"
#include "networkio.h"
#include "networkinfo.h"
#include "networkanalysis.h"
#include "grid.h"
#include "channel.h"
#include "feature.h"
#include "holograms.h"
#include "instructions.h"
#include "ray.h"
#include "psd.h"
#include "area_and_volume.h"
#include "sphere_approx.h"
#include "poreinfo.h"
#include "zeojobs.h"
#include "material.h"
using namespace std;
using namespace voro;
void MATERIAL::runVoroFlat()
{
if(doneFlatVoroFlag == false) {
// Perform the relevant Voronoi decomposition
cout << "Starting Voronoi decomposition" << "\n";
if(radial)
rad_con = (container_periodic_poly *)performVoronoiDecomp(true, &atmnet, &vornet, cells, outputZvis, bvcells);
else
no_rad_con = (container_periodic *)performVoronoiDecomp (false, &atmnet, &vornet, cells, outputZvis, bvcells);
doneFlatVoroFlag = true;
cout << "Finished Voronoi decomposition" << "\n";
};
};
/* ACCESSIBLE VOLUME FUNCTIONS (incl. blocking&PSD) */
void MATERIAL::AVcalc(double r, int sampleDensity,ostream &output, char *filename){
runVoroFlat();
accessAnalysis.AccessibilityClassSetup(&atmnet, &orgAtomnet, highAccuracy, rad_con, &vornet, &bvcells, &cells);
accessAnalysis.FindChannels(r);
MATERIAL *pMaterial = this;
if(!AVdoneFlag) NEWcalcAV(pMaterial, r, sampleDensity);
AVdoneFlag = true;
NEWcalcAVprint(pMaterial, output,filename);
};
void MATERIAL::AVblockPockets(ostream &output){
if(AVdoneFlag == false)
{
cerr << "Cannot execute blocking before AV run.\n";
} else
{
if(AVblockDoneFlag == false) blockPockets(&atmnet, output, AVaxsPoints, AVaxsPointsChannelIDs, AVinaxsPoints, AVinaxsPointsPocketIDs, AVprobeRadius);
AVblockDoneFlag = true;
};
};
void MATERIAL::AVcalcPoreSizeDistr(ostream &output){
if(AVdoneFlag == false)
{
cerr << "Cannot execute PSD before AV run.\n";
} else
{
MATERIAL *pMaterial = this;
if(AVPSDdoneFlag == false) NEWcalcPoreSizeDistr(pMaterial, output);
AVPSDdoneFlag = true;
};
};
void MATERIAL::AVreportPoints(ostream &output){
NEWreportPoints(output, &atmnet, &AVaxsPoints, &AVaxsPointsChannelIDs, &AVinaxsPoints, &AVinaxsPointsPocketIDs, VisSetting);
};
void MATERIAL::AVreportPSDPoints(ostream &output){
NEWreportPointsValue(output, &atmnet, &AVaxsPoints, &AVaxsPointsChannelIDs, &AVaxsPointsPSD, VisSetting);
};
/* SURFACE AREA FUNCTIONS */
void MATERIAL::ASAcalc(double r, int sampleDensity, ostream &output, char *filename){
runVoroFlat();
accessAnalysis.AccessibilityClassSetup(&atmnet, &orgAtomnet, highAccuracy, rad_con, &vornet, &bvcells, &cells);
accessAnalysis.FindChannels(r);
MATERIAL *pMaterial = this;
if(!ASAdoneFlag) NEWcalcASA(pMaterial, r, sampleDensity);
ASAdoneFlag = true;
NEWcalcASAprint(pMaterial, output,filename);
};
void MATERIAL::ASAreportPoints(ostream &output){
NEWreportPoints(output, &atmnet, &ASAaxsPoints, &ASAaxsPointsChannelIDs, &ASAinaxsPoints, &ASAinaxsPointsPocketIDs, VisSetting);
};
/* visVORO FUNCTION */
void MATERIAL::visualizeVoroNet(char* name, double r, int skel_a, int skel_b, int skel_c){
visVoro(name, r, skel_a, skel_b, skel_c, &vornet, &atmnet);
}; // ends visVoro
/* PORE LIMITING ANALYSIS FUNCTIONS */
// PLDcalc uses seg_r to segment the void space into POREs, then takes the network available to r and analysis PLD between the segments identified for seg_r
void MATERIAL::PLDcalc(double r, double seg_r, string seg_file, ostream &output, char *filename){
runVoroFlat();
accessAnalysis.AccessibilityClassSetup(&atmnet, &orgAtomnet, highAccuracy, rad_con, &vornet, &bvcells, &cells);
accessAnalysis.FindChannels(r);
if(seg_r > 0)
{ // segment the network based on provide radii of void
accessAnalysis.calculatePLDbasedOnRadius(seg_r);
accessAnalysis.reportPLD(output);
} else
{ // segment the network based on provided segment definitions from a file
accessAnalysis.calculatePLDbasedOnFile(seg_file);
accessAnalysis.reportPLD(output);
};
/*
MATERIAL *pMaterial = this;
if(!ASAdoneFlag) NEWcalcASA(pMaterial, r, sampleDensity);
ASAdoneFlag = true;
NEWcalcASAprint(pMaterial, output,filename);
*/
};
// PLDcalc uses molecules present in the periodic box to segment the void space into POREs, then takes the network available to r and analysie PLD between the segments
void MATERIAL::PLDcalcFromMolecules(double r, ostream &output, char *filename){
runVoroFlat();
accessAnalysis.AccessibilityClassSetup(&atmnet, &orgAtomnet, highAccuracy, rad_con, &vornet, &bvcells, &cells);
accessAnalysis.FindChannels(r);
accessAnalysis.calculatePLDbasedOnMoleculesPresent(filename);
accessAnalysis.reportPLD(output);
};
// Function to save visualization of the calculated PLD
void MATERIAL::PLDvisualize(string basefilename, string visformat){
fstream output;
// Three data structures storing information about
vector<Point> NodesFracCoord;
vector<int> NodesSegmentIDs;
vector<double> NodesSize;
string filename_vis;
if(visformat == "ZEOVIS") filename_vis = basefilename + ".zpld_segments";
if(visformat == "VISIT") filename_vis = basefilename + ".vpld_segments";
if(visformat == "LIVERPOOL") filename_vis = basefilename + ".lpld_segments";
output.open(filename_vis.data(), fstream::out);
accessAnalysis.getPLDvisData(&NodesFracCoord, &NodesSegmentIDs, &NodesSize, "INITSEGMAP");
NEWreportPointsValue(output, &atmnet, &NodesFracCoord, &NodesSegmentIDs, &NodesSize, visformat);
output.close();
if(visformat == "ZEOVIS") filename_vis = basefilename + ".zpld_segmentdi";
if(visformat == "VISIT") filename_vis = basefilename + ".vpld_segmentdi";
if(visformat == "LIVERPOOL") filename_vis = basefilename + ".lpld_segmentdi";
output.open(filename_vis.data(), fstream::out);
accessAnalysis.getPLDvisData(&NodesFracCoord, &NodesSegmentIDs, &NodesSize, "INITSEGDINODE");
NEWreportPointsValue(output, &atmnet, &NodesFracCoord, &NodesSegmentIDs, &NodesSize, visformat);
output.close();
if(visformat == "ZEOVIS") filename_vis = basefilename + ".zpld_segmentpld";
if(visformat == "VISIT") filename_vis = basefilename + ".vpld_segmentpld";
if(visformat == "LIVERPOOL") filename_vis = basefilename + ".lpld_segmentpld";
output.open(filename_vis.data(), fstream::out);
accessAnalysis.getPLDvisData(&NodesFracCoord, &NodesSegmentIDs, &NodesSize, "PLDNODES");
NEWreportPointsValue(output, &atmnet, &NodesFracCoord, &NodesSegmentIDs, &NodesSize, visformat);
output.close();
if(visformat == "ZEOVIS") filename_vis = basefilename + ".zpld_segmentdf";
if(visformat == "VISIT") filename_vis = basefilename + ".vpld_segmentdf";
if(visformat == "LIVERPOOL") filename_vis = basefilename + ".lpld_segmentdf";
output.open(filename_vis.data(), fstream::out);
accessAnalysis.getPLDvisData(&NodesFracCoord, &NodesSegmentIDs, &NodesSize, "DFSPHERES");
NEWreportPointsValue(output, &atmnet, &NodesFracCoord, &NodesSegmentIDs, &NodesSize, visformat);
output.close();
}