Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output filename definition to visVoro #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*.o
network
framework_builder
molecule_to_abstract

18 changes: 11 additions & 7 deletions area_and_volume.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,11 @@ void determineAccessibility(ATOM_NETWORK *atmnet, double r_probe_chan, double r_
}

//create diagrams of 1) Voronoi network and 2) accessible Voronoi network in an adjacent cell if specified with shift; xyz and vtk output files generated
void visVoro(char* name, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet) {
string filename_xyz = string(name).append("_voro.xyz");
string filename2_xyz = string(name).append("_voro_accessible.xyz");
string filename3_xyz = string(name).append("_voro_nonaccessible.xyz");
void visVoro(char* name, string prefix, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet, string filename_xyz, string filename2_xyz, string filename3_xyz, string filename_vtk, string filename2_vtk, string filename3_vtk) {
//void visVoro(char* name, string prefix, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet) {
// string filename_xyz = string(name).append("_voro.xyz");
// string filename2_xyz = string(name).append("_voro_accessible.xyz");
// string filename3_xyz = string(name).append("_voro_nonaccessible.xyz");
vector<bool> accessInfo;
vector<bool> nonaccessInfo;
vector<CHANNEL> channels;
Expand All @@ -1338,6 +1339,9 @@ void visVoro(char* name, double probeRad, int skel_a, int skel_b, int skel_c, VO
};

//write Voronoi nodes as .xyz
// FILE *output_xyz; output_xyz = fopen(filename_xyz, "w");
// FILE *output2_xyz; output2_xyz = fopen(filename2_xyz, "w");
// FILE *output3_xyz; output3_xyz = fopen(filename3_xyz, "w");
FILE *output_xyz; output_xyz = fopen(filename_xyz.c_str(), "w");
FILE *output2_xyz; output2_xyz = fopen(filename2_xyz.c_str(), "w");
FILE *output3_xyz; output3_xyz = fopen(filename3_xyz.c_str(), "w");
Expand Down Expand Up @@ -1376,9 +1380,9 @@ void visVoro(char* name, double probeRad, int skel_a, int skel_b, int skel_c, VO
// when printing (non)accesible network, all nodes are printed first

//write Voronoi edges as .vtk
string filename_vtk = string(name).append("_voro.vtk");
string filename2_vtk = string(name).append("_voro_accessible.vtk");
string filename3_vtk = string(name).append("_voro_nonaccessible.vtk");
// string filename_vtk = string(name).append("_voro.vtk");
// string filename2_vtk = string(name).append("_voro_accessible.vtk");
// string filename3_vtk = string(name).append("_voro_nonaccessible.vtk");
//start saving the addresses of (non)accessible nodes
int *accessIndex;
accessIndex = new int[accessInfo.size()];
Expand Down
2 changes: 1 addition & 1 deletion area_and_volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ double calcASA(ATOM_NETWORK *atmnet, ATOM_NETWORK *orgatmnet, bool highAccuracy,
std::string calcASA(ATOM_NETWORK *atmnet, ATOM_NETWORK *orgatmnet, bool highAccuracy, double r_probe_chan, double r_probe, int numSamples, bool excludePockets, bool ExtendedOutputFlag);

void determineAccessibility(ATOM_NETWORK *atmnet, double r_probe_chan, double r_probe, bool excludePockets, std::vector<bool> *isAccessible, VORONOI_NETWORK *pointSet);
void visVoro(char* name, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet);
void visVoro(char* name, string prefix, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet, string filename_xyz, string filename2_xyz, string filename3_xyz, string filename_vtk, string filename2_vtk, string filename3_vtk);

//extract spherical substructures: this is a functionality designed for extracting local substructures of zeolites so that they can be scanned for potential guest molecule binding sites
//this functionality writes out a number of xyz format files containing spherical substructures of the given radius, centred on given probe-accessible Voronoi nodes; if an element_type is given, a simplified Voronoi network is used, based only on atoms of that type
Expand Down
15 changes: 15 additions & 0 deletions arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ string processFilename(vector<string> command, string name, string file_type, un
}
}

string processFilenameXtra(vector<string> command, string name, string prefix, string file_type, unsigned int num_args_1, unsigned int num_args_2){
if(command.size() == (num_args_1 + 1) || command.size() == (num_args_1 + 4)){
return string(name).append(file_type);
}
else if (command.size() == (num_args_2 + 1) || command.size() == (num_args_2 + 4)){
return string(prefix).append(file_type);
}
else {
cerr << "Error: " << command[0] << " option accepts " << num_args_1 << " or " << num_args_2 << " or " << num_args_1 + 3 << " or " << num_args_2 + 3
<< " arguments but " << command.size() - 1 << " arguments were supplied. " << "\n"
<< "Exiting..." << "\n";
// exit(1);
return "";
}
}

/** Assuming that -r was part of the command line parameters, this
function examines the list of arguments to determine whether
Expand Down
1 change: 1 addition & 0 deletions arguments.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using namespace std;

string processFilename(vector<string> command, string name, string file_type, unsigned int num_args_1, unsigned int num_args_2);
string processFilenameXtra(vector<string> command, string name, string prefix, string file_type, unsigned int num_args_1, unsigned int num_args_2);
void processRadialParameters(vector<string> args);
void processMassParameters(std::vector<std::string> args);
string processAccuracyParameters(vector<string> args);
Expand Down
4 changes: 2 additions & 2 deletions instructions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cout << "Network commandline invocation syntax:" << "\n" << "\n"
<< " [-psd chan_radius probe_radius num_samples [outputfile_sa]] " << "\n"
<< " [-ray chan_radius probe_radius num_samples [outputfile_ray]] " << "\n"
<< " [-chan probe_radius [outputfile_chan]] " << "\n"
<< " [-visVoro probe_radius [unit_cell_shifts: a b c]] " << "\n"
<< " [-visVoro probe_radius [prefix] [unit_cell_shifts: a b c]] " << "\n"
<< " [-sphericalSubstructures probe_radius sphere_radius [element_type]]" << "\n"
<< " [-findTetrahedra element_type]" << "\n"
<< " [-cellmulti sphere_radius]" << "\n"
Expand Down Expand Up @@ -105,7 +105,7 @@ cout << "Network commandline invocation syntax:" << "\n" << "\n"
<< " -gridG : Write distance grid in Gaussian cube format (inputfilename.cube). " << "\n"
<< " -gridGBohr : Write distance grid in Gaussian cube format, with distances converted from Angstrom to Bohr (inputfilename.cube). " << "\n"
<< " -chan probe_radius [outputfile_chan] : Determine the channels available to a probe of size $probe_radius. " << "\n"
<< " -visVoro probe_radius [unit_cell_shifts: a b c] : For visualization: draw the Voronoi network as xyz and vtk formats, including only the accessible portion, which can be drawn in an adjacent unit cell with the provided shifts. " << "\n"
<< " -visVoro probe_radius [prefix] [unit_cell_shifts: a b c] : For visualization: draw the Voronoi network as xyz and vtk formats, including only the accessible portion, which can be drawn in an adjacent unit cell with the provided shifts. " << "\n"
<< " -sphericalSubstructures probe_radius sphere_radius [element_type] : For zeolites: Write out a number of xyz format files containing spherical substructures of the given radius, centred on given probe-accessible Voronoi nodes; if an element_type is given, a simplified Voronoi network is used, based only on atoms of that type. " << "\n"
<< " -findTetrahedra element_type: Write to terminal the tetrahedrality (distortion) index for each tetrahedral arrangement of the specified atom type in the material" << "\n"
<< " -cellmulti sphere_radius: Write to terminal the number of cells required in each crystallographic axis in order to construct a supercell, where a sphere with the provided radius will not overlap with itself periodically" << "\n"
Expand Down
34 changes: 28 additions & 6 deletions main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1017,19 +1017,41 @@ int main(int argc, char * argv[]){
}
//create skeleton diagram (prints Voronoi network to file, and accessible Voronoi network to a separate file, in an adjacent cell if specified with shift - xyz and vtk output files generated)
else if(command[0].compare("-visVoro") == 0){
if(command.size()!=2 && command.size()!=5) {
printf("Error: -visVoro option accepts 1 (probe radius) or 4 (probe radius and then a, b and c shifts for illustrating accessible part of network) arguments but %d arguments were supplied.\n", (int)(command.size() - 1));
printf("Exiting...\n");
// exit(1);
error=true; break;
string prefix;
//printf("%s\n",prefix.c_str());
if(command.size()==3 || command.size() ==6) {
prefix = command[2].c_str();
//printf("%s\n",prefix.c_str());
}
//printf("%s\n",prefix.c_str());
string filename_xyz = processFilenameXtra(command, name, prefix, ".voro", 1, 2);
string filename2_xyz = processFilenameXtra(command, name, prefix, ".voro_accessible", 1, 2);
string filename3_xyz = processFilenameXtra(command, name, prefix, ".voro_nonaccessible", 1, 2);
// string filename_xyz = processFilenameXtra(command, name, prefix, "_voro.xyz", 1, 2);
// string filename2_xyz = processFilenameXtra(command, name, prefix, "_voro_accessible.xyz", 1, 2);
// string filename3_xyz = processFilenameXtra(command, name, prefix, "_voro_nonaccessible.xyz", 1, 2);
string filename_vtk = processFilenameXtra(command, name, prefix, "_voro.vtk", 1, 2);
string filename2_vtk = processFilenameXtra(command, name, prefix, "_voro_accessible.vtk", 1, 2);
string filename3_vtk = processFilenameXtra(command, name, prefix, "_voro_nonaccessible.vtk", 1, 2);

if(filename_xyz.empty() || filename2_xyz.empty() || filename3_xyz.empty() || filename_vtk.empty() || filename2_vtk.empty() || filename3_vtk.empty()) {error=true; break;}
// if(command.size()!=2 && command.size()!=5) {
// printf("Error: -visVoro option accepts 1 (probe radius) or 4 (probe radius and then a, b and c shifts for illustrating accessible part of network) arguments but %d arguments were supplied.\n", (int)(command.size() - 1));
// printf("Exiting...\n");
// // exit(1);
// error=true; break;
// }
double probeRad = strtod(command[1].data(), NULL);
int skel_a = 0, skel_b = 0, skel_c = 0;
if(command.size()==5) {
//if shift was provided
skel_a = strtod(command[2].data(), NULL), skel_b = strtod(command[3].data(), NULL), skel_c = strtod(command[4].data(), NULL);
}
visVoro(name, probeRad, skel_a, skel_b, skel_c, &vornet, &atmnet);
if(command.size()==6) {
//if shift was provided
skel_a = strtod(command[3].data(), NULL), skel_b = strtod(command[4].data(), NULL), skel_c = strtod(command[5].data(), NULL);
}
visVoro(name, prefix, probeRad, skel_a, skel_b, skel_c, &vornet, &atmnet, filename_xyz, filename2_xyz, filename3_xyz, filename_vtk, filename2_vtk, filename3_vtk);
}
//extract spherical substructures: this is a functionality designed for extracting local substructures of zeolites so that they can be scanned for potential guest molecule binding sites
//this functionality writes out a number of xyz format files containing spherical substructures of the given radius, centred on given probe-accessible Voronoi nodes; if an element_type is given, a simplified Voronoi network is used, based only on atoms of that type
Expand Down
7 changes: 5 additions & 2 deletions material.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,11 @@ void MATERIAL::ASAreportPoints(ostream &output){


/* 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);
//void visVoro(char* name, string prefix, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet, string *filename_xyz, string *filename2_xyz, string *filename3_xyz) {
//void visVoro(char* name, string prefix, double probeRad, int skel_a, int skel_b, int skel_c, VORONOI_NETWORK* vornet, ATOM_NETWORK* atmnet) {

void MATERIAL::visualizeVoroNet(char* name, string prefix, double r, int skel_a, int skel_b, int skel_c, string filename_xyz, string filename2_xyz, string filename3_xyz, string filename_vtk, string filename2_vtk, string filename3_vtk){
visVoro(name, prefix, r, skel_a, skel_b, skel_c, &vornet, &atmnet, filename_xyz, filename2_xyz, filename3_xyz, filename_vtk, filename2_vtk, filename3_vtk);
}; // ends visVoro


Expand Down
2 changes: 1 addition & 1 deletion material.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class MATERIAL {
void ASAcalc(double r, int sampleDensity,ostream &output, char *filename);
void ASAreportPoints(ostream &output);

void visualizeVoroNet(char *, double, int, int, int);
void visualizeVoroNet(char *, string, double, int, int, int, string filename_xyz, string filename2_xyz, string filename3_xyz, string filename_vtk, string filename2_vtk, string filename3_vtk);

void PLDcalc(double r, double seg_r, string seg_file, ostream &output, char *filename);
void PLDcalcFromMolecules(double r, ostream &output, char *filename);
Expand Down
49 changes: 40 additions & 9 deletions zeojobs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class zeoJob {
std::vector< std::vector<std::string> > commands;
char name[256];
char extension[256];
char prefix[256];

/* Run setting */
double probeRadius; // this stores a probe radius used in all Zeo++ analysis
Expand Down Expand Up @@ -418,19 +419,49 @@ class zeoJob {
output.close();
}
else if(command[0].compare("-visVoro") == 0){ // for visualization
if(command.size()!=1 && command.size()!=4) {
printf("Error: -visVoro option accepts 0 or 3 (a, b and c shifts for illustrating accessible part of network) arguments but %d arguments were supplied.\n", (int)(command.size() - 1));
printf("Exiting...\n");
error=true; break;
string prefix = "";
if(command.size()==3 || command.size() ==6) {
string prefix = command[2];
}
string filename_xyz = processFilenameXtra(command, name, prefix, "_voro.xyz", 1, 2);
string filename2_xyz = processFilenameXtra(command, name, prefix, "_voro_accessible.xyz", 1, 2);
string filename3_xyz = processFilenameXtra(command, name, prefix, "_voro_nonaccessible.xyz", 1, 2);
string filename_vtk = processFilenameXtra(command, name, prefix, "_voro.vtk", 1, 2);
string filename2_vtk = processFilenameXtra(command, name, prefix, "_voro_accessible.vtk", 1, 2);
string filename3_vtk = processFilenameXtra(command, name, prefix, "_voro_nonaccessible.vtk", 1, 2);

if(filename_xyz.empty() || filename2_xyz.empty() || filename3_xyz.empty() || filename_vtk.empty() || filename2_vtk.empty() || filename3_vtk.empty()) {error=true; break;}


// string filename_xyz = processFilenameXtra(command, name, prefix, "_voro.xyz", 1, 2);
// string filename2_xyz = processFilenameXtra(command, name, prefix, "_voro_accessible.xyz", 1, 2);
// string filename3_xyz = processFilenameXtra(command, name, prefix, "_voro_nonaccessible.xyz", 1, 2);
// if(filename_xyz.empty() || filename2_xyz.empty() || filename3_xyz.empty()) {error=true; break;}
// if(command.size()!=1 && command.size()!=4) {
// printf("Error: -visVoro option accepts 0 or 3 (a, b and c shifts for illustrating accessible part of network) arguments but %d arguments were supplied.\n", (int)(command.size() - 1));
// printf("Exiting...\n");
// error=true; break;
// }
double probeRad = strtod(command[1].data(), NULL);
int skel_a = 0, skel_b = 0, skel_c = 0;
if(command.size()==4) {
if(command.size()==5) {
//if shift was provided
skel_a = strtod(command[2].data(), NULL), skel_b = strtod(command[3].data(), NULL), skel_c = strtod(command[4].data(), NULL);
}
if(command.size()==6) {
//if shift was provided
skel_a = strtod(command[1].data(), NULL), skel_b = strtod(command[2].data(), NULL), skel_c = strtod(command[3].data(), NULL);
};
skel_a = strtod(command[3].data(), NULL), skel_b = strtod(command[4].data(), NULL), skel_c = strtod(command[5].data(), NULL);
}


// int skel_a = 0, skel_b = 0, skel_c = 0;
// if(command.size()==4) {
// //if shift was provided
// skel_a = strtod(command[1].data(), NULL), skel_b = strtod(command[2].data(), NULL), skel_c = strtod(command[3].data(), NULL);
// };
Material.runVoroFlat();
// visVoro(name, probeRad, skel_a, skel_b, skel_c, &vornet, &atmnet);
Material.visualizeVoroNet(name, probeRadius, skel_a, skel_b, skel_c);
// visVoro(name, prefix, probeRad, skel_a, skel_b, skel_c, &vornet, &atmnet);
Material.visualizeVoroNet(name, prefix, probeRadius, skel_a, skel_b, skel_c, filename_xyz, filename2_xyz, filename3_xyz, filename_vtk, filename2_vtk, filename3_vtk);
}

//Rich: holograms as a separate flag, -holo
Expand Down