Skip to content

Commit e32323f

Browse files
authored
Merge pull request #1 from MikeHeiber/development
v3.1 Morphology Correlation Function Update
2 parents 9a348a8 + d01a255 commit e32323f

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Morphology.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Michael C. Heiber
1+
// Copyright (c) 2017 Michael C. Heiber
22
// This source file is part of the Ising_OPV project, which is subject to the MIT License.
33
// For more information, see the LICENSE file that accompanies this package.
44

@@ -106,7 +106,7 @@ double Morphology::calculateAdditionalEnergyChange(long int main_site_index,long
106106
continue;
107107
}
108108
}
109-
calculateDZ(z1,k);
109+
dz = calculateDZ(z1,k);
110110
// Count the number of similar neighbors
111111
if(lattice[getSite(x1,y1,z1+k+dz)].type==site1_type){
112112
count1_i++;
@@ -316,6 +316,11 @@ bool Morphology::calculateAnisotropy(char site_type,int cutoff_distance,int N_sa
316316
}
317317
return false;
318318
}
319+
if(4*correlation_length_x>Length || 4*correlation_length_y>Width){
320+
cout << "Warning. Correlation length in x- or y-direction is greater than L/4." << endl;
321+
cout << "x-direction correlation length is " << correlation_length_x << "." << endl;
322+
cout << "y-direction correlation length is " << correlation_length_y << "." << endl;
323+
}
319324
if(site_type==(char)1){
320325
Domain_anisotropy1 = (2*correlation_length_z)/(correlation_length_x+correlation_length_y);
321326
}

Morphology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Michael C. Heiber
1+
// Copyright (c) 2017 Michael C. Heiber
22
// This source file is part of the Ising_OPV project, which is subject to the MIT License.
33
// For more information, see the LICENSE file that accompanies this software.
44

main.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2016 Michael C. Heiber
1+
// Copyright (c) 2017 Michael C. Heiber
22
// This source file is part of the Ising_OPV project, which is subject to the MIT License.
33
// For more information, see the LICENSE file that accompanies this software.
44

@@ -61,7 +61,7 @@ int main(int argc, char * argv[]){
6161
// Input parameters
6262
Input_Parameters parameters;
6363
// Internal parameters
64-
string version = "v3.0";
64+
string version = "v3.1";
6565
bool enable_import_morphology;
6666
double mix_ratio = 0;
6767
double domain_size1 = 0;
@@ -84,6 +84,7 @@ int main(int argc, char * argv[]){
8484
ofstream morphology_output_file;
8585
ofstream morphology_cross_section_file;
8686
ofstream correlationfile_avg;
87+
ofstream correlationfile;
8788
ofstream interfacial_dist_hist_file;
8889
ofstream tortuosity_hist_file;
8990
ofstream path_data1_file;
@@ -316,11 +317,20 @@ int main(int argc, char * argv[]){
316317
if(success){
317318
domain_size1 = morph.getDomainSize((char)1);
318319
domain_size2 = morph.getDomainSize((char)2);
320+
ss << path << "correlation_data_" << procid << ".txt";
321+
correlationfile.open(ss.str().c_str());
322+
ss.str("");
323+
vector<double> correlation_data1 = morph.getCorrelationData((char)1);
324+
vector<double> correlation_data2 = morph.getCorrelationData((char)2);
325+
for(int i=0;i<correlation_data1.size();i++){
326+
correlationfile << 0.5*(double)i << "," << correlation_data1[i] << "," << correlation_data2[i] << endl;
327+
}
328+
correlationfile.close();
319329
}
320330
success = false;
321331
cout << procid << ": Calculating the domain anisotropy..." << endl;
322332
while(!success){
323-
if(2*cutoff_distance>morph.getLength() || 2*cutoff_distance>morph.getWidth() || 2*cutoff_distance>morph.getHeight()){
333+
if(2*cutoff_distance>morph.getLength() && 2*cutoff_distance>morph.getWidth() && 2*cutoff_distance>morph.getHeight()){
324334
break;
325335
}
326336
success = morph.calculateAnisotropies(cutoff_distance,parameters.N_sampling_max);
@@ -330,6 +340,9 @@ int main(int argc, char * argv[]){
330340
domain_anisotropy1 = morph.getDomainAnisotropy((char)1);
331341
domain_anisotropy2 = morph.getDomainAnisotropy((char)2);
332342
}
343+
else{
344+
cout << procid << ": Warning! Could not calculate the domain anisotropy." << endl;
345+
}
333346
}
334347
// Calculate interfacial distance histogram if enabled.
335348
if(parameters.enable_interfacial_distance_calc){
@@ -621,7 +634,7 @@ int main(int argc, char * argv[]){
621634
ss.str("");
622635
}
623636
}
624-
analysis_file << "Summary of results for this morphology set containing " << nproc <<" morphologies created using Ising_OPV " << version << ":\n" << endl;
637+
analysis_file << "Summary of results for this morphology set containing " << nproc <<" morphologies created using Ising_OPV " << version << ":" << endl;
625638
analysis_file << "length,width,height,mix_ratio_avg,mix_ratio_stdev,domain1_size_avg,domain1_size_stdev,domain2_size_avg,domain2_size_stdev,";
626639
analysis_file << "domain1_anisotropy_avg,domain1_anisotropy_stdev,domain2_anisotropy_avg,domain2_anisotropy_stdev,";
627640
analysis_file << "interfacial_area_volume_ratio_avg,interfacial_area_volume_ratio_stdev,interfacial_volume_ratio_avg,interfacial_volume_ratio_stdev,";

0 commit comments

Comments
 (0)