Commit 026151c6 authored by texw's avatar texw
Browse files

File Comments

parent 7fe7384f
......@@ -89,7 +89,6 @@ int boxGenMain(map<string,string>& config, string protein_filename) {
option = 1;
} else {
throw std::runtime_error("Invalid input file passed. Input file must be off or pqr.\n");
exit(1);
}
int n_dim = 3;
......
......@@ -89,7 +89,6 @@ map<string,string> getConfig(const string config_filename) {
string getVal(map<string,string>& config, string key) {
if (config.find(key) == config.end()) {
throw std::runtime_error("Key: " + key + " not found.\n");
exit(1);
} else {
return config[key];
}
......@@ -130,28 +129,26 @@ string pqrToOff(map<string,string>& config){
default:
throw std::runtime_error("Not on supported OS for TMSmesh.\n");
exit(1);
}
cout << "Running TMSmesh now.\n";
int status = std::system(command.c_str());
if (status < 0){
throw std::runtime_error("TMSmesh error.\nExiting\n");
exit(1);
}
cout << "Outputting protein off file " << protein_filename << endl;
} else {
throw std::runtime_error("Invalid output file passed. Output file must be off or poly.\n");
exit(1);
}
return protein_filename;
}
int main(int argc, char** argv){
void main_helper(int argc, char** argv){
// Program configuration and options
string config_filename = "config.txt";
getOptions(argc, argv, config_filename);
map<string,string> config = getConfig(config_filename);
map<string, string> config = getConfig(config_filename);
// Run TMSmesh or ESES to create protein's .off file
string protein_filename = pqrToOff(config);
......@@ -177,9 +174,8 @@ int main(int argc, char** argv){
command += "An" + quality_commands + " " + poly_filename;
cout << command << endl;
int status = std::system(command.c_str());
if (status < 0){
if (status < 0) {
throw std::runtime_error("Tetgen error.\nExiting\n");
exit(1);
}
// Separate membrane region with mem_gen
......@@ -188,9 +184,22 @@ int main(int argc, char** argv){
// Split volume mesh into membrane, solvent, protein regions
status = std::system("python3 ../splitMesh.py");
if (status < 0){
if (status < 0) {
throw std::runtime_error("splitMesh error.\nExiting\n");
exit(1);
}
}
// Main Program Driver
int main(int argc, char** argv) {
try {
main_helper(argc, argv);
}
catch (const std::exception& e) {
std::cerr << e.what() << '\n';
return 1;
}
return 0;
}
\ No newline at end of file
}
\ No newline at end of file
......@@ -126,27 +126,21 @@ private:
**/
int memGenMain(map<string,string>& config, string file_prefix) {
try {
MemGen generator;
// initialize filenames and membrane attributes
generator.node_file_name = file_prefix + ".node";
generator.ele_file_name = file_prefix + ".ele";
generator.neigh_file_name = file_prefix + ".neigh";
generator.outFileName = "output.xml";
generator.z_min = stod(getVal(config, "membrane_bottom_height"));
generator.z_max = stod(getVal(config, "membrane_top_height"));
// generate membrane and output in FEniCS .xml format
generator.readFiles();
generator.findStartingTetra();
generator.extractMembrane();
generator.genOutput();
}
catch (std::runtime_error& e){
cout << e.what();
return 1;
}
MemGen generator;
// initialize filenames and membrane attributes
generator.node_file_name = file_prefix + ".node";
generator.ele_file_name = file_prefix + ".ele";
generator.neigh_file_name = file_prefix + ".neigh";
generator.outFileName = "output.xml";
generator.z_min = stod(getVal(config, "membrane_bottom_height"));
generator.z_max = stod(getVal(config, "membrane_top_height"));
// generate membrane and output in FEniCS .xml format
generator.readFiles();
generator.findStartingTetra();
generator.extractMembrane();
generator.genOutput();
cout << "Membrane extraction complete\n";
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment