diff --git a/src/base/cli.cpp b/src/base/cli.cpp index 9f3c9964a..b9faaaaaf 100644 --- a/src/base/cli.cpp +++ b/src/base/cli.cpp @@ -115,36 +115,36 @@ void MasterData::debugCli(int argc, char *argv[]) { // Turn on call debugging case (Cli::DebugSwitch): - addDebugLevel(DM_CALLS); + Debug::addDebug(Debug::Calls); break; // Turn on debug messages for atom typing case (Cli::DebugTypingSwitch): - addDebugLevel(DM_TYPING); + Debug::addDebug(Debug::Typing); break; // Turn on debug messages for atom typing case (Cli::DebugParseSwitch): - addDebugLevel(DM_PARSE); + Debug::addDebug(Debug::Parse); break; // Turn on debug messages for atom typing case (Cli::DebugFileSwitch): - addDebugLevel(DM_FILTERS); + Debug::addDebug(Debug::Filters); break; // Turn on debug messages for more calls case (Cli::DebugMoreSwitch): - addDebugLevel(DM_CALLS); - addDebugLevel(DM_MORECALLS); + Debug::addDebug(Debug::Calls); + Debug::addDebug(Debug::MoreCalls); break; // Turn on debug messages for all calls case (Cli::DebugAllSwitch): - addDebugLevel(DM_CALLS); - addDebugLevel(DM_MORECALLS); - addDebugLevel(DM_VERBOSE); - addDebugLevel(DM_PARSE); - addDebugLevel(DM_TYPING); + Debug::addDebug(Debug::Calls); + Debug::addDebug(Debug::MoreCalls); + Debug::addDebug(Debug::Verbose); + Debug::addDebug(Debug::Parse); + Debug::addDebug(Debug::Typing); break; // Turn on verbose messaging case (Cli::VerboseSwitch): - addDebugLevel(DM_VERBOSE); + Debug::addDebug(Debug::Verbose); break; } } @@ -249,7 +249,7 @@ int MasterData::parseCli(int argc, char *argv[]) for (n=0; nnext) diff --git a/src/base/debug.cpp b/src/base/debug.cpp index 00952d8eb..a904282dc 100644 --- a/src/base/debug.cpp +++ b/src/base/debug.cpp @@ -27,18 +27,27 @@ */ // Bitvector of debug levels -int debug_output = 0; +int Debug::debugOutput = 0; // Formatting indent for call debugging output int funclevel = 0; // Add a debug level to the debug output bitvector -void addDebugLevel(DebugMode dm) { if (!(debug_output&dm)) debug_output += dm; } +void Debug::addDebug(Debug::DebugMode dm) +{ + if (!(Debug::debugOutput&dm)) Debug::debugOutput += dm; +} // Remove a debug level from the debug output bitvector -void removeDebugLevel(DebugMode dm) { if (debug_output&dm) debug_output -= dm; } +void Debug::removeDebug(Debug::DebugMode dm) +{ + if (Debug::debugOutput&dm) Debug::debugOutput -= dm; +} // Returns whether the specified debug level is set -bool isDebugLevelActive(DebugMode dm) { return ((debug_output&dm) ? TRUE : FALSE); } +bool Debug::isDebugActive(Debug::DebugMode dm) +{ + return ((Debug::debugOutput&dm) ? TRUE : FALSE); +} // Standard message -void msg(DebugMode dm, const char *fmt ...) +void msg(Debug::DebugMode dm, const char *fmt ...) { // Print to the text view in the main window if it has been initialised. // Otherwise, print to stdout. Also print to stdout if debuglevel >= msglevel. @@ -48,23 +57,23 @@ void msg(DebugMode dm, const char *fmt ...) // Parse the argument list (...) and internally write the output string into msgs[] va_start(arguments,fmt); vsprintf(msgs,fmt,arguments); - // We always print messages with mode DM_NONE to stdout *or* the GUI (if it has been initialised) + // We always print messages with mode Debug::None to stdout *or* the GUI (if it has been initialised) // For other message levels, only print if it's debug level is active - if (dm == DM_NONE) + if (dm == Debug::None) { if (gui.exists()) gui.printMessage(msgs); else printf("%s",msgs); } - else if (isDebugLevelActive(dm)) printf("%s",msgs); + else if (Debug::isDebugActive(dm)) printf("%s",msgs); va_end(arguments); } // Function enter -void dbgBegin(DebugMode dm, const char *fmt ...) +void dbgBegin(Debug::DebugMode dm, const char *fmt ...) { // Debug Messaging - Enter Function static char msgs[8096]; - if (!isDebugLevelActive(dm)) return; + if (!Debug::isDebugActive(dm)) return; va_list arguments; msgs[0] = '\0'; // Parse the argument list (...) and internally write the output string into msgs[] @@ -78,11 +87,11 @@ void dbgBegin(DebugMode dm, const char *fmt ...) } // Function leave -void dbgEnd(DebugMode dm, const char *fmt ...) +void dbgEnd(Debug::DebugMode dm, const char *fmt ...) { // Debug Messaging - Leave Function static char msgs[8096]; - if (!isDebugLevelActive(dm)) return; + if (!Debug::isDebugActive(dm)) return; va_list arguments; msgs[0] = '\0'; // Parse the argument list (...) and internally write the output string into msgs[] diff --git a/src/base/debug.h b/src/base/debug.h index cf340d350..8bb99875c 100644 --- a/src/base/debug.h +++ b/src/base/debug.h @@ -29,17 +29,22 @@ */ // Debug messaging modes -enum DebugMode { DM_NONE=0, DM_CALLS=1, DM_MORECALLS=2, DM_TYPING=4, DM_PARSE=8, DM_VERBOSE=16, DM_FILTERS=32 }; -// Add a debug level to the debug output bitvector -void addDebugLevel(DebugMode); -// Remove a debug level from the debug output bitvector -void removeDebugLevel(DebugMode); -// Returns whether the specified debug level is set -bool isDebugLevelActive(DebugMode); +namespace Debug +{ + enum DebugMode { None=0, Calls=1, MoreCalls=2, Typing=4, Parse=8, Verbose=16, Filters=32 }; + // Add a debug level to the debug output bitvector + void addDebug(Debug::DebugMode); + // Remove a debug level from the debug output bitvector + void removeDebug(Debug::DebugMode); + // Returns whether the specified debug level is set + bool isDebugActive(Debug::DebugMode); + // Bitvector of debug levels + extern int debugOutput; +} // Messaging Functions -void msg(DebugMode, const char* ...); -void dbgBegin(DebugMode, const char* ...); -void dbgEnd(DebugMode, const char* ...); +void msg(Debug::DebugMode, const char* ...); +void dbgBegin(Debug::DebugMode, const char* ...); +void dbgEnd(Debug::DebugMode, const char* ...); #endif diff --git a/src/base/elements.cpp b/src/base/elements.cpp index 568dd6a4f..6a907c808 100644 --- a/src/base/elements.cpp +++ b/src/base/elements.cpp @@ -414,12 +414,12 @@ int ElementMap::ffToZ(const char *s) int ElementMap::find(const char *query) { // Get the element number from the element name provided. - dbgBegin(DM_CALLS,"ElementMap::find"); + dbgBegin(Debug::Calls,"ElementMap::find"); int result = -1; if (query[0] == '\0') { printf("Warning: Element search requested on blank string.\n"); - dbgEnd(DM_CALLS,"ElementMap::find"); + dbgEnd(Debug::Calls,"ElementMap::find"); return 0; } // Convert the query string according to the specified rule @@ -462,7 +462,7 @@ int ElementMap::find(const char *query) result = numberToZ(query); break; } - dbgEnd(DM_CALLS,"ElementMap::find"); + dbgEnd(Debug::Calls,"ElementMap::find"); return ((result == -1) ? 0 : result); } diff --git a/src/base/master.cpp b/src/base/master.cpp index bbf3b1899..a3e0c806b 100644 --- a/src/base/master.cpp +++ b/src/base/master.cpp @@ -75,7 +75,7 @@ void MasterData::clear() // Set the active model void MasterData::setCurrentModel(Model *m) { - dbgBegin(DM_CALLS,"master::setCurrentModel"); + dbgBegin(Debug::Calls,"master::setCurrentModel"); // Set current.m and tell the mainview canvas to display it current.m = m; // Set other Bundle objects based on model @@ -84,7 +84,7 @@ void MasterData::setCurrentModel(Model *m) current.m->calculateViewMatrix(); current.m->projectAll(); gui.refresh(); - dbgEnd(DM_CALLS,"master::setCurrentModel"); + dbgEnd(Debug::Calls,"master::setCurrentModel"); } /* @@ -130,13 +130,13 @@ int MasterData::nModels() const // Add model Model *MasterData::addModel() { - dbgBegin(DM_CALLS,"master::addModel"); + dbgBegin(Debug::Calls,"master::addModel"); current.m = models_.add(); char newname[16]; sprintf(newname,"Unnamed%03i",++modelId_); current.m->setName(newname); gui.addModel(current.m); - dbgEnd(DM_CALLS,"master::addModel"); + dbgEnd(Debug::Calls,"master::addModel"); return current.m; } @@ -144,7 +144,7 @@ Model *MasterData::addModel() void MasterData::removeModel(Model *xmodel) { // Remove this model from the model_list in the main window - dbgBegin(DM_CALLS,"master::removeModel"); + dbgBegin(Debug::Calls,"master::removeModel"); Model *m; // Unset the datamodel for the canvas // Delete the current model, but don't allow there to be zero models_... @@ -156,17 +156,17 @@ void MasterData::removeModel(Model *xmodel) int id = models_.indexOf(xmodel); models_.remove(xmodel); gui.removeModel(id); - dbgEnd(DM_CALLS,"master::removeModel"); + dbgEnd(Debug::Calls,"master::removeModel"); } // Find model by name Model *MasterData::findModel(const char *s) const { // Search model list for name 's' (script function) - dbgBegin(DM_CALLS,"master::findModel"); + dbgBegin(Debug::Calls,"master::findModel"); Model *result = NULL; for (result = models_.first(); result != NULL; result = result->next) if (strcmp(s,result->name()) == 0) break; - dbgEnd(DM_CALLS,"master::findModel"); + dbgEnd(Debug::Calls,"master::findModel"); return result ; } @@ -195,11 +195,11 @@ Grid *MasterData::grid(int id) // Add new surface Grid *MasterData::addGrid() { - dbgBegin(DM_CALLS,"master::addGrid"); + dbgBegin(Debug::Calls,"master::addGrid"); current.g = grids_.add(); gui.addGrid(current.g); gui.selectGrid(current.g); - dbgEnd(DM_CALLS,"master::addGrid"); + dbgEnd(Debug::Calls,"master::addGrid"); return current.g; } @@ -221,13 +221,13 @@ void MasterData::removeGrid(Grid *xgrid) // Load forcefield Forcefield *MasterData::loadForcefield(const char *filename) { - dbgBegin(DM_CALLS,"master::loadForcefield"); + dbgBegin(Debug::Calls,"master::loadForcefield"); Forcefield *newff = forcefields_.add(); if (!newff->load(filename)) { - msg(DM_NONE,"Couldn't load forcefield file '%s'.\n",filename); + msg(Debug::None,"Couldn't load forcefield file '%s'.\n",filename); forcefields_.remove(newff); - dbgEnd(DM_CALLS,"master::loadForcefield"); + dbgEnd(Debug::Calls,"master::loadForcefield"); return NULL; } else @@ -235,14 +235,14 @@ Forcefield *MasterData::loadForcefield(const char *filename) gui.addForcefield(newff); current.ff = newff; } - dbgEnd(DM_CALLS,"master::loadForcefield"); + dbgEnd(Debug::Calls,"master::loadForcefield"); return newff; } // Unload forcefield from the master's list void MasterData::removeForcefield(Forcefield *xff) { - dbgBegin(DM_CALLS,"master::removeForcefield"); + dbgBegin(Debug::Calls,"master::removeForcefield"); Forcefield *newff; // If possible, set the active row to the next model. Otherwise, the previous. xff->next != NULL ? newff = xff->next : newff = xff->prev; @@ -252,18 +252,18 @@ void MasterData::removeForcefield(Forcefield *xff) gui.selectForcefield(newff); // Finally, delete the ff forcefields_.remove(xff); - dbgEnd(DM_CALLS,"master::removeForcefield"); + dbgEnd(Debug::Calls,"master::removeForcefield"); } // Find forcefield by name Forcefield *MasterData::findForcefield(const char *s) const { // Search forcefield list for name 's' (script function) - dbgBegin(DM_CALLS,"master::findForcefield"); + dbgBegin(Debug::Calls,"master::findForcefield"); Forcefield *ff; for (ff = forcefields_.first(); ff != NULL; ff = ff->next) if (strcmp(s,ff->name()) == 0) break; - if (ff == NULL) msg(DM_NONE,"Forcefield '%s' is not loaded.\n",s); - dbgEnd(DM_CALLS,"master::findForcefield"); + if (ff == NULL) msg(Debug::None,"Forcefield '%s' is not loaded.\n",s); + dbgEnd(Debug::Calls,"master::findForcefield"); return ff; } @@ -271,7 +271,7 @@ Forcefield *MasterData::findForcefield(const char *s) const void MasterData::dereferenceForcefield(Forcefield *xff) { // Remove references to the forcefield in the models - dbgBegin(DM_CALLS,"master::dereferenceForcefield"); + dbgBegin(Debug::Calls,"master::dereferenceForcefield"); for (Model *m = models_.first(); m != NULL; m = m->next) { if (m->forcefield() == xff) @@ -293,15 +293,15 @@ void MasterData::dereferenceForcefield(Forcefield *xff) } } } - dbgEnd(DM_CALLS,"master::dereferenceForcefield"); + dbgEnd(Debug::Calls,"master::dereferenceForcefield"); } // Set the default forcefield void MasterData::setDefaultForcefield(Forcefield *ff) { defaultForcefield_ = ff; - if (defaultForcefield_ == NULL) msg(DM_NONE,"Default forcefield has been unset.\n"); - else msg(DM_NONE,"Default forcefield is now '%s'.\n", defaultForcefield_->name()); + if (defaultForcefield_ == NULL) msg(Debug::None,"Default forcefield has been unset.\n"); + else msg(Debug::None,"Default forcefield is now '%s'.\n", defaultForcefield_->name()); } // Return the first ff in the list @@ -353,21 +353,21 @@ Forcefield *MasterData::defaultForcefield() const // Load filters bool MasterData::openFilters(const char *path, bool isdatadir) { - dbgBegin(DM_CALLS,"master::openFilters"); + dbgBegin(Debug::Calls,"master::openFilters"); // Load in model filters Filter *f; int n; char longname[512]; // Open the filter list file (in 'path/index') and read in the list of filters to load in... - if (isdatadir) msg(DM_NONE,"Loading default filters ('%s')...\n",path); - else msg(DM_NONE,"Loading user filters ('%s')...\n",path); + if (isdatadir) msg(Debug::None,"Loading default filters ('%s')...\n",path); + else msg(Debug::None,"Loading user filters ('%s')...\n",path); strcpy(longname,path); strcat(longname,"index"); ifstream listfile(longname,ios::in); if (!listfile.is_open()) { - if (isdatadir) msg(DM_NONE,"Default filter index file not found. Has $ATENDATA been set correctly?\n"); - else msg(DM_NONE,"No user filter index found in '%s'.\n",longname); + if (isdatadir) msg(Debug::None,"Default filter index file not found. Has $ATENDATA been set correctly?\n"); + else msg(Debug::None,"No user filter index found in '%s'.\n",longname); } else { @@ -381,7 +381,7 @@ bool MasterData::openFilters(const char *path, bool isdatadir) printf("%s ",parser.argc(0)); if (!loadFilter(longname)) { - dbgEnd(DM_CALLS,"master::openFilters"); + dbgEnd(Debug::Calls,"master::openFilters"); return FALSE; } } @@ -394,19 +394,19 @@ bool MasterData::openFilters(const char *path, bool isdatadir) // Set filter partners partnerFilters(); // Print data on loaded filters - msg(DM_NONE,"Found (import/export): Models (%i/%i) ", filters_[FT_MODEL_IMPORT].nItems(), filters_[FT_MODEL_EXPORT].nItems()); - msg(DM_NONE,"Trajectory (%i/%i) ", filters_[FT_TRAJECTORY_IMPORT].nItems(), filters_[FT_TRAJECTORY_EXPORT].nItems()); - msg(DM_NONE,"Expression (%i/%i) ", filters_[FT_EXPRESSION_IMPORT].nItems(), filters_[FT_EXPRESSION_EXPORT].nItems()); - msg(DM_NONE,"Grid (%i/%i)\n", filters_[FT_GRID_IMPORT].nItems(), filters_[FT_GRID_EXPORT].nItems()); + msg(Debug::None,"Found (import/export): Models (%i/%i) ", filters_[FT_MODEL_IMPORT].nItems(), filters_[FT_MODEL_EXPORT].nItems()); + msg(Debug::None,"Trajectory (%i/%i) ", filters_[FT_TRAJECTORY_IMPORT].nItems(), filters_[FT_TRAJECTORY_EXPORT].nItems()); + msg(Debug::None,"Expression (%i/%i) ", filters_[FT_EXPRESSION_IMPORT].nItems(), filters_[FT_EXPRESSION_EXPORT].nItems()); + msg(Debug::None,"Grid (%i/%i)\n", filters_[FT_GRID_IMPORT].nItems(), filters_[FT_GRID_EXPORT].nItems()); } - dbgEnd(DM_CALLS,"master::openFilters"); + dbgEnd(Debug::Calls,"master::openFilters"); return TRUE; } // Read commands from filter file bool MasterData::loadFilter(const char *filename) { - dbgBegin(DM_CALLS,"master::loadFilter"); + dbgBegin(Debug::Calls,"master::loadFilter"); FilterType ft; Filter *newfilter; bool foundmain, error; @@ -426,7 +426,7 @@ bool MasterData::loadFilter(const char *filename) // Unrecognised filter section? if (ft == FT_NITEMS) { - msg(DM_NONE,"Unrecognised section '%s' in filter.\n",parser.argc(0)); + msg(Debug::None,"Unrecognised section '%s' in filter.\n",parser.argc(0)); error = TRUE; break; } @@ -445,14 +445,14 @@ bool MasterData::loadFilter(const char *filename) } filterfile.close(); //variables.print(); - dbgEnd(DM_CALLS,"master::loadFilter"); + dbgEnd(Debug::Calls,"master::loadFilter"); return (!error); } // Set filter partners void MasterData::partnerFilters() { - dbgBegin(DM_CALLS,"master::partnerFilters"); + dbgBegin(Debug::Calls,"master::partnerFilters"); // Loop through import filters and search / set export partners Filter *imp, *exp; int importid; @@ -500,18 +500,18 @@ void MasterData::partnerFilters() if (exp == NULL) printf("o]"); } printf("\n"); - dbgEnd(DM_CALLS,"master::partnerFilters"); + dbgEnd(Debug::Calls,"master::partnerFilters"); } // Find filter with specified type and nickname Filter *MasterData::findFilter(FilterType ft, const char *nickname) const { - dbgBegin(DM_CALLS,"master::findFilter"); + dbgBegin(Debug::Calls,"master::findFilter"); Filter *result; for (result = filters_[ft].first(); result != NULL; result = result->next) if (strcmp(result->nickname(), nickname) == 0) break; - if (result == NULL) msg(DM_NONE,"No %s filter with nickname '%s' defined.\n",text_from_FT(ft),nickname); - dbgEnd(DM_CALLS,"master::findFilter"); + if (result == NULL) msg(Debug::None,"No %s filter with nickname '%s' defined.\n",text_from_FT(ft),nickname); + dbgEnd(Debug::Calls,"master::findFilter"); return result; } @@ -546,7 +546,7 @@ void MasterData::cancelProgress() // Spacegroup name search int MasterData::findSpacegroupByName(const char *name) const { - dbgBegin(DM_CALLS,"MasterData::findSpacegroupByName"); + dbgBegin(Debug::Calls,"MasterData::findSpacegroupByName"); int result = 0; for (int n=1; n<231; n++) if (strcmp(spacegroups[n].name,name) == 0) @@ -554,14 +554,14 @@ int MasterData::findSpacegroupByName(const char *name) const result = n; break; } - dbgEnd(DM_CALLS,"MasterData::findSpacegroupByName"); + dbgEnd(Debug::Calls,"MasterData::findSpacegroupByName"); return result; } // Cell type from spacegrgoup CellType MasterData::spacegroupCellType(int sg) const { - dbgBegin(DM_CALLS,"MasterData::spacegroupCellType"); + dbgBegin(Debug::Calls,"MasterData::spacegroupCellType"); CellType result = CT_NONE; // None if (sg == 0) result = CT_NONE; @@ -575,6 +575,6 @@ CellType MasterData::spacegroupCellType(int sg) const else if (sg < 195) result = CT_NONE; // Cubic else result = CT_CUBIC; - dbgBegin(DM_CALLS,"MasterData::spacegroupCellType"); + dbgBegin(Debug::Calls,"MasterData::spacegroupCellType"); return result; } diff --git a/src/base/prefs.cpp b/src/base/prefs.cpp index 72597cf3c..845fe828c 100644 --- a/src/base/prefs.cpp +++ b/src/base/prefs.cpp @@ -250,7 +250,7 @@ PrefsData::~PrefsData() // Load user preferences file void PrefsData::load(const char *filename) { - dbgBegin(DM_CALLS,"PrefsData::load"); + dbgBegin(Debug::Calls,"PrefsData::load"); int success; // Open the file ifstream prefsfile(filename,ios::in); @@ -258,7 +258,7 @@ void PrefsData::load(const char *filename) { printf("Couldn't open preferences file in '%s'\n",filename); prefsfile.close(); - dbgEnd(DM_CALLS,"PrefsData::load"); + dbgEnd(Debug::Calls,"PrefsData::load"); return; } // Create script structure and initialise @@ -269,7 +269,7 @@ void PrefsData::load(const char *filename) success = parser.getArgsDelim(&prefsfile,PO_USEQUOTES+PO_SKIPBLANKS); if (success == 1) { - msg(DM_NONE,"prefs::load - Error reading file.\n"); + msg(Debug::None,"prefs::load - Error reading file.\n"); break; } else if (success == -1) break; @@ -280,11 +280,11 @@ void PrefsData::load(const char *filename) if (prefcmds.nBranches() != 1) { printf("%i unterminated blocks in prefs file.\n",prefcmds.nBranches()); - dbgEnd(DM_CALLS,"prefs::load"); + dbgEnd(Debug::Calls,"prefs::load"); return; } prefcmds.execute(); - dbgEnd(DM_CALLS,"prefs::load"); + dbgEnd(Debug::Calls,"prefs::load"); } /* diff --git a/src/base/spacegroup.cpp b/src/base/spacegroup.cpp index 8d77a12ff..abda8b2bf 100644 --- a/src/base/spacegroup.cpp +++ b/src/base/spacegroup.cpp @@ -498,7 +498,7 @@ void symmop::set(const char *xyzstr) // Sets the rotation matrix and translation vector. // String format is, for example, "-y,x,z,0.0,0.0,0.5", corresponding to a matrix whose rows are (0,-1,0), (1,0,0), and (0,0,1) respectively, // and a translation vector of (0,0,0.5) - dbgBegin(DM_CALLS,"symmop::set"); + dbgBegin(Debug::Calls,"symmop::set"); static int n,m,i; static Dnchar temps, s; static char dat[32]; @@ -541,7 +541,7 @@ void symmop::set(const char *xyzstr) translation.set(n-3,atof(temps.get())); } identity = FALSE; - dbgEnd(DM_CALLS,"symmop::set"); + dbgEnd(Debug::Calls,"symmop::set"); } // Set from xyz string @@ -549,7 +549,7 @@ void symmop::set_from_xyz(const char *xyzstr) { // Sets the rotation matrix and translation vector. // String format is, for example, "-y,x,z+1/2", corresponding to a matrix whose rows are (0,-1,0), (1,0,0), and (0,0,1) respectively, - // and a translation vector of (0,0,0.5). Detect if an identity transformation (x,y,z,0,0,0) is passed and flag 'identity' variable. dbgBegin(DM_CALLS,"symmop::set_from_xyz"); + // and a translation vector of (0,0,0.5). Detect if an identity transformation (x,y,z,0,0,0) is passed and flag 'identity' variable. dbgBegin(Debug::Calls,"symmop::set_from_xyz"); int n,m,i,pos; Dnchar temps, s, dat, temp2; s = xyzstr; @@ -613,8 +613,8 @@ void symmop::set_from_xyz(const char *xyzstr) } } // Print out a message if we detected this was the identity operator - if (identity) msg(DM_NONE,"Added an identity operator - will be ignored in symmetry transformation.\n"); - dbgEnd(DM_CALLS,"symmop::set_from_xyz"); + if (identity) msg(Debug::None,"Added an identity operator - will be ignored in symmetry transformation.\n"); + dbgEnd(Debug::Calls,"symmop::set_from_xyz"); } */ diff --git a/src/base/sysfunc.cpp b/src/base/sysfunc.cpp index 3a0bc9936..0ae0dbdef 100644 --- a/src/base/sysfunc.cpp +++ b/src/base/sysfunc.cpp @@ -135,7 +135,7 @@ const char *removePath(const char *s) // Search for string in delimited string list int sinlist(const char *search, const char *list) { - dbgBegin(DM_PARSE,"sinlist"); + dbgBegin(Debug::Parse,"sinlist"); static int cpos, count, result; static Dnchar arg, arglist; arglist.set(list); @@ -158,14 +158,14 @@ int sinlist(const char *search, const char *list) } if (arg == search) { - msg(DM_PARSE,"sinlist [%s->%s==%s]\n",list,arg.get(),search); + msg(Debug::Parse,"sinlist [%s->%s==%s]\n",list,arg.get(),search); result = count; break; } - else msg(DM_PARSE,"sinlist [%s->%s<>%s]\n",list,arg.get(),search); + else msg(Debug::Parse,"sinlist [%s->%s<>%s]\n",list,arg.get(),search); count ++; } - dbgEnd(DM_PARSE,"sinlist"); + dbgEnd(Debug::Parse,"sinlist"); return result; } @@ -260,7 +260,7 @@ const char *evaluate(const char *s, VariableList *vars) { v = vars->get(&arg[1]); a = (v == NULL ? 0.0 : v->asDouble()); - if (v == NULL) msg(DM_NONE,"Warning: Unrecognised variable '%s' in expression - using zero...\n",&arg[1]); + if (v == NULL) msg(Debug::None,"Warning: Unrecognised variable '%s' in expression - using zero...\n",&arg[1]); } else a = atof(arg); strcpy(arg,parser.argc(rightarg)); @@ -268,7 +268,7 @@ const char *evaluate(const char *s, VariableList *vars) { v = vars->get(&arg[1]); b = (v == NULL ? 0.0 : v->asDouble()); - if (v == NULL) msg(DM_NONE,"Warning: Unrecognised variable '%s' in expression - using zero...\n",&arg[1]); + if (v == NULL) msg(Debug::None,"Warning: Unrecognised variable '%s' in expression - using zero...\n",&arg[1]); } else b = atof(arg); switch (*c) diff --git a/src/classes/atom.cpp b/src/classes/atom.cpp index b2bfa9088..60796b18c 100644 --- a/src/classes/atom.cpp +++ b/src/classes/atom.cpp @@ -247,27 +247,27 @@ void Atom::copyStyle(Atom *source) // Print void Atom::print() { - msg(DM_NONE,"Atom ID %i (%s):\n", id_, elements.name(this)); - msg(DM_NONE," %s, %s, style is %s.\n", (selected_ ? "Selected" : "Not selected"), (hidden_ ? "hidden" : "not hidden"), drawStyleKeyword(style_)); - msg(DM_NONE," Model Coord : %8.4f %8.4f %8.4f\n",r_.x,r_.y,r_.z); - msg(DM_NONE," World Coord : %8.4f %8.4f %8.4f\n",rWorld_.x,rWorld_.y,rWorld_.z); - msg(DM_NONE,"Screen Coord : %8.4f %8.4f \n",rScreen_.x,rScreen_.y,rScreen_.z); - msg(DM_NONE," Velocities : %8.4f %8.4f %8.4f\n",v_.x,v_.y,v_.z); - msg(DM_NONE," Forces : %8.4f %8.4f %8.4f\n",f_.x,f_.y,f_.z); - msg(DM_NONE," Charge : %8.4f\n",charge_); - msg(DM_NONE," FFType : %s\n",(type_ != NULL ? type_->name() : "None")); - msg(DM_NONE," Bonds : %i\n",bonds_.nItems()); - msg(DM_NONE," Environment : %s\n",text_from_AE(env_)); - msg(DM_NONE," O.S. : %i\n",os_); + msg(Debug::None,"Atom ID %i (%s):\n", id_, elements.name(this)); + msg(Debug::None," %s, %s, style is %s.\n", (selected_ ? "Selected" : "Not selected"), (hidden_ ? "hidden" : "not hidden"), drawStyleKeyword(style_)); + msg(Debug::None," Model Coord : %8.4f %8.4f %8.4f\n",r_.x,r_.y,r_.z); + msg(Debug::None," World Coord : %8.4f %8.4f %8.4f\n",rWorld_.x,rWorld_.y,rWorld_.z); + msg(Debug::None,"Screen Coord : %8.4f %8.4f \n",rScreen_.x,rScreen_.y,rScreen_.z); + msg(Debug::None," Velocities : %8.4f %8.4f %8.4f\n",v_.x,v_.y,v_.z); + msg(Debug::None," Forces : %8.4f %8.4f %8.4f\n",f_.x,f_.y,f_.z); + msg(Debug::None," Charge : %8.4f\n",charge_); + msg(Debug::None," FFType : %s\n",(type_ != NULL ? type_->name() : "None")); + msg(Debug::None," Bonds : %i\n",bonds_.nItems()); + msg(Debug::None," Environment : %s\n",text_from_AE(env_)); + msg(Debug::None," O.S. : %i\n",os_); } // Print summary void Atom::printSummary() { // Print format : " Id El FFType X Y Z Q S" - msg(DM_NONE," %-5i %-3s %-8s", id_, elements.symbol(this),(type_ != NULL ? type_->name() : "None")); - msg(DM_NONE," %13.6e %13.6e %13.6e %13.6e ",r_.x, r_.y, r_.z, charge_); - msg(DM_NONE,"%c \n",(selected_ ? 'x' : ' ')); + msg(Debug::None," %-5i %-3s %-8s", id_, elements.symbol(this),(type_ != NULL ? type_->name() : "None")); + msg(Debug::None," %13.6e %13.6e %13.6e %13.6e ",r_.x, r_.y, r_.z, charge_); + msg(Debug::None,"%c \n",(selected_ ? 'x' : ' ')); } /* @@ -302,7 +302,7 @@ void Atom::acceptBond(Bond *b) void Atom::detachBond(Bond *xbond) { // Remove the reference to the bond from the Reflist on the atom. - dbgBegin(DM_MORECALLS,"Atom::detachBond"); + dbgBegin(Debug::MoreCalls,"Atom::detachBond"); // Mark pointer as NULL. If both are NULL, delete the bond. bonds_.remove(xbond); if (xbond->atomI() == this) @@ -315,7 +315,7 @@ void Atom::detachBond(Bond *xbond) xbond->setAtomJ(NULL); if (xbond->atomI() == NULL) delete xbond; } - dbgEnd(DM_MORECALLS,"Atom::detachBond"); + dbgEnd(Debug::MoreCalls,"Atom::detachBond"); } // Total bond order @@ -323,29 +323,29 @@ int Atom::totalBondOrder() { // Calculate the total bond order of the atom // Returned result is 2*actual bond order (to account for resonant bonds [BO = 1.5]) - dbgBegin(DM_CALLS,"Atom::totalBondOrder"); + dbgBegin(Debug::Calls,"Atom::totalBondOrder"); int result = 0; for (Refitem *bref = bonds(); bref != NULL; bref = bref->next) result += (2 * bref->item->order()); - dbgEnd(DM_CALLS,"Atom::totalBondOrder"); + dbgEnd(Debug::Calls,"Atom::totalBondOrder"); return result; } // Count bonds of specific type int Atom::countBonds(Bond::BondType type) { - dbgBegin(DM_CALLS,"Atom::countBonds"); + dbgBegin(Debug::Calls,"Atom::countBonds"); int count = 0; for (Refitem *bref = bonds(); bref != NULL; bref = bref->next) if (bref->item->order() == type) count ++; - dbgEnd(DM_CALLS,"Atom::countBonds"); + dbgEnd(Debug::Calls,"Atom::countBonds"); return count; } // Find bond to atom 'j' Bond *Atom::findBond(Atom *j) { - dbgBegin(DM_MORECALLS,"Atom::findBond"); + dbgBegin(Debug::MoreCalls,"Atom::findBond"); Bond *result = NULL; Refitem *bref = bonds(); while (bref != NULL) @@ -353,7 +353,7 @@ Bond *Atom::findBond(Atom *j) if (bref->item->partner(this) == j) result = bref->item; bref = bref->next; } - dbgEnd(DM_MORECALLS,"Atom::findBond"); + dbgEnd(Debug::MoreCalls,"Atom::findBond"); return result; } @@ -362,7 +362,7 @@ double Atom::bondOrder(Atom *j) { // Returns the (fractional) bond order of the bond between this atom and j. // Aromatic bonds are given a bond order of 1.5. - dbgBegin(DM_CALLS,"Atom::bondOrder"); + dbgBegin(Debug::Calls,"Atom::bondOrder"); double order; // First, find the bond Bond *b = findBond(j); @@ -370,21 +370,21 @@ double Atom::bondOrder(Atom *j) if (b == NULL) { printf("bondOrder : Failed to find bond between atoms!\n"); - dbgEnd(DM_CALLS,"Atom::bondOrder"); + dbgEnd(Debug::Calls,"Atom::bondOrder"); return 0.0; } // Get the enum'd type of the bond and 'convert' it to the bond order order = b->order(); // Special case where both atoms are AE_AROMATIC - bond order is then 1.5. if ((env_ == AE_AROMATIC) && (j->env_ == AE_AROMATIC)) order = 1.5; - dbgEnd(DM_CALLS,"Atom::bondOrder"); + dbgEnd(Debug::Calls,"Atom::bondOrder"); return order; } // Determine bonding geometry AtomGeometry Atom::geometry(Model *parent) { - dbgBegin(DM_CALLS,"Atom::geometry"); + dbgBegin(Debug::Calls,"Atom::geometry"); static AtomGeometry result; static double angle, largest; static Bond *b1, *b2; @@ -447,7 +447,7 @@ AtomGeometry Atom::geometry(Model *parent) result = ((angle/6.0) > 115.0 ? AG_SQPLANAR : AG_TETRAHEDRAL); break; } - dbgEnd(DM_CALLS,"Atom::geometry"); + dbgEnd(Debug::Calls,"Atom::geometry"); return result; } diff --git a/src/classes/atomtype.cpp b/src/classes/atomtype.cpp index 8fe937b4b..26ed87716 100644 --- a/src/classes/atomtype.cpp +++ b/src/classes/atomtype.cpp @@ -132,7 +132,7 @@ void Atomtype::print() void Atomtype::setElements(const char *ellist, Forcefield *ff) { // Add elements from the comma-separated ellist string as possible matches for this Atomtype - dbgBegin(DM_CALLS,"Atomtype::setElements"); + dbgBegin(Debug::Calls,"Atomtype::setElements"); int n, count, el; ForcefieldAtom *ffa; Dnchar temp; @@ -143,7 +143,7 @@ void Atomtype::setElements(const char *ellist, Forcefield *ff) allowedElements_ = new int[nAllowedElements_]; count = 0; // Go through items in 'element' list... - msg(DM_TYPING," %i atom types/elements given for Atomtype : ",nAllowedElements_); + msg(Debug::Typing," %i atom types/elements given for Atomtype : ",nAllowedElements_); for (n=0; n>>>\n"); - msg(DM_TYPING,"%s ",parser.argc(n)); + msg(Debug::Typing,"%s ",parser.argc(n)); } else { @@ -173,19 +173,19 @@ void Atomtype::setElements(const char *ellist, Forcefield *ff) if (el == 0) { nAllowedElements_ --; - msg(DM_NONE,"Warning : Unrecognised element in list of bound atoms: '%s'\n",parser.argc(n)); - msg(DM_TYPING,"?%s? ",parser.argc(n)); + msg(Debug::None,"Warning : Unrecognised element in list of bound atoms: '%s'\n",parser.argc(n)); + msg(Debug::Typing,"?%s? ",parser.argc(n)); } else { allowedElements_[count] = el; count ++; - msg(DM_TYPING,"%s ",parser.argc(n)); + msg(Debug::Typing,"%s ",parser.argc(n)); } } } - msg(DM_TYPING,"\n"); - dbgEnd(DM_CALLS,"Atomtype::setElements"); + msg(Debug::Typing,"\n"); + dbgEnd(Debug::Calls,"Atomtype::setElements"); } /* @@ -213,7 +213,7 @@ void RingType::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) { // Separate function (to prevent brain melting) to recursively create a ring definition. // At least allows the restriction (and addition) of commands to the ring command. - dbgBegin(DM_CALLS,"RingType::expand"); + dbgBegin(Debug::Calls,"RingType::expand"); Dnchar keywd, optlist, def; static char c; static int level = 0; @@ -221,17 +221,17 @@ void RingType::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) static RingTypeCommand rtc; static Atomtype *newat; level ++; - msg(DM_TYPING,"expand[ring] : Received string [%s]\n",data); + msg(Debug::Typing,"expand[ring] : Received string [%s]\n",data); // Grab the next command, trip the keyword and option list (if there is one). def.set(data); do { // Get next command and repeat - msg(DM_TYPING,"Command String : [%s]\n",def.get()); + msg(Debug::Typing,"Command String : [%s]\n",def.get()); optlist = parser.parseAtomtypeString(def); keywd = parser.trimAtomtypeKeyword(optlist); - msg(DM_TYPING," Keyword : [%s]\n",keywd.get()); - msg(DM_TYPING," Options : [%s]\n",optlist.get()); + msg(Debug::Typing," Keyword : [%s]\n",keywd.get()); + msg(Debug::Typing," Options : [%s]\n",optlist.get()); found = FALSE; // Check for Atomtype specifier ('-' or '='). Both mean the same here... c = keywd[0]; @@ -267,14 +267,14 @@ void RingType::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) break; // Unrecognised default: - if (parent != NULL) msg(DM_NONE,"Unrecognised command '%s' found while expanding ring at depth %i [ffid/name %i/%s].\n", keywd.get(), level, parent->typeId(), parent->name()); - else msg(DM_NONE,"RingType::expand - Unrecognised command (%s).\n", keywd.get()); + if (parent != NULL) msg(Debug::None,"Unrecognised command '%s' found while expanding ring at depth %i [ffid/name %i/%s].\n", keywd.get(), level, parent->typeId(), parent->name()); + else msg(Debug::None,"RingType::expand - Unrecognised command (%s).\n", keywd.get()); break; } } } while (!def.empty()); level --; - dbgEnd(DM_CALLS,"RingType::expand"); + dbgEnd(Debug::Calls,"RingType::expand"); } // Master creation routine, returning the head node of an Atomtype structure. @@ -290,7 +290,7 @@ void Atomtype::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) // The supplied string should contain a keyword followed by (optional) bracketed list of specs. // Parent ring structure must be supplied when descending into a ring options structure. // Parent pointer is used for error reporting - dbgBegin(DM_CALLS,"Atomtype::expand"); + dbgBegin(Debug::Calls,"Atomtype::expand"); Dnchar keywd, optlist, def; static RingType *newring; static bool found; @@ -299,22 +299,22 @@ void Atomtype::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) static AtomGeometry ag; static AtomtypeCommand atc; level ++; - msg(DM_TYPING,"Atomtype::expand - Received string [%s]\n",data); + msg(Debug::Typing,"Atomtype::expand - Received string [%s]\n",data); if (data[0] == '\0') { level --; - dbgEnd(DM_CALLS,"Atomtype::expand"); + dbgEnd(Debug::Calls,"Atomtype::expand"); return; } // Grab the next command, strip the keyword and option list (if there is one). def.set(data); do { - msg(DM_TYPING,"Command String : [%s]\n",def.get()); + msg(Debug::Typing,"Command String : [%s]\n",def.get()); optlist = parser.parseAtomtypeString(def); keywd = parser.trimAtomtypeKeyword(optlist); - msg(DM_TYPING," Keyword : [%s]\n",keywd.get()); - msg(DM_TYPING," Options : [%s]\n",optlist.get()); + msg(Debug::Typing," Keyword : [%s]\n",keywd.get()); + msg(Debug::Typing," Options : [%s]\n",optlist.get()); // Check for 'bound to' specifiers first ('-' or '=') // Bound atom spec - create new subnode and add it to the bound list. // Format is either '-X(options...)' or '-[X1,X2,X3](options...)' (single or list of elements respectively) @@ -392,14 +392,14 @@ void Atomtype::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) if (ag != AG_NITEMS) geometry_ = ag; else { - if (parent != NULL) msg(DM_NONE,"Unrecognised command '%s' found while expanding atom at depth %i [ffid/name %i/%s].\n", keywd.get(), level, parent->typeId(), parent->name()); - else msg(DM_NONE,"Unrecognised command '%s' found while expanding atom.\n", keywd.get()); + if (parent != NULL) msg(Debug::None,"Unrecognised command '%s' found while expanding atom at depth %i [ffid/name %i/%s].\n", keywd.get(), level, parent->typeId(), parent->name()); + else msg(Debug::None,"Unrecognised command '%s' found while expanding atom.\n", keywd.get()); break; } } } while (!def.empty()); level --; - dbgEnd(DM_CALLS,"Atomtype::expand"); + dbgEnd(Debug::Calls,"Atomtype::expand"); } /* @@ -408,7 +408,7 @@ void Atomtype::expand(const char *data, Forcefield *ff, ForcefieldAtom *parent) int Atomtype::matchInList(Reflist *alist, List *ringdata, Model *parent, Atom *topatom) { - dbgBegin(DM_CALLS,"Atomtype::matchInList"); + dbgBegin(Debug::Calls,"Atomtype::matchInList"); // Search the atomlist supplied for a match to this Atomtype. // If we find one, remove the corresponding atom from the atomlist. int score = 0, bondscore; @@ -426,12 +426,12 @@ int Atomtype::matchInList(Reflist *alist, List *ringdata, Model if (boundi != NULL) { alist->remove(boundi); - dbgEnd(DM_CALLS,"Atomtype::matchInList"); + dbgEnd(Debug::Calls,"Atomtype::matchInList"); return bondscore+score; } else { - dbgEnd(DM_CALLS,"Atomtype::matchInList"); + dbgEnd(Debug::Calls,"Atomtype::matchInList"); return 0; } } @@ -441,7 +441,7 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa // Given the supplied atom pointer and ring data pointer (passed from pattern) // see how well the description matches the actual atom, returning as an int. Cycle data is // available in (pattern->)rings. Exit and return 0 as soon as a test fails. - dbgBegin(DM_CALLS,"Atomtype::match_atom"); + dbgBegin(Debug::Calls,"Atomtype::match_atom"); static int level = 0; int typescore, atomscore, ringscore, n; bool found; @@ -457,10 +457,10 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa // Set the scoring to one (which will be the case if there are no specifications to match) typescore = 1; level ++; - msg(DM_TYPING,"(%li %2i) Looking to match atom %s: nbonds=%i, env=%s\n", this, level, elements.symbol(i), i->nBonds(), text_from_AE(i->env())); + msg(Debug::Typing,"(%li %2i) Looking to match atom %s: nbonds=%i, env=%s\n", this, level, elements.symbol(i), i->nBonds(), text_from_AE(i->env())); // Element check - msg(DM_TYPING,"(%li %2i) ... Element ",this,level); - if (nAllowedElements_ == 0) msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Element ",this,level); + if (nAllowedElements_ == 0) msg(Debug::Typing,"[defaulted]\n"); else { // Check through list of elements/types that this atom is allowed to be @@ -491,93 +491,93 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa if (found) { typescore++; - msg(DM_TYPING,"[passed]\n"); + msg(Debug::Typing,"[passed]\n"); } else { - msg(DM_TYPING,"[failed - is %i, but type needs %i]\n", i->element(), characterElement_); + msg(Debug::Typing,"[failed - is %i, but type needs %i]\n", i->element(), characterElement_); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // Atom environment check - msg(DM_TYPING,"(%li %2i) ... Environment ",this,level); - if (env_ == AE_UNSPECIFIED) msg(DM_TYPING," [defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Environment ",this,level); + if (env_ == AE_UNSPECIFIED) msg(Debug::Typing," [defaulted]\n"); else { if (i->isEnv(env_)) { typescore++; - msg(DM_TYPING,"[passed - matched '%s']\n",text_from_AE(i->env())); + msg(Debug::Typing,"[passed - matched '%s']\n",text_from_AE(i->env())); } else { - msg(DM_TYPING,"[failed - is '%s', but type needs %s]\n", text_from_AE(i->env()), text_from_AE(env_)); + msg(Debug::Typing,"[failed - is '%s', but type needs %s]\n", text_from_AE(i->env()), text_from_AE(env_)); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // Oxidation state check - msg(DM_TYPING,"(%li %2i) ... Oxidation state ",this,level); - if (os_ == 99) msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Oxidation state ",this,level); + if (os_ == 99) msg(Debug::Typing,"[defaulted]\n"); else { if (i->isOs(os_)) { typescore++; - msg(DM_TYPING,"[passed - matched '%i']\n",i->os()); + msg(Debug::Typing,"[passed - matched '%i']\n",i->os()); } else { - msg(DM_TYPING,"[failed - is '%s', but type needs '%s']\n", i->os(), os_); + msg(Debug::Typing,"[failed - is '%s', but type needs '%s']\n", i->os(), os_); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // Number of bound atoms check - msg(DM_TYPING,"(%li %2i) ... Bond number ",this,level); - if (nBonds_ == -1) msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Bond number ",this,level); + if (nBonds_ == -1) msg(Debug::Typing,"[defaulted]\n"); else { if (i->isNBonds(nBonds_)) { typescore++; - msg(DM_TYPING,"[passed - matched '%i']\n",i->nBonds()); + msg(Debug::Typing,"[passed - matched '%i']\n",i->nBonds()); } else { - msg(DM_TYPING,"[failed - is '%i', but type needs '%i']\n",i->nBonds(),nBonds_); + msg(Debug::Typing,"[failed - is '%i', but type needs '%i']\n",i->nBonds(),nBonds_); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // Local atom geometry check - msg(DM_TYPING,"(%li %2i) ... Geometry ",this,level); - if (geometry_ == AG_UNSPECIFIED) msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Geometry ",this,level); + if (geometry_ == AG_UNSPECIFIED) msg(Debug::Typing,"[defaulted]\n"); else { if (i->geometry(parent) == geometry_) { typescore++; - msg(DM_TYPING,"[passed - matched '%s']\n",text_from_AG(geometry_)); + msg(Debug::Typing,"[passed - matched '%s']\n",text_from_AG(geometry_)); } else { - msg(DM_TYPING,"[failed - is '%s', but type needs '%s']\n",text_from_AG(i->geometry(parent)), text_from_AG(geometry_)); + msg(Debug::Typing,"[failed - is '%s', but type needs '%s']\n",text_from_AG(i->geometry(parent)), text_from_AG(geometry_)); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // Construct bound atom list for subsequent checks... i->addBoundToReflist(&atomchecklist); // Hydrogen check - msg(DM_TYPING,"(%li %2i) ... Attached hydrogens ",this,level); - if (nHydrogen_ == -1) msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"(%li %2i) ... Attached hydrogens ",this,level); + if (nHydrogen_ == -1) msg(Debug::Typing,"[defaulted]\n"); else { // Get number of hydrogen atoms appearing in the atomchecklist... @@ -586,44 +586,44 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa if (nHydrogen_ == n) { typescore++; - msg(DM_TYPING,"[passed - matched '%i']\n",n); + msg(Debug::Typing,"[passed - matched '%i']\n",n); } else { - msg(DM_TYPING,"[failed - is '%i', but type needs '%i']\n", n, nHydrogen_); + msg(Debug::Typing,"[failed - is '%i', but type needs '%i']\n", n, nHydrogen_); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } // List of bound atoms check - if (boundList_.first() == NULL) msg(DM_TYPING,"(%li %2i) ... Bound atoms [defaulted]\n",this,level); + if (boundList_.first() == NULL) msg(Debug::Typing,"(%li %2i) ... Bound atoms [defaulted]\n",this,level); else { for (bat = boundList_.first(); bat != NULL; bat = bat->next) { for (n=0; nnRepeat_; n++) { - msg(DM_TYPING,"(%li %2i) ... Bound atom %li (%i/%i):\n",this,level,bat,n+1,bat->nRepeat_); + msg(Debug::Typing,"(%li %2i) ... Bound atom %li (%i/%i):\n",this,level,bat,n+1,bat->nRepeat_); // Check the atomlist for a match to the bound Atomtype atomscore = bat->matchInList(&atomchecklist,ringdata,parent,topatom); if (atomscore != 0) { - msg(DM_TYPING,"(%li %2i) ... Bound atom %li (%i/%i) [passed]\n",this,level,bat,n+1,bat->nRepeat_); + msg(Debug::Typing,"(%li %2i) ... Bound atom %li (%i/%i) [passed]\n",this,level,bat,n+1,bat->nRepeat_); typescore += atomscore; } else { - msg(DM_TYPING,"(%li %2i) ... Bound atom %li (%i/%i) [failed]\n",this,level,bat,n+1,bat->nRepeat_); + msg(Debug::Typing,"(%li %2i) ... Bound atom %li (%i/%i) [failed]\n",this,level,bat,n+1,bat->nRepeat_); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } } } // Ring check - if (ringList_.first() == NULL) msg(DM_TYPING,"(%li %2i) ... Rings [defaulted]\n",this,level); + if (ringList_.first() == NULL) msg(Debug::Typing,"(%li %2i) ... Rings [defaulted]\n",this,level); else { // Get list of rings out test atom is involved in @@ -635,7 +635,7 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa { for (n=0; nnRepeat_; n++) { - msg(DM_TYPING,"(%li %2i) ... Ring (%li) (%i/%i):\n",this,level,atr,n+1,atr->nRepeat_); + msg(Debug::Typing,"(%li %2i) ... Ring (%li) (%i/%i):\n",this,level,atr,n+1,atr->nRepeat_); // Loop over rings our atom is involved in, searching for a match. for (refring = ringchecklist.first(); refring != NULL; refring = refring->next) { @@ -648,25 +648,25 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa else ringscore ++; } // Size check - msg(DM_TYPING,"(%li %2i) ... ... Size ",this,level); + msg(Debug::Typing,"(%li %2i) ... ... Size ",this,level); if (atr->nAtoms_ == -1) { - msg(DM_TYPING,"[defaulted]\n"); + msg(Debug::Typing,"[defaulted]\n"); ringscore ++; } else if (atr->nAtoms_ == refring->item->nAtoms()) { - msg(DM_TYPING,"[passed - matched '%i']\n",atr->nAtoms_); + msg(Debug::Typing,"[passed - matched '%i']\n",atr->nAtoms_); ringscore ++; } else { - msg(DM_TYPING,"[failed]\n"); + msg(Debug::Typing,"[failed]\n"); continue; } // Get the list of other atoms in this ring ready for searching. - msg(DM_TYPING,"(%li %2i) ... ... Atoms:\n", this, level); + msg(Debug::Typing,"(%li %2i) ... ... Atoms:\n", this, level); atomchecklist.clear(); refring->item->addAtomsToReflist(&atomchecklist,NULL); // Now go through list of specified Atomtypes in this RingType @@ -674,16 +674,16 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa { for (n=0; nnRepeat_; n++) { - msg(DM_TYPING,"(%li %2i) ... ... ... Atom (%li) (%i/%i) ",this,level,bat,n+1,bat->nRepeat_); + msg(Debug::Typing,"(%li %2i) ... ... ... Atom (%li) (%i/%i) ",this,level,bat,n+1,bat->nRepeat_); atomscore = bat->matchInList(&atomchecklist, ringdata, parent, topatom); if (atomscore != 0) { - msg(DM_TYPING,"[passed]\n"); + msg(Debug::Typing,"[passed]\n"); ringscore += atomscore; } else { - msg(DM_TYPING,"[failed]\n"); + msg(Debug::Typing,"[failed]\n"); // Don't fully return just yet - move onto next ring... ringscore = 0; break; @@ -698,16 +698,16 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa // Check 'refring' - if NULL then we did not manage to find a match for the ring if (refring != NULL) { - msg(DM_TYPING,"(%li %2i) ... Ring (%li) [passed]\n",this,level,atr); + msg(Debug::Typing,"(%li %2i) ... Ring (%li) [passed]\n",this,level,atr); typescore += ringscore; // Remove matched ring from list ringchecklist.remove(refring); } else { - msg(DM_TYPING,"(%li %2i) ... Ring (%li) [failed]\n",this,level,atr); + msg(Debug::Typing,"(%li %2i) ... Ring (%li) [failed]\n",this,level,atr); level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return 0; } } //End of loop over repeats @@ -715,7 +715,7 @@ int Atomtype::matchAtom(Atom* i, List *ringdata, Model *parent, Atom *topa } // All checks completed, so return the final typing score level --; - dbgEnd(DM_CALLS,"Atomtype::match_atom"); + dbgEnd(Debug::Calls,"Atomtype::match_atom"); return typescore; } diff --git a/src/classes/cell.cpp b/src/classes/cell.cpp index a09af8d54..23cedc0b2 100644 --- a/src/classes/cell.cpp +++ b/src/classes/cell.cpp @@ -192,7 +192,7 @@ double Cell::density() const // Determine Type void Cell::determineType() { - dbgBegin(DM_CALLS,"Cell::determineType"); + dbgBegin(Debug::Calls,"Cell::determineType"); // Compare cell angles_.... double ab, bc, ac; int count = 0; @@ -210,13 +210,13 @@ void Cell::determineType() else type_ = CT_ORTHORHOMBIC; } else type_ = CT_PARALLELEPIPED; - dbgEnd(DM_CALLS,"Cell::determineType"); + dbgEnd(Debug::Calls,"Cell::determineType"); } // Set (by parameters) void Cell::set(const Vec3 &newlengths, const Vec3 &newangles) { - dbgBegin(DM_CALLS,"Cell::set[parameters]"); + dbgBegin(Debug::Calls,"Cell::set[parameters]"); double temp; // Store cell lengths and angles (in degrees) in structure angles_ = newangles; @@ -245,13 +245,13 @@ void Cell::set(const Vec3 &newlengths, const Vec3 &newangles) calculateCentre(); calculateInverse(); calculateReciprocal(); - dbgEnd(DM_CALLS,"Cell::set[parameters]"); + dbgEnd(Debug::Calls,"Cell::set[parameters]"); } // Set (by matrix) void Cell::set(const Mat3 &newaxes) { - dbgBegin(DM_CALLS,"Cell::set[matrix]"); + dbgBegin(Debug::Calls,"Cell::set[matrix]"); // Store the supplied matrix and get transpose for vector calculation axes_ = newaxes; transpose_ = axes_.transpose(); @@ -278,18 +278,18 @@ void Cell::set(const Mat3 &newaxes) calculateCentre(); calculateInverse(); calculateReciprocal(); - dbgEnd(DM_CALLS,"Cell::set[matrix]"); + dbgEnd(Debug::Calls,"Cell::set[matrix]"); } // Calculate reciprocal cell vectors void Cell::calculateReciprocal() { // Calculate the reciprocal cell of 'this->cell' - dbgBegin(DM_CALLS,"Cell::calculateReciprocal"); + dbgBegin(Debug::Calls,"Cell::calculateReciprocal"); switch (type_) { case (CT_NONE): - msg(DM_NONE,"Cell : Can't calculate reciprocal cell - no cell defined.\n"); + msg(Debug::None,"Cell : Can't calculate reciprocal cell - no cell defined.\n"); break; case (CT_CUBIC): case (CT_ORTHORHOMBIC): @@ -310,29 +310,29 @@ void Cell::calculateReciprocal() reciprocal_.rows[2] = reciprocal_.rows[2] * TWOPI / reciprocalVolume_; break; } - dbgEnd(DM_CALLS,"Cell::calculateReciprocal"); + dbgEnd(Debug::Calls,"Cell::calculateReciprocal"); } // Calculate centre coordinate of cell void Cell::calculateCentre() { - dbgBegin(DM_CALLS,"Cell::calculateCentre"); + dbgBegin(Debug::Calls,"Cell::calculateCentre"); if (type_ != CT_NONE) { centre_.set(0.5,0.5,0.5); centre_ *= transpose_; } else centre_.set(0.0,0.0,0.0); - dbgEnd(DM_CALLS,"Cell::calculateCentre"); + dbgEnd(Debug::Calls,"Cell::calculateCentre"); } // Calculate inverse transpose matrix void Cell::calculateInverse() { - dbgBegin(DM_CALLS,"Cell::calculateInverse"); + dbgBegin(Debug::Calls,"Cell::calculateInverse"); itranspose_ = transpose_; itranspose_.invert(); - dbgEnd(DM_CALLS,"Cell::calculateInverse"); + dbgEnd(Debug::Calls,"Cell::calculateInverse"); } /* @@ -433,7 +433,7 @@ Vec3 Cell::mimd(Atom *i, Atom *j) const void Cell::fold(Vec3 &r) const { // Folds the coordinates in 'r' into the defined unit cell - dbgBegin(DM_MORECALLS,"Cell::fold"); + dbgBegin(Debug::MoreCalls,"Cell::fold"); static Vec3 newr; switch (type_) { @@ -468,7 +468,7 @@ void Cell::fold(Vec3 &r) const r = newr * transpose_; break; } - dbgEnd(DM_MORECALLS,"Cell::fold"); + dbgEnd(Debug::MoreCalls,"Cell::fold"); } void Cell::fold(Atom *i) const @@ -483,10 +483,10 @@ void Cell::fold(Atom *i) const double Cell::distance(const Vec3 &r1, const Vec3 &r2) const { // Calculate the distance between atoms i and j - dbgBegin(DM_MORECALLS,"Cell::distance"); + dbgBegin(Debug::MoreCalls,"Cell::distance"); static Vec3 mimi; mimi = mimd(r1,r2); - dbgEnd(DM_MORECALLS,"Cell::distance"); + dbgEnd(Debug::MoreCalls,"Cell::distance"); return mimi.magnitude(); } @@ -499,7 +499,7 @@ double Cell::angle(const Vec3 &r1, const Vec3 &r2, const Vec3 vecij, veckj; static double dp, a; vecij = mimd(r1,r2); @@ -509,7 +509,7 @@ double Cell::angle(const Vec3 &r1, const Vec3 &r2, const Vec3 &i, const Vec3 &j, const Vec3 vecji, veckl, vecjk, veckj, mim_k, xpj, xpk; static double dp, angle; // Vector j->i (minimum image of i w.r.t. j) @@ -546,7 +546,7 @@ double Cell::torsion(const Vec3 &i, const Vec3 &j, const Vec3 0) angle = -angle; - dbgEnd(DM_MORECALLS,"Cell::torsion"); + dbgEnd(Debug::MoreCalls,"Cell::torsion"); return angle; } @@ -592,8 +592,8 @@ Vec3 Cell::randomPos() const // Print void Cell::print() const { - msg(DM_NONE,"\t x y z l\n"); - msg(DM_NONE,"\t[ A <%8.4f %8.4f %8.4f > %8.4f [alpha=%8.3f]\n", axes_.rows[0].x, axes_.rows[0].y, axes_.rows[0].z, lengths_.x, angles_.x); - msg(DM_NONE,"\t[ B <%8.4f %8.4f %8.4f > %8.4f [ beta=%8.3f]\n", axes_.rows[1].x, axes_.rows[1].y, axes_.rows[1].z, lengths_.y, angles_.y); - msg(DM_NONE,"\t[ C <%8.4f %8.4f %8.4f > %8.4f [gamma=%8.3f]\n", axes_.rows[2].x, axes_.rows[2].y, axes_.rows[2].z, lengths_.z, angles_.z); + msg(Debug::None,"\t x y z l\n"); + msg(Debug::None,"\t[ A <%8.4f %8.4f %8.4f > %8.4f [alpha=%8.3f]\n", axes_.rows[0].x, axes_.rows[0].y, axes_.rows[0].z, lengths_.x, angles_.x); + msg(Debug::None,"\t[ B <%8.4f %8.4f %8.4f > %8.4f [ beta=%8.3f]\n", axes_.rows[1].x, axes_.rows[1].y, axes_.rows[1].z, lengths_.y, angles_.y); + msg(Debug::None,"\t[ C <%8.4f %8.4f %8.4f > %8.4f [gamma=%8.3f]\n", axes_.rows[2].x, axes_.rows[2].y, axes_.rows[2].z, lengths_.z, angles_.z); } diff --git a/src/classes/clipboard.cpp b/src/classes/clipboard.cpp index f83233794..8bb52713f 100644 --- a/src/classes/clipboard.cpp +++ b/src/classes/clipboard.cpp @@ -117,29 +117,29 @@ Clipatom *Clipboard::atoms() // Copy atom to clipboard void Clipboard::copyAtom(Atom *i) { - dbgBegin(DM_CALLS,"Clipboard::copyAtom"); + dbgBegin(Debug::Calls,"Clipboard::copyAtom"); // Initialise the new clipatom Clipatom *newatom = atoms_.add(); newatom->copy(i); newatom->setAtomPointer(i); newatom->setId(atoms_.nItems()-1); - dbgEnd(DM_CALLS,"Clipboard::copyAtom"); + dbgEnd(Debug::Calls,"Clipboard::copyAtom"); } // Empty clipboard void Clipboard::clear() { // Clear the list of atoms on the clipboard - dbgBegin(DM_CALLS,"Clipboard::clear"); + dbgBegin(Debug::Calls,"Clipboard::clear"); atoms_.clear(); bonds_.clear(); - dbgEnd(DM_CALLS,"Clipboard::clear"); + dbgEnd(Debug::Calls,"Clipboard::clear"); } /* Replace pointers in bond list void Clipboard::setNewBondPointers(Clipatom *clipptr, Atom *newptr) { - dbgBegin(DM_CALLS,"Clipboard::setNewBondPointers"); + dbgBegin(Debug::Calls,"Clipboard::setNewBondPointers"); // Go through bond list searching for clipatom in clipi or clipj. Set associated bondi/bondj to newptr. for (Linkbond *b = bonds_.first(); b != NULL; b = b->next) { @@ -149,13 +149,13 @@ void Clipboard::setNewBondPointers(Clipatom *clipptr, Atom *newptr) printf("Linkbonds List after setNewBondPointers:\n"); for (Linkbond *b = bonds_.first(); b != NULL; b = b->next) printf(" Bond %li = original atom IDs %i and %i\n",b,b->atomI()->id(),b->atomJ()->id()); - dbgEnd(DM_CALLS,"Clipboard::setNewBondPointers"); + dbgEnd(Debug::Calls,"Clipboard::setNewBondPointers"); } */ // Copy bonds for atoms void Clipboard::copyBonds() { - dbgBegin(DM_CALLS,"Clipboard::copyBonds"); + dbgBegin(Debug::Calls,"Clipboard::copyBonds"); // Go through pairs of oldptrs in the atoms list and check for bonds, adding to our list as we go. // The bonds we generate will point to pairs of Clipatoms. Bond *oldbond; @@ -173,17 +173,17 @@ void Clipboard::copyBonds() } } } - dbgEnd(DM_CALLS,"Clipboard::copyBonds"); + dbgEnd(Debug::Calls,"Clipboard::copyBonds"); } // Copy selection void Clipboard::copySelection(Model *m) { - dbgBegin(DM_CALLS,"Clipboard::copySelection"); + dbgBegin(Debug::Calls,"Clipboard::copySelection"); if (m->nSelected() == 0) { - msg(DM_NONE,"Nothing selected to copy.\n"); - dbgEnd(DM_CALLS,"Clipboard::copyAll"); + msg(Debug::None,"Nothing selected to copy.\n"); + dbgEnd(Debug::Calls,"Clipboard::copyAll"); } // Clear the clipboard first and make sure atom ids are valid clear(); @@ -191,32 +191,32 @@ void Clipboard::copySelection(Model *m) for (Atom *i = m->atoms(); i != NULL; i = i->next) if (i->isSelected()) copyAtom(i); // Copy bonds copyBonds(); - dbgEnd(DM_CALLS,"Clipboard::copySelection"); + dbgEnd(Debug::Calls,"Clipboard::copySelection"); } // Copy model void Clipboard::copyAll(Model *m) { - dbgBegin(DM_CALLS,"Clipboard::copyAll"); + dbgBegin(Debug::Calls,"Clipboard::copyAll"); // Clear the clipboard first and make sure atom ids are valid clear(); for (Atom *i = m->atoms(); i != NULL; i = i->next) copyAtom(i); - msg(DM_VERBOSE, "Copied %i atoms from model %s\n", atoms_.nItems(), m->name()); + msg(Debug::Verbose, "Copied %i atoms from model %s\n", atoms_.nItems(), m->name()); // Copy bonds copyBonds(); - dbgEnd(DM_CALLS,"Clipboard::copyAll"); + dbgEnd(Debug::Calls,"Clipboard::copyAll"); } // Cut selection void Clipboard::cutSelection(Model *m) { // Cut the selection from the specified model into the clipboard - dbgBegin(DM_CALLS,"Clipboard::cutSelection"); + dbgBegin(Debug::Calls,"Clipboard::cutSelection"); // Copy selection... copySelection(m); // ..and then we can use delete_selection to rid ourselves of the selection m->selectionDelete(); - dbgEnd(DM_CALLS,"Clipboard::cutSelection"); + dbgEnd(Debug::Calls,"Clipboard::cutSelection"); } // Paste to model @@ -224,7 +224,7 @@ void Clipboard::pasteToModel(Model *m, bool selectpasted) { // Paste the contents of the clipboard into the model specified. // Deselect all atoms of the model, and select the pasted atoms_. - dbgBegin(DM_CALLS,"Clipboard::pasteToModel"); + dbgBegin(Debug::Calls,"Clipboard::pasteToModel"); Atom *pastedi, *ii, *jj; if (selectpasted) m->selectNone(); for (Clipatom *i = atoms_.first(); i != NULL; i = i->getNext()) @@ -239,7 +239,7 @@ void Clipboard::pasteToModel(Model *m, bool selectpasted) } // Add in bonds to pasted atoms pasteBonds(m); - dbgEnd(DM_CALLS,"Clipboard::pasteToModel"); + dbgEnd(Debug::Calls,"Clipboard::pasteToModel"); } // Paste to pattern @@ -248,7 +248,7 @@ void Clipboard::pasteToPattern(Model *m, Pattern *p) // Paste the contents of the clipboard into the model specified. // An optional pattern is supplied, indicating atoms should be pasted into its local list. Otherwise, use the model. // Deselect all atoms of the model, and select the pasted atoms_. - dbgBegin(DM_CALLS,"Clipboard::pasteToPattern"); + dbgBegin(Debug::Calls,"Clipboard::pasteToPattern"); Atom *pastedi; m->selectNone(); for (Clipatom *i = atoms_.first(); i != NULL; i = i->getNext()) @@ -263,19 +263,19 @@ void Clipboard::pasteToPattern(Model *m, Pattern *p) pasteBonds(m); // Project the newly-pasted (and currently selected) atoms m->projectSelection(); - dbgEnd(DM_CALLS,"Clipboard::pasteToPattern"); + dbgEnd(Debug::Calls,"Clipboard::pasteToPattern"); } // Paste to model in specified pattern / position void Clipboard::pasteToModel(Model *destmodel, Pattern *p, int mol) { // Paste the contents of the clipboard into the configuration supplied, and in the pattern / molecule position given. - dbgBegin(DM_CALLS,"Clipboard::pasteToModel"); + dbgBegin(Debug::Calls,"Clipboard::pasteToModel"); // Check pattern spec against number of atoms in clipboard if (p->nAtoms() != atoms_.nItems()) { printf("Number of atoms in clipboard (%i) does not match number in one molecule of pattern (%i).\n", atoms_.nItems(), p->nAtoms()); - dbgEnd(DM_CALLS,"Clipboard::pasteToModel"); + dbgEnd(Debug::Calls,"Clipboard::pasteToModel"); return; } // Paste the atoms @@ -291,13 +291,13 @@ void Clipboard::pasteToModel(Model *destmodel, Pattern *p, int mol) i = i->getNext(); } // No need to paste bonds or re-project. - dbgEnd(DM_CALLS,"Clipboard::pasteToModel"); + dbgEnd(Debug::Calls,"Clipboard::pasteToModel"); } // Paste to model translated void Clipboard::pasteToModel(Model *m, Vec3 t) { - dbgBegin(DM_CALLS,"Clipboard::pasteToModel[translated]"); + dbgBegin(Debug::Calls,"Clipboard::pasteToModel[translated]"); Atom *pastedi, *ii, *jj; // Deselect all atoms of the model, and select the pasted atoms_. m->selectNone(); @@ -315,17 +315,17 @@ void Clipboard::pasteToModel(Model *m, Vec3 t) pasteBonds(m); // Project the newly-pasted (and currently selected) atoms m->projectSelection(); - dbgEnd(DM_CALLS,"Clipboard::pasteToModel[translated]"); + dbgEnd(Debug::Calls,"Clipboard::pasteToModel[translated]"); } // Paste bonds void Clipboard::pasteBonds(Model *m) { - dbgBegin(DM_CALLS,"Clipboard::pasteBonds"); + dbgBegin(Debug::Calls,"Clipboard::pasteBonds"); // By this point, bondi and bondj pointers in the bondlist will refer to clipatom* pointers for (Clipbond *b = bonds_.first(); b != NULL; b = b->next) m->bondAtoms(b->atomI()->atomPointer(), b->atomJ()->atomPointer(), b->order()); - dbgEnd(DM_CALLS,"Clipboard::pasteBonds"); + dbgEnd(Debug::Calls,"Clipboard::pasteBonds"); } // Translate Clipped Atoms diff --git a/src/classes/energystore.cpp b/src/classes/energystore.cpp index ad4e2f9c7..7ad6cc9f5 100644 --- a/src/classes/energystore.cpp +++ b/src/classes/energystore.cpp @@ -73,11 +73,11 @@ double EnergyStore::elec() // Add void EnergyStore::add(EnergyType et, double energy, int id1, int id2) { - dbgBegin(DM_CALLS,"EnergyStore::add"); + dbgBegin(Debug::Calls,"EnergyStore::add"); if ((id1 >= size_) || (id2 >= size_)) { printf("EnergyStore::add <<<< Array element out of range - %i %i - Ignored >>>>\n", id1, id2); - dbgEnd(DM_CALLS,"EnergyStore::add"); + dbgEnd(Debug::Calls,"EnergyStore::add"); return; } switch (et) @@ -125,13 +125,13 @@ void EnergyStore::add(EnergyType et, double energy, int id1, int id2) ewaldMolCorrect_[id1] += energy; break; } - dbgEnd(DM_CALLS,"EnergyStore::add"); + dbgEnd(Debug::Calls,"EnergyStore::add"); } // Deallocate arrays void EnergyStore::deallocate() { - dbgBegin(DM_CALLS,"EnergyStore::deallocate"); + dbgBegin(Debug::Calls,"EnergyStore::deallocate"); if (bond_ != NULL) delete[] bond_; if (angle_ != NULL) delete[] angle_; if (torsion_ != NULL) delete[] torsion_; @@ -153,13 +153,13 @@ void EnergyStore::deallocate() if (ewaldSelfCorrect_ != NULL) delete[] ewaldSelfCorrect_; if (ewaldMolCorrect_ != NULL) delete[] ewaldMolCorrect_; size_ = 0; - dbgEnd(DM_CALLS,"EnergyStore::deallocate"); + dbgEnd(Debug::Calls,"EnergyStore::deallocate"); } // Resize void EnergyStore::resize(int newsize) { - dbgBegin(DM_CALLS,"EnergyStore::resize"); + dbgBegin(Debug::Calls,"EnergyStore::resize"); // Delete old data first deallocate(); // Now create new arrays... @@ -185,15 +185,15 @@ void EnergyStore::resize(int newsize) ewaldSelfCorrect_ = new double[size_]; ewaldMolCorrect_ = new double[size_]; clear(); - msg(DM_VERBOSE,"Energy store resized to %i\n",size_); - dbgEnd(DM_CALLS,"EnergyStore::resize"); + msg(Debug::Verbose,"Energy store resized to %i\n",size_); + dbgEnd(Debug::Calls,"EnergyStore::resize"); } // CLear values void EnergyStore::clear() { // Clear all the values in the energy store - dbgBegin(DM_CALLS,"EnergyStore::clear"); + dbgBegin(Debug::Calls,"EnergyStore::clear"); int n,m; for (n=0; nname(), energy, energy/p1->nMols(), bond_[count1], angle_[count1], torsion_[count1]); count1 ++; } - dbgEnd(DM_CALLS,"EnergyStore::printIntraMatrix"); + dbgEnd(Debug::Calls,"EnergyStore::printIntraMatrix"); } diff --git a/src/classes/forcefield.cpp b/src/classes/forcefield.cpp index f4d4084ea..087281128 100644 --- a/src/classes/forcefield.cpp +++ b/src/classes/forcefield.cpp @@ -371,11 +371,11 @@ int Forcefield::matchType(const Dnchar &a, const Dnchar &b) ForcefieldAtom *Forcefield::findType(int query) { // Search for the typeId_ specified and return the internal integer id (i.e. position in atomtype list) - dbgBegin(DM_CALLS,"Forcefield::find_type[int]"); + dbgBegin(Debug::Calls,"Forcefield::find_type[int]"); ForcefieldAtom *result; for (result = types_.first(); result != NULL; result = result->next) if (query == result->typeId()) break; - dbgEnd(DM_CALLS,"Forcefield::find_type[int]"); + dbgEnd(Debug::Calls,"Forcefield::find_type[int]"); return result; } @@ -385,23 +385,23 @@ ForcefieldAtom *Forcefield::findType(const char *query) // Search for the atomname specified and return the internal integer id (i.e. position in atomtype list) // We return the first occurrence we find (since there may be more than one - only typeId_ need be unique) // Search both names and equivalents (since aliases may be defined that are not themselves defined as types_) - dbgBegin(DM_CALLS,"Forcefield::find_type[char]"); + dbgBegin(Debug::Calls,"Forcefield::find_type[char]"); ForcefieldAtom *result; for (result = types_.first(); result != NULL; result = result->next) if ((strcmp(result->name(),query) == 0) || (strcmp(result->equivalent(),query) == 0)) break; - dbgEnd(DM_CALLS,"Forcefield::find_type[char]"); + dbgEnd(Debug::Calls,"Forcefield::find_type[char]"); return result; } // Return description of typeId_ Atomtype *Forcefield::typeOfId(int i) { - dbgBegin(DM_CALLS,"Forcefield::get_atomtype_of_typeId_"); + dbgBegin(Debug::Calls,"Forcefield::get_atomtype_of_typeId_"); ForcefieldAtom *result = NULL; for (result = types_.first(); result != NULL; result = result->next) if (result->typeId() == i) break; if (result == NULL) printf("Forcefield::get_atomtype_of_typeId_ <<<< FFID %i not found in forcefield >>>>\n",i); - dbgEnd(DM_CALLS,"Forcefield::get_atomtype_of_typeId_"); + dbgEnd(Debug::Calls,"Forcefield::get_atomtype_of_typeId_"); return result->atomType(); } @@ -440,18 +440,18 @@ int Forcefield::matchTypes(ForcefieldAtom *ffi, ForcefieldAtom *ffj, const char // specified in the bond / angle / torsion data supplied. Only check 'one way round' - the routine // must be called again with i and j swapped over to test the inverse case. // Matches against 'equiv' atomnames. - dbgBegin(DM_CALLS,"Forcefield::matchTypes"); + dbgBegin(Debug::Calls,"Forcefield::matchTypes"); int matchi, matchj; // Best case - exact, direct match: if ((strcmp(ffi->equivalent(),typei) == 0) && (strcmp(ffj->equivalent(),typej) == 0)) { - dbgEnd(DM_CALLS,"Forcefield::matchTypes"); + dbgEnd(Debug::Calls,"Forcefield::matchTypes"); return 0; } // No such luck, so match each atom separately matchi = matchType(ffi->equivalent(),typei); matchj = matchType(ffj->equivalent(),typej); - dbgEnd(DM_CALLS,"Forcefield::matchTypes"); + dbgEnd(Debug::Calls,"Forcefield::matchTypes"); return (matchi + matchj); } @@ -465,7 +465,7 @@ ForcefieldBound *Forcefield::findBond(ForcefieldAtom *ffi, ForcefieldAtom *ffj) { // Search the forcefield for the bond definition for the interaction of the atom types i-j // Return NULL if no match found ('result' remains 'NULL' if no kind of match is found). - dbgBegin(DM_CALLS,"Forcefield::findBond"); + dbgBegin(Debug::Calls,"Forcefield::findBond"); ForcefieldBound *result = NULL; int matchij, matchji, bestmatch; bestmatch = 10; @@ -487,7 +487,7 @@ ForcefieldBound *Forcefield::findBond(ForcefieldAtom *ffi, ForcefieldAtom *ffj) if (bestmatch == 0) break; b = b ->next; } - dbgEnd(DM_CALLS,"Forcefield::findBond"); + dbgEnd(Debug::Calls,"Forcefield::findBond"); return result; } @@ -496,7 +496,7 @@ ForcefieldBound *Forcefield::findAngle(ForcefieldAtom *ffi, ForcefieldAtom *ffj, { // Search the forcefield for the angle definition for the interaction of the atom types i-j-k // Return NULL is no match found. - dbgBegin(DM_CALLS,"Forcefield::findAngle"); + dbgBegin(Debug::Calls,"Forcefield::findAngle"); ForcefieldBound *result = NULL; int matchj, matchik, matchki, bestmatch; bestmatch = 10; @@ -526,7 +526,7 @@ ForcefieldBound *Forcefield::findAngle(ForcefieldAtom *ffi, ForcefieldAtom *ffj, if (bestmatch == 0) break; // Early exit for an exact match a = a ->next; } - dbgEnd(DM_CALLS,"Forcefield::findAngle"); + dbgEnd(Debug::Calls,"Forcefield::findAngle"); return result; } @@ -535,7 +535,7 @@ ForcefieldBound *Forcefield::findTorsion(ForcefieldAtom *ffi, ForcefieldAtom *ff { // Search the forcefield for the torsion definition for the interaction of the atom types i-j-k-l // Return NULL is no match found. - dbgBegin(DM_CALLS,"Forcefield::findTorsion"); + dbgBegin(Debug::Calls,"Forcefield::findTorsion"); ForcefieldBound *result = NULL; int matchil, matchli, matchjk, matchkj, matchijkl, matchlkji, bestmatch; bestmatch = 10; @@ -561,7 +561,7 @@ ForcefieldBound *Forcefield::findTorsion(ForcefieldAtom *ffi, ForcefieldAtom *ff if (bestmatch == 0) break; t = t->next; } - dbgEnd(DM_CALLS,"Forcefield::findTorsion"); + dbgEnd(Debug::Calls,"Forcefield::findTorsion"); return result; } @@ -569,7 +569,7 @@ void Forcefield::convertParameters(EnergyUnit ff_eunit) { // Convert units of all the energetic parameters within the forcefield from the unit supplied into program internal units (specified in prefs) // Check for 'NULL' pointers for ff_param variables (for e.g. rule-based forcefields) - dbgBegin(DM_CALLS,"Forcefield::convertParameters"); + dbgBegin(Debug::Calls,"Forcefield::convertParameters"); ForcefieldParams *p; ForcefieldBound *b; ForcefieldAtom *ffa; @@ -662,5 +662,5 @@ void Forcefield::convertParameters(EnergyUnit ff_eunit) break; } } - dbgEnd(DM_CALLS,"Forcefield::convertParameters"); + dbgEnd(Debug::Calls,"Forcefield::convertParameters"); } diff --git a/src/classes/fourier.cpp b/src/classes/fourier.cpp index 6ba270641..9ba1ff134 100644 --- a/src/classes/fourier.cpp +++ b/src/classes/fourier.cpp @@ -44,7 +44,7 @@ FourierData::~FourierData() // Clear fourier structure void FourierData::clear() { - dbgBegin(DM_CALLS,"FourierData:::clear"); + dbgBegin(Debug::Calls,"FourierData:::clear"); if (rCos != NULL) { for (int n=0; n newkvec, int newkmax) { // Create the rCos and rSin arrays to the specified dimensions. - dbgBegin(DM_CALLS,"FourierData:::create"); + dbgBegin(Debug::Calls,"FourierData:::create"); if (rCos != NULL) clear(); if (newkmax < 1) printf("FourierData:::create <<<< Bad 'newkmax' passed (< 1) >>>>\n"); kMax = newkmax; @@ -77,8 +77,8 @@ void FourierData::create(int newnAtoms, Vec3 newkvec, int newkmax) for (int n=0; n[nAtoms]; rSin = new Vec3*[2*kMax+1]; for (int n=0; n<2*kMax+1; n++) rSin[n] = new Vec3[nAtoms]; - msg(DM_VERBOSE,"Created Fourier space for %i atoms, kmax = %i \n",nAtoms, kMax); - dbgEnd(DM_CALLS,"FourierData:::create"); + msg(Debug::Verbose,"Created Fourier space for %i atoms, kmax = %i \n",nAtoms, kMax); + dbgEnd(Debug::Calls,"FourierData:::create"); } void FourierData::calculate(Model *srcmodel) @@ -90,14 +90,14 @@ void FourierData::calculate(Model *srcmodel) void FourierData::calculate(Model *srcmodel, int startatom, int atomstodo) { // (Re-)Calculate the range of reciprocal space vectors of the coordinates in the supplied config. - dbgBegin(DM_CALLS,"FourierData:::calculate"); + dbgBegin(Debug::Calls,"FourierData:::calculate"); Vec3 pos; Mat3 tempmat; int firstsin, n, k, sinpos, i; if (srcmodel->nAtoms() != nAtoms) { printf("Indescribable fourier error! Wrong number of atoms in supplied config.\n"); - dbgEnd(DM_CALLS,"FourierData:::calculate"); + dbgEnd(Debug::Calls,"FourierData:::calculate"); return; } // Make sure model has a staticatoms space @@ -149,23 +149,23 @@ void FourierData::calculate(Model *srcmodel, int startatom, int atomstodo) rSin[kMax-k][i].z = -rSin[kMax+k][i].z; } } - dbgEnd(DM_CALLS,"FourierData:::calculate"); + dbgEnd(Debug::Calls,"FourierData:::calculate"); } void FourierData::prepare(Model *srcmodel, Vec3 newkvec) { // Set up arrays in the fourier class to handle all atoms / maximum kvectors specified. - dbgBegin(DM_CALLS,"FourierData:::prepare"); + dbgBegin(Debug::Calls,"FourierData:::prepare"); int newkmax = newkvec.max(); // Don't delete the arrays, however, if the new nAtoms and kmax match... if ((nAtoms != srcmodel->nAtoms()) || (kMax != newkmax)) { - msg(DM_VERBOSE,"Clearing and recreating fourier arrays...\n"); + msg(Debug::Verbose,"Clearing and recreating fourier arrays...\n"); clear(); create(srcmodel->nAtoms(), newkvec, newkmax); } cell = srcmodel->cell(); // Now we have suitable arrays, we can calculate and store the reciprocal coordinate vectors calculate(srcmodel); - dbgEnd(DM_CALLS,"FourierData:::prepare"); + dbgEnd(Debug::Calls,"FourierData:::prepare"); } diff --git a/src/classes/grid.cpp b/src/classes/grid.cpp index 6876ad549..bc3109498 100644 --- a/src/classes/grid.cpp +++ b/src/classes/grid.cpp @@ -198,7 +198,7 @@ GLfloat *Grid::colour() // Create data array (from npoints vector) void Grid::create() { - dbgBegin(DM_CALLS,"Grid::create"); + dbgBegin(Debug::Calls,"Grid::create"); clear(); int i, j; if (data_ != NULL) clear(); @@ -208,13 +208,13 @@ void Grid::create() data_[i] = new double*[nPoints_.y]; for (j = 0; j m) // Set grid extent (and data[]) void Grid::setNPoints(Vec3 v) { - dbgBegin(DM_CALLS,"Grid::setNPoints"); + dbgBegin(Debug::Calls,"Grid::setNPoints"); nPoints_ = v; log_ ++; create(); - dbgEnd(DM_CALLS,"Grid::setNPoints"); + dbgEnd(Debug::Calls,"Grid::setNPoints"); } // Update minimum / maximum based on supplied value @@ -278,17 +278,17 @@ void Grid::setData(int x, int y, int z, double d) // Check limits against npoints vector if ((x < 0) || (x >= nPoints_.x)) { - msg(DM_NONE,"Grid::set_data(x,y,z) - X index is outside array bounds.\n"); + msg(Debug::None,"Grid::set_data(x,y,z) - X index is outside array bounds.\n"); return; } else if ((y < 0) || (y >= nPoints_.y)) { - msg(DM_NONE,"Grid::set_data(x,y,z) - Y index is outside array bounds.\n"); + msg(Debug::None,"Grid::set_data(x,y,z) - Y index is outside array bounds.\n"); return; } else if ((z < 0) || (z >= nPoints_.z)) { - msg(DM_NONE,"Grid::set_data(x,y,z) - Z index is outside array bounds.\n"); + msg(Debug::None,"Grid::set_data(x,y,z) - Z index is outside array bounds.\n"); return; } // Okay, so store data @@ -303,7 +303,7 @@ void Grid::setNextData(double d) // Check limit if (dataFull_ == TRUE) { - msg(DM_NONE,"Grid::setNextData - Array already full.\n"); + msg(Debug::None,"Grid::setNextData - Array already full.\n"); return; } // Set current point referenced by currentpoint diff --git a/src/classes/pattern.cpp b/src/classes/pattern.cpp index 339d2dc01..4b8d7d742 100644 --- a/src/classes/pattern.cpp +++ b/src/classes/pattern.cpp @@ -371,11 +371,11 @@ Ring *Pattern::rings() void Pattern::initialise(int patid, int start, int mols, int atomsmol) { // Initialise atom pointers / values in pattern. - dbgBegin(DM_CALLS,"Pattern::initialise"); + dbgBegin(Debug::Calls,"Pattern::initialise"); if (parent_ == NULL) { printf("Owner model has not been set in pattern!\n"); - dbgEnd(DM_CALLS,"Pattern::initialise"); + dbgEnd(Debug::Calls,"Pattern::initialise"); return; } // Store parameters @@ -389,7 +389,7 @@ void Pattern::initialise(int patid, int start, int mols, int atomsmol) if (startAtom_ > parent_->nAtoms()) { // Can't get first atom (probably the pattern extends past nAtoms_) - msg(DM_NONE,"Initial atom in pattern is past end of model's atom list (%i).\n",endAtom_); + msg(Debug::None,"Initial atom in pattern is past end of model's atom list (%i).\n",endAtom_); firstAtom_ = NULL; } else @@ -400,21 +400,21 @@ void Pattern::initialise(int patid, int start, int mols, int atomsmol) for (int n=0; nnext; firstAtom_ = i; } - msg(DM_NONE,"New pattern node : start=%i, nMols=%i, nAtoms/mol=%i, totalAtoms=%i, name=%s\n", startAtom_, nMols_, nAtoms_, totalAtoms_, name_.get()); - dbgEnd(DM_CALLS,"Pattern::initialise"); + msg(Debug::None,"New pattern node : start=%i, nMols=%i, nAtoms/mol=%i, totalAtoms=%i, name=%s\n", startAtom_, nMols_, nAtoms_, totalAtoms_, name_.get()); + dbgEnd(Debug::Calls,"Pattern::initialise"); } // Empty the selected pattern void Pattern::empty() { // Set all variables to reflect an empty pattern - dbgBegin(DM_CALLS,"Pattern::empty_pattern"); + dbgBegin(Debug::Calls,"Pattern::empty_pattern"); // Zero everything except nAtoms_ firstAtom_ = NULL; lastAtom_ = NULL; nMols_ = 0; totalAtoms_ = 0; - dbgEnd(DM_CALLS,"Pattern::empty_pattern"); + dbgEnd(Debug::Calls,"Pattern::empty_pattern"); } // Set contents of pattern @@ -435,7 +435,7 @@ void Pattern::setContents(int newstartAtom_, int newnMols_, int newnAtoms_) void Pattern::deleteExpression() { // Clear the energy expression for the pattern node - dbgBegin(DM_CALLS,"Pattern::deleteExpression"); + dbgBegin(Debug::Calls,"Pattern::deleteExpression"); atoms_.clear(); bonds_.clear(); angles_.clear(); @@ -446,14 +446,14 @@ void Pattern::deleteExpression() delete[] conMat_; } conMat_ = NULL; - dbgEnd(DM_CALLS,"Pattern::deleteExpression"); + dbgEnd(Debug::Calls,"Pattern::deleteExpression"); } // Create connectivity matrix for molecules in pattern void Pattern::createConMat() { // Create (calculate) the connectivity matrix for this node - dbgBegin(DM_CALLS,"Pattern::createConMat"); + dbgBegin(Debug::Calls,"Pattern::createConMat"); int n,m,a1,a2,b1,b2; PatternBound *pb; for (n=0; nnAtoms(); @@ -528,10 +528,10 @@ bool Pattern::validate() // 1) Check number of atoms does not exceed number in model if (startAtom_+totalAtoms_ > mnAtoms_) { - msg(DM_NONE,"Pattern's last atom is beyond the number of atoms in the model.\n"); - msg(DM_NONE,"No pattern defined for model.\n"); + msg(Debug::None,"Pattern's last atom is beyond the number of atoms in the model.\n"); + msg(Debug::None,"No pattern defined for model.\n"); // Can't do much else if this is the case, so break early. - dbgEnd(DM_CALLS,"Pattern::validate"); + dbgEnd(Debug::Calls,"Pattern::validate"); return FALSE; } else testAtomLimit_ = TRUE; @@ -567,7 +567,7 @@ bool Pattern::validate() } if (!ok) { - msg(DM_NONE,"Pattern::validate : Failed element composition test at molecule %i.\n",m+1); + msg(Debug::None,"Pattern::validate : Failed element composition test at molecule %i.\n",m+1); result = FALSE; break; } @@ -575,8 +575,8 @@ bool Pattern::validate() } // 3) Bonding within molecules in pattern //TODO - if (!result) msg(DM_NONE,"No pattern defined for model.\n"); - dbgEnd(DM_CALLS,"Pattern::validate"); + if (!result) msg(Debug::None,"No pattern defined for model.\n"); + dbgEnd(Debug::Calls,"Pattern::validate"); return result; } @@ -584,9 +584,9 @@ bool Pattern::validate() Vec3 Pattern::calculateCog(Model *srcmodel, int mol) { // Calculate the centre of geometry for this molecule - dbgBegin(DM_CALLS,"Pattern::calculate_cog"); + dbgBegin(Debug::Calls,"Pattern::calculate_cog"); int offset = startAtom_ + mol*nAtoms_; - msg(DM_VERBOSE,"Pattern::calculate_cog : Calculating for pattern '%s', molecule %i (starting at %i, nMols=%i)\n", name_.get(), mol, offset, nMols_); + msg(Debug::Verbose,"Pattern::calculate_cog : Calculating for pattern '%s', molecule %i (starting at %i, nMols=%i)\n", name_.get(), mol, offset, nMols_); static Vec3 cog, mim_i; Cell *cell = srcmodel->cell(); cog.zero(); @@ -598,7 +598,7 @@ Vec3 Pattern::calculateCog(Model *srcmodel, int mol) cog += mim_i; } cog /= nAtoms_; - dbgEnd(DM_CALLS,"Pattern::calculate_cog"); + dbgEnd(Debug::Calls,"Pattern::calculate_cog"); return cog; } @@ -606,14 +606,14 @@ Vec3 Pattern::calculateCog(Model *srcmodel, int mol) Vec3 Pattern::calculateCom(Model *srcmodel, int mol) { // Calculate the centre of geometry for this molecule - dbgBegin(DM_CALLS,"Pattern::calculateCom"); - msg(DM_VERBOSE,"Calculating centre-of-mass for molecule %i in pattern '%s' (pattern nMols=%i)\n", mol, name_.get(), nMols_); + dbgBegin(Debug::Calls,"Pattern::calculateCom"); + msg(Debug::Verbose,"Calculating centre-of-mass for molecule %i in pattern '%s' (pattern nMols=%i)\n", mol, name_.get(), nMols_); Vec3 com; double massnorm = 0.0; static Vec3 mim_i; int offset = startAtom_ + mol*nAtoms_; com.zero(); - msg(DM_VERBOSE,"molecule_com : Offset = %i\n",offset); + msg(Debug::Verbose,"molecule_com : Offset = %i\n",offset); Cell *cell = srcmodel->cell(); Atom **modelatoms = srcmodel->atomArray(); for (int a1=offset; a1 Pattern::calculateCom(Model *srcmodel, int mol) massnorm += elements.atomicMass(modelatoms[a1]->element()); } com /= massnorm; - dbgEnd(DM_CALLS,"Pattern::calculateCom"); + dbgEnd(Debug::Calls,"Pattern::calculateCom"); return com; } @@ -635,7 +635,7 @@ Vec3 Pattern::calculateCom(Model *srcmodel, int mol) void Pattern::propagateAtomtypes() { // Copy type information contained in the first molecule in the pattern to all other molecules in the pattern, and the pattern's representative molecule - dbgBegin(DM_CALLS,"Pattern::propagateAtomtypes"); + dbgBegin(Debug::Calls,"Pattern::propagateAtomtypes"); Atom *i, *j; int n, m; // Set 'j' to be the starting atom of the second molecule @@ -662,7 +662,7 @@ void Pattern::propagateAtomtypes() j = j->next; } } - dbgEnd(DM_CALLS,"Pattern::propagateAtomtypes"); + dbgEnd(Debug::Calls,"Pattern::propagateAtomtypes"); } void Pattern::propagateBondTypes() @@ -670,7 +670,7 @@ void Pattern::propagateBondTypes() // Copy the bond type data in the first molecule of the pattern to all other molecules in the pattern. // With a loop over all other molecules, loop over the atoms of the first molecule. For each bond on this atom, // find the relative atom id and search for the corresponding atom in the n'th molecule. - dbgBegin(DM_CALLS,"Pattern::propagateBondTypes"); + dbgBegin(Debug::Calls,"Pattern::propagateBondTypes"); int n,m,o,offset; Atom *i, *j, *k; Refitem *bref; @@ -698,7 +698,7 @@ void Pattern::propagateBondTypes() else for (o=0; oprev; // 'k' now points to the bond partner of 'j' b2 = j->findBond(k); - if (b2 == NULL) msg(DM_NONE,"Bizarre fatal error. Couldn't find bond in Pattern::propagateBondTypes\n"); + if (b2 == NULL) msg(Debug::None,"Bizarre fatal error. Couldn't find bond in Pattern::propagateBondTypes\n"); else b2->setOrder(b1->order()); bref = bref->next; } @@ -706,7 +706,7 @@ void Pattern::propagateBondTypes() j = j->next; } } - dbgEnd(DM_CALLS,"Pattern::propagateBondTypes"); + dbgEnd(Debug::Calls,"Pattern::propagateBondTypes"); } /* @@ -717,14 +717,14 @@ void Pattern::propagateBondTypes() Atom *Pattern::appendCopy(Atom *source) { // Append the supplied atom to the pattern's 'local' atom list - dbgBegin(DM_CALLS,"Pattern::appendCopy"); + dbgBegin(Debug::Calls,"Pattern::appendCopy"); Atom *newatom = new Atom; firstAtom_ == NULL ? firstAtom_ = newatom : lastAtom_->next = newatom; newatom->prev = lastAtom_; lastAtom_ = newatom; newatom->copy(source); totalAtoms_ ++; - dbgEnd(DM_CALLS,"Pattern::appendCopy"); + dbgEnd(Debug::Calls,"Pattern::appendCopy"); return newatom; } @@ -732,21 +732,21 @@ Atom *Pattern::appendCopy(Atom *source) void Pattern::deleteAtom(Atom *xatom) { // Delete the supplied atom from the pattern's 'local' atom list - dbgBegin(DM_CALLS,"Pattern::deleteAtom"); + dbgBegin(Debug::Calls,"Pattern::deleteAtom"); xatom->prev == NULL ? firstAtom_ = xatom->next : xatom->prev->next = xatom->next; xatom->next == NULL ? lastAtom_ = xatom->prev : xatom->next->prev = xatom->prev; delete xatom; totalAtoms_ --; - dbgEnd(DM_CALLS,"Pattern::deleteAtom"); + dbgEnd(Debug::Calls,"Pattern::deleteAtom"); } // Delete atoms from end void Pattern::deleteAtomsFromEnd(int count) { // Deletes a number 'n' of atoms from the end of the list (i.e. recently created ones) - dbgBegin(DM_CALLS,"Pattern::deleteAtomsFromEnd"); + dbgBegin(Debug::Calls,"Pattern::deleteAtomsFromEnd"); for (int n=0; ntempi == 0) { - dbgEnd(DM_CALLS,"Pattern::markRingAtoms"); + dbgEnd(Debug::Calls,"Pattern::markRingAtoms"); return; } else @@ -809,7 +809,7 @@ void Pattern::markRingAtoms(Atom *i) default : i->tempi = 6; break; } } - dbgEnd(DM_CALLS,"Pattern::markRingAtoms"); + dbgEnd(Debug::Calls,"Pattern::markRingAtoms"); } // Find rings @@ -818,7 +818,7 @@ void Pattern::findRings() // Locate rings in the molecule of the current pattern. // Maintain a local array corresponding to whether specific atoms are 'done' or not - i.e., whether // they have been check as as much as they need to be checked. - dbgBegin(DM_CALLS,"Pattern::findRings"); + dbgBegin(Debug::Calls,"Pattern::findRings"); int n, rsize, ringpotential; Atom *i; Refitem *bref; @@ -856,7 +856,7 @@ void Pattern::findRings() i = firstAtom_; for (n=0; ntempi); + msg(Debug::Verbose,"Atom %i : potential = %i\n",n,i->tempi); ringpotential += i->tempi; i = i->next; } @@ -876,14 +876,14 @@ void Pattern::findRings() } i = i->next; } - dbgEnd(DM_CALLS,"Pattern::findRings"); + dbgEnd(Debug::Calls,"Pattern::findRings"); } // Ring search void Pattern::ringSearch(Atom *i, Ring *currentpath, int &ringpotential) { // Extend the path (ring) passed by the atom 'i', searching for a path length of 'ringsize' - dbgBegin(DM_CALLS,"Pattern::ringSearch"); + dbgBegin(Debug::Calls,"Pattern::ringSearch"); Refitem *bref; Ring *r; Refitem *lastra; @@ -892,14 +892,14 @@ void Pattern::ringSearch(Atom *i, Ring *currentpath, int &ringpotential) if (i->tempi == 0) { //printf(" --- No vacant 'bonds' on atom - skipping...\n"); - dbgEnd(DM_CALLS,"Pattern::ringSearch"); + dbgEnd(Debug::Calls,"Pattern::ringSearch"); return; } // Otherwise, add it to the current path lastra = currentpath->lastAtom(); if (currentpath->addAtom(i)) { - msg(DM_VERBOSE," --- Atom i added to path : "); + msg(Debug::Verbose," --- Atom i added to path : "); currentpath->print(); // Adding the atom did not exceed the requested ring size, and is not a duplicate // Go through the list of atoms bound to 'i' and then: @@ -918,7 +918,7 @@ void Pattern::ringSearch(Atom *i, Ring *currentpath, int &ringpotential) // The correct number of atoms is in the current path. Does it form a cycle? if (i->findBond(currentpath->firstAtom()->item) != NULL) { - msg(DM_VERBOSE," --- Storing current ring.\n"); + msg(Debug::Verbose," --- Storing current ring.\n"); r = rings_.add(); r->copy(currentpath); // Must now update atom 'tempi' values to reflect the inclusion of these atoms in @@ -944,23 +944,23 @@ void Pattern::ringSearch(Atom *i, Ring *currentpath, int &ringpotential) if (done) break; } // Return the list to its original state - msg(DM_VERBOSE," --- Removing atom %s[%li] from current path...\n",elements.symbol(i),i); + msg(Debug::Verbose," --- Removing atom %s[%li] from current path...\n",elements.symbol(i),i); currentpath->removeAtom(currentpath->lastAtom()); } else { //printf(" --- Atom is already in list, or adding it exceeds specified ringsize.\n"); } - dbgEnd(DM_CALLS,"Pattern::ringSearch"); + dbgEnd(Debug::Calls,"Pattern::ringSearch"); } void Pattern::augment() { - dbgBegin(DM_CALLS,"Pattern::augment"); + dbgBegin(Debug::Calls,"Pattern::augment"); Atom *i; Refitem *bref; int n, nHeavy; - msg(DM_NONE,"Augmenting bonds in pattern %s...\n",name_.get()); + msg(Debug::None,"Augmenting bonds in pattern %s...\n",name_.get()); /* We do not reset the present bonding assignments, only check if they're correct. If we find an atom whose bond order is too high, we only decrease it if we can find a bound atom in a similar situation. @@ -1031,7 +1031,7 @@ void Pattern::augment() i = i->next; } propagateBondTypes(); - dbgEnd(DM_CALLS,"Pattern::augment"); + dbgEnd(Debug::Calls,"Pattern::augment"); } void Pattern::initExpression(bool vdwOnly) @@ -1040,7 +1040,7 @@ void Pattern::initExpression(bool vdwOnly) // NBonds can be calculated through a loop over all atoms // NAngles can be calculated from atomic nBonds data. // NTorsions can be calculated from the bond list and atomic nBonds data. - dbgBegin(DM_CALLS,"Pattern::initExpression"); + dbgBegin(Debug::Calls,"Pattern::initExpression"); Atom *i, *j; Refitem *bref; int n, atomId, nBonds, nAngles, nTorsions; @@ -1052,7 +1052,7 @@ void Pattern::initExpression(bool vdwOnly) if (vdwOnly) { noIntramolecular_ = TRUE; - msg(DM_NONE,"Expression for pattern '%s' contains Atomtype terms only.\n", name_.get()); + msg(Debug::None,"Expression for pattern '%s' contains Atomtype terms only.\n", name_.get()); } else { @@ -1073,18 +1073,18 @@ void Pattern::initExpression(bool vdwOnly) // Some totals are double counted, so... nBonds /= 2; nTorsions /= 2; - msg(DM_NONE,"Expression for pattern '%s' contains %i bonds, %i angles, and %i torsions.\n", name_.get(), nBonds, nAngles, nTorsions); + msg(Debug::None,"Expression for pattern '%s' contains %i bonds, %i angles, and %i torsions.\n", name_.get(), nBonds, nAngles, nTorsions); bonds_.createEmpty(nBonds); angles_.createEmpty(nAngles); torsions_.createEmpty(nTorsions); } - if (conMat_ != NULL) msg(DM_NONE,"Pattern::initExpression : Error - connectivity matrix already allocated.\n"); + if (conMat_ != NULL) msg(Debug::None,"Pattern::initExpression : Error - connectivity matrix already allocated.\n"); else { conMat_ = new int*[nAtoms_]; for (n=0; n *bref; ForcefieldBound *ffb; @@ -1110,8 +1110,8 @@ bool Pattern::fillExpression() int count, ii, jj, kk, ll; // If there is no specified pattern forcefield, use the parent model's instead forcefield_ == NULL ? xff = parent_->forcefield() : xff = forcefield_; - msg(DM_NONE,"Fleshing out expression for %i atoms in pattern '%s'...\n", totalAtoms_, name_.get()); - msg(DM_NONE,"... Using forcefield '%s'...\n",xff->name()); + msg(Debug::None,"Fleshing out expression for %i atoms in pattern '%s'...\n", totalAtoms_, name_.get()); + msg(Debug::None,"... Using forcefield '%s'...\n",xff->name()); // Construct the atom list. // If any atom has not been assigned a type, we *still* include it in the list ai = firstAtom_; @@ -1123,7 +1123,7 @@ bool Pattern::fillExpression() pa->setData(ai->type()); if (ai->type() == 0) { - msg(DM_NONE,"... No FF definition for atom %i (%s).\n", count+1, elements.symbol(ai)); + msg(Debug::None,"... No FF definition for atom %i (%s).\n", count+1, elements.symbol(ai)); incomplete_ = TRUE; iatoms ++; } @@ -1158,8 +1158,8 @@ bool Pattern::fillExpression() // Quick check to ensure the bond is within the same molecule... if (jj > endAtom_) { - msg(DM_NONE,"!!! Found bond between molecules. Check pattern.\n"); - dbgEnd(DM_CALLS,"Pattern::fillExpression"); + msg(Debug::None,"!!! Found bond between molecules. Check pattern.\n"); + dbgEnd(Debug::Calls,"Pattern::fillExpression"); return FALSE; } if (jj > ii) @@ -1185,14 +1185,14 @@ bool Pattern::fillExpression() // Check ffb - if it's still NULL we couldn't find a definition if (ffb == NULL) { - msg(DM_NONE,"!!! No FF definition for bond %s-%s.\n", ti->equivalent(), tj->equivalent()); + msg(Debug::None,"!!! No FF definition for bond %s-%s.\n", ti->equivalent(), tj->equivalent()); incomplete_ = TRUE; ibonds ++; } else { params = bonds_[count]->data()->params(); - msg(DM_VERBOSE,"Bond %s-%s data : %f %f %f %f\n",ti->equivalent(), tj->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); + msg(Debug::Verbose,"Bond %s-%s data : %f %f %f %f\n",ti->equivalent(), tj->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); } // Update the bonding array counters bonding[ii][0] ++; @@ -1208,11 +1208,11 @@ bool Pattern::fillExpression() } if (bonds_.nItems() != count) { - msg(DM_NONE,"...INTERNAL ERROR: expected %i bonds, found %i\n", bonds_.nItems(), count); + msg(Debug::None,"...INTERNAL ERROR: expected %i bonds, found %i\n", bonds_.nItems(), count); incomplete_ = TRUE; } - else if (ibonds == 0) msg(DM_NONE,"... Found parameters for %i bonds.\n", bonds_.nItems()); - else msg(DM_NONE,"... Missing parameters for %i of %i bonds.\n", ibonds, bonds_.nItems()); + else if (ibonds == 0) msg(Debug::None,"... Found parameters for %i bonds.\n", bonds_.nItems()); + else msg(Debug::None,"... Missing parameters for %i of %i bonds.\n", ibonds, bonds_.nItems()); // Construct the angle list. // Use the list of bound atoms in the bonding[][] array generated above count = 0; @@ -1250,14 +1250,14 @@ bool Pattern::fillExpression() // Check ffa and raise warning if NULL if (ffb == NULL) { - msg(DM_NONE,"!!! No FF definition for angle %s-%s-%s.\n", ti->equivalent(), tj->equivalent(), tk->equivalent()); + msg(Debug::None,"!!! No FF definition for angle %s-%s-%s.\n", ti->equivalent(), tj->equivalent(), tk->equivalent()); incomplete_ = TRUE; iangles ++; } else { params = angles_[count]->data()->params(); - msg(DM_VERBOSE,"Angle %s-%s-%s data : %f %f %f %f\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); + msg(Debug::Verbose,"Angle %s-%s-%s data : %f %f %f %f\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); } count ++; } @@ -1265,11 +1265,11 @@ bool Pattern::fillExpression() } if (angles_.nItems() != count) { - msg(DM_NONE,"...INTERNAL ERROR: expected %i angles, found %i\n", angles_.nItems(), count); + msg(Debug::None,"...INTERNAL ERROR: expected %i angles, found %i\n", angles_.nItems(), count); incomplete_ = TRUE; } - else if (iangles == 0) msg(DM_NONE,"... Found parameters for %i angles_.\n", angles_.nItems()); - else msg(DM_NONE,"... Missing parameters for %i of %i angles_.\n", iangles, angles_.nItems()); + else if (iangles == 0) msg(Debug::None,"... Found parameters for %i angles_.\n", angles_.nItems()); + else msg(Debug::None,"... Missing parameters for %i of %i angles_.\n", iangles, angles_.nItems()); // Construct the torsion list. // Loop over the bond list and add permutations of the bonding atoms listed for either atom j and k count = 0; @@ -1320,14 +1320,14 @@ bool Pattern::fillExpression() // Check fft and raise warning if NULL if (ffb == NULL) { - msg(DM_NONE,"!!! No FF definition for torsion %s-%s-%s-%s.\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), tl->equivalent()); + msg(Debug::None,"!!! No FF definition for torsion %s-%s-%s-%s.\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), tl->equivalent()); incomplete_ = TRUE; itorsions ++; } else { params = torsions_[count]->data()->params(); - msg(DM_VERBOSE,"Torsion %s-%s-%s-%s data : %f %f %f %f\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), tl->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); + msg(Debug::Verbose,"Torsion %s-%s-%s-%s data : %f %f %f %f\n", ti->equivalent(), tj->equivalent(), tk->equivalent(), tl->equivalent(), params.data[0], params.data[1], params.data[2], params.data[3]); } count ++; } @@ -1335,14 +1335,14 @@ bool Pattern::fillExpression() } if (torsions_.nItems() != count) { - msg(DM_NONE,"...INTERNAL ERROR: expected %i torsions, found %i\n", torsions_.nItems(), count); + msg(Debug::None,"...INTERNAL ERROR: expected %i torsions, found %i\n", torsions_.nItems(), count); incomplete_ = TRUE; } - else if (itorsions == 0) msg(DM_NONE,"... Found parameters for %i torsions_.\n", torsions_.nItems()); - else msg(DM_NONE,"... Missing parameters for %i of %i torsions_.\n", itorsions, torsions_.nItems()); + else if (itorsions == 0) msg(Debug::None,"... Found parameters for %i torsions_.\n", torsions_.nItems()); + else msg(Debug::None,"... Missing parameters for %i of %i torsions_.\n", itorsions, torsions_.nItems()); } // Print out a warning if the expression is incomplete. - if (incomplete_) msg(DM_NONE,"!!! Expression is incomplete.\n"); - dbgEnd(DM_CALLS,"Pattern::fillExpression"); + if (incomplete_) msg(Debug::None,"!!! Expression is incomplete.\n"); + dbgEnd(Debug::Calls,"Pattern::fillExpression"); return (incomplete_ ? FALSE : TRUE); } diff --git a/src/classes/region.cpp b/src/classes/region.cpp index 677719ce5..ba301678d 100644 --- a/src/classes/region.cpp +++ b/src/classes/region.cpp @@ -113,7 +113,7 @@ bool ComponentRegion::allowOverlap() bool ComponentRegion::checkOverlap(const Vec3 &v, Cell *cell, Component *firstc) { // Check whether the supplied coordinates overlap with other regions in the list bar this one - dbgBegin(DM_CALLS,"ComponentRegion::checkOverlap"); + dbgBegin(Debug::Calls,"ComponentRegion::checkOverlap"); static Vec3 tempv; bool result = FALSE; ComponentRegion *r; @@ -125,7 +125,7 @@ bool ComponentRegion::checkOverlap(const Vec3 &v, Cell *cell, Component //printf("Overlap with region '%s' is %s.\n",text_from_RS(r->get_shape()),(result ? "TRUE" : "FALSE")); if (result) break; } - dbgEnd(DM_CALLS,"ComponentRegion::checkOverlap"); + dbgEnd(Debug::Calls,"ComponentRegion::checkOverlap"); return result; } @@ -133,7 +133,7 @@ bool ComponentRegion::checkOverlap(const Vec3 &v, Cell *cell, Component bool ComponentRegion::checkCoords(const Vec3 &v, Cell *cell) { // Check whether the supplied coordinates overlap with other regions in the list bar this one - dbgBegin(DM_CALLS,"ComponentRegion::checkCoords"); + dbgBegin(Debug::Calls,"ComponentRegion::checkCoords"); static Vec3 tempv; bool result = TRUE; switch (shape_) @@ -156,14 +156,14 @@ bool ComponentRegion::checkCoords(const Vec3 &v, Cell *cell) printf("ComponentRegion::checkCoords - Not done yet for this type.\n"); break; } - dbgEnd(DM_CALLS,"ComponentRegion::checkCoords"); + dbgEnd(Debug::Calls,"ComponentRegion::checkCoords"); return result; } // Random coordinate in region Vec3 ComponentRegion::randomCoords(Cell *cell, Component *c) { - dbgBegin(DM_CALLS,"ComponentRegion::randomCoords"); + dbgBegin(Debug::Calls,"ComponentRegion::randomCoords"); static Vec3 v, tempv; static int nattempts; bool done = FALSE; @@ -212,6 +212,6 @@ Vec3 ComponentRegion::randomCoords(Cell *cell, Component *c) done = TRUE; } } while (!done); - dbgEnd(DM_CALLS,"ComponentRegion::randomCoords"); + dbgEnd(Debug::Calls,"ComponentRegion::randomCoords"); return v; } diff --git a/src/classes/restraint.cpp b/src/classes/restraint.cpp index 0635de335..7bd618916 100644 --- a/src/classes/restraint.cpp +++ b/src/classes/restraint.cpp @@ -55,11 +55,11 @@ restraint_ij::~restraint_ij() // Add Distance void restraints::add_ij(Reflist &rl) { - dbgBegin(DM_CALLS,"restraints::add_ij"); + dbgBegin(Debug::Calls,"restraints::add_ij"); if (rl.nItems() != 2) { printf("Not enough atoms in supplied list to add distance restraint.\n"); - dbgEnd(DM_CALLS,"restraints::add_ij"); + dbgEnd(Debug::Calls,"restraints::add_ij"); return; } restraint_ij *newdist = ijs.add(); @@ -68,14 +68,14 @@ void restraints::add_ij(Reflist &rl) newdist->i = ri->item; newdist->j = ri->next->item; newdist->rij = ownermodel->distance(newdist->i, newdist->j); - dbgEnd(DM_CALLS,"restraints::add_ij"); + dbgEnd(Debug::Calls,"restraints::add_ij"); } // Find Distance restraint_ij *restraints::does_ij_exist(Reflist &rl) { // Go through the list of restraints and check if the current distance is already measured - dbgBegin(DM_CALLS,"restraints::does_lj_exist"); + dbgBegin(Debug::Calls,"restraints::does_lj_exist"); restraint_ij *xdist, *result; Refitem *ri = rl.first(); result = NULL; @@ -87,23 +87,23 @@ restraint_ij *restraints::does_ij_exist(Reflist &rl) if (result != NULL) break; xdist = xdist->next; } - dbgEnd(DM_CALLS,"restraints::does_lj_exist"); + dbgEnd(Debug::Calls,"restraints::does_lj_exist"); return result; } // Clear all restraints void restraints::clear_all() { - dbgBegin(DM_CALLS,"restraints::clear_all"); + dbgBegin(Debug::Calls,"restraints::clear_all"); ijs.clear(); - dbgEnd(DM_CALLS,"restraints::clear_all"); + dbgEnd(Debug::Calls,"restraints::clear_all"); } // Prune restraints for deleted atoms void restraints::prune_atom(Atom *xatom) { // Search the lists of restraints for the supplied atom, and remove any that use it - dbgBegin(DM_CALLS,"restraints::prune_atom"); + dbgBegin(Debug::Calls,"restraints::prune_atom"); restraint_ij *ij = ijs.first(); restraint_ij *tempij; while (ij != NULL) @@ -142,5 +142,5 @@ void restraints::prune_atom(Atom *xatom) else ijkl = ijkl->next; } */ - dbgEnd(DM_CALLS,"restraints::prune_atom"); + dbgEnd(Debug::Calls,"restraints::prune_atom"); } diff --git a/src/classes/ring.cpp b/src/classes/ring.cpp index b9a251900..43d4f2c70 100644 --- a/src/classes/ring.cpp +++ b/src/classes/ring.cpp @@ -88,23 +88,23 @@ bool Ring::containsAtom(Atom *i) // Add atom to ring bool Ring::addAtom(Atom *i) { - dbgBegin(DM_CALLS,"Ring::addAtom"); + dbgBegin(Debug::Calls,"Ring::addAtom"); // Size check if (atoms_.nItems() == requestedSize_) { - dbgEnd(DM_CALLS,"Ring::addAtom"); + dbgEnd(Debug::Calls,"Ring::addAtom"); return FALSE; } // Duplicate check if (atoms_.search(i) != NULL) { - dbgEnd(DM_CALLS,"Ring::addAtom"); + dbgEnd(Debug::Calls,"Ring::addAtom"); return FALSE; } // Append a ringatomx to the list, pointing to atom i // Store atom ID in the Refitem's data variable atoms_.add(i,i->id()); - dbgEnd(DM_CALLS,"Ring::addAtom"); + dbgEnd(Debug::Calls,"Ring::addAtom"); return TRUE; } @@ -118,7 +118,7 @@ void Ring::removeAtom(Refitem *ri) bool Ring::isAromatic() { // Determine whether the ring is aromatic. - dbgBegin(DM_CALLS,"Ring::isAromatic"); + dbgBegin(Debug::Calls,"Ring::isAromatic"); // SP2 atom types should have already been defined, so use these to determine aromaticity. // Use a set of exceptions for heteroatoms_.such as N and O... int okatoms= 0; @@ -152,7 +152,7 @@ bool Ring::isAromatic() } // Now we just check 'okatoms if it equals the number of atoms_.in the ring, then it should be aromatic! if (okatoms== atoms_.nItems()) result = TRUE; - dbgEnd(DM_CALLS,"Ring::isAromatic"); + dbgEnd(Debug::Calls,"Ring::isAromatic"); return result; } @@ -160,23 +160,23 @@ bool Ring::isAromatic() void Ring::setAromatic() { // Set the environment flags of the constituent atoms_.of the ring to AE_AROMATIC. - dbgBegin(DM_CALLS,"Ring::setAromatic"); + dbgBegin(Debug::Calls,"Ring::setAromatic"); for (Refitem *ra = atoms_.first(); ra != NULL; ra = ra->next) ra->item->setEnv(AE_AROMATIC); - dbgEnd(DM_CALLS,"Ring::setAromatic"); + dbgEnd(Debug::Calls,"Ring::setAromatic"); } // Finalise ring void Ring::finish() { // Perform some finishing tasks on the list - dbgBegin(DM_CALLS,"Ring::finish"); + dbgBegin(Debug::Calls,"Ring::finish"); Refitem *ra, *temp, *lowid; // Make the list head point to the atom with the lowest id if (atoms_.nItems() == 0) { printf("No atoms_.in ring - can't finalise!\n"); - dbgEnd(DM_CALLS,"Ring::finish"); + dbgEnd(Debug::Calls,"Ring::finish"); return; } // First, find the lowest atomid @@ -207,7 +207,7 @@ void Ring::finish() } ra = ra->next; } - dbgEnd(DM_CALLS,"Ring::finish"); + dbgEnd(Debug::Calls,"Ring::finish"); } // Copy ring @@ -228,15 +228,15 @@ void Ring::print() { // Print out the data of the ring. // Beware, since if it has been 'finished' it will be a circular list - msg(DM_VERBOSE,"Ring has %i atoms_.: ",atoms_.nItems()); + msg(Debug::Verbose,"Ring has %i atoms_.: ",atoms_.nItems()); Refitem *ra = atoms_.first(); while (ra != NULL) { - msg(DM_VERBOSE,"%s(%i),",elements.symbol(ra->item),ra->data); + msg(Debug::Verbose,"%s(%i),",elements.symbol(ra->item),ra->data); //printf("%s(%i),",elements.el[ra->i->el].symbol.c_str(),ra->i->tempi); ra = ra->next; } - msg(DM_VERBOSE,"\n"); + msg(Debug::Verbose,"\n"); } // Clear atoms_.in reflist @@ -255,7 +255,7 @@ void Ring::addAtomsToReflist(Reflist *rlist, Atom *i) // Augment ring atom void Ring::augmentAtom(Refitem *refatom, Model *parent) { - dbgBegin(DM_CALLS,"Ring::augmentAtom"); + dbgBegin(Debug::Calls,"Ring::augmentAtom"); // Assumes current bond order differences are in i->tempi Atom *i, *j; i = refatom->item; @@ -281,5 +281,5 @@ void Ring::augmentAtom(Refitem *refatom, Model *parent) if (j->tempi > 0) parent->augmentBond(i,j,-1); } } - dbgEnd(DM_CALLS,"Ring::augmentAtom"); + dbgEnd(Debug::Calls,"Ring::augmentAtom"); } diff --git a/src/classes/site.cpp b/src/classes/site.cpp index 9be7d9217..81987e2c7 100644 --- a/src/classes/site.cpp +++ b/src/classes/site.cpp @@ -71,7 +71,7 @@ const char *Site::name() // Calculate site centre Vec3 Site::calculateCentre(Model *srcmodel, int mol) { - dbgBegin(DM_CALLS,"Site::calculateCentre"); + dbgBegin(Debug::Calls,"Site::calculateCentre"); int offset, n; Atom **modelatoms = srcmodel->atomArray(); Cell *cell = srcmodel->cell(); @@ -106,14 +106,14 @@ Vec3 Site::calculateCentre(Model *srcmodel, int mol) // Take average centre_ /= pattern_->nAtoms(); } - dbgEnd(DM_CALLS,"Site::calculateCentre"); + dbgEnd(Debug::Calls,"Site::calculateCentre"); return centre_; } // Calculate site local axis system Mat3 Site::calculateAxes(Model *srcmodel, int mol) { - dbgBegin(DM_CALLS,"Site::calculateAxes"); + dbgBegin(Debug::Calls,"Site::calculateAxes"); int offset, n; Atom **modelatoms = srcmodel->atomArray(); Cell *cell = srcmodel->cell(); @@ -151,6 +151,6 @@ Mat3 Site::calculateAxes(Model *srcmodel, int mol) axes_.set(1,v2); axes_.set(2,v1 * v2); //axes.print(); - dbgBegin(DM_CALLS,"Site::calculateAxes"); + dbgBegin(Debug::Calls,"Site::calculateAxes"); return axes_; } diff --git a/src/classes/undostate.cpp b/src/classes/undostate.cpp index f31da84b3..5fa4597d9 100644 --- a/src/classes/undostate.cpp +++ b/src/classes/undostate.cpp @@ -60,7 +60,7 @@ Change::~Change() // Set change (by passed variable types) void Change::set(int ue, Atom *i, Atom *j) { - dbgBegin(DM_CALLS,"Change::set[Atom]"); + dbgBegin(Debug::Calls,"Change::set[Atom]"); direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS); type_ = (UndoEvent) abs(ue); // Copy atom data from source atoms, unless they are NULL @@ -76,13 +76,13 @@ void Change::set(int ue, Atom *i, Atom *j) atomData_[1]->copy(j); atomData_[1]->setId(j->id()); } - dbgEnd(DM_CALLS,"Change::set[atom]"); + dbgEnd(Debug::Calls,"Change::set[atom]"); } // Set change (general) void Change::set(int ue, int i, int j, int k, int l, int m) { - dbgBegin(DM_CALLS,"Change::set[int]"); + dbgBegin(Debug::Calls,"Change::set[int]"); direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS); type_ = (UndoEvent) abs(ue); data_[0] = i; @@ -90,13 +90,13 @@ void Change::set(int ue, int i, int j, int k, int l, int m) data_[2] = k; data_[3] = l; data_[4] = m; - dbgEnd(DM_CALLS,"Change::set[int]"); + dbgEnd(Debug::Calls,"Change::set[int]"); } // Set change (by passed variable types) void Change::set(int ue, Vec3 *v1, Vec3 *v2, Vec3 *v3, Vec3 *v4) { - dbgBegin(DM_CALLS,"Change::set[vector]"); + dbgBegin(Debug::Calls,"Change::set[vector]"); direction_ = (ue > 0 ? UD_REVERSE : UD_FORWARDS); type_ = (UndoEvent) abs(ue); // Copy data from source vectors, unless they are NULL @@ -120,13 +120,13 @@ void Change::set(int ue, Vec3 *v1, Vec3 *v2, Vec3 *v3, V vecData_[3] = new Vec3; *vecData_[3] = *v4; } - dbgEnd(DM_CALLS,"Change::set[vector]"); + dbgEnd(Debug::Calls,"Change::set[vector]"); } // Reverse (undo) stored change void Change::reverse(Model *m) { - dbgBegin(DM_CALLS,"Change::reverse"); + dbgBegin(Debug::Calls,"Change::reverse"); Atom **modelatoms = m->atomArray(); int id; Atom *i, *j, *k, *l; @@ -139,14 +139,14 @@ void Change::reverse(Model *m) { // We delete the atom at the position referenced by the ID in the atom id = atomData_[0]->id(); - msg(DM_VERBOSE,"Reversing atom creation - atom id = %i\n",id); + msg(Debug::Verbose,"Reversing atom creation - atom id = %i\n",id); m->deleteAtom(modelatoms[id]); } else { // Insert a new atom at the position before the stored atom id id = atomData_[0]->id(); - msg(DM_VERBOSE,"Replaying atom deletion - atom id = %i\n",id); + msg(Debug::Verbose,"Replaying atom deletion - atom id = %i\n",id); if (id == 0) m->addCopy(NULL, atomData_[0]); else m->addCopy(modelatoms[id-1], atomData_[0]); } @@ -158,13 +158,13 @@ void Change::reverse(Model *m) if (direction_ == UD_REVERSE) { // Delete bond between stored atom ids - msg(DM_VERBOSE,"Reversing bond creation - atom ids = %i %i\n", data_[0], data_[1]); + msg(Debug::Verbose,"Reversing bond creation - atom ids = %i %i\n", data_[0], data_[1]); m->unbondAtoms(i,j); } else { // Add bond between stored atom ids - msg(DM_VERBOSE,"Replaying bond deletion - atom ids = %i %i\n", data_[0], data_[1]); + msg(Debug::Verbose,"Replaying bond deletion - atom ids = %i %i\n", data_[0], data_[1]); m->bondAtoms(i,j,(Bond::BondType) data_[2]); } break; @@ -173,12 +173,12 @@ void Change::reverse(Model *m) i = modelatoms[data_[0]]; if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing atom selection - atom id = %i\n", data_[0]); + msg(Debug::Verbose,"Reversing atom selection - atom id = %i\n", data_[0]); m->deselectAtom(i); } else { - msg(DM_VERBOSE,"Replaying atom deselection - atom id = %i\n", data_[0]); + msg(Debug::Verbose,"Replaying atom deselection - atom id = %i\n", data_[0]); m->selectAtom(i); } break; @@ -189,12 +189,12 @@ void Change::reverse(Model *m) b = i->findBond(j); if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing bond order change - atoms %i-%i, old = %i, new = %i\n", i->id(), j->id(), data_[3], data_[2]); + msg(Debug::Verbose,"Reversing bond order change - atoms %i-%i, old = %i, new = %i\n", i->id(), j->id(), data_[3], data_[2]); m->changeBond(b,(Bond::BondType) data_[2]); } else { - msg(DM_VERBOSE,"Replaying bond order change - atoms %i-%i, old = %i, new = %i\n", i->id(), j->id(), data_[2], data_[3]); + msg(Debug::Verbose,"Replaying bond order change - atoms %i-%i, old = %i, new = %i\n", i->id(), j->id(), data_[2], data_[3]); m->changeBond(b,(Bond::BondType) data_[3]); } break; @@ -207,14 +207,14 @@ void Change::reverse(Model *m) if (direction_ == UD_REVERSE) { GeometryType gt = (GeometryType) data_[0]; - msg(DM_VERBOSE,"Reversing measurement - type = %i\n", gt); + msg(Debug::Verbose,"Reversing measurement - type = %i\n", gt); Measurement *me = m->findMeasurement(gt, i, j, k, l); if (me != NULL) m->removeMeasurement(me); } else { GeometryType gt = (GeometryType) data_[0]; - msg(DM_VERBOSE,"Replaying measurement - type = %i\n", gt); + msg(Debug::Verbose,"Replaying measurement - type = %i\n", gt); m->addMeasurement(gt, i, j, k, l); } break; @@ -223,12 +223,12 @@ void Change::reverse(Model *m) i = modelatoms[data_[0]]; if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing atom transmute - atom %i, old = %i, new = %i\n", i->id(), data_[2], data_[1]); + msg(Debug::Verbose,"Reversing atom transmute - atom %i, old = %i, new = %i\n", i->id(), data_[2], data_[1]); m->transmuteAtom(i,data_[1]); } else { - msg(DM_VERBOSE,"Replaying atom transmute - atom %i, old = %i, new = %i\n", i->id(), data_[1], data_[2]); + msg(Debug::Verbose,"Replaying atom transmute - atom %i, old = %i, new = %i\n", i->id(), data_[1], data_[2]); m->transmuteAtom(i,data_[2]); } break; @@ -236,13 +236,13 @@ void Change::reverse(Model *m) case (UE_CELL): if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing cell change\n"); + msg(Debug::Verbose,"Reversing cell change\n"); if (vecData_[0] == NULL) m->removeCell(); else m->setCell(*vecData_[0], *vecData_[1]); } else { - msg(DM_VERBOSE,"Replaying cell change\n"); + msg(Debug::Verbose,"Replaying cell change\n"); if (vecData_[2] == NULL) m->removeCell(); else m->setCell(*vecData_[2], *vecData_[3]); } @@ -252,12 +252,12 @@ void Change::reverse(Model *m) i = modelatoms[data_[0]]; if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing atom label change - atom %i, from %i to %i\n",data_[0],data_[2],data_[1]); + msg(Debug::Verbose,"Reversing atom label change - atom %i, from %i to %i\n",data_[0],data_[2],data_[1]); i->setLabels(data_[1]); } else { - msg(DM_VERBOSE,"Replaying atom label change - atom %i, from %i to %i\n",data_[0],data_[1],data_[2]); + msg(Debug::Verbose,"Replaying atom label change - atom %i, from %i to %i\n",data_[0],data_[1],data_[2]); i->setLabels(data_[2]); } break; @@ -266,12 +266,12 @@ void Change::reverse(Model *m) i = modelatoms[data_[0]]; if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing atom translation - atom %i, subtracting %f %f %f\n", data_[0], vecData_[0]->x, vecData_[0]->y, vecData_[0]->z); + msg(Debug::Verbose,"Reversing atom translation - atom %i, subtracting %f %f %f\n", data_[0], vecData_[0]->x, vecData_[0]->y, vecData_[0]->z); i->r() -= *vecData_[0]; } else { - msg(DM_VERBOSE,"Replaying atom translation - atom %i, adding %f %f %f\n", data_[0], vecData_[0]->x, vecData_[0]->y, vecData_[0]->z); + msg(Debug::Verbose,"Replaying atom translation - atom %i, adding %f %f %f\n", data_[0], vecData_[0]->x, vecData_[0]->y, vecData_[0]->z); i->r() += *vecData_[0]; } break; @@ -279,12 +279,12 @@ void Change::reverse(Model *m) case (UE_SHIFT): if (direction_ == UD_REVERSE) { - msg(DM_VERBOSE,"Reversing atom shift - atom %i moves %i places\n", data_[0]+data_[1], -data_[1]); + msg(Debug::Verbose,"Reversing atom shift - atom %i moves %i places\n", data_[0]+data_[1], -data_[1]); m->atoms_.move(data_[0]+data_[1], -data_[1]); } else { - msg(DM_VERBOSE,"Performing atom shift - atom %i moves %i places\n", data_[0], data_[1]); + msg(Debug::Verbose,"Performing atom shift - atom %i moves %i places\n", data_[0], data_[1]); m->atoms_.move(data_[0], data_[1]); } m->renumberAtoms(); @@ -293,19 +293,19 @@ void Change::reverse(Model *m) printf("Don't know how to reverse change (type = %i)\n", type_); break; } - dbgEnd(DM_CALLS,"Change::reverse"); + dbgEnd(Debug::Calls,"Change::reverse"); } // Perform (redo) stored change void Change::perform(Model *m) { - dbgBegin(DM_CALLS,"Change::perform"); + dbgBegin(Debug::Calls,"Change::perform"); // Re-use the commands in Change::revert, performing the change in the opposite direction direction_ = (direction_ == UD_REVERSE ? UD_FORWARDS : UD_REVERSE); // Now just call reverse instead, and then set the old direction back at the end reverse(m); direction_ = (direction_ == UD_REVERSE ? UD_FORWARDS : UD_REVERSE); - dbgEnd(DM_CALLS,"Change::perform"); + dbgEnd(Debug::Calls,"Change::perform"); } /* @@ -363,22 +363,22 @@ int Undostate::nChanges() // Revert (undo) changes detailed in state void Undostate::reverse(Model *m) { - dbgBegin(DM_CALLS,"Undostate::reverse"); + dbgBegin(Debug::Calls,"Undostate::reverse"); // Undo the changes stored in the change list for (Change* c = changes_.last(); c != NULL; c = c->prev) c->reverse(m); // Set model logs to the old values m->copyLogs(startLogs_); - dbgEnd(DM_CALLS,"Undostate::reverse"); + dbgEnd(Debug::Calls,"Undostate::reverse"); } // Perform (redo) changes detailed in state void Undostate::perform(Model *m) { - dbgBegin(DM_CALLS,"Undostate::perform"); + dbgBegin(Debug::Calls,"Undostate::perform"); for (Change* c = changes_.first(); c != NULL; c = c->next) c->perform(m); // Set model logs to the new values m->copyLogs(endLogs_); - dbgEnd(DM_CALLS,"Undostate::perform"); + dbgEnd(Debug::Calls,"Undostate::perform"); } // Check differences between LOG_STRUCTURE and LOG_COORDS for start/end points diff --git a/src/classes/variables.cpp b/src/classes/variables.cpp index 5e4aff028..6f4df7093 100644 --- a/src/classes/variables.cpp +++ b/src/classes/variables.cpp @@ -157,7 +157,7 @@ void Variable::set(Atom *i) return; } ptrValue_ = i; - msg(DM_VERBOSE,"Atom variable '%s' set to '%li' ('%s')\n",name_.get(),i,(i == NULL ? "" : elements.symbol(i))); + msg(Debug::Verbose,"Atom variable '%s' set to '%li' ('%s')\n",name_.get(),i,(i == NULL ? "" : elements.symbol(i))); } // Set (pattern) @@ -169,7 +169,7 @@ void Variable::set(Pattern *p) return; } ptrValue_ = p; - msg(DM_VERBOSE,"Pattern variable '%s' set to '%li' ('%s')\n",name_.get(),p,(p == NULL ? "" : p->name())); + msg(Debug::Verbose,"Pattern variable '%s' set to '%li' ('%s')\n",name_.get(),p,(p == NULL ? "" : p->name())); } // Set (model) @@ -181,7 +181,7 @@ void Variable::set(Model *m) return; } ptrValue_ = m; - msg(DM_VERBOSE,"Model variable '%s' set to '%li' ('%s')\n",name_.get(),m,(m == NULL ? "" : m->name())); + msg(Debug::Verbose,"Model variable '%s' set to '%li' ('%s')\n",name_.get(),m,(m == NULL ? "" : m->name())); } // Set (PatternBound) @@ -193,7 +193,7 @@ void Variable::set(PatternBound *pb) return; } ptrValue_ = pb; - msg(DM_VERBOSE,"PatBound variable '%s' set to '%li'\n",name_.get(),pb); + msg(Debug::Verbose,"PatBound variable '%s' set to '%li'\n",name_.get(),pb); } // Set (ForcefieldAtom) @@ -205,7 +205,7 @@ void Variable::set(ForcefieldAtom *ffa) return; } ptrValue_ = ffa; - msg(DM_VERBOSE,"FFAtom variable '%s' set to '%li'\n",name_.get(),ffa); + msg(Debug::Verbose,"FFAtom variable '%s' set to '%li'\n",name_.get(),ffa); } // Get as char @@ -220,7 +220,7 @@ const char *Variable::asCharacter() case (VT_DOUBLE): return ftoa(doubleValue_); default: - msg(DM_VERBOSE,"Variable::asCharacter <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); + msg(Debug::Verbose,"Variable::asCharacter <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); } return ""; } @@ -237,7 +237,7 @@ int Variable::asInteger() case (VT_DOUBLE): return int(doubleValue_); default: - msg(DM_VERBOSE,"Variable::asInteger <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); + msg(Debug::Verbose,"Variable::asInteger <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); } return 0; } @@ -254,7 +254,7 @@ double Variable::asDouble() case (VT_DOUBLE): return doubleValue_; default: - msg(DM_VERBOSE,"Variable::asDouble <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); + msg(Debug::Verbose,"Variable::asDouble <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); } return 0.0; } @@ -269,7 +269,7 @@ bool Variable::asBool() case (VT_INTEGER): return (intValue_ < 1 ? FALSE : TRUE); default: - msg(DM_VERBOSE,"Variable::get_as_bool <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); + msg(Debug::Verbose,"Variable::get_as_bool <<<< Tried to get variable '%s' which is of type_ '%s' >>>>\n", name_.get(), text_from_VT(type_)); } return FALSE; } @@ -509,15 +509,15 @@ void VariableList::print() // Clear all variable values void VariableList::resetAll() { - dbgBegin(DM_CALLS,"VariableList::resetAll"); + dbgBegin(Debug::Calls,"VariableList::resetAll"); for (Variable *v = vars_.first(); v != NULL; v = v->next) v->reset(); - dbgEnd(DM_CALLS,"VariableList::resetAll"); + dbgEnd(Debug::Calls,"VariableList::resetAll"); } // Clear list of variables void VariableList::reset(const char *s, ...) { - dbgBegin(DM_CALLS,"VariableList::reset"); + dbgBegin(Debug::Calls,"VariableList::reset"); // List of variables must be ended by "". static char name[64]; va_list namelist; @@ -535,5 +535,5 @@ void VariableList::reset(const char *s, ...) else v->reset(); } } while (name[0] != '\0'); - dbgEnd(DM_CALLS,"VariableList::reset"); + dbgEnd(Debug::Calls,"VariableList::reset"); } diff --git a/src/command/analyse.cpp b/src/command/analyse.cpp index 0de24fd97..1a8f96910 100644 --- a/src/command/analyse.cpp +++ b/src/command/analyse.cpp @@ -128,7 +128,7 @@ int CommandData::function_CA_TRAJANALYSE(Command *&c, Bundle &obj) totalframes = obj.m->totalFrames(); if (totalframes == 0) { - msg(DM_NONE,"No trajectory associated to model.\n"); + msg(Debug::None,"No trajectory associated to model.\n"); return CR_FAIL; } // Get start frame, frame skip, and frames to do (if supplied) @@ -156,6 +156,6 @@ int CommandData::function_CA_TRAJANALYSE(Command *&c, Bundle &obj) // Move to next frame if (n != totalframes) obj.m->seekNextFrame(); } - msg(DM_NONE,"Finished calculating properties - used %i frames from trajectory.\n", framesdone); + msg(Debug::None,"Finished calculating properties - used %i frames from trajectory.\n", framesdone); return CR_SUCCESS; } diff --git a/src/command/atom.cpp b/src/command/atom.cpp index e78e3f42e..58b250aac 100644 --- a/src/command/atom.cpp +++ b/src/command/atom.cpp @@ -53,7 +53,7 @@ int CommandData::function_CA_NEWATOM(Command *&c, Bundle &obj) c->arga(0) == NULL ? el = 0 : c->arga(0)->element(); break; default: - msg(DM_NONE,"Type '%s' is not a valid one to pass to CA_ADDATOM.\n", text_from_VT(c->argt(0))); + msg(Debug::None,"Type '%s' is not a valid one to pass to CA_ADDATOM.\n", text_from_VT(c->argt(0))); el = 0; break; } @@ -83,13 +83,13 @@ int CommandData::function_CA_NEWATOMFRAC(Command *&c, Bundle &obj) c->arga(0) == NULL ? el = 0 : c->arga(0)->element(); break; default: - msg(DM_NONE,"Type '%s' is not a valid one to pass to CA_ADDATOM.\n", text_from_VT(c->argt(0))); + msg(Debug::None,"Type '%s' is not a valid one to pass to CA_ADDATOM.\n", text_from_VT(c->argt(0))); el = 0; break; } // Check for presence of unit cell Vec3 r = c->arg3d(1); - if (obj.m->cell()->type() == CT_NONE) msg(DM_NONE,"Warning: No unit cell present - atom added with supplied coordinates.\n"); + if (obj.m->cell()->type() == CT_NONE) msg(Debug::None,"Warning: No unit cell present - atom added with supplied coordinates.\n"); else r = obj.m->cell()->fracToReal(r); master.current.i = obj.m->addAtom(el, r); return CR_SUCCESS; diff --git a/src/command/build.cpp b/src/command/build.cpp index 96f7117e4..38cc4fffa 100644 --- a/src/command/build.cpp +++ b/src/command/build.cpp @@ -36,7 +36,7 @@ int CommandData::function_CA_ADDHYDROGEN(Command *&c, Bundle &obj) else if (c->argt(0) == VT_ATOM) i = c->arga(0); else { - msg(DM_NONE,"Optional argument to 'addhydrogen' must be an integer or an atom*.\n"); + msg(Debug::None,"Optional argument to 'addhydrogen' must be an integer or an atom*.\n"); return CR_FAIL; } obj.m->hydrogenSatisfy(i); diff --git a/src/command/cell.cpp b/src/command/cell.cpp index 6d9c19f2f..8307992c5 100644 --- a/src/command/cell.cpp +++ b/src/command/cell.cpp @@ -54,7 +54,7 @@ int CommandData::function_CA_PACK(Command *&c, Bundle &obj) int CommandData::function_CA_PRINTCELL(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; - msg(DM_NONE,"Unit cell type for model '%s' is %s\n", obj.m->name(), text_from_CT(obj.m->cell()->type())); + msg(Debug::None,"Unit cell type for model '%s' is %s\n", obj.m->name(), text_from_CT(obj.m->cell()->type())); if (obj.m->cell()->type() != CT_NONE) obj.m->cell()->print(); return CR_SUCCESS; } @@ -107,10 +107,10 @@ int CommandData::function_CA_SETSPACEGROUP(Command *&c, Bundle &obj) if (c->argt(0) == VT_INTEGER) obj.m->setSpacegroup(c->argi(0)); else { - msg(DM_NONE,"Searching for spacegroup '%s'...",c->argc(0)); + msg(Debug::None,"Searching for spacegroup '%s'...",c->argc(0)); int sg = master.findSpacegroupByName(c->argc(0)); - if (sg == 0) msg(DM_NONE," not found - no spacegroup set.\n"); - else msg(DM_NONE," found, id = %i.\n",sg); + if (sg == 0) msg(Debug::None," not found - no spacegroup set.\n"); + else msg(Debug::None," found, id = %i.\n",sg); obj.m->setSpacegroup(sg); } return CR_SUCCESS; diff --git a/src/command/charge.cpp b/src/command/charge.cpp index 430d86d0c..439a82b14 100644 --- a/src/command/charge.cpp +++ b/src/command/charge.cpp @@ -39,7 +39,7 @@ int CommandData::function_CA_CHARGEFROMMODEL(Command *&c, Bundle &obj) Model *frame = obj.m->currentFrame(); if (frame == NULL) { - msg(DM_NONE,"Error - 'chargefrommodel' requires an active trajectory frame in the current model.\n"); + msg(Debug::None,"Error - 'chargefrommodel' requires an active trajectory frame in the current model.\n"); return CR_FAIL; } else frame->copyAtomData(obj.m, Atom::ChargeData); diff --git a/src/command/commandlist.cpp b/src/command/commandlist.cpp index d82b0ea5c..73113b5e3 100644 --- a/src/command/commandlist.cpp +++ b/src/command/commandlist.cpp @@ -236,7 +236,7 @@ void CommandList::clear() // Print data variables void Command::print_args() { - dbgBegin(DM_CALLS,"Command::print_args"); + dbgBegin(Debug::Calls,"Command::print_args"); int i; for (int i=0; iasPointer()); } } - dbgEnd(DM_CALLS,"Command::print_args"); + dbgEnd(Debug::Calls,"Command::print_args"); } // Return arguments as Vec3 Vec3 Command::arg3d(int i) { - dbgBegin(DM_CALLS,"Command::arg3d"); + dbgBegin(Debug::Calls,"Command::arg3d"); static Vec3 result; if (i > (MAXDATAVARS-3)) printf("Command::get_vector3d - Starting point too close to MAXDATAVARS.\n"); result.set(args_[i]->asDouble(),args_[i+1]->asDouble(),args_[i+2]->asDouble()); - dbgEnd(DM_CALLS,"Command::arg3d"); + dbgEnd(Debug::Calls,"Command::arg3d"); return result; } // Return arguments as Vec3 Vec3 Command::arg3f(int i) { - dbgBegin(DM_CALLS,"Command::arg3f"); + dbgBegin(Debug::Calls,"Command::arg3f"); static Vec3 result; if (i > (MAXDATAVARS-3)) printf("Command::get_vector3f - Starting point too close to MAXDATAVARS.\n"); result.set(args_[i]->asFloat(),args_[i+1]->asFloat(),args_[i+2]->asFloat()); - dbgEnd(DM_CALLS,"Command::arg3f"); + dbgEnd(Debug::Calls,"Command::arg3f"); return result; } // Return arguments as Vec3 Vec3 Command::arg3i(int i) { - dbgBegin(DM_CALLS,"Command::arg3i"); + dbgBegin(Debug::Calls,"Command::arg3i"); static Vec3 result; if (i > (MAXDATAVARS-3)) printf("Command::get_vector3i - Starting point too close to MAXDATAVARS.\n"); result.set(args_[i]->asInteger(),args_[i+1]->asInteger(),args_[i+2]->asInteger()); - dbgEnd(DM_CALLS,"Command::arg3i"); + dbgEnd(Debug::Calls,"Command::arg3i"); return result; } // Create branch List *Command::createBranch() { - dbgBegin(DM_CALLS,"Command::createBranch"); + dbgBegin(Debug::Calls,"Command::createBranch"); if (branch_ != NULL) printf("Command::createBranch <<<< Already has a branch >>>>\n"); branch_ = new List< Command >; - dbgEnd(DM_CALLS,"Command::createBranch"); + dbgEnd(Debug::Calls,"Command::createBranch"); return branch_; } // Create branch bool Command::createFormat(const char *s, VariableList &vars, bool delimited) { - dbgBegin(DM_CALLS,"Command::create_format"); + dbgBegin(Debug::Calls,"Command::create_format"); bool result = FALSE; if (format_ != NULL) printf("Command::createBranch <<<< Already has a format >>>>\n"); else @@ -306,14 +306,14 @@ bool Command::createFormat(const char *s, VariableList &vars, bool delimited) format_ = new Format; result = format_->create(s, vars, delimited); } - dbgEnd(DM_CALLS,"Command::create_format"); + dbgEnd(Debug::Calls,"Command::create_format"); return result; } // Set if condition test bool Command::setIfTest(const char *s) { - dbgBegin(DM_CALLS,"Command::setIfTest"); + dbgBegin(Debug::Calls,"Command::setIfTest"); bool result = TRUE; int n, m; m = 0; @@ -336,14 +336,14 @@ bool Command::setIfTest(const char *s) } if (result >= IF_NITEMS) result = FALSE; else ifTest_ = (IfTest) m; - dbgEnd(DM_CALLS,"Command::setIfTest"); + dbgEnd(Debug::Calls,"Command::setIfTest"); return result; } // Evaluate condition bool Command::ifEvaluate() { - dbgBegin(DM_CALLS,"Command::ifEvaluate"); + dbgBegin(Debug::Calls,"Command::ifEvaluate"); // Do all as comparisons as floats, except for equalities bool result; static Dnchar value1, value2; @@ -360,7 +360,7 @@ bool Command::ifEvaluate() d1 = args_[0]->asDouble(); d2 = args_[2]->asDouble(); } - msg(DM_VERBOSE,"IF TEST = var1(%s)=[%s] (%s) var2(%s)=[%s]\n", args_[0]->name(), args_[0]->asCharacter(), text_from_IC(ifTest_), args_[2]->name(), args_[2]->asCharacter()); + msg(Debug::Verbose,"IF TEST = var1(%s)=[%s] (%s) var2(%s)=[%s]\n", args_[0]->name(), args_[0]->asCharacter(), text_from_IC(ifTest_), args_[2]->name(), args_[2]->asCharacter()); // Do comparison switch (ifTest_) { @@ -384,14 +384,14 @@ bool Command::ifEvaluate() break; } //printf("IF TEST : [%s] [%i] [%s] = %s\n",value1,type,value2,(result ? "TRUE" : "FALSE")); - dbgEnd(DM_CALLS,"Command::ifEvaluate"); + dbgEnd(Debug::Calls,"Command::ifEvaluate"); return result; } // Add variables to command bool Command::addVariables(const char *cmd, const char *v, VariableList &vars) { - dbgBegin(DM_CALLS,"Command::addVariables"); + dbgBegin(Debug::Calls,"Command::addVariables"); bool required = TRUE; int n, argcount, varcount; Variable *b; @@ -403,7 +403,7 @@ bool Command::addVariables(const char *cmd, const char *v, VariableList &vars) if ((parser.nArgs() - 1) > strlen(v)) { printf("Too many arguments (%i) given to command '%s' (which expects %li at most).\n", (parser.nArgs()-1), cmd, strlen(v)); - dbgEnd(DM_CALLS,"Command::addVariables"); + dbgEnd(Debug::Calls,"Command::addVariables"); return FALSE; } argcount = 0; @@ -422,7 +422,7 @@ bool Command::addVariables(const char *cmd, const char *v, VariableList &vars) if (required) { printf("Command '%s' requires argument %i\n", cmd, argcount); - dbgEnd(DM_CALLS,"Command::addVariables"); + dbgEnd(Debug::Calls,"Command::addVariables"); return FALSE; } else break; // No more arguments, so may as well quit. @@ -460,7 +460,7 @@ bool Command::addVariables(const char *cmd, const char *v, VariableList &vars) if (strcmp(arg,"=") != 0) { printf("Expected '=' after argument %i for command '%s'.\n", argcount, cmd); - dbgEnd(DM_CALLS,"Command::addVariables"); + dbgEnd(Debug::Calls,"Command::addVariables"); return FALSE; } break; @@ -485,7 +485,7 @@ bool Command::addVariables(const char *cmd, const char *v, VariableList &vars) break; } } - dbgEnd(DM_CALLS,"Command::addVariables"); + dbgEnd(Debug::Calls,"Command::addVariables"); return TRUE; } @@ -591,7 +591,7 @@ Command* CommandList::addTopBranchCommand(CommandAction ca, Command *nodeptr) // Add basic command bool CommandList::addCommand(CommandAction ca) { - dbgBegin(DM_CALLS,"CommandList::addCommand"); + dbgBegin(Debug::Calls,"CommandList::addCommand"); // Pointers to command nodes Command *fn, *fn2, *fn3; CommandAction branchca; @@ -644,7 +644,7 @@ bool CommandList::addCommand(CommandAction ca) branchca = topBranchType(); if ((branchca != CA_IF) && (branchca != CA_ELSEIF)) { - msg(DM_NONE,"Error: 'elseif' used without previous if/elseif.\n"); + msg(Debug::None,"Error: 'elseif' used without previous if/elseif.\n"); result = FALSE; break; } @@ -666,7 +666,7 @@ bool CommandList::addCommand(CommandAction ca) branchca = topBranchType(); if ((branchca != CA_IF) && (branchca != CA_ELSEIF)) { - msg(DM_NONE,"Error: 'else' used without previous if/elseif.\n"); + msg(Debug::None,"Error: 'else' used without previous if/elseif.\n"); result = FALSE; break; } @@ -711,7 +711,7 @@ bool CommandList::addCommand(CommandAction ca) case (CA_END): if (branchStack_.nItems() == 0) { - msg(DM_NONE,"CommandList::addCommand - 'end' does not end a block.\n"); + msg(Debug::None,"CommandList::addCommand - 'end' does not end a block.\n"); result = FALSE; break; } @@ -754,17 +754,17 @@ bool CommandList::addCommand(CommandAction ca) // Check variable assignment result if (!varresult) { - msg(DM_NONE,"Error: Command '%s' was not given the correct variables.\n", CA_data[ca].keyword); + msg(Debug::None,"Error: Command '%s' was not given the correct variables.\n", CA_data[ca].keyword); result = FALSE; } - dbgEnd(DM_CALLS,"CommandList::addCommand"); + dbgEnd(Debug::Calls,"CommandList::addCommand"); return result; } // Cache script commands from line containing semicolon-separated commands bool CommandList::cacheLine(const char *s) { - dbgBegin(DM_CALLS,"CommandList::cacheLine"); + dbgBegin(Debug::Calls,"CommandList::cacheLine"); // Use a local parser to split up the semi-colon'd line into individual commands static Parser lines; lines.getLinesDelim(s); @@ -774,18 +774,18 @@ bool CommandList::cacheLine(const char *s) parser.getArgsDelim(lines.argc(n), PO_USEQUOTES+PO_SKIPBLANKS); if (!cacheCommand()) { - dbgEnd(DM_CALLS,"CommandList::cacheLine"); + dbgEnd(Debug::Calls,"CommandList::cacheLine"); return FALSE; } } - dbgEnd(DM_CALLS,"CommandList::cacheLine"); + dbgEnd(Debug::Calls,"CommandList::cacheLine"); return TRUE; } // Cache command arguments in line_parser bool CommandList::cacheCommand() { - dbgBegin(DM_CALLS,"CommandList::cacheCommand"); + dbgBegin(Debug::Calls,"CommandList::cacheCommand"); CommandAction ca; int success; bool result = TRUE; @@ -796,17 +796,17 @@ bool CommandList::cacheCommand() // If addCommand() returns FALSE then we encountered an error if (!addCommand(ca)) { - msg(DM_NONE,"Error adding command '%s'.\n", parser.argc(0)); - msg(DM_NONE,"Command usage is: %s %s\n", CA_data[ca].keyword, CA_data[ca].argText); + msg(Debug::None,"Error adding command '%s'.\n", parser.argc(0)); + msg(Debug::None,"Command usage is: %s %s\n", CA_data[ca].keyword, CA_data[ca].argText); result = FALSE; } } else { - msg(DM_NONE,"Unrecognised command '%s'.\n", parser.argc(0)); + msg(Debug::None,"Unrecognised command '%s'.\n", parser.argc(0)); result = FALSE; } - dbgEnd(DM_CALLS,"CommandList::cacheCommand"); + dbgEnd(Debug::Calls,"CommandList::cacheCommand"); return result; } @@ -847,7 +847,7 @@ int CommandList::readOptions() { // Load commands from file bool CommandList::load(const char *filename) { - dbgBegin(DM_CALLS,"CommandList::load"); + dbgBegin(Debug::Calls,"CommandList::load"); scriptFilename_ = filename; ifstream cmdfile(filename,ios::in); Command *c; @@ -860,8 +860,8 @@ bool CommandList::load(const char *filename) success = parser.getArgsDelim(&cmdfile,PO_USEQUOTES+PO_SKIPBLANKS); if (success == 1) { - msg(DM_NONE,"CommandList::load - Error reading command file.\n"); - dbgEnd(DM_CALLS,"CommandList::load"); + msg(Debug::None,"CommandList::load - Error reading command file.\n"); + dbgEnd(Debug::Calls,"CommandList::load"); return FALSE; } else if (success == -1) break; @@ -873,15 +873,15 @@ bool CommandList::load(const char *filename) if (addCommand(ca)) continue; else { - msg(DM_NONE,"CommandList::load <<< Error adding command '%s' >>>>\n", parser.argc(0)); - dbgEnd(DM_CALLS,"CommandList::load"); + msg(Debug::None,"CommandList::load <<< Error adding command '%s' >>>>\n", parser.argc(0)); + dbgEnd(Debug::Calls,"CommandList::load"); return FALSE; } } else { - msg(DM_NONE,"Unrecognised command '%s' in file.\n", parser.argc(0)); - dbgEnd(DM_CALLS,"CommandList::load"); + msg(Debug::None,"Unrecognised command '%s' in file.\n", parser.argc(0)); + dbgEnd(Debug::Calls,"CommandList::load"); return FALSE; } } @@ -890,31 +890,31 @@ bool CommandList::load(const char *filename) if (itemsleft != 1) { printf("CommandList::load <<<< %i block%s not been terminated >>>>\n", itemsleft, (itemsleft == 1 ? " has" : "s have")); - dbgEnd(DM_CALLS,"CommandList::load"); + dbgEnd(Debug::Calls,"CommandList::load"); return FALSE; } - dbgEnd(DM_CALLS,"CommandList::load"); + dbgEnd(Debug::Calls,"CommandList::load"); return TRUE; } // Set input file (pointer) bool CommandList::setInputFile(const char *sourcefile) { - dbgBegin(DM_CALLS,"CommandList::setInFile"); + dbgBegin(Debug::Calls,"CommandList::setInFile"); if (inputFile_ != NULL) printf("CommandList::setInFile <<<< Inputfile already set >>>>\n"); inputFile_ = new ifstream(sourcefile,ios::in); filename_ = sourcefile; - dbgEnd(DM_CALLS,"CommandList::setInFile"); + dbgEnd(Debug::Calls,"CommandList::setInFile"); return (!inputFile_->good() ? FALSE : TRUE); } // Set output file bool CommandList::setOutputFile(const char *destfile) { - dbgBegin(DM_CALLS,"CommandList::setOutputFile"); + dbgBegin(Debug::Calls,"CommandList::setOutputFile"); outputFile_ = new ofstream(destfile,ios::out); filename_ = destfile; - dbgEnd(DM_CALLS,"CommandList::setOutputFile"); + dbgEnd(Debug::Calls,"CommandList::setOutputFile"); if (!outputFile_->good()) return FALSE; else return TRUE; } @@ -922,7 +922,7 @@ bool CommandList::setOutputFile(const char *destfile) // Close files void CommandList::closeFiles() { - dbgBegin(DM_CALLS,"CommandList::closeFiles"); + dbgBegin(Debug::Calls,"CommandList::closeFiles"); if (inputFile_ != NULL) { inputFile_->close(); @@ -935,7 +935,7 @@ void CommandList::closeFiles() } inputFile_ = NULL; outputFile_ = NULL; - dbgEnd(DM_CALLS,"CommandList::closeFiles"); + dbgEnd(Debug::Calls,"CommandList::closeFiles"); } // Execute command @@ -952,7 +952,7 @@ int Command::execute(Command *&c, Model *alttarget) // Execute commands in command list bool CommandList::execute(Model *alttarget, ifstream *sourcefile) { - dbgBegin(DM_CALLS,"CommandList::execute"); + dbgBegin(Debug::Calls,"CommandList::execute"); // Set alternative input file if one was supplied if (sourcefile != NULL) { @@ -966,7 +966,7 @@ bool CommandList::execute(Model *alttarget, ifstream *sourcefile) while (c != NULL) { // Run command and get return value - msg(DM_PARSE,"Commandlist executing command '%s'...\n",CA_data[c->command()].keyword); + msg(Debug::Parse,"Commandlist executing command '%s'...\n",CA_data[c->command()].keyword); switch (c->execute(c, alttarget)) { // Command succeeded - get following command @@ -998,26 +998,26 @@ bool CommandList::execute(Model *alttarget, ifstream *sourcefile) break; } } - dbgEnd(DM_CALLS,"CommandList::execute"); + dbgEnd(Debug::Calls,"CommandList::execute"); return result; } // Set variables for model void CommandList::setModelVariables(Model *m) { - dbgBegin(DM_CALLS,"CommandList::setModelVariables"); + dbgBegin(Debug::Calls,"CommandList::setModelVariables"); if (m != NULL) { variables.set("title","",m->name()); variables.set("natoms","",m->nAtoms()); } - dbgEnd(DM_CALLS,"CommandList::setModelVariables"); + dbgEnd(Debug::Calls,"CommandList::setModelVariables"); } // Set variables for cell void CommandList::setCellVariables(Cell *c) { - dbgBegin(DM_CALLS,"CommandList::setCellVariables"); + dbgBegin(Debug::Calls,"CommandList::setCellVariables"); Mat3 mat; Vec3 vec; if (c != NULL) @@ -1051,7 +1051,7 @@ void CommandList::setCellVariables(Cell *c) variables.reset("cell.type","cell.ax","cell.ay","cell.az","cell.bx","cell.by","cell.bz","cell.cx","cell.cy","cell.cz",""); variables.reset("cell.a","cell.b","cell.c","cell.alpha","cell.beta","cell.gamma","cell.ox","cell.oy","cell.oz",""); } - dbgEnd(DM_CALLS,"CommandList::setCellVariables"); + dbgEnd(Debug::Calls,"CommandList::setCellVariables"); } // Create atom parameter variables @@ -1098,7 +1098,7 @@ bool CommandList::createAtomVariables(const char *base) // Set variable values for atom void CommandList::setAtomVariables(const char *varname, Atom *i) { - dbgBegin(DM_CALLS,"CommandList::setAtomVariables"); + dbgBegin(Debug::Calls,"CommandList::setAtomVariables"); Vec3 v; if (i != NULL) { @@ -1125,7 +1125,7 @@ void CommandList::setAtomVariables(const char *varname, Atom *i) variables.set(varname,"vz",v.z); variables.set(varname,"q",i->charge()); } - dbgEnd(DM_CALLS,"CommandList::setAtomVariables"); + dbgEnd(Debug::Calls,"CommandList::setAtomVariables"); } // Create pattern parameter variables @@ -1154,7 +1154,7 @@ bool CommandList::createPatternVariables(const char *base) // Set variables for pattern void CommandList::setPatternVariables(const char *varname, Pattern *p) { - dbgBegin(DM_CALLS,"CommandList::setPatternVariables"); + dbgBegin(Debug::Calls,"CommandList::setPatternVariables"); if (p != NULL) { variables.set(varname,"name",p->name()); @@ -1165,7 +1165,7 @@ void CommandList::setPatternVariables(const char *varname, Pattern *p) variables.set(varname,"nangles",p->nAngles()); variables.set(varname,"ntorsions",p->nTorsions()); } - dbgEnd(DM_CALLS,"CommandList::setPatternVariables"); + dbgEnd(Debug::Calls,"CommandList::setPatternVariables"); } // Create pattern bound term variables @@ -1207,7 +1207,7 @@ bool CommandList::createPatternBoundVariables(const char *base) // Set variables for PatternBound void CommandList::setPatternBoundVariables(const char *varname, PatternBound *pb) { - dbgBegin(DM_CALLS,"CommandList::setPatternBoundVariables"); + dbgBegin(Debug::Calls,"CommandList::setPatternBoundVariables"); static ForcefieldParams ffp; static ForcefieldBound *ffb; static char parm[24]; @@ -1258,7 +1258,7 @@ void CommandList::setPatternBoundVariables(const char *varname, PatternBound *pb } } - dbgEnd(DM_CALLS,"CommandList::setPatternBoundVariables"); + dbgEnd(Debug::Calls,"CommandList::setPatternBoundVariables"); } // Create atomtype parameter variables @@ -1291,7 +1291,7 @@ bool CommandList::createAtomtypeVariables(const char *base) // Set variables for pattern void CommandList::setAtomtypeVariables(const char *varname, ForcefieldAtom *ffa) { - dbgBegin(DM_CALLS,"CommandList::setAtomtypeVariables"); + dbgBegin(Debug::Calls,"CommandList::setAtomtypeVariables"); static char parm[24]; int i; ForcefieldParams ffp; @@ -1310,5 +1310,5 @@ void CommandList::setAtomtypeVariables(const char *varname, ForcefieldAtom *ffa) variables.set(varname,"equiv",ffa->equivalent()); variables.set(varname,"form",keyword_from_VF(ffa->vdwForm())); } - dbgEnd(DM_CALLS,"CommandList::setAtomtypeVariables"); + dbgEnd(Debug::Calls,"CommandList::setAtomtypeVariables"); } diff --git a/src/command/disorder.cpp b/src/command/disorder.cpp index 0b5ce0f72..0325237d5 100644 --- a/src/command/disorder.cpp +++ b/src/command/disorder.cpp @@ -38,7 +38,7 @@ int CommandData::function_CA_ADDCOMPONENT(Command *&c, Bundle &obj) } else { - msg(DM_NONE,"Couldn't find model '%s' specified in 'addcomponent'\n", c->argc(1)); + msg(Debug::None,"Couldn't find model '%s' specified in 'addcomponent'\n", c->argc(1)); return CR_FAIL; } return CR_SUCCESS; @@ -50,10 +50,10 @@ int CommandData::function_CA_DISORDER(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (mc.components.nItems() == 0) { - msg(DM_NONE,"Disordered builder requires a list of components.\n"); + msg(Debug::None,"Disordered builder requires a list of components.\n"); return CR_FAIL; } - msg(DM_NONE,"Performing disordered build for model '%s'\n", obj.m->name()); + msg(Debug::None,"Performing disordered build for model '%s'\n", obj.m->name()); mc.setNCycles(c->argi(0)); mc.disorder(obj.m); return CR_SUCCESS; @@ -62,7 +62,7 @@ int CommandData::function_CA_DISORDER(Command *&c, Bundle &obj) // Print current component list ('printcomponents') int CommandData::function_CA_PRINTCOMPONENTS(Command *&c, Bundle &obj) { - msg(DM_NONE,"Current component list:\n"); + msg(Debug::None,"Current component list:\n"); Vec3 v1, v2; Component *comp = mc.components.first(); comp != NULL ? printf("Name Nmols I D T R Z Model ComponentRegion cent.x cent.y cent.z size.x size.y size.z Overlap\n") @@ -93,7 +93,7 @@ int CommandData::function_CA_SETCENTRE(Command *&c, Bundle &obj) Component *comp = mc.componentByName(c->argc(0)); if (comp == NULL) { - msg(DM_NONE,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); + msg(Debug::None,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); return CR_FAIL; } comp->area.setCentre(c->arg3d(1)); @@ -106,7 +106,7 @@ int CommandData::function_CA_SETGEOMETRY(Command *&c, Bundle &obj) Component *comp = mc.componentByName(c->argc(0)); if (comp == NULL) { - msg(DM_NONE,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); + msg(Debug::None,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); return CR_FAIL; } comp->area.setSize(c->arg3d(1)); @@ -120,7 +120,7 @@ int CommandData::function_CA_SETOVERLAP(Command *&c, Bundle &obj) Component *comp = mc.componentByName(c->argc(0)); if (comp == NULL) { - msg(DM_NONE,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); + msg(Debug::None,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); return CR_FAIL; } comp->area.setAllowOverlap(c->argb(1)); @@ -133,7 +133,7 @@ int CommandData::function_CA_SETSHAPE(Command *&c, Bundle &obj) Component *comp = mc.componentByName(c->argc(0)); if (comp == NULL) { - msg(DM_NONE,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); + msg(Debug::None,"ERROR: '%s' is not a valid component name.\n", c->argc(0)); return CR_FAIL; } ComponentRegionShape rs = RS_from_text(c->argc(1)); diff --git a/src/command/expression.cpp b/src/command/expression.cpp index 0c3b1a295..937862b73 100644 --- a/src/command/expression.cpp +++ b/src/command/expression.cpp @@ -37,11 +37,11 @@ int CommandData::function_CA_CREATEEXPRESSION(Command *&c, Bundle &obj) // Print expression setup ('printexpression') int CommandData::function_CA_PRINTSETUP(Command *&c, Bundle &obj) { - msg(DM_NONE,"Current Energy Setup:\n"); - msg(DM_NONE,"Intramolecular Terms : %s\n",(prefs.calculateIntra() ? "On" : "Off")); - msg(DM_NONE," van der Waals : %s\n",(prefs.calculateVdw() ? "On" : "Off")); - msg(DM_NONE," Electrostatics : %s (%s)\n",(prefs.calculateElec() ? "On" : "Off"), text_from_EM(prefs.electrostaticsMethod())); - msg(DM_NONE," Cutoffs : %13.6e (VDW) %13.6e (elec)\n", prefs.vdwCutoff(), prefs.elecCutoff()); + msg(Debug::None,"Current Energy Setup:\n"); + msg(Debug::None,"Intramolecular Terms : %s\n",(prefs.calculateIntra() ? "On" : "Off")); + msg(Debug::None," van der Waals : %s\n",(prefs.calculateVdw() ? "On" : "Off")); + msg(Debug::None," Electrostatics : %s (%s)\n",(prefs.calculateElec() ? "On" : "Off"), text_from_EM(prefs.electrostaticsMethod())); + msg(Debug::None," Cutoffs : %13.6e (VDW) %13.6e (elec)\n", prefs.vdwCutoff(), prefs.elecCutoff()); return CR_SUCCESS; } @@ -54,7 +54,7 @@ int CommandData::function_CA_SAVEEXPRESSION(Command *&c, Bundle &obj) // Check that a suitable format was found if (f == NULL) { - msg(DM_NONE,"script : No expression export filter was found that matches the extension '%s'.\nNot saved.\n",c->argc(0)); + msg(Debug::None,"script : No expression export filter was found that matches the extension '%s'.\nNot saved.\n",c->argc(0)); return CR_FAIL; } f->execute(c->argc(1)); diff --git a/src/command/ff.cpp b/src/command/ff.cpp index de9ef1398..ea475a829 100644 --- a/src/command/ff.cpp +++ b/src/command/ff.cpp @@ -66,7 +66,7 @@ int CommandData::function_CA_FFPATTERNID(Command *&c, Bundle &obj) int nodeid = c->argi(0) - 1; if ((nodeid < 0) || (nodeid > obj.m->nPatterns())) { - msg(DM_NONE,"Pattern ID %i is out of range for model (which has %i atterns).\n", nodeid, obj.m->nPatterns()); + msg(Debug::None,"Pattern ID %i is out of range for model (which has %i atterns).\n", nodeid, obj.m->nPatterns()); return CR_FAIL; } else obj.m->pattern(nodeid)->setForcefield(obj.ff); @@ -81,7 +81,7 @@ int CommandData::function_CA_LOADFF(Command *&c, Bundle &obj) { master.setCurrentForcefield(ff); if (c->hasArg(1)) ff->setName(c->argc(1)); - msg(DM_NONE,"Forcefield '%s' loaded, name '%s'\n", c->argc(0), ff->name()); + msg(Debug::None,"Forcefield '%s' loaded, name '%s'\n", c->argc(0), ff->name()); return CR_SUCCESS; } else return CR_FAIL; @@ -105,7 +105,7 @@ int CommandData::function_CA_MAP(Command *&c, Bundle &obj) for (n=0; nfindType(c->argi(0)); if (ffa == NULL) { - msg(DM_NONE,"Type ID %i does not exist in the forcefield '%s'.\n",c->argi(0), obj.ff->name()); + msg(Debug::None,"Type ID %i does not exist in the forcefield '%s'.\n",c->argi(0), obj.ff->name()); return CR_FAIL; } else @@ -140,8 +140,8 @@ int CommandData::function_CA_TYPETEST(Command *&c, Bundle &obj) int el = i->element(); Pattern *p = obj.m->pattern(i); int score = ffa->atomType()->matchAtom(i,p->ringList(),obj.m,i); - if (score != 0) msg(DM_NONE,"Atom %i matched type %i (%s) with score %i.\n", i->id()+1, ffa->typeId(), ffa->name(), score); - else msg(DM_NONE,"Atom %i did not match type %i (%s).\n", i->id()+1, ffa->typeId(), ffa->name()); + if (score != 0) msg(Debug::None,"Atom %i matched type %i (%s) with score %i.\n", i->id()+1, ffa->typeId(), ffa->name(), score); + else msg(Debug::None,"Atom %i did not match type %i (%s).\n", i->id()+1, ffa->typeId(), ffa->name()); } else return CR_FAIL; } diff --git a/src/command/flow.cpp b/src/command/flow.cpp index 6846af001..40f5df4a8 100644 --- a/src/command/flow.cpp +++ b/src/command/flow.cpp @@ -75,7 +75,7 @@ int CommandData::function_CA_FOR(Command *&c, Bundle &obj) // Check for end of file... if (c->parent()->inputFile()->peek() == -1) { - msg(DM_VERBOSE,"Infinite 'for' reached end of file.\n"); + msg(Debug::Verbose,"Infinite 'for' reached end of file.\n"); status = FALSE; } } @@ -123,7 +123,7 @@ int CommandData::function_CA_FOR(Command *&c, Bundle &obj) else { // Initialise loop variable in arg(0), depending on its type - //msg(DM_VERBOSE,"Initialising loop : count variable is '%s', type = '%s'\n", countvar->name(), text_from_VT(counttype)); + //msg(Debug::Verbose,"Initialising loop : count variable is '%s', type = '%s'\n", countvar->name(), text_from_VT(counttype)); switch (c->argt(0)) { // Integer loop: 1 arg - loop from 1 until end of file or termination @@ -136,7 +136,7 @@ int CommandData::function_CA_FOR(Command *&c, Bundle &obj) if (c->parent()->inputFile() != NULL) if (c->parent()->inputFile()->peek() == -1) { - msg(DM_VERBOSE,"Command 'repeat' reached end of file.\n"); + msg(Debug::Verbose,"Command 'repeat' reached end of file.\n"); status = FALSE; } } @@ -273,14 +273,14 @@ int CommandData::function_CA_FOR(Command *&c, Bundle &obj) { c->setLoopActive(TRUE); c->setLoopIterations(1); - msg(DM_VERBOSE,"Loop is initialised and running.\n"); + msg(Debug::Verbose,"Loop is initialised and running.\n"); c = c->branchCommands(); } else { c->setLoopActive(FALSE); c->setLoopIterations(0); - msg(DM_VERBOSE,"Loop terminated on initialisation.\n"); + msg(Debug::Verbose,"Loop terminated on initialisation.\n"); c = c->next; } } diff --git a/src/command/glyph.cpp b/src/command/glyph.cpp index 3372af779..473d9e00a 100644 --- a/src/command/glyph.cpp +++ b/src/command/glyph.cpp @@ -37,7 +37,7 @@ int CommandData::function_CA_NEWGLYPH(Command *&c, Bundle &obj) // Get glyph style GlyphStyle gs = GS_from_text(c->argc(0)); master.current.gl = obj.m->addGlyph(); - if (gs == GS_NITEMS) msg(DM_NONE,"Warning: Unrecognised glyph style '%s' - not set.\n",c->argc(0)); + if (gs == GS_NITEMS) msg(Debug::None,"Warning: Unrecognised glyph style '%s' - not set.\n",c->argc(0)); master.current.gl->setType(gs); return CR_SUCCESS; } @@ -50,7 +50,7 @@ int CommandData::function_CA_SETGLYPHATOMF(Command *&c, Bundle &obj) int d = c->argi(0) - 1; if ((d < 0) || (d >= MAXGLYPHDATA)) { - msg(DM_NONE,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); + msg(Debug::None,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); return CR_FAIL; } // If second argument was given, it refers to either an atom by pointer or by id @@ -62,7 +62,7 @@ int CommandData::function_CA_SETGLYPHATOMF(Command *&c, Bundle &obj) } // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_F); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); return CR_SUCCESS; } @@ -74,7 +74,7 @@ int CommandData::function_CA_SETGLYPHATOMR(Command *&c, Bundle &obj) int d = c->argi(0) - 1; if ((d < 0) || (d >= MAXGLYPHDATA)) { - msg(DM_NONE,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); + msg(Debug::None,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); return CR_FAIL; } // If second argument was given, it refers to either an atom by pointer or by id @@ -86,7 +86,7 @@ int CommandData::function_CA_SETGLYPHATOMR(Command *&c, Bundle &obj) } // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_R); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); return CR_SUCCESS; } @@ -98,7 +98,7 @@ int CommandData::function_CA_SETGLYPHATOMV(Command *&c, Bundle &obj) int d = c->argi(0) - 1; if ((d < 0) || (d >= MAXGLYPHDATA)) { - msg(DM_NONE,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); + msg(Debug::None,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); return CR_FAIL; } // If second argument was given, it refers to either an atom by pointer or by id @@ -110,7 +110,7 @@ int CommandData::function_CA_SETGLYPHATOMV(Command *&c, Bundle &obj) } // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_V); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); return CR_SUCCESS; } @@ -131,7 +131,7 @@ int CommandData::function_CA_SETGLYPHATOMSF(Command *&c, Bundle &obj) else break; // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_F); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); } return CR_SUCCESS; } @@ -153,7 +153,7 @@ int CommandData::function_CA_SETGLYPHATOMSR(Command *&c, Bundle &obj) else break; // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_R); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); } return CR_SUCCESS; } @@ -174,7 +174,7 @@ int CommandData::function_CA_SETGLYPHATOMSV(Command *&c, Bundle &obj) else break; // Finally, check pointer currently in target and store it obj.gl->data[d].setAtom(target, AV_V); - if (target == NULL) msg(DM_NONE,"Warning - NULL atom stored in glyph data %i.\n",d); + if (target == NULL) msg(Debug::None,"Warning - NULL atom stored in glyph data %i.\n",d); } return CR_SUCCESS; } @@ -187,7 +187,7 @@ int CommandData::function_CA_SETGLYPHDATA(Command *&c, Bundle &obj) int d = c->argi(0) - 1; if ((d < 0) || (d >= MAXGLYPHDATA)) { - msg(DM_NONE,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); + msg(Debug::None,"Data index given to 'setglyphatom' (%i) is out of range.\n", d); return CR_FAIL; } obj.gl->data[d].setVector(c->argd(1), c->argd(2), c->argd(3)); diff --git a/src/command/grid.cpp b/src/command/grid.cpp index 10499f802..ab42b34c0 100644 --- a/src/command/grid.cpp +++ b/src/command/grid.cpp @@ -83,7 +83,7 @@ int CommandData::function_CA_SETGRIDLOOPORDER(Command *&c, Bundle &obj) if (obj.notifyNull(BP_GRID)) return CR_FAIL; if (strlen(c->argc(0)) != 3) { - msg(DM_NONE,"A string of three characters must be passed to 'setgridlooporder'.\n"); + msg(Debug::None,"A string of three characters must be passed to 'setgridlooporder'.\n"); return CR_FAIL; } char ch; @@ -108,7 +108,7 @@ int CommandData::function_CA_SETGRIDLOOPORDER(Command *&c, Bundle &obj) obj.g->setLoopOrder(n,2); break; default: - msg(DM_NONE,"Unrecognised character (%c) given to 'setgridlooporder' - default value used.\n",ch); + msg(Debug::None,"Unrecognised character (%c) given to 'setgridlooporder' - default value used.\n",ch); obj.g->setLoopOrder(n,n); break; } diff --git a/src/command/image.cpp b/src/command/image.cpp index 66af616a4..5d89cd0c5 100644 --- a/src/command/image.cpp +++ b/src/command/image.cpp @@ -37,7 +37,7 @@ int CommandData::function_CA_SAVEVECTOR(Command *&c, Bundle &obj) vector_format vf = VIF_from_text(c->argc(0)); if (vf == VIF_NITEMS) { - msg(DM_NONE,"Unrecognised vector format '%s'.\n",c->argc(0)); + msg(Debug::None,"Unrecognised vector format '%s'.\n",c->argc(0)); return CR_FAIL; } // If gui exists, use the main canvas. Otherwise, use the offscreen canvas diff --git a/src/command/mc.cpp b/src/command/mc.cpp index 9bda2d988..4ac1f4c77 100644 --- a/src/command/mc.cpp +++ b/src/command/mc.cpp @@ -63,13 +63,13 @@ int CommandData::function_CA_MCNTRIALS(Command *&c, Bundle &obj) // Prints the current MC params ('printmc') int CommandData::function_CA_PRINTMC(Command *&c, Bundle &obj) { - msg(DM_NONE,"Current Monte Carlo Parameters are:\n"); - msg(DM_NONE,"Move Allowed NTrials MaxStep EAccept :\n"); + msg(Debug::None,"Current Monte Carlo Parameters are:\n"); + msg(Debug::None,"Move Allowed NTrials MaxStep EAccept :\n"); MonteCarloMove mt; for (int n=0; nformat(); if (fmt == NULL) printf("Warning - No format defined in 'error' command.\n"); - else msg(DM_NONE,"%s\n",fmt->createString()); + else msg(Debug::None,"%s\n",fmt->createString()); return CR_EXITWITHERROR; } @@ -36,7 +36,7 @@ int CommandData::function_CA_PRINT(Command *&c, Bundle &obj) { Format *fmt = c->format(); if (fmt == NULL) printf("Warning - No format defined in 'print' command.\n"); - else msg(DM_NONE,"%s\n",fmt->createString()); + else msg(Debug::None,"%s\n",fmt->createString()); return CR_SUCCESS; } @@ -45,7 +45,7 @@ int CommandData::function_CA_VERBOSE(Command *&c, Bundle &obj) { Format *fmt = c->format(); if (fmt == NULL) printf("Warning - No format defined in 'verbose' command.\n"); - else msg(DM_VERBOSE,"%s\n",fmt->createString()); + else msg(Debug::Verbose,"%s\n",fmt->createString()); return CR_SUCCESS; } @@ -54,6 +54,6 @@ int CommandData::function_CA_WARN(Command *&c, Bundle &obj) { Format *fmt = c->format(); if (fmt == NULL) printf("Warning - No format defined in 'error' command.\n"); - else msg(DM_NONE,"Warning: %s\n",fmt->createString()); + else msg(Debug::None,"Warning: %s\n",fmt->createString()); return CR_SUCCESS; } diff --git a/src/command/model.cpp b/src/command/model.cpp index 4983deb02..07e59542e 100644 --- a/src/command/model.cpp +++ b/src/command/model.cpp @@ -55,8 +55,8 @@ int CommandData::function_CA_FINALISEMODEL(Command *&c, Bundle &obj) obj.m->selectNone(); obj.m->resetLogs(); // Print out some useful info on the model that we've just read in - msg(DM_NONE,"Atoms : %i\n",obj.m->nAtoms()); - msg(DM_NONE,"Cell : %s\n",text_from_CT(obj.m->cell()->type())); + msg(Debug::None,"Atoms : %i\n",obj.m->nAtoms()); + msg(Debug::None,"Cell : %s\n",text_from_CT(obj.m->cell()->type())); if (obj.m->cell()->type() != CT_NONE) obj.m->cell()->print(); // Lastly, reset all the log points and start afresh obj.m->resetLogs(); @@ -67,9 +67,9 @@ int CommandData::function_CA_FINALISEMODEL(Command *&c, Bundle &obj) // Print loaded models ('listmodels') int CommandData::function_CA_LISTMODELS(Command *&c, Bundle &obj) { - if (master.nModels() != 0) msg(DM_NONE,"Name NAtoms Forcefield\n"); + if (master.nModels() != 0) msg(Debug::None,"Name NAtoms Forcefield\n"); for (Model *m = master.models(); m != NULL; m = m->next) - msg(DM_NONE,"%-15s %5i %-15s\n", m->name(),m->nAtoms(),(m->forcefield() != NULL ? m->forcefield()->name() : "None")); + msg(Debug::None,"%-15s %5i %-15s\n", m->name(),m->nAtoms(),(m->forcefield() != NULL ? m->forcefield()->name() : "None")); return CR_SUCCESS; } @@ -116,7 +116,7 @@ int CommandData::function_CA_NEWMODEL(Command *&c, Bundle &obj) { obj.m = master.addModel(); obj.m->setName(stripTrailing(c->argc(0))); - msg(DM_NONE,"Created model '%s'\n", obj.m->name()); + msg(Debug::None,"Created model '%s'\n", obj.m->name()); return CR_SUCCESS; } @@ -137,7 +137,7 @@ int CommandData::function_CA_SAVEMODEL(Command *&c, Bundle &obj) // Check that a suitable format was found if (f == NULL) { - msg(DM_NONE,"No model export filter was found that matches the nickname '%s'.\nNot saved.\n", c->argc(0)); + msg(Debug::None,"No model export filter was found that matches the nickname '%s'.\nNot saved.\n", c->argc(0)); return CR_FAIL; } obj.m->setFilter(f); @@ -159,7 +159,7 @@ int CommandData::function_CA_GETMODEL(Command *&c, Bundle &obj) } else { - msg(DM_NONE,"No model named '%s' is available.\n", c->argc(0)); + msg(Debug::None,"No model named '%s' is available.\n", c->argc(0)); return CR_FAIL; } } diff --git a/src/command/readwrite.cpp b/src/command/readwrite.cpp index b840a60e5..1a6b0e767 100644 --- a/src/command/readwrite.cpp +++ b/src/command/readwrite.cpp @@ -39,7 +39,7 @@ int CommandData::function_CA_FIND(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } static char linefromfile[MAXLINELENGTH]; @@ -68,12 +68,12 @@ int CommandData::function_CA_READCHARS(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } inputfile->read((char*) &readc, c->argi(1)); c->arg(0)->set(readc); - msg(DM_FILTERS,"Unformatted char read got '%s'\n",readc); + msg(Debug::Filters,"Unformatted char read got '%s'\n",readc); return CR_SUCCESS; } @@ -83,13 +83,13 @@ int CommandData::function_CA_READDOUBLE(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } double readd; inputfile->read((char*) &readd,8); c->arg(0)->set(readd); - msg(DM_FILTERS,"Unformatted double read got '%f'\n",readd); + msg(Debug::Filters,"Unformatted double read got '%f'\n",readd); return CR_SUCCESS; } @@ -99,13 +99,13 @@ int CommandData::function_CA_READINTEGER(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } int readi; inputfile->read((char*) &readi,4); c->arg(0)->set(readi); - msg(DM_FILTERS,"Unformatted int read got '%i'\n",readi); + msg(Debug::Filters,"Unformatted int read got '%i'\n",readi); return CR_SUCCESS; } @@ -115,7 +115,7 @@ int CommandData::function_CA_READLINE(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } parser.getArgsFormatted(inputfile,c->parent()->readOptions(),c->format()); @@ -128,7 +128,7 @@ int CommandData::function_CA_READNEXT(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } c->arg(0)->set(parser.getArgDelim(inputfile)); @@ -157,7 +157,7 @@ int CommandData::function_CA_REWIND(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } inputfile->seekg(0, ios::beg); @@ -170,7 +170,7 @@ int CommandData::function_CA_SKIPCHARS(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } inputfile->ignore(c->argi(0)); @@ -183,7 +183,7 @@ int CommandData::function_CA_SKIPLINE(Command *&c, Bundle &obj) ifstream *inputfile = c->parent()->inputFile(); if (inputfile == NULL) { - msg(DM_NONE,"No input file active.\n"); + msg(Debug::None,"No input file active.\n"); return CR_FAIL; } if (c->hasArg(0)) parser.skipLines(inputfile,c->argi(0)); @@ -197,7 +197,7 @@ int CommandData::function_CA_WRITELINE(Command *&c, Bundle &obj) ofstream *outputfile = c->parent()->outputFile(); if (outputfile == NULL) { - msg(DM_NONE,"No output file active.\n"); + msg(Debug::None,"No output file active.\n"); return CR_FAIL; } *outputfile << c->format()->createString(); diff --git a/src/command/script.cpp b/src/command/script.cpp index 9b93dbc59..7b2d7dde3 100644 --- a/src/command/script.cpp +++ b/src/command/script.cpp @@ -25,10 +25,10 @@ // List available scripts int CommandData::function_CA_LISTSCRIPTS(Command *&c, Bundle &obj) { - if (master.scripts.nItems() == 0) msg(DM_NONE,"No scripts loaded.\n"); - else msg(DM_NONE,"Currently loaded scripts:\n"); + if (master.scripts.nItems() == 0) msg(Debug::None,"No scripts loaded.\n"); + else msg(Debug::None,"Currently loaded scripts:\n"); for (CommandList *cl = master.scripts.first(); cl != NULL; cl = cl->next) - msg(DM_NONE," %s (%s)\n", cl->scriptFilename(), cl->name()); + msg(Debug::None," %s (%s)\n", cl->scriptFilename(), cl->name()); return CR_SUCCESS; } @@ -55,9 +55,9 @@ int CommandData::function_CA_RUNSCRIPT(Command *&c, Bundle &obj) if (strcmp(c->argc(0), cl->name()) == 0) break; if (cl != NULL) { - msg(DM_NONE,"Executing script '%s':\n",c->argc(0)); + msg(Debug::None,"Executing script '%s':\n",c->argc(0)); cl->execute(); } - else msg(DM_NONE,"Couldn't find script '%s'.\n",c->argc(0)); + else msg(Debug::None,"Couldn't find script '%s'.\n",c->argc(0)); return CR_SUCCESS; } diff --git a/src/command/select.cpp b/src/command/select.cpp index f3411ec6a..56fa0e5b8 100644 --- a/src/command/select.cpp +++ b/src/command/select.cpp @@ -61,7 +61,7 @@ int CommandData::function_CA_SELECTFFTYPE(Command *&c, Bundle &obj) Forcefield *ff = obj.m->forcefield(); if (ff == NULL) { - msg(DM_NONE,"No forcefield associated to model.\n"); + msg(Debug::None,"No forcefield associated to model.\n"); return CR_FAIL; } ForcefieldAtom *ffa; @@ -107,7 +107,7 @@ int CommandData::function_CA_SELECTPATTERN(Command *&c, Bundle &obj) Pattern *p = NULL; if (c->hasArg(0)) p = obj.m->findPattern(c->argc(0)); else p = obj.p; - if (p == NULL) msg(DM_NONE,"No pattern in which to select atoms.\n"); + if (p == NULL) msg(Debug::None,"No pattern in which to select atoms.\n"); else { Atom *i = p->firstAtom(); @@ -155,11 +155,11 @@ int CommandData::function_CA_SELECTTYPE(Command *&c, Bundle &obj) } } // Write results - msg(DM_NONE,"Type description score = %i. Matched %i atoms.\n", matchscore, count); + msg(Debug::None,"Type description score = %i. Matched %i atoms.\n", matchscore, count); // Update model and delete temporary atomtype obj.m->logChange(LOG_SELECTION); return CR_SUCCESS; } - else msg(DM_NONE,"Can't test atomtype description without a valid pattern definition!\n"); + else msg(Debug::None,"Can't test atomtype description without a valid pattern definition!\n"); return CR_FAIL; } diff --git a/src/command/site.cpp b/src/command/site.cpp index c6a77980f..0f53b8ad5 100644 --- a/src/command/site.cpp +++ b/src/command/site.cpp @@ -48,7 +48,7 @@ int CommandData::function_CA_NEWSITE(Command *&c, Bundle &obj) li->data = parser.argi(n) - 1; } } - msg(DM_NONE,"New site added for model: '%s', for pattern '%s', %i atoms defined%s", obj.s->name(), p->name(), obj.s->atoms.nItems(), (obj.s->atoms.nItems() == 0 ? " (will use centre of geometry)\n" : "\n")); + msg(Debug::None,"New site added for model: '%s', for pattern '%s', %i atoms defined%s", obj.s->name(), p->name(), obj.s->atoms.nItems(), (obj.s->atoms.nItems() == 0 ? " (will use centre of geometry)\n" : "\n")); return CR_SUCCESS; } @@ -57,16 +57,16 @@ int CommandData::function_CA_LISTSITES(Command *&c, Bundle &obj) { if (obj.notifyNull(BP_MODEL)) return CR_FAIL; Site *s = obj.m->sites.first(); - if (s == NULL) msg(DM_NONE,"No sites defined for model '%s'.\n",obj.m->name()); + if (s == NULL) msg(Debug::None,"No sites defined for model '%s'.\n",obj.m->name()); else { - msg(DM_NONE,"Site list for model '%s':\n",obj.m->name()); + msg(Debug::None,"Site list for model '%s':\n",obj.m->name()); for (s = s; s != NULL; s = s->next) { - msg(DM_NONE," %15s %15s ",s->name(), s->pattern()->name()); - if (s->atoms.nItems() == 0) msg(DM_NONE,"All atoms assumed (none defined)"); - else for (Listitem *li = s->atoms.first(); li != NULL; li = li->next)msg(DM_NONE," %i",li->data); - msg(DM_NONE,"\n"); + msg(Debug::None," %15s %15s ",s->name(), s->pattern()->name()); + if (s->atoms.nItems() == 0) msg(Debug::None,"All atoms assumed (none defined)"); + else for (Listitem *li = s->atoms.first(); li != NULL; li = li->next)msg(Debug::None," %i",li->data); + msg(Debug::None,"\n"); } } return CR_SUCCESS; @@ -78,7 +78,7 @@ int CommandData::function_CA_GETSITE(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; Site *s; for (s = obj.m->sites.first(); s != NULL; s = s->next) if (strcmp(s->name(),c->argc(0)) == 0) break; - if (s == NULL) msg(DM_NONE,"No site '%s' defined in model '%s'.\n", c->argc(0), obj.m->name()); + if (s == NULL) msg(Debug::None,"No site '%s' defined in model '%s'.\n", c->argc(0), obj.m->name()); else master.current.s = s; return CR_FAIL; } diff --git a/src/command/system.cpp b/src/command/system.cpp index 057464ce3..6fbec014e 100644 --- a/src/command/system.cpp +++ b/src/command/system.cpp @@ -44,9 +44,9 @@ int CommandData::function_CA_GUI(Command *&c, Bundle &obj) int CommandData::function_CA_HELP(Command *&c, Bundle &obj) { CommandAction ca = CA_from_text(c->argc(0)); - if (ca == CA_NITEMS) msg(DM_NONE,"help: Unrecognised command '%s'.\n",c->argc(0)); - else if (CA_data[ca].hasArguments()) msg(DM_NONE,"help: %s -- %s\n", CA_data[ca].keyword, CA_data[ca].syntax); - else msg(DM_NONE,"help: %s %s -- %s\n", CA_data[ca].keyword, CA_data[ca].argText, CA_data[ca].syntax); + if (ca == CA_NITEMS) msg(Debug::None,"help: Unrecognised command '%s'.\n",c->argc(0)); + else if (CA_data[ca].hasArguments()) msg(Debug::None,"help: %s -- %s\n", CA_data[ca].keyword, CA_data[ca].syntax); + else msg(Debug::None,"help: %s %s -- %s\n", CA_data[ca].keyword, CA_data[ca].argText, CA_data[ca].syntax); return CR_SUCCESS; } diff --git a/src/command/traj.cpp b/src/command/traj.cpp index b12ad403b..c78431f8c 100644 --- a/src/command/traj.cpp +++ b/src/command/traj.cpp @@ -30,7 +30,7 @@ int CommandData::function_CA_FIRSTFRAME(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (obj.m->totalFrames() == 0) { - msg(DM_NONE,"No trajectory associated to model '%s'.\n",obj.m->name()); + msg(Debug::None,"No trajectory associated to model '%s'.\n",obj.m->name()); return CR_FAIL; } obj.m->seekFirstFrame(); @@ -43,7 +43,7 @@ int CommandData::function_CA_LASTFRAME(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (obj.m->totalFrames() == 0) { - msg(DM_NONE,"No trajectory associated to model '%s'.\n",obj.m->name()); + msg(Debug::None,"No trajectory associated to model '%s'.\n",obj.m->name()); return CR_FAIL; } obj.m->seekLastFrame(); @@ -65,7 +65,7 @@ int CommandData::function_CA_NEXTFRAME(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (obj.m->totalFrames() == 0) { - msg(DM_NONE,"No trajectory associated to model '%s'.\n",obj.m->name()); + msg(Debug::None,"No trajectory associated to model '%s'.\n",obj.m->name()); return CR_FAIL; } obj.m->seekNextFrame(); @@ -78,7 +78,7 @@ int CommandData::function_CA_PREVFRAME(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (obj.m->totalFrames() == 0) { - msg(DM_NONE,"No trajectory associated to model '%s'.\n",obj.m->name()); + msg(Debug::None,"No trajectory associated to model '%s'.\n",obj.m->name()); return CR_FAIL; } obj.m->seekPreviousFrame(); diff --git a/src/command/variables.cpp b/src/command/variables.cpp index 2e598ec03..2fa5632b4 100644 --- a/src/command/variables.cpp +++ b/src/command/variables.cpp @@ -43,7 +43,7 @@ int CommandData::function_CA_LET(Command *&c, Bundle &obj) { if (c->argt(0) != c->argt(2)) { - msg(DM_NONE,"Incompatible pointer types for variable assignment of contents of '%s' to '%s'.\n", c->arg(0)->name(), c->arg(2)->name()); + msg(Debug::None,"Incompatible pointer types for variable assignment of contents of '%s' to '%s'.\n", c->arg(0)->name(), c->arg(2)->name()); return CR_FAIL; } else c->arg(0)->copyPointer(c->arg(2)); diff --git a/src/command/view.cpp b/src/command/view.cpp index adad9fbca..e490c9fe8 100644 --- a/src/command/view.cpp +++ b/src/command/view.cpp @@ -76,7 +76,7 @@ int CommandData::function_CA_SPEEDTEST(Command *&c, Bundle &obj) if (obj.notifyNull(BP_MODEL)) return CR_FAIL; if (!gui.exists()) { - msg(DM_NONE,"Can't perform rendering speedtest without the GUI.\n"); + msg(Debug::None,"Can't perform rendering speedtest without the GUI.\n"); return CR_FAIL; } clock_t tstart = clock(); @@ -89,6 +89,6 @@ int CommandData::function_CA_SPEEDTEST(Command *&c, Bundle &obj) } clock_t tfinish = clock(); double nsec = double(tfinish-tstart) / CLOCKS_PER_SEC; - msg(DM_NONE,"SPEEDTEST : Performed %i renders over %8.2f seconds (%8.2f/sec).\n", nrenders, nsec, nrenders/nsec); + msg(Debug::None,"SPEEDTEST : Performed %i renders over %8.2f seconds (%8.2f/sec).\n", nrenders, nsec, nrenders/nsec); return CR_SUCCESS; } diff --git a/src/energy/angle.cpp b/src/energy/angle.cpp index 38203aa1f..4104d9105 100644 --- a/src/energy/angle.cpp +++ b/src/energy/angle.cpp @@ -30,7 +30,7 @@ // Calculate angle energy of pattern (or individual molecule if 'molecule' != -1) void Pattern::angleEnergy(Model *srcmodel, EnergyStore *estore, int molecule) { - dbgBegin(DM_CALLS,"Pattern::angleEnergy"); + dbgBegin(Debug::Calls,"Pattern::angleEnergy"); static int i,j,k,aoff,m1; static double forcek, n, s, eq, r, theta, dp, energy, c0, c1, c2; static ForcefieldParams params; @@ -91,13 +91,13 @@ void Pattern::angleEnergy(Model *srcmodel, EnergyStore *estore, int molecule) } // Increment energy for pattern estore->add(ET_ANGLE,energy,id_); - dbgEnd(DM_CALLS,"Pattern::angleEnergy"); + dbgEnd(Debug::Calls,"Pattern::angleEnergy"); } // Calculate angle forces in pattern void Pattern::angleForces(Model *srcmodel) { - dbgBegin(DM_CALLS,"Pattern::angleForcess"); + dbgBegin(Debug::Calls,"Pattern::angleForcess"); static int i,j,k,aoff,m1; static Vec3 vec_ij, vec_kj, fi, fk; static double forcek, eq, dp, theta, mag_ij, mag_kj, n, s, c0, c1, c2, cosx, sinx; @@ -174,5 +174,5 @@ void Pattern::angleForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::angleForcess"); + dbgEnd(Debug::Calls,"Pattern::angleForcess"); } diff --git a/src/energy/bond.cpp b/src/energy/bond.cpp index 7a809a031..29fca0ecb 100644 --- a/src/energy/bond.cpp +++ b/src/energy/bond.cpp @@ -30,7 +30,7 @@ // Calculate bond energy of pattern (or molecule in pattern) void Pattern::bondEnergy(Model *srcmodel, EnergyStore *estore, int molecule) { - dbgBegin(DM_CALLS,"Pattern::bondEnergy"); + dbgBegin(Debug::Calls,"Pattern::bondEnergy"); int i,j,m1,aoff; static Vec3 mim_i; static double forcek, eq, r, energy; @@ -70,13 +70,13 @@ void Pattern::bondEnergy(Model *srcmodel, EnergyStore *estore, int molecule) } // Increment energy for pattern estore->add(ET_BOND,energy,id_); - dbgEnd(DM_CALLS,"Pattern::bondEnergy"); + dbgEnd(Debug::Calls,"Pattern::bondEnergy"); } // Calculate bond forces in pattern void Pattern::bondForces(Model *srcmodel) { - dbgBegin(DM_CALLS,"Pattern::bondForcess"); + dbgBegin(Debug::Calls,"Pattern::bondForcess"); int n,i,j,m1,aoff; static Vec3 mim_i, fi; static double forcek, eq, rij, du_dr; @@ -119,5 +119,5 @@ void Pattern::bondForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::bondForcess"); + dbgEnd(Debug::Calls,"Pattern::bondForcess"); } diff --git a/src/energy/coulomb.cpp b/src/energy/coulomb.cpp index df6bfe6e0..8d9cee495 100644 --- a/src/energy/coulomb.cpp +++ b/src/energy/coulomb.cpp @@ -32,7 +32,7 @@ // Consider only the intrapattern interactions of individual molecules within this pattern. void Pattern::coulombIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, int molecule) { - dbgBegin(DM_CALLS,"Pattern::coulombIntraPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::coulombIntraPatternEnergy"); static int n,i,j,aoff,m1; static Vec3 mim_i; static double rij, energy_inter, energy_intra, energy, cutoff; @@ -78,13 +78,13 @@ void Pattern::coulombIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, in energy_inter = energy_inter * prefs.elecConvert(); estore->add(ET_COULOMBINTRA,energy_intra,id_); estore->add(ET_COULOMBINTER,energy_inter,id_,id_); - dbgEnd(DM_CALLS,"Pattern::coulombIntraPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::coulombIntraPatternEnergy"); } // Calculate the coulomb contribution to the energy from interactions between different molecules of this pattern and the one supplied void Pattern::coulombInterPatternEnergy(Model *srcmodel, Pattern *xpnode, EnergyStore *estore, int molecule) { - dbgBegin(DM_CALLS,"Pattern::coulombInterPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::coulombInterPatternEnergy"); static int n1, n2, i, j, aoff1, aoff2, m1, m2, finish1, start2, finish2, a1, a2; static Vec3 mim_i; static double rij, energy_inter, energy, cutoff; @@ -134,14 +134,14 @@ void Pattern::coulombInterPatternEnergy(Model *srcmodel, Pattern *xpnode, Energy } energy_inter = energy_inter * prefs.elecConvert(); estore->add(ET_COULOMBINTER,energy_inter,id_,xpnode->id_); - dbgEnd(DM_CALLS,"Pattern::coulombInterPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::coulombInterPatternEnergy"); } // Calculate the internal coulomb forces in the pattern. // Consider only the intrapattern interactions of individual molecules within this pattern. void Pattern::coulombIntraPatternForces(Model *srcmodel) { - dbgBegin(DM_CALLS,"Pattern::coulombIntraPatternForces"); + dbgBegin(Debug::Calls,"Pattern::coulombIntraPatternForces"); static int n, i, j, aoff, m1; static Vec3 mim_i, f_i, tempf; static double rij, factor, cutoff; @@ -188,13 +188,13 @@ void Pattern::coulombIntraPatternForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::coulombIntraPatternForces"); + dbgEnd(Debug::Calls,"Pattern::coulombIntraPatternForces"); } // Calculate the coulomb forces from interactions between different molecules of this pattern and the one supplied void Pattern::coulombInterPatternForces(Model *srcmodel, Pattern *xpnode) { - dbgBegin(DM_CALLS,"Pattern::coulombInterPatternForces"); + dbgBegin(Debug::Calls,"Pattern::coulombInterPatternForces"); static int n1,n2,i,j,aoff1,aoff2,m1,m2,start,finish,a1,a2; static Vec3 mim_i, f_i, tempf; static double rij, factor, cutoff; @@ -236,6 +236,6 @@ void Pattern::coulombInterPatternForces(Model *srcmodel, Pattern *xpnode) } aoff1 += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::coulombInterPatternForces"); + dbgEnd(Debug::Calls,"Pattern::coulombInterPatternForces"); } diff --git a/src/energy/ewald.cpp b/src/energy/ewald.cpp index e43a62a2f..e7ece9523 100644 --- a/src/energy/ewald.cpp +++ b/src/energy/ewald.cpp @@ -37,10 +37,10 @@ void PrefsData::estimateEwaldParameters(Cell *cell) { // Estimate alpha and kmax parameters based on a given precision value - dbgBegin(DM_CALLS,"PrefsData::estimateEwaldParameterss"); + dbgBegin(Debug::Calls,"PrefsData::estimateEwaldParameterss"); if (prefs.hasValidEwaldAuto()) { - dbgEnd(DM_CALLS,"PrefsData::estimateEwaldParameters"); + dbgEnd(Debug::Calls,"PrefsData::estimateEwaldParameters"); return; } // Estimate ewaldAlpha_ @@ -61,9 +61,9 @@ void PrefsData::estimateEwaldParameters(Cell *cell) printf("No estimation of parameters is available yet for this cell type.\n"); break; } - msg(DM_NONE,"Pattern::ewald_estimate_parameters : For precision = %6.4e, alpha = %8.6f and kmax = %i %i %i.\n", ewaldPrecision_, ewaldAlpha_, ewaldKvec_.x, ewaldKvec_.y, ewaldKvec_.z); + msg(Debug::None,"Pattern::ewald_estimate_parameters : For precision = %6.4e, alpha = %8.6f and kmax = %i %i %i.\n", ewaldPrecision_, ewaldAlpha_, ewaldKvec_.x, ewaldKvec_.y, ewaldKvec_.z); validEwaldAuto_ = TRUE; - dbgEnd(DM_CALLS,"PrefsData::estimateEwaldParameters"); + dbgEnd(Debug::Calls,"PrefsData::estimateEwaldParameters"); } // Ewald Energy Real-space contributions @@ -77,7 +77,7 @@ void Pattern::ewaldRealIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, { // Calculate a real-space contribution to the Ewald sum. // Internal interaction of atoms in individual molecules within the pattern is considered. - dbgBegin(DM_CALLS,"Pattern::ewaldRealIntraPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::ewaldRealIntraPatternEnergy"); static int n,i,j,aoff,m1; static Vec3 mim_i; static double rij, energy_inter, energy_intra, energy, cutoff, alpha; @@ -126,7 +126,7 @@ void Pattern::ewaldRealIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, estore->add(ET_EWALDREALINTER,energy_inter,id_,id_); //estore->ewaldReal_intra[id] += energy_intra; //estore->ewaldReal_inter[id][id] += energy_inter; - dbgEnd(DM_CALLS,"Pattern::ewaldRealIntraPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::ewaldRealIntraPatternEnergy"); } void Pattern::ewaldRealInterPatternEnergy(Model *srcmodel, Pattern *xpnode, EnergyStore *estore, int molecule) @@ -134,7 +134,7 @@ void Pattern::ewaldRealInterPatternEnergy(Model *srcmodel, Pattern *xpnode, Ener // Calculate the real-space Ewald contribution to the energy from interactions between different molecules // of this pnode and the one supplied. Contributions to the sum from the inner loop of atoms (a2) is summed into // 'energy; before multiplication by the charge of the second atom (a1) - dbgBegin(DM_CALLS,"Pattern::ewaldRealInterPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::ewaldRealInterPatternEnergy"); static int n1,n2,i,j,aoff1,aoff2,m1,m2,finish1,start2,finish2,atomi,atomj; static Vec3 mim_i; static double rij, energy_inter, energy, cutoff, alpha; @@ -185,7 +185,7 @@ void Pattern::ewaldRealInterPatternEnergy(Model *srcmodel, Pattern *xpnode, Ener energy_inter = energy_inter * prefs.elecConvert(); estore->add(ET_EWALDREALINTER,energy_inter,id_,xpnode->id_); //estore->ewaldReal_inter[id][xpnode->id] += energy_inter; - dbgEnd(DM_CALLS,"Pattern::ewaldRealInterPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::ewaldRealInterPatternEnergy"); } // Ewald Reciprocal energy contributions @@ -197,7 +197,7 @@ void Pattern::ewaldReciprocalEnergy(Model *srcmodel, Pattern *firstp, int npats, { // Calculate the reciprocal contribution of all atoms to the Ewald sum. // Only needs to be called once from an arbitrary pattern. - dbgBegin(DM_CALLS,"Pattern::ewaldReciprocalEnergy"); + dbgBegin(Debug::Calls,"Pattern::ewaldReciprocalEnergy"); static int kx, ky, kz, i, n, kmax, finalatom; static Vec3 kvec; static Mat3 rcell; @@ -261,7 +261,7 @@ void Pattern::ewaldReciprocalEnergy(Model *srcmodel, Pattern *firstp, int npats, //estore->ewaldRecip_inter[i][n] += exp1*(sumcos[i]*sumcos[n] + sumsin[i]*sumsin[n]); } } - dbgEnd(DM_CALLS,"Pattern::ewaldReciprocalEnergy"); + dbgEnd(Debug::Calls,"Pattern::ewaldReciprocalEnergy"); } // Ewald Corrections @@ -277,7 +277,7 @@ void Pattern::ewaldReciprocalEnergy(Model *srcmodel, Pattern *firstp, int npats, void Pattern::ewaldCorrectEnergy(Model *srcmodel, EnergyStore *estore, int molecule) { // Calculate corrections to the Ewald sum energy - dbgBegin(DM_CALLS,"Pattern::ewaldCorrectEnergy"); + dbgBegin(Debug::Calls,"Pattern::ewaldCorrectEnergy"); static int aoff, m1, i, j; static double molcorrect, energy, qprod, rij, chargesum, alpha; alpha = prefs.ewaldAlpha(); @@ -322,7 +322,7 @@ void Pattern::ewaldCorrectEnergy(Model *srcmodel, EnergyStore *estore, int molec energy = molcorrect * prefs.elecConvert(); estore->add(ET_EWALDMOL,energy,id_); //estore->ewald_mol_correct[id] += energy; - dbgEnd(DM_CALLS,"Pattern::ewaldCorrectEnergy"); + dbgEnd(Debug::Calls,"Pattern::ewaldCorrectEnergy"); } // Ewald Real-space forces @@ -334,7 +334,7 @@ void Pattern::ewaldRealIntraPatternForces(Model *srcmodel) { // Calculate a real-space forces in the Ewald sum. // Internal interaction of atoms in individual molecules within the pattern is considered. - dbgBegin(DM_CALLS,"Pattern::ewaldRealIntraPatternForces"); + dbgBegin(Debug::Calls,"Pattern::ewaldRealIntraPatternForces"); static int n, i, j, aoff, m1, atomi, atomj; static Vec3 mim_i, tempf, f_i; static double rij, factor, qqrij3, alpharij, cutoff, alpha; @@ -396,14 +396,14 @@ void Pattern::ewaldRealIntraPatternForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::ewaldRealIntraPatternForces"); + dbgEnd(Debug::Calls,"Pattern::ewaldRealIntraPatternForces"); } void Pattern::ewaldRealInterPatternForces(Model *srcmodel, Pattern *xpnode) { // Calculate the real-space Ewald forces from interactions between different molecules // of this pnode and the one supplied. - dbgBegin(DM_CALLS,"Pattern::ewaldRealInterPatternForces"); + dbgBegin(Debug::Calls,"Pattern::ewaldRealInterPatternForces"); int n1,n2,i,j,aoff1,aoff2,m1,m2,start,finish,atomi,atomj; static Vec3 mim_i, f_i, tempf; static double rij, factor, alpharij, qqrij3, cutoff, alpha; @@ -452,7 +452,7 @@ void Pattern::ewaldRealInterPatternForces(Model *srcmodel, Pattern *xpnode) } aoff1 += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::ewaldRealInterPatternForces"); + dbgEnd(Debug::Calls,"Pattern::ewaldRealInterPatternForces"); } // Reciprocal space forces @@ -464,7 +464,7 @@ void Pattern::ewaldReciprocalForces(Model *srcmodel) { // Calculate the reciprocal force contribution to the Ewald sum. // Must be called for the first pattern in the list only! - dbgBegin(DM_CALLS,"Pattern::ewaldReciprocalForces"); + dbgBegin(Debug::Calls,"Pattern::ewaldReciprocalForces"); static int kx, ky, kz, i, n, kmax; static Vec3 kvec; static Mat3 rcell; @@ -520,13 +520,13 @@ void Pattern::ewaldReciprocalForces(Model *srcmodel) //if (i == 0) printf("%i %i %i %8.4f %8.4f %8.4f %8.4f\n",kx,ky,kz,force,kvec.x,kvec.y,kvec.z); } } - dbgEnd(DM_CALLS,"Pattern::ewaldReciprocalForces"); + dbgEnd(Debug::Calls,"Pattern::ewaldReciprocalForces"); } void Pattern::ewaldCorrectForces(Model *srcmodel) { // Correct the Ewald forces due to bond / angle / torsion exclusions - dbgBegin(DM_CALLS,"Pattern::ewaldCorrectForces"); + dbgBegin(Debug::Calls,"Pattern::ewaldCorrectForces"); static int n, i, j, aoff, m1, atomi, atomj; static Vec3 mim_i, tempf, f_i; static double rij, factor, qqrij3, alpharij, cutoff, alpha; @@ -589,6 +589,6 @@ void Pattern::ewaldCorrectForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::ewaldCorrectForces"); + dbgEnd(Debug::Calls,"Pattern::ewaldCorrectForces"); } diff --git a/src/energy/rules.cpp b/src/energy/rules.cpp index 1f8926d16..d16761ddb 100644 --- a/src/energy/rules.cpp +++ b/src/energy/rules.cpp @@ -28,13 +28,13 @@ void Forcefield::generateVdw(Atom *i) { // Simplest of all generation routines - creates the params() data for VDW interactions. - dbgBegin(DM_CALLS,"Forcefield::generateVdw"); + dbgBegin(Debug::Calls,"Forcefield::generateVdw"); double sigma, epsilon; ForcefieldAtom *ffi = i->type(); switch (rules_) { case (FFR_NORULES): - msg(DM_NONE,"Forcefield::generateVdw <<<< Tried to generate parameters for a NORULES FF >>>>\n"); + msg(Debug::None,"Forcefield::generateVdw <<<< Tried to generate parameters for a NORULES FF >>>>\n"); break; case (FFR_UFF): // UFF VDW types are just the third [2] and fourth [3] data (for simple LJ) @@ -42,11 +42,11 @@ void Forcefield::generateVdw(Atom *i) sigma = ffi->generator(2); ffi->params().data[VF_LJ_EPS] = epsilon; ffi->params().data[VF_LJ_SIGMA] = sigma; - msg(DM_VERBOSE,"UFF LJ : sigma, epsilon = %8.4f %8.4f\n", sigma, epsilon); + msg(Debug::Verbose,"UFF LJ : sigma, epsilon = %8.4f %8.4f\n", sigma, epsilon); ffi->setVdwForm(VF_LJ); break; } - dbgEnd(DM_CALLS,"Forcefield::generateVdw"); + dbgEnd(Debug::Calls,"Forcefield::generateVdw"); } // Generate bond params @@ -54,14 +54,14 @@ ForcefieldBound *Forcefield::generateBond(Atom *i, Atom *j) { // Creates bond forcefield data for the specified atom types. // No check is performed to see if similar data has already been generated. - dbgBegin(DM_CALLS,"Forcefield::generateBond"); + dbgBegin(Debug::Calls,"Forcefield::generateBond"); ForcefieldAtom *ffi = i->type(); ForcefieldAtom *ffj = j->type(); ForcefieldBound *newbond = NULL; switch (rules_) { case (FFR_NORULES): - msg(DM_NONE,"Forcefield::generateBond <<<< Tried to generate parameters for a NORULES FF >>>>\n"); + msg(Debug::None,"Forcefield::generateBond <<<< Tried to generate parameters for a NORULES FF >>>>\n"); break; case (FFR_UFF): // UFF Harmonic Bond Generator @@ -83,10 +83,10 @@ ForcefieldBound *Forcefield::generateBond(Atom *i, Atom *j) newbond->setBondStyle(BF_HARMONIC); newbond->params().data[BF_HARMONIC_EQ] = sumr + rBO - rEN; newbond->params().data[BF_HARMONIC_K] = 664.12 * ( (Zi * Zj) / (sumr + sumr + sumr) ); - msg(DM_VERBOSE,"UFF Bond : eq, k = %8.4f %8.4f\n", newbond->params().data[BF_HARMONIC_EQ], newbond->params().data[BF_HARMONIC_K]); + msg(Debug::Verbose,"UFF Bond : eq, k = %8.4f %8.4f\n", newbond->params().data[BF_HARMONIC_EQ], newbond->params().data[BF_HARMONIC_K]); break; } - dbgEnd(DM_CALLS,"Forcefield::generateBond"); + dbgEnd(Debug::Calls,"Forcefield::generateBond"); return newbond; } @@ -95,7 +95,7 @@ ForcefieldBound *Forcefield::generateAngle(Atom *i, Atom *j, Atom *k) { // Creates angle forcefield data for the specified atom types. // No check is performed to see if similar data has already been generated. - dbgBegin(DM_CALLS,"Forcefield::generateAngle"); + dbgBegin(Debug::Calls,"Forcefield::generateAngle"); ForcefieldAtom *ffi = i->type(); ForcefieldAtom *ffj = j->type(); ForcefieldAtom *ffk = k->type(); @@ -103,7 +103,7 @@ ForcefieldBound *Forcefield::generateAngle(Atom *i, Atom *j, Atom *k) switch (rules_) { case (FFR_NORULES): - msg(DM_NONE,"Forcefield::generateAngle <<<< Tried to generate parameters for a NORULES FF >>>>\n"); + msg(Debug::None,"Forcefield::generateAngle <<<< Tried to generate parameters for a NORULES FF >>>>\n"); break; case (FFR_UFF): // UFF Cosine Angle Generator @@ -153,11 +153,11 @@ ForcefieldBound *Forcefield::generateAngle(Atom *i, Atom *j, Atom *k) // Set function style if (n == 2) newangle->setAngleStyle(AF_UFFCOSINE2); else newangle->setAngleStyle(AF_UFFCOSINE1); - msg(DM_VERBOSE,"UFF Angle : %s-%s-%s - forcek = %8.4f, eq = %8.4f, n = %i\n", ffi->name(), ffj->name(), ffk->name(), forcek, eq, n); + msg(Debug::Verbose,"UFF Angle : %s-%s-%s - forcek = %8.4f, eq = %8.4f, n = %i\n", ffi->name(), ffj->name(), ffk->name(), forcek, eq, n); break; } - dbgEnd(DM_CALLS,"Forcefield::generateAngle"); + dbgEnd(Debug::Calls,"Forcefield::generateAngle"); return newangle; } @@ -166,12 +166,12 @@ ForcefieldBound *Forcefield::generateTorsion(Atom *i, Atom *j, Atom *k, Atom *l) { // Creates torsion forcefield data for the specified atom types. // No check is performed to see if similar data has already been generated. - dbgBegin(DM_CALLS,"Forcefield::generateTorsion"); + dbgBegin(Debug::Calls,"Forcefield::generateTorsion"); ForcefieldBound *newtorsion = NULL; switch (rules_) { case (FFR_NORULES): - msg(DM_NONE,"Forcefield::generateTorsion <<<< Tried to generate parameters for a NORULES FF >>>>\n"); + msg(Debug::None,"Forcefield::generateTorsion <<<< Tried to generate parameters for a NORULES FF >>>>\n"); break; case (FFR_UFF): // UFF Torsions TODO @@ -179,6 +179,6 @@ ForcefieldBound *Forcefield::generateTorsion(Atom *i, Atom *j, Atom *k, Atom *l) newtorsion = torsions_.add(); break; } - dbgEnd(DM_CALLS,"Forcefield::generateTorsion"); + dbgEnd(Debug::Calls,"Forcefield::generateTorsion"); return newtorsion; } diff --git a/src/energy/torsion.cpp b/src/energy/torsion.cpp index 3e1c2ab2a..421398cb3 100644 --- a/src/energy/torsion.cpp +++ b/src/energy/torsion.cpp @@ -30,7 +30,7 @@ void Pattern::torsionEnergy(Model *srcmodel, EnergyStore *estore, int molecule) { // Calculate the energy of the torsions in this pattern with coordinates from *xcfg - dbgBegin(DM_CALLS,"Pattern::torsionEnergy"); + dbgBegin(Debug::Calls,"Pattern::torsionEnergy"); int n,i,j,k,l,aoff,m1; static double k0, k1, k2, k3, k4, eq, phi, energy, period; PatternBound *pb; @@ -93,7 +93,7 @@ void Pattern::torsionEnergy(Model *srcmodel, EnergyStore *estore, int molecule) // Increment energy for pattern estore->add(ET_TORSION,energy,id_); //estore->torsion[id] += energy; - dbgEnd(DM_CALLS,"Pattern::torsionEnergy"); + dbgEnd(Debug::Calls,"Pattern::torsionEnergy"); } // Returns a unit vector in the specified direction @@ -128,7 +128,7 @@ Mat3 make_cp_mat(Vec3 *v) void Pattern::torsionForces(Model *srcmodel) { // Calculate force contributions from the torsions in this pattern with coordinates from *xcfg - dbgBegin(DM_CALLS,"Pattern::torsionForces"); + dbgBegin(Debug::Calls,"Pattern::torsionForces"); int n,i,j,k,l,aoff,m1; static Vec3 rij, rkj, rlk, xpj, xpk, dcos_dxpj, dcos_dxpk, temp; static Mat3 dxpj_dij, dxpj_dkj, dxpk_dkj, dxpk_dlk; @@ -261,5 +261,5 @@ void Pattern::torsionForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::torsionForces"); + dbgEnd(Debug::Calls,"Pattern::torsionForces"); } diff --git a/src/energy/vdw.cpp b/src/energy/vdw.cpp index df291bf99..6bf9226ff 100644 --- a/src/energy/vdw.cpp +++ b/src/energy/vdw.cpp @@ -32,7 +32,7 @@ void Pattern::vdwIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, int lo { // Calculate the internal VDW contributions with coordinates from *xcfg // Consider only the intrapattern interactions between atoms in individual molecules within the pattern. - dbgBegin(DM_CALLS,"Pattern::vdwIntraPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::vdwIntraPatternEnergy"); static int n,aoff,m1,i,j, start1, finish1; static Vec3 mim_i; static double sigma, sigmar6, epsilon, rij, energy_inter, energy_intra, cutoff, vrs; @@ -114,14 +114,14 @@ void Pattern::vdwIntraPatternEnergy(Model *srcmodel, EnergyStore *estore, int lo estore->add(ET_VDWINTRA,energy_intra,id_); estore->add(ET_VDWINTER,energy_inter,id_,id_); //printf("TOTAL = %f %f\n",energy_intra,energy_inter); - dbgEnd(DM_CALLS,"Pattern::vdwIntraPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::vdwIntraPatternEnergy"); } // Interpattern VDW energy void Pattern::vdwInterPatternEnergy(Model *srcmodel, Pattern *otherPattern, EnergyStore *estore, int molId) { // Calculate the VDW contribution to the energy from interactions between molecules of this pattern and the one supplied - dbgBegin(DM_CALLS,"Pattern::vdwInterPatternEnergy"); + dbgBegin(Debug::Calls,"Pattern::vdwInterPatternEnergy"); static int n1,n2,i,j,aoff1,aoff2,m1,m2,finish1,start1,start2,finish2; static Vec3 mim_i; static double sigma, sigmar6, epsilon, rij, energy_inter, cutoff, vrs; @@ -145,7 +145,6 @@ void Pattern::vdwInterPatternEnergy(Model *srcmodel, Pattern *otherPattern, Ener finish1 = molId + 1; } aoff1 = startAtom_ + start1 * nAtoms_; - //printf("VDWINTER Pattern is '%li', molId = %i: start1/finish1 = %i/%i, otherPattern = %li\n",this,molId,start1,finish1,otherPattern); for (m1=start1; m1next) { i++; @@ -213,7 +211,7 @@ void Pattern::vdwInterPatternEnergy(Model *srcmodel, Pattern *otherPattern, Ener aoff1 += nAtoms_; } estore->add(ET_VDWINTER,energy_inter,id_,otherPattern->id_); - dbgEnd(DM_CALLS,"Pattern::vdwInterPatternEnergy"); + dbgEnd(Debug::Calls,"Pattern::vdwInterPatternEnergy"); } // Intrapattern VDW forces @@ -224,7 +222,7 @@ void Pattern::vdwIntraPatternForces(Model *srcmodel) // 'aoff' stores the atom number offset (molecule offset) but is *only* used for lookups in the coordinate // arrays since assuming the pattern definition is correct then the sigmas/epsilons in molecule 0 represent // those of all molecules. - dbgBegin(DM_CALLS,"Pattern::vdwIntraPatternForces"); + dbgBegin(Debug::Calls,"Pattern::vdwIntraPatternForces"); static int n,i,j,aoff,m1; static Vec3 mim_i, f_i, tempf; static double sigma, sigmar6, epsilon, rij, factor, cutoff, vrs; @@ -310,7 +308,7 @@ void Pattern::vdwIntraPatternForces(Model *srcmodel) } aoff += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::vdwIntraPatternForces"); + dbgEnd(Debug::Calls,"Pattern::vdwIntraPatternForces"); } // Interpattern VDW forces @@ -318,7 +316,7 @@ void Pattern::vdwInterPatternForces(Model *srcmodel, Pattern *xpnode) { // Calculate the VDW forces from interactions between different molecules // of this pnode and the one supplied - dbgBegin(DM_CALLS,"Pattern::vdwInterPatternForces"); + dbgBegin(Debug::Calls,"Pattern::vdwInterPatternForces"); static int n1,n2,i,j,aoff1,aoff2,m1,m2,start,finish; static Vec3 mim_i, f_i, tempf; static double sigma, sigmar6, epsilon, rij, factor, cutoff, vrs; @@ -378,7 +376,7 @@ void Pattern::vdwInterPatternForces(Model *srcmodel, Pattern *xpnode) } aoff1 += nAtoms_; } - dbgEnd(DM_CALLS,"Pattern::vdwInterPatternForces"); + dbgEnd(Debug::Calls,"Pattern::vdwInterPatternForces"); } // @@ -394,7 +392,7 @@ void Pattern::vdwInterPatternForces(Model *srcmodel, Pattern *xpnode) void Pattern::vdwCorrectEnergy(Cell *cell, EnergyStore *estore) { // Calculate the long-range correction to the VDW energy - dbgBegin(DM_CALLS,"Pattern::vdwCorrectEnergy"); + dbgBegin(Debug::Calls,"Pattern::vdwCorrectEnergy"); static int i, j; static Pattern *p1, *p2; static double energy, rho, cutoff, dudr, sigma, epsilon, sigmar3, sigmar9, volume, vrs; @@ -436,7 +434,7 @@ void Pattern::vdwCorrectEnergy(Cell *cell, EnergyStore *estore) dudr *= (sigma * sigma * sigma); break; default: - msg(DM_NONE,"VDW tail correction not implemented for LJ form %s.\n", text_from_VF(atoms_[j]->data()->vdwForm())); + msg(Debug::None,"VDW tail correction not implemented for LJ form %s.\n", text_from_VF(atoms_[j]->data()->vdwForm())); break; } energy += 2.0 * PI * rho * dudr; @@ -445,6 +443,6 @@ void Pattern::vdwCorrectEnergy(Cell *cell, EnergyStore *estore) } } estore->add(ET_VDWTAIL,energy,-1); - dbgEnd(DM_CALLS,"Pattern::vdwCorrectEnergy"); + dbgEnd(Debug::Calls,"Pattern::vdwCorrectEnergy"); } diff --git a/src/gui/atomlist_funcs.cpp b/src/gui/atomlist_funcs.cpp index d71bece5a..03f29a66f 100644 --- a/src/gui/atomlist_funcs.cpp +++ b/src/gui/atomlist_funcs.cpp @@ -41,7 +41,7 @@ int listPosition; void AtenForm::on_AtomTree_itemSelectionChanged() { if (REFRESHING) return; - dbgBegin(DM_CALLS,"AtenForm::on_AtomTree_selectionChanged"); + dbgBegin(Debug::Calls,"AtenForm::on_AtomTree_selectionChanged"); //printf("AtenForm:: atom selection has changed...\n"); // Selection has changed, so go through the Reflist of TTreeWidgetItems and check their selection status Model *m = master.currentModel(); @@ -55,16 +55,16 @@ void AtenForm::on_AtomTree_itemSelectionChanged() } gui.mainView.postRedisplay(); gui.updateLabels(); - dbgEnd(DM_CALLS,"AtenForm::on_AtomTree_selectionChanged"); + dbgEnd(Debug::Calls,"AtenForm::on_AtomTree_selectionChanged"); } void AtenForm::refreshAtomPage() { - dbgBegin(DM_CALLS,"AtenForm::refreshAtomPage"); + dbgBegin(Debug::Calls,"AtenForm::refreshAtomPage"); // If the atom list page is not visible, don't do anything if (!ui.ShowAtomPageButton->isChecked()) { - dbgEnd(DM_CALLS,"AtenForm::refreshAtomPage"); + dbgEnd(Debug::Calls,"AtenForm::refreshAtomPage"); return; } // Check stored log point against 'structure' and 'visual' log points in model to see if we need to refresh the list @@ -92,7 +92,7 @@ void AtenForm::refreshAtomPage() // If there are no atoms in the current model, exit now. if (m->nAtoms() == 0) { - dbgEnd(DM_CALLS,"AtenForm::refreshAtomPage"); + dbgEnd(Debug::Calls,"AtenForm::refreshAtomPage"); REFRESHING = FALSE; return; } @@ -156,7 +156,7 @@ void AtenForm::refreshAtomPage() } for (n=0; n<6; n++) ui.AtomTree->resizeColumnToContents(n); REFRESHING = FALSE; - dbgEnd(DM_CALLS,"AtenForm::refreshAtomPage"); + dbgEnd(Debug::Calls,"AtenForm::refreshAtomPage"); } void AtenForm::peekScrollBar() diff --git a/src/gui/canvas-qt.cpp b/src/gui/canvas-qt.cpp index 69d4045ec..3e7bcbc29 100644 --- a/src/gui/canvas-qt.cpp +++ b/src/gui/canvas-qt.cpp @@ -82,18 +82,18 @@ bool canvas::set_widget(TCanvas *w) void canvas::realize() { // Sets the canvas to use a widget for output. - dbgBegin(DM_CALLS,"canvas::realize"); + dbgBegin(Debug::Calls,"canvas::realize"); valid = TRUE; init_gl(); - dbgEnd(DM_CALLS,"canvas::realize"); + dbgEnd(Debug::Calls,"canvas::realize"); } // Invalidate void canvas::postRedisplay() { - dbgBegin(DM_CALLS,"canvas::postRedisplay"); + dbgBegin(Debug::Calls,"canvas::postRedisplay"); if (gui.exists()) context_widget->paintGL(); - dbgEnd(DM_CALLS,"canvas::postRedisplay"); + dbgEnd(Debug::Calls,"canvas::postRedisplay"); } // Widget Expose diff --git a/src/gui/canvas.cpp b/src/gui/canvas.cpp index a520e62f5..0a4648aa6 100644 --- a/src/gui/canvas.cpp +++ b/src/gui/canvas.cpp @@ -107,18 +107,18 @@ bool Canvas::setWidget(TCanvas *w) void Canvas::realize() { // Sets the canvas to use a widget for output. - dbgBegin(DM_CALLS,"Canvas::realize"); + dbgBegin(Debug::Calls,"Canvas::realize"); valid_ = TRUE; initGl(); - dbgEnd(DM_CALLS,"Canvas::realize"); + dbgEnd(Debug::Calls,"Canvas::realize"); } // Invalidate void Canvas::postRedisplay() { - dbgBegin(DM_CALLS,"Canvas::postRedisplay"); + dbgBegin(Debug::Calls,"Canvas::postRedisplay"); if (gui.exists()) contextWidget_->paintGL(); - dbgEnd(DM_CALLS,"Canvas::postRedisplay"); + dbgEnd(Debug::Calls,"Canvas::postRedisplay"); } // Widget Expose @@ -169,7 +169,7 @@ void Canvas::calculateDrawPixelWidth() void Canvas::initGl() { if (!valid_) return; - dbgBegin(DM_CALLS,"Canvas::initGl"); + dbgBegin(Debug::Calls,"Canvas::initGl"); if (beginGl()) { // Create lists for globs if this is the first call to init_gl() @@ -240,14 +240,14 @@ void Canvas::initGl() endGl(); } else printf("Failed to set-up OpenGL on canvas.\n"); - dbgEnd(DM_CALLS,"Canvas::initGl"); + dbgEnd(Debug::Calls,"Canvas::initGl"); } // Create display lists void Canvas::createLists() { if (!isValid()) return; - dbgBegin(DM_CALLS,"Canvas::createLists"); + dbgBegin(Debug::Calls,"Canvas::createLists"); int n,m, atomdetail, ticks, extent; double delta, tickdelta, tickheight, ticktop, tickbottom, spacing; @@ -470,7 +470,7 @@ void Canvas::createLists() } glEndList(); - dbgEnd(DM_CALLS,"Canvas::createLists"); + dbgEnd(Debug::Calls,"Canvas::createLists"); } /* @@ -482,7 +482,7 @@ void Canvas::doProjection() { // (Re)Create the projection and viewport matrix from the current geometry of the rendering widget / pixmap if (!gui.exists()) return; - dbgBegin(DM_CALLS,"Canvas::doProjection"); + dbgBegin(Debug::Calls,"Canvas::doProjection"); double pmat[16], bottom, top; // Check source if (beginGl()) @@ -521,7 +521,7 @@ void Canvas::doProjection() endGl(); } else printf("Canvas::doProjection <<<< Failed to reset projection matrix >>>>\n"); - dbgEnd(DM_CALLS,"Canvas::doProjection"); + dbgEnd(Debug::Calls,"Canvas::doProjection"); } /* @@ -548,7 +548,7 @@ void Canvas::saveVector(Model *source, vector_format vf, const char *filename) FILE *vectorfile = fopen(filename, "w"); if (vectorfile == NULL) { - msg(DM_NONE,"Couldn't open output file for vector export.\n"); + msg(Debug::None,"Couldn't open output file for vector export.\n"); return; } GLint result = GL2PS_OVERFLOW, bufsize = 0; diff --git a/src/gui/disorder_funcs.cpp b/src/gui/disorder_funcs.cpp index 712485008..c187c7e55 100644 --- a/src/gui/disorder_funcs.cpp +++ b/src/gui/disorder_funcs.cpp @@ -141,7 +141,7 @@ void AtenForm::on_AddComponentButton_clicked(bool checked) Model *m = master.currentModel(); if (m->cell()->type() != CT_NONE) { - msg(DM_NONE,"Model is periodic - can't add to component list.\n"); + msg(Debug::None,"Model is periodic - can't add to component list.\n"); return; } // Add it to mc.s component list and refresh the list diff --git a/src/gui/edit_funcs.cpp b/src/gui/edit_funcs.cpp index 819b79faf..7e2cf88c7 100644 --- a/src/gui/edit_funcs.cpp +++ b/src/gui/edit_funcs.cpp @@ -157,7 +157,7 @@ void AtenForm::on_ElementEdit_editingFinished() int el = elements.find(qPrintable(ui.ElementEdit->text())); if (el == -1) { - msg(DM_NONE,"Unknown element '%s'\n",qPrintable(ui.ElementEdit->text())); + msg(Debug::None,"Unknown element '%s'\n",qPrintable(ui.ElementEdit->text())); ui.ElementEdit->setText(ui.ElementUserButton->text()); } else diff --git a/src/gui/editactions.cpp b/src/gui/editactions.cpp index 6151613fe..d04320e98 100644 --- a/src/gui/editactions.cpp +++ b/src/gui/editactions.cpp @@ -57,8 +57,8 @@ void AtenForm::on_actionEditCopy_triggered(bool checked) { // Copy the selected atoms in the model into the paste buffer master.userClipboard->copySelection(master.currentModel()); - msg(DM_NONE,"%i atoms copied to clipboard.\n",master.userClipboard->nAtoms()); - msg(DM_VERBOSE, "Copied selection (%i atoms) from model %s\n",master.userClipboard->nAtoms(), master.currentModel()->name()); + msg(Debug::None,"%i atoms copied to clipboard.\n",master.userClipboard->nAtoms()); + msg(Debug::Verbose, "Copied selection (%i atoms) from model %s\n",master.userClipboard->nAtoms(), master.currentModel()->name()); } void AtenForm::on_actionEditPaste_triggered(bool checked) diff --git a/src/gui/ffeditor_funcs.cpp b/src/gui/ffeditor_funcs.cpp index da2005651..867df77bb 100644 --- a/src/gui/ffeditor_funcs.cpp +++ b/src/gui/ffeditor_funcs.cpp @@ -33,15 +33,15 @@ AtenEdit::AtenEdit(QDialog *parent) : QDialog(parent) // Finalise GUI void AtenEdit::finaliseUi() { - dbgBegin(DM_CALLS,"AtenEdit::finaliseUi"); - dbgEnd(DM_CALLS,"AtenEdit::finaliseUi"); + dbgBegin(Debug::Calls,"AtenEdit::finaliseUi"); + dbgEnd(Debug::Calls,"AtenEdit::finaliseUi"); } // Set controls void AtenEdit::setControls() { - dbgBegin(DM_CALLS,"AtenEdit::setControls"); - dbgBegin(DM_CALLS,"AtenEdit::setControls"); + dbgBegin(Debug::Calls,"AtenEdit::setControls"); + dbgBegin(Debug::Calls,"AtenEdit::setControls"); } // Populate widget with specified forcefield diff --git a/src/gui/fileactions.cpp b/src/gui/fileactions.cpp index eea2eb75a..5f8649673 100644 --- a/src/gui/fileactions.cpp +++ b/src/gui/fileactions.cpp @@ -219,7 +219,7 @@ void AtenForm::on_actionFileAddTrajectory_triggered(bool checked) ui.TrajectoryToolBar->setVisible(TRUE); ui.actionViewTrajectory->setChecked(TRUE); } - else msg(DM_NONE, "Couldn't determine trajectory file format.\n"); + else msg(Debug::None, "Couldn't determine trajectory file format.\n"); gui.refresh(); } } diff --git a/src/gui/forcefield_funcs.cpp b/src/gui/forcefield_funcs.cpp index 6c2cc6d71..f1ae590e6 100644 --- a/src/gui/forcefield_funcs.cpp +++ b/src/gui/forcefield_funcs.cpp @@ -207,7 +207,7 @@ void AtenForm::on_ManualTypeSetButton_clicked(bool checked) if ((m == NULL) || (ff == NULL)) return; if (m->forcefield() != ff) { - msg(DM_NONE,"The type you are trying to assign is in a different forcefield to that assigned to the model.\n"); + msg(Debug::None,"The type you are trying to assign is in a different forcefield to that assigned to the model.\n"); return; } // Get the selected row in the FFTypeList @@ -240,7 +240,7 @@ void AtenForm::on_ManualTypeTestButton_clicked(bool checked) Atomtype *at = ffa->atomType(); if (m->autocreatePatterns()) { - msg(DM_NONE,"Testing atom type '%s' (id = %i) from forcefield '%s' on current selection:\n", ffa->name(), ffa->typeId(), ff->name()); + msg(Debug::None,"Testing atom type '%s' (id = %i) from forcefield '%s' on current selection:\n", ffa->name(), ffa->typeId(), ff->name()); // Prepare for typing m->describeAtoms(); int matchscore; @@ -251,9 +251,9 @@ void AtenForm::on_ManualTypeTestButton_clicked(bool checked) if (i->element() == at->characterElement()) { matchscore = at->matchAtom(i, p->ringList(), m, i); - msg(DM_NONE,"Atom %i (%s) matched type with score %i.\n", i->id()+1, elements.symbol(i), matchscore); + msg(Debug::None,"Atom %i (%s) matched type with score %i.\n", i->id()+1, elements.symbol(i), matchscore); } - else msg(DM_NONE,"Atom %i (%s) is the wrong element for this type.\n", i->id()+1, elements.symbol(i)); + else msg(Debug::None,"Atom %i (%s) is the wrong element for this type.\n", i->id()+1, elements.symbol(i)); } } } @@ -266,7 +266,7 @@ void AtenForm::on_ManualTypeEdit_editingFinished() int el = elements.find(qPrintable(ui.ManualTypeEdit->text())); if (el == -1) { - msg(DM_NONE,"Unknown element '%s'\n",qPrintable(ui.ManualTypeEdit->text())); + msg(Debug::None,"Unknown element '%s'\n",qPrintable(ui.ManualTypeEdit->text())); ui.ManualTypeEdit->setText("H"); typelist_element = 1; } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 4554441d5..bc08a790b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -48,7 +48,7 @@ GuiQt::GuiQt() // Initialise and create GUI void GuiQt::run(int argc, char **argv) { - dbgBegin(DM_CALLS,"GuiQt::run"); + dbgBegin(Debug::Calls,"GuiQt::run"); // Initialise Qt, and the icons resource app = new QApplication(argc, argv); @@ -95,7 +95,7 @@ void GuiQt::run(int argc, char **argv) mainWindow->refreshForcefieldPage(); int n = app->exec(); - dbgEnd(DM_CALLS,"GuiQt::run"); + dbgEnd(Debug::Calls,"GuiQt::run"); } // Update trajectory controls @@ -137,7 +137,7 @@ void GuiQt::updateLabels() { // Update the information labels in the button bar if (!doesExist_) return; - dbgBegin(DM_CALLS,"GuiQt::update_labels"); + dbgBegin(Debug::Calls,"GuiQt::update_labels"); QString s; Model *m = master.currentModel(); // Trajectory information label @@ -174,7 +174,7 @@ void GuiQt::updateLabels() } } mainWindow->statusLabel->setText(s); - dbgEnd(DM_CALLS,"GuiQt::update_labels"); + dbgEnd(Debug::Calls,"GuiQt::update_labels"); } /* diff --git a/src/gui/input.cpp b/src/gui/input.cpp index 3eea8aa7d..05401dd34 100644 --- a/src/gui/input.cpp +++ b/src/gui/input.cpp @@ -43,9 +43,9 @@ void Canvas::informMouseDown(MouseButton button, double x, double y) if (subselection_.search(atomHover_) == NULL) { subselection_.add(atomHover_); - msg(DM_VERBOSE,"Adding atom %i to canvas subselection.\n",atomHover_); + msg(Debug::Verbose,"Adding atom %i to canvas subselection.\n",atomHover_); } - else msg(DM_VERBOSE,"Atom %i is already in canvas subselection.\n",atomHover_); + else msg(Debug::Verbose,"Atom %i is already in canvas subselection.\n",atomHover_); } // Activate mode... beginMode(button); @@ -160,12 +160,12 @@ void Canvas::informKeyUp(key_code key) // Set selected mode void Canvas::setSelectedMode(UserAction ua) { - dbgBegin(DM_CALLS,"Canvas::setSelectedMode"); + dbgBegin(Debug::Calls,"Canvas::setSelectedMode"); selectedMode_ = ua; if (displayModel_ == NULL) { printf("Pointless Canvas::setSelectedMode - datamodel == NULL.\n"); - dbgEnd(DM_CALLS,"Canvas::setSelectedMode"); + dbgEnd(Debug::Calls,"Canvas::setSelectedMode"); return; } // Prepare canvas / model depending on the mode @@ -186,13 +186,13 @@ void Canvas::setSelectedMode(UserAction ua) break; } gui.mainView.postRedisplay(); - dbgEnd(DM_CALLS,"Canvas::setSelectedMode"); + dbgEnd(Debug::Calls,"Canvas::setSelectedMode"); } // Begin Mode void Canvas::beginMode(MouseButton button) { - dbgBegin(DM_CALLS,"widgetCanvas::beginMode"); + dbgBegin(Debug::Calls,"widgetCanvas::beginMode"); static bool manipulate, zrotate; static int n; static Atom *i; @@ -203,7 +203,7 @@ void Canvas::beginMode(MouseButton button) if (displayModel_ == NULL) { printf("Pointless Canvas::beginMode - datamodel == NULL.\n"); - dbgEnd(DM_CALLS,"Canvas::beginMode"); + dbgEnd(Debug::Calls,"Canvas::beginMode"); return; } // Note the mouse button pressed @@ -278,14 +278,14 @@ void Canvas::beginMode(MouseButton button) displayModel_->prepareTransform(); } } - dbgEnd(DM_CALLS,"Canvas::begin_mode"); + dbgEnd(Debug::Calls,"Canvas::begin_mode"); } // End Mode void Canvas::endMode(MouseButton button) { // Finalize the current action on the model - dbgBegin(DM_CALLS,"Canvas::endMode"); + dbgBegin(Debug::Calls,"Canvas::endMode"); bool manipulate; double area, radius; Atom *atoms[4], *i; @@ -294,7 +294,7 @@ void Canvas::endMode(MouseButton button) if (displayModel_ == NULL) { printf("Pointless Canvas::endMode - datamodel == NULL.\n"); - dbgEnd(DM_CALLS,"Canvas::endMode"); + dbgEnd(Debug::Calls,"Canvas::endMode"); return; } // Reset mouse button flag @@ -483,19 +483,19 @@ void Canvas::endMode(MouseButton button) } activeMode_ = UA_NONE; postRedisplay(); - dbgEnd(DM_CALLS,"Canvas::endMode"); + dbgEnd(Debug::Calls,"Canvas::endMode"); } void Canvas::modeMotion(double x, double y) { // Actively update variables when moving the mouse (possibly while performing a given action) - dbgBegin(DM_CALLS,"Canvas::modeMotion"); + dbgBegin(Debug::Calls,"Canvas::modeMotion"); static Vec3 delta; static Model *viewtarget; if (displayModel_ == NULL) { printf("Pointless Canvas::modeMotion - datamodel == NULL.\n"); - dbgEnd(DM_CALLS,"Canvas::modeMotion"); + dbgEnd(Debug::Calls,"Canvas::modeMotion"); return; } // For view operations when we have a trajectory, apply all movement to the parent model @@ -541,19 +541,19 @@ void Canvas::modeMotion(double x, double y) break; } postRedisplay(); - dbgEnd(DM_CALLS,"Canvas::modeMotion"); + dbgEnd(Debug::Calls,"Canvas::modeMotion"); } void Canvas::modeScroll(bool scrollup) { // Handle mouse-wheel scroll events. // Do the requested wheel action as defined in the control panel - dbgBegin(DM_CALLS,"Canvas::modeScroll"); + dbgBegin(Debug::Calls,"Canvas::modeScroll"); static Model *viewtarget; if (displayModel_ == NULL) { printf("Pointless Canvas::modeScroll - datamodel == NULL.\n"); - dbgEnd(DM_CALLS,"Canvas::modeScroll"); + dbgEnd(Debug::Calls,"Canvas::modeScroll"); return; } // For view operations when we have a trajectory, apply all movement to the parent model @@ -579,5 +579,5 @@ void Canvas::modeScroll(bool scrollup) break; } postRedisplay(); - dbgEnd(DM_CALLS,"Canvas::modeScroll"); + dbgEnd(Debug::Calls,"Canvas::modeScroll"); } diff --git a/src/gui/mainwindow_funcs.cpp b/src/gui/mainwindow_funcs.cpp index db92baeba..4d12db2f4 100644 --- a/src/gui/mainwindow_funcs.cpp +++ b/src/gui/mainwindow_funcs.cpp @@ -105,16 +105,16 @@ void AtenForm::keyReleaseEvent(QKeyEvent *event) void AtenForm::on_ModelTabs_currentChanged(int n) { - dbgBegin(DM_CALLS,"AtenForm::on_ModelTabs_currentChanged"); + dbgBegin(Debug::Calls,"AtenForm::on_ModelTabs_currentChanged"); // Different model tab has been selected, so set master.currentmodel to reflect it. master.setCurrentModel(master.model(n)); gui.refresh(); - dbgEnd(DM_CALLS,"AtenForm::on_ModelTabs_currentChanged"); + dbgEnd(Debug::Calls,"AtenForm::on_ModelTabs_currentChanged"); } void AtenForm::refreshModelTabs() { - dbgBegin(DM_CALLS,"AtenForm::refreshModelTabs"); + dbgBegin(Debug::Calls,"AtenForm::refreshModelTabs"); // Set names on tabs int count = 0; for (Model *m = master.models(); m != NULL; m = m->next) @@ -122,7 +122,7 @@ void AtenForm::refreshModelTabs() ui.ModelTabs->setTabText(count, m->name()); count ++; } - dbgEnd(DM_CALLS,"AtenForm::refreshModelTabs"); + dbgEnd(Debug::Calls,"AtenForm::refreshModelTabs"); } void AtenForm::executeCommand() @@ -178,10 +178,10 @@ void AtenForm::loadRecent() // See if any loaded model filename matches this filename for (m = master.models(); m != NULL; m = m->next) { - msg(DM_VERBOSE,"Checking loaded models for '%s': %s\n",filename.get(),m->filename()); + msg(Debug::Verbose,"Checking loaded models for '%s': %s\n",filename.get(),m->filename()); if (filename == m->filename()) { - msg(DM_VERBOSE,"Matched filename to loaded model.\n"); + msg(Debug::Verbose,"Matched filename to loaded model.\n"); master.setCurrentModel(m); return; } @@ -323,7 +323,7 @@ void AtenForm::runScript() else { // Execute the script - msg(DM_NONE,"Executing script '%s':\n",ri->data->name()); + msg(Debug::None,"Executing script '%s':\n",ri->data->name()); ri->data->execute(); } } diff --git a/src/gui/mainwindow_init.cpp b/src/gui/mainwindow_init.cpp index 0d16455f3..5dad2c1ed 100644 --- a/src/gui/mainwindow_init.cpp +++ b/src/gui/mainwindow_init.cpp @@ -28,7 +28,7 @@ // Finalise GUI void AtenForm::finaliseUi() { - dbgBegin(DM_CALLS,"AtenForm::finaliseUi"); + dbgBegin(Debug::Calls,"AtenForm::finaliseUi"); Filter *f; int n; char temp[256]; @@ -294,13 +294,13 @@ void AtenForm::finaliseUi() filters << "All files (*)"; openScriptDialog->setFilters(filters); - dbgEnd(DM_CALLS,"AtenForm::finaliseUi"); + dbgEnd(Debug::Calls,"AtenForm::finaliseUi"); } // Set controls void AtenForm::setControls() { - dbgBegin(DM_CALLS,"AtenForm::setControls"); + dbgBegin(Debug::Calls,"AtenForm::setControls"); // Set correct Atom::DrawStyle on toolbar switch (prefs.renderStyle()) { @@ -314,6 +314,6 @@ void AtenForm::setControls() prefs.hasPerspective() ? ui.actionViewPerspective->setChecked(TRUE) : ui.actionViewOrthographic->setChecked(TRUE); // Set controls on edit page ui.BondToleranceSpin->setValue(prefs.bondTolerance()); - dbgEnd(DM_CALLS,"AtenForm::setControls"); + dbgEnd(Debug::Calls,"AtenForm::setControls"); } diff --git a/src/gui/minimise_funcs.cpp b/src/gui/minimise_funcs.cpp index 27d22e6da..2067682af 100644 --- a/src/gui/minimise_funcs.cpp +++ b/src/gui/minimise_funcs.cpp @@ -59,7 +59,7 @@ void AtenForm::on_MinimiseButton_clicked(bool checked) mc.minimise(master.currentModel(),econverge,fconverge); break; case (MM_SIMPLEX): - msg(DM_NONE,"Simplex minimiser not yet written!\n"); + msg(Debug::None,"Simplex minimiser not yet written!\n"); break; } gui.mainView.postRedisplay(); diff --git a/src/gui/prefs_funcs.cpp b/src/gui/prefs_funcs.cpp index dd05ad8d8..b6f7f463c 100644 --- a/src/gui/prefs_funcs.cpp +++ b/src/gui/prefs_funcs.cpp @@ -38,7 +38,7 @@ AtenPrefs::AtenPrefs(QDialog *parent) : QDialog(parent) // Finalise GUI void AtenPrefs::finaliseUi() { - dbgBegin(DM_CALLS,"AtenPrefs::finaliseUi"); + dbgBegin(Debug::Calls,"AtenPrefs::finaliseUi"); int i; // Add elements to element list and select first item QListWidgetItem *item; @@ -49,13 +49,13 @@ void AtenPrefs::finaliseUi() item->setText(elements.name(i)); } ui.ElementList->setCurrentRow(0); - dbgEnd(DM_CALLS,"AtenPrefs::finaliseUi"); + dbgEnd(Debug::Calls,"AtenPrefs::finaliseUi"); } // Set controls void AtenPrefs::setControls() { - dbgBegin(DM_CALLS,"AtenPrefs::setControls"); + dbgBegin(Debug::Calls,"AtenPrefs::setControls"); // Select the first element in the elements list ui.ElementList->setCurrentRow(0); @@ -91,7 +91,7 @@ void AtenPrefs::setControls() ui.ShiftButtonCombo->setCurrentIndex(prefs.keyAction(MK_SHIFT)); ui.CtrlButtonCombo->setCurrentIndex(prefs.keyAction(MK_CTRL)); ui.AltButtonCombo->setCurrentIndex(prefs.keyAction(MK_ALT)); - dbgBegin(DM_CALLS,"AtenPrefs::setControls"); + dbgBegin(Debug::Calls,"AtenPrefs::setControls"); } /* diff --git a/src/gui/tcanvas_funcs.cpp b/src/gui/tcanvas_funcs.cpp index 53cb06fd9..7ba753c3b 100644 --- a/src/gui/tcanvas_funcs.cpp +++ b/src/gui/tcanvas_funcs.cpp @@ -68,14 +68,14 @@ void TCanvas::resizeGL(int width, int height) void TCanvas::mousePressEvent(QMouseEvent *event) { // Handle button presses (button down) from the mouse - dbgBegin(DM_CALLS,"TCanvas::mousePressEvent"); + dbgBegin(Debug::Calls,"TCanvas::mousePressEvent"); MouseButton button; if (event->button() == Qt::LeftButton) button = MB_LEFT; else if (event->button() == Qt::MidButton) button = MB_MIDDLE; else if (event->button() == Qt::RightButton) button = MB_RIGHT; else { - dbgEnd(DM_CALLS,"TCanvas::mousePressEvent"); + dbgEnd(Debug::Calls,"TCanvas::mousePressEvent"); return; } // Do the requested action as defined in the edit panel, but only if another action @@ -89,7 +89,7 @@ void TCanvas::mousePressEvent(QMouseEvent *event) { gui.callAtomPopup(tempi, event->globalX(), event->globalY()); gui.mainView.postRedisplay(); - dbgEnd(DM_CALLS,"TCanvas::mousePressEvent"); + dbgEnd(Debug::Calls,"TCanvas::mousePressEvent"); return; } } @@ -101,32 +101,32 @@ void TCanvas::mousePressEvent(QMouseEvent *event) { printf("gui::dblclick show atom list not done.\n"); //gui.atomwin_list_refresh(); - dbgEnd(DM_CALLS,"TCanvas::mousePressEvent"); + dbgEnd(Debug::Calls,"TCanvas::mousePressEvent"); return; } } // Inform the main canvas that a button action has occurred gui.mainView.informMouseDown(button,event->x(),event->y()); - dbgEnd(DM_CALLS,"TCanvas::mousePressEvent"); + dbgEnd(Debug::Calls,"TCanvas::mousePressEvent"); } void TCanvas::mouseReleaseEvent(QMouseEvent *event) { // Handle button releases (button up) from the mouse - dbgBegin(DM_CALLS,"TCanvas::mouseReleaseEvent"); + dbgBegin(Debug::Calls,"TCanvas::mouseReleaseEvent"); MouseButton button; if (event->button() == Qt::LeftButton) button = MB_LEFT; else if (event->button() == Qt::MidButton) button = MB_MIDDLE; else if (event->button() == Qt::RightButton) button = MB_RIGHT; else { - dbgEnd(DM_CALLS,"TCanvas::mouseReleaseEvent"); + dbgEnd(Debug::Calls,"TCanvas::mouseReleaseEvent"); return; } // Finalize the requested action gui.mainView.informMouseUp(button,event->x(),event->y()); gui.refresh(); - dbgEnd(DM_CALLS,"TCanvas::mouseReleaseEvent"); + dbgEnd(Debug::Calls,"TCanvas::mouseReleaseEvent"); } void TCanvas::mouseMoveEvent(QMouseEvent *event) diff --git a/src/gui/transform_funcs.cpp b/src/gui/transform_funcs.cpp index d72da0627..8f8bdc4b7 100644 --- a/src/gui/transform_funcs.cpp +++ b/src/gui/transform_funcs.cpp @@ -145,7 +145,7 @@ void AtenForm::translateSelection(int axis, int dir) // Translate selection in the cell axes of the model if (m->cell()->type() == CT_NONE) { - msg(DM_NONE,"No unit cell defined for model.\n"); + msg(Debug::None,"No unit cell defined for model.\n"); return; } tvec = master.currentModel()->cell()->axes().get(axis); diff --git a/src/methods/cg.cpp b/src/methods/cg.cpp index d1d3b0fab..68cce56ab 100644 --- a/src/methods/cg.cpp +++ b/src/methods/cg.cpp @@ -38,7 +38,7 @@ MethodCg::MethodCg() void MethodCg::minimise(Model *srcmodel, double econ, double fcon) { // Line Search (Steepest Descent) energy minimisation. - dbgBegin(DM_CALLS,"MethodCg::minimise"); + dbgBegin(Debug::Calls,"MethodCg::minimise"); int cycle, m, i; double enew, ecurrent, edelta, rmscurrent, rmsnew, fdelta, g_old_sq, gamma, g_current_sq; double *g_old; @@ -52,7 +52,7 @@ void MethodCg::minimise(Model *srcmodel, double econ, double fcon) // First, create expression for the current model and assign charges if (!srcmodel->createExpression()) { - dbgEnd(DM_CALLS,"MethodCg::minimise"); + dbgEnd(Debug::Calls,"MethodCg::minimise"); return; } @@ -67,8 +67,8 @@ void MethodCg::minimise(Model *srcmodel, double econ, double fcon) converged = FALSE; linedone = FALSE; - msg(DM_NONE,"Step Energy DeltaE RMS Force\n"); - msg(DM_NONE,"Init %15.5e --- %15.5e\n",ecurrent,rmscurrent); + msg(Debug::None,"Step Energy DeltaE RMS Force\n"); + msg(Debug::None,"Init %15.5e --- %15.5e\n",ecurrent,rmscurrent); gui.progressCreate("Minimising (CG)", nCycles_); for (cycle=0; cycletotalEnergy(srcmodel); srcmodel->energy.print(); // Calculate fresh new forces for the model, log changes / update, and exit. srcmodel->calculateForces(srcmodel); srcmodel->updateMeasurements(); srcmodel->logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"MethodCg::minimise"); + dbgEnd(Debug::Calls,"MethodCg::minimise"); } diff --git a/src/methods/geometry.cpp b/src/methods/geometry.cpp index 287303341..e5b4d8d1d 100644 --- a/src/methods/geometry.cpp +++ b/src/methods/geometry.cpp @@ -78,28 +78,28 @@ void Geometry::setRange(double d, double w, int n) // Initialise structure bool Geometry::initialise() { - dbgBegin(DM_CALLS,"Geometry::initialise"); + dbgBegin(Debug::Calls,"Geometry::initialise"); // Check site definitions.... for (nSites_ = 0; nSites_ < 4; nSites_++) if (sites_[nSites_] == NULL) break; if (nSites_ == 0) { - msg(DM_NONE,"Geometry::initialise - At least two sites_ must be defined.\n"); - dbgEnd(DM_CALLS,"Geometry::initialise"); + msg(Debug::None,"Geometry::initialise - At least two sites_ must be defined.\n"); + dbgEnd(Debug::Calls,"Geometry::initialise"); return FALSE; } // Create the data arrays data_ = new double[nBins_]; for (int n=0; n centre1, centre2, centre3, centre4; Cell *cell = sourcemodel->cell(); @@ -181,14 +181,14 @@ void Geometry::accumulate(Model *sourcemodel) // Increase accumulation counter nAdded_ ++; - dbgEnd(DM_CALLS,"Geometry::accumulate"); + dbgEnd(Debug::Calls,"Geometry::accumulate"); } // Finalise void Geometry::finalise(Model *sourcemodel) { - dbgBegin(DM_CALLS,"Geometry::finalise"); - dbgEnd(DM_CALLS,"Geometry::finalise"); + dbgBegin(Debug::Calls,"Geometry::finalise"); + dbgEnd(Debug::Calls,"Geometry::finalise"); } // Save measurement data diff --git a/src/methods/linemin.cpp b/src/methods/linemin.cpp index 5f02258da..ba805444e 100644 --- a/src/methods/linemin.cpp +++ b/src/methods/linemin.cpp @@ -32,7 +32,7 @@ LineMinimiser::LineMinimiser() void LineMinimiser::gradientMove(Model *srcmodel, Model *destmodel, double delta) { // Generate a new set of coordinates in destmodel following the normalised gradient vector present in srcmodel, with the stepsize given - dbgBegin(DM_CALLS,"LineMinimiser::gradientMove"); + dbgBegin(Debug::Calls,"LineMinimiser::gradientMove"); int i; Atom **srcatoms = srcmodel->atomArray(); Atom **destatoms = destmodel->atomArray(); @@ -42,13 +42,13 @@ void LineMinimiser::gradientMove(Model *srcmodel, Model *destmodel, double delta destatoms[i]->r().y = srcatoms[i]->r().y + srcatoms[i]->f().y * delta; destatoms[i]->r().z = srcatoms[i]->r().z + srcatoms[i]->f().z * delta; } - dbgEnd(DM_CALLS,"LineMinimiser::gradientMove"); + dbgEnd(Debug::Calls,"LineMinimiser::gradientMove"); } // Line minimise supplied model along gradient vector double LineMinimiser::lineMinimise(Model *srcmodel) { - dbgBegin(DM_CALLS,"LineMinimiser::lineMinimise"); + dbgBegin(Debug::Calls,"LineMinimiser::lineMinimise"); int m, i; double enew, ecurrent, step, bound[3], energy[3], newmin, mid, a, b, b10, b12; Model destmodel; @@ -99,7 +99,7 @@ double LineMinimiser::lineMinimise(Model *srcmodel) bound[2] = bound[1]; bound[1] = enew; } - msg(DM_VERBOSE,"Initial bounding values/energies = %f (%f) %f (%f) %f (%f)\n",bound[0],energy[0],bound[1],energy[1],bound[2],energy[2]); + msg(Debug::Verbose,"Initial bounding values/energies = %f (%f) %f (%f) %f (%f)\n",bound[0],energy[0],bound[1],energy[1],bound[2],energy[2]); do { @@ -201,7 +201,7 @@ double LineMinimiser::lineMinimise(Model *srcmodel) } } while (fabs(bound[0]-bound[2]) > (2.0 * tolerance_)); //printf("Final bounding values are %f %f %f\n",bound[0],bound[1],bound[2]); - dbgEnd(DM_CALLS,"LineMinimiser::minimise"); + dbgEnd(Debug::Calls,"LineMinimiser::minimise"); return energy[1]; } diff --git a/src/methods/mc.cpp b/src/methods/mc.cpp index ccd844702..476d3bb4b 100644 --- a/src/methods/mc.cpp +++ b/src/methods/mc.cpp @@ -252,7 +252,7 @@ bool MethodMc::minimise(Model* srcmodel, double econ, double fcon) { // Monte Carlo energy minimisation. // Validity of forcefield and energy setup must be performed before calling and is *not* checked here. - dbgBegin(DM_CALLS,"MethodMc::minimise"); + dbgBegin(Debug::Calls,"MethodMc::minimise"); int n, cycle, nmoves, move, mol, randpat, npats, prog; char s[256], t[32]; double enew, ecurrent, currentVdwEnergy, currentElecEnergy, elast, phi, theta; @@ -263,10 +263,10 @@ bool MethodMc::minimise(Model* srcmodel, double econ, double fcon) // Prepare the calculation */ // First, create expression for the current model and assign charges - msg(DM_NONE,"Creating expression for target model...\n"); + msg(Debug::None,"Creating expression for target model...\n"); if (!srcmodel->createExpression()) { - dbgEnd(DM_CALLS,"MethodMc::minimise"); + dbgEnd(Debug::Calls,"MethodMc::minimise"); return FALSE; } srcmodel->assignCharges(prefs.chargeSource()); @@ -278,15 +278,15 @@ bool MethodMc::minimise(Model* srcmodel, double econ, double fcon) // Create ratio array (not per-pattern, just per move type) createRatioArray(1); - msg(DM_NONE,"Beginning Monte Carlo minimise...\n\n"); - msg(DM_NONE," Step Energy Delta VDW Elec T%% R%% Z%% I%% D%%\n"); + msg(Debug::None,"Beginning Monte Carlo minimise...\n\n"); + msg(Debug::None," Step Energy Delta VDW Elec T%% R%% Z%% I%% D%%\n"); // Calculate initial reference energy ecurrent = srcmodel->totalEnergy(srcmodel); currentVdwEnergy = srcmodel->energy.vdw(); currentElecEnergy = srcmodel->energy.elec(); elast = ecurrent; - msg(DM_NONE," %13.6e %13.6e %13.6e\n", ecurrent, currentVdwEnergy, currentElecEnergy); + msg(Debug::None," %13.6e %13.6e %13.6e\n", ecurrent, currentVdwEnergy, currentElecEnergy); // Cycle through move types; try and perform nTrials_ for each; move on. // For each attempt, select a random molecule in a random pattern @@ -380,9 +380,9 @@ bool MethodMc::minimise(Model* srcmodel, double econ, double fcon) if (prefs.shouldUpdateEnergy(cycle)) { - msg(DM_NONE," %-5i %13.6e %13.6e %13.6e %13.6e", cycle+1, ecurrent, ecurrent-elast, currentVdwEnergy, currentElecEnergy); - for (n=0; nlogChange(LOG_COORDS); - dbgEnd(DM_CALLS,"MethodMc::minimise"); + dbgEnd(Debug::Calls,"MethodMc::minimise"); return TRUE; } @@ -404,7 +404,7 @@ bool MethodMc::minimise(Model* srcmodel, double econ, double fcon) bool MethodMc::disorder(Model *destmodel) { // Monte Carlo Insertion - dbgBegin(DM_CALLS,"MethodMc::disorder"); + dbgBegin(Debug::Calls,"MethodMc::disorder"); int n, m, cycle, move, mol, nOldAtoms, nOldPatterns; int patternNMols, prog; char s[256], t[32]; @@ -423,10 +423,10 @@ bool MethodMc::disorder(Model *destmodel) // Prepare the calculation */ // First, create expression for the current model and assign charges - msg(DM_NONE,"Creating expression for target model...\n"); + msg(Debug::None,"Creating expression for target model...\n"); if (!destmodel->createExpression()) { - dbgEnd(DM_CALLS,"MethodMc::disorder"); + dbgEnd(Debug::Calls,"MethodMc::disorder"); return FALSE; } nOldPatterns = destmodel->nPatterns(); @@ -438,13 +438,13 @@ bool MethodMc::disorder(Model *destmodel) // Check that there were actually components specified if (components.nItems() == 0) { - msg(DM_NONE,"No components have been specified for inclusion into the model.\n"); - dbgEnd(DM_CALLS,"MethodMc::disorder"); + msg(Debug::None,"No components have been specified for inclusion into the model.\n"); + dbgEnd(Debug::Calls,"MethodMc::disorder"); return FALSE; } // Autocreate expressions for component models, paste copies in to the target model, and then add a corresponding pattern node. - msg(DM_NONE,"Preparing destination model...\n"); + msg(Debug::None,"Preparing destination model...\n"); for (c = components.first(); c != NULL; c = c->next) { // Grab the model pointer for this component and set the number filled to zero @@ -453,8 +453,8 @@ bool MethodMc::disorder(Model *destmodel) // Check that we can create a suitable expression for the component model if (!m->createExpression()) { - msg(DM_NONE,"Failed to create expression for component model '%s'.\n", m->name()); - dbgEnd(DM_CALLS,"MethodMc::disorder"); + msg(Debug::None,"Failed to create expression for component model '%s'.\n", m->name()); + dbgEnd(Debug::Calls,"MethodMc::disorder"); return FALSE; } // TODO Autocreation of patterns may not give a 1*N pattern. Add option to force 1*N pattern. @@ -472,16 +472,16 @@ bool MethodMc::disorder(Model *destmodel) // Create master expression for the new (filled) model if (!destmodel->createExpression()) { - msg(DM_NONE,"Couldn't create master expression for destination model.\n"); + msg(Debug::None,"Couldn't create master expression for destination model.\n"); return FALSE; } // Set starting populations of patterns, add atom space to target model, and print out pattern list info. - msg(DM_NONE,"Pattern info for insertion to model '%s':\n",destmodel->name()); - msg(DM_NONE," ID nmols atoms starti finali name\n"); + msg(Debug::None,"Pattern info for insertion to model '%s':\n",destmodel->name()); + msg(Debug::None," ID nmols atoms starti finali name\n"); for (p = destmodel->patterns(); p != NULL; p = p->next) { // Set nmols, starti, endi, startatom and endatom in the pattern - msg(DM_NONE," %2i %5i %5i %6i %6i %s\n",p->id(),p->nMols(),p->nAtoms(), + msg(Debug::None," %2i %5i %5i %6i %6i %s\n",p->id(),p->nMols(),p->nAtoms(), p->startAtom(),p->startAtom() + p->totalAtoms(),p->name()); } @@ -493,7 +493,7 @@ bool MethodMc::disorder(Model *destmodel) for (n = nOldAtoms; n < destmodel->nAtoms(); n++) modelAtoms[n]->setHidden(TRUE); // Create a backup model - msg(DM_NONE,"Preparing workspace for maximum of %i atoms...\n", destmodel->nAtoms()); + msg(Debug::None,"Preparing workspace for maximum of %i atoms...\n", destmodel->nAtoms()); Model bakmodel; bakmodel.copy(destmodel); @@ -512,22 +512,22 @@ bool MethodMc::disorder(Model *destmodel) */ // Cycle through move types; try and perform nTrials_ for each; move on. // For each attempt, select a random molecule in a random pattern - msg(DM_NONE,"Beginning Monte Carlo insertion...\n\n"); - msg(DM_NONE," Step Energy Delta VDW Elec Model N Nreq T%% R%% Z%% I%% D%%\n"); + msg(Debug::None,"Beginning Monte Carlo insertion...\n\n"); + msg(Debug::None," Step Energy Delta VDW Elec Model N Nreq T%% R%% Z%% I%% D%%\n"); // Calculate initial reference energies ecurrent = destmodel->totalEnergy(destmodel); currentVdwEnergy = destmodel->energy.vdw(); currentElecEnergy = destmodel->energy.elec(); elast = ecurrent; - msg(DM_NONE," %-5i %13.6e %13s %13.6e %13.6e \n", 0, ecurrent, " --- ", destmodel->energy.vdw(), destmodel->energy.elec()); + msg(Debug::None," %-5i %13.6e %13s %13.6e %13.6e \n", 0, ecurrent, " --- ", destmodel->energy.vdw(), destmodel->energy.elec()); // Loop over MC cycles if (gui.exists()) gui.progressCreate("Building disordered system", nCycles_ * components.nItems() * MT_NITEMS); prog = 0; for (cycle=0; cyclenext) @@ -535,15 +535,15 @@ bool MethodMc::disorder(Model *destmodel) // Get pointers to variables p = c->pattern(); r = &c->area; - msg(DM_VERBOSE,"Working on pattern '%s'\n",p->name()); + msg(Debug::Verbose,"Working on pattern '%s'\n",p->name()); // If the pattern is fixed, move on if (p->isFixed()) { prog += MT_NITEMS; - msg(DM_VERBOSE,"Pattern '%s' is fixed.\n",p->name()); + msg(Debug::Verbose,"Pattern '%s' is fixed.\n",p->name()); continue; } - msg(DM_VERBOSE,"Pattern region is '%s'.\n",text_from_RS(r->shape())); + msg(Debug::Verbose,"Pattern region is '%s'.\n",text_from_RS(r->shape())); // Loop over MC moves in reverse order so we do creation / destruction first for (move=MT_DELETE; move>-1; move--) @@ -567,10 +567,10 @@ bool MethodMc::disorder(Model *destmodel) // New molecule case (MT_INSERT): // Check if we've already filled as many as requested - msg(DM_VERBOSE,"insert : Pattern %s has %i molecules.\n",p->name(),patternNMols); + msg(Debug::Verbose,"insert : Component %s has %i molecules.\n",c->name(),patternNMols); if (patternNMols == p->nExpectedMols()) continue; // Paste a new molecule into the working configuration - msg(DM_VERBOSE,"insert : Pasting new molecule - pattern %s, mol %i\n",p->name(),patternNMols); + msg(Debug::Verbose,"insert : Pasting new molecule - component %s, mol %i\n",c->name(),patternNMols); //clip.paste_to_model(destmodel,p,patternNMols); // Increase nmols for pattern and natoms for config mol = patternNMols; // Points to new molecule, since m-1 @@ -635,7 +635,7 @@ bool MethodMc::disorder(Model *destmodel) deltaMoleculeEnergy = enew - referenceMoleculeEnergy; deltaVdwEnergy = destmodel->energy.vdw() - referenceVdwEnergy; deltaElecEnergy = destmodel->energy.elec() - referenceElecEnergy; - // printf("enew = %f, eref = %f, edelta = %f\n",enew, eref, edelta); + msg(Debug::Verbose,"eNew = %f, deltaMoleculeEnergy = %f, deltaVdwEnergy = %f\n", enew, deltaMoleculeEnergy, deltaVdwEnergy); if (deltaMoleculeEnergy > acceptanceEnergy_[move]) { //printf("REJECTING MOVE : edelta = %20.14f\n",edelta); @@ -677,7 +677,7 @@ bool MethodMc::disorder(Model *destmodel) if (prefs.shouldUpdateEnergy(cycle)) { // Print start of first line (current energy and difference) - //msg(DM_NONE," %-5i %13.6e %13.6e %13.6e %13.6e ", cycle+1, ecurrent, ecurrent-elastcycle, currentVdwEnergy, currentElecEnergy); + //msg(Debug::None," %-5i %13.6e %13.6e %13.6e %13.6e ", cycle+1, ecurrent, ecurrent-elastcycle, currentVdwEnergy, currentElecEnergy); for (p = destmodel->patterns(); p != NULL; p = p->next) { n = p->id(); @@ -693,7 +693,7 @@ bool MethodMc::disorder(Model *destmodel) strcat(s,t); } strcat(s,"\n"); - msg(DM_NONE,s); + msg(Debug::None,s); } } elast = ecurrent; @@ -707,7 +707,7 @@ bool MethodMc::disorder(Model *destmodel) } if (done) { - msg(DM_NONE,"All component populations satisfied.\n"); + msg(Debug::None,"All component populations satisfied.\n"); break; } } @@ -717,12 +717,12 @@ bool MethodMc::disorder(Model *destmodel) enew = destmodel->totalEnergy(destmodel); destmodel->energy.print(); // Print out pattern list info here - msg(DM_NONE,"Final populations for model '%s':\n",destmodel->name()); - msg(DM_NONE," ID name nmols \n"); + msg(Debug::None,"Final populations for model '%s':\n",destmodel->name()); + msg(Debug::None," ID name nmols \n"); p = destmodel->patterns(); while (p != NULL) { - msg(DM_NONE," %2i %-20s %6i\n",p->id(),p->name(),p->nMols()); + msg(Debug::None," %2i %-20s %6i\n",p->id(),p->name(),p->nMols()); p = p->next; } @@ -743,6 +743,14 @@ bool MethodMc::disorder(Model *destmodel) } else i = i->next; } + // Fix pattern startAtom and endAtom (pointers to first atom are okay) + for (p = destmodel->patterns(); p != NULL; p = p->next) + { + // For the first pattern, set StartAtom to zero. Otherwise, use previous pattern's endAtom. + p->setStartAtom( p == destmodel->patterns() ? 0 : p->prev->startAtom() + p->prev->nMols()*p->prev->nAtoms() ); + p->setEndAtom( p->startAtom() + p->nAtoms() - 1 ); + //printf("PATTERN %li NEW START/END = %i/%i\n",p,p->startAtom(),p->endAtom()); + } //bakmodel.copy(destmodel); //destmodel->recreate_from_patterns(&bakmodel); //destmodel->renderFromSelf(); @@ -751,7 +759,7 @@ bool MethodMc::disorder(Model *destmodel) destmodel->calculateDensity(); destmodel->logChange(LOG_COORDS); gui.refresh(); - dbgEnd(DM_CALLS,"MethodMc::insert"); + dbgEnd(Debug::Calls,"MethodMc::insert"); return TRUE; } diff --git a/src/methods/pdens.cpp b/src/methods/pdens.cpp index cbb8592ca..3fe257bf1 100644 --- a/src/methods/pdens.cpp +++ b/src/methods/pdens.cpp @@ -82,12 +82,12 @@ void Pdens::setRange(double ss, int n) // Initialise structure bool Pdens::initialise() { - dbgBegin(DM_CALLS,"Pdens::initialise"); + dbgBegin(Debug::Calls,"Pdens::initialise"); // Check site definitions.... if ((sites_[0] == NULL) || (sites_[1] == NULL)) { - msg(DM_NONE,"Pdens::initialise - At least one site has NULL value.\n"); - dbgEnd(DM_CALLS,"calculable::initialise"); + msg(Debug::None,"Pdens::initialise - At least one site has NULL value.\n"); + dbgEnd(Debug::Calls,"calculable::initialise"); return FALSE; } // Create the data_ array @@ -102,16 +102,16 @@ bool Pdens::initialise() for (o=0; o centre1, centre2, mimd; static Vec3 gridPoint; @@ -143,7 +143,7 @@ void Pdens::accumulate(Model *sourcemodel) } // Increase accumulation counter nAdded_ ++; - dbgEnd(DM_CALLS,"Pdens::accumulate"); + dbgEnd(Debug::Calls,"Pdens::accumulate"); } // Add point to data_ array @@ -160,7 +160,7 @@ void Pdens::addPoint(Vec3 &coords) // Finalise void Pdens::finalise(Model *sourcemodel) { - dbgBegin(DM_CALLS,"Pdens::finalise"); + dbgBegin(Debug::Calls,"Pdens::finalise"); int n, m, o; double factor, numberDensity; // Normalise the pdens w.r.t. number of frames, number of central molecules, and number density of system @@ -169,7 +169,7 @@ void Pdens::finalise(Model *sourcemodel) for (n=0; n centre1, centre2, mimd; Cell *cell = sourcemodel->cell(); @@ -136,13 +136,13 @@ void Rdf::accumulate(Model *sourcemodel) } // Increase nAdded_umulation counter nAdded_ ++; - dbgEnd(DM_CALLS,"Rdf::accumulate"); + dbgEnd(Debug::Calls,"Rdf::accumulate"); } // Finalise void Rdf::finalise(Model *sourcemodel) { - dbgBegin(DM_CALLS,"Rdf::finalise"); + dbgBegin(Debug::Calls,"Rdf::finalise"); int n; double factor, r1, r2, numDensity; // Normalise the rdf w.r.t. number of frames and number of central molecules @@ -157,7 +157,7 @@ void Rdf::finalise(Model *sourcemodel) data_[n] /= factor; } - dbgEnd(DM_CALLS,"Rdf::finalise"); + dbgEnd(Debug::Calls,"Rdf::finalise"); } // Save RDF data_ diff --git a/src/methods/sd.cpp b/src/methods/sd.cpp index 6d7194f58..beea31bc3 100644 --- a/src/methods/sd.cpp +++ b/src/methods/sd.cpp @@ -50,7 +50,7 @@ int MethodSd::nCycles() const void MethodSd::minimise(Model* srcmodel, double econ, double fcon) { // Line Search (Steepest Descent) energy minimisation. - dbgBegin(DM_CALLS,"MethodSd::minimise"); + dbgBegin(Debug::Calls,"MethodSd::minimise"); int cycle, m, i; double newEnergy, currentEnergy, deltaEnergy, currentRms, newRms, fdelta; Atom **modelAtoms; @@ -62,7 +62,7 @@ void MethodSd::minimise(Model* srcmodel, double econ, double fcon) // First, create expression for the current model and assign charges if (!srcmodel->createExpression()) { - dbgEnd(DM_CALLS,"MethodSd::minimise"); + dbgEnd(Debug::Calls,"MethodSd::minimise"); return; } @@ -76,8 +76,8 @@ void MethodSd::minimise(Model* srcmodel, double econ, double fcon) converged = FALSE; lineDone = FALSE; - msg(DM_NONE,"Step Energy DeltaE RMS Force\n"); - msg(DM_NONE,"Init %15.5e --- %15.5e\n",currentEnergy,currentRms); + msg(Debug::None,"Step Energy DeltaE RMS Force\n"); + msg(Debug::None,"Init %15.5e --- %15.5e\n",currentEnergy,currentRms); gui.progressCreate("Minimising (SD)", nCycles_); for (cycle=0; cycletotalEnergy(srcmodel); srcmodel->energy.print(); // Calculate fresh new forces for the model, log changes / update, and exit. srcmodel->calculateForces(srcmodel); srcmodel->updateMeasurements(); srcmodel->logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"MethodSd::minimise"); + dbgEnd(Debug::Calls,"MethodSd::minimise"); } diff --git a/src/model/atom.cpp b/src/model/atom.cpp index 0071390c6..032cc2c32 100644 --- a/src/model/atom.cpp +++ b/src/model/atom.cpp @@ -40,7 +40,7 @@ int Model::nAtoms() // Add atom Atom *Model::addAtom(int newel, Vec3 pos) { - dbgBegin(DM_CALLS,"Model::addAtom"); + dbgBegin(Debug::Calls,"Model::addAtom"); Atom *newatom = atoms_.add(); newatom->setElement(newel); newatom->setId(atoms_.nItems() - 1); @@ -54,14 +54,14 @@ Atom *Model::addAtom(int newel, Vec3 pos) Change *newchange = recordingState_->addChange(); newchange->set(UE_ATOM,newatom); } - dbgEnd(DM_CALLS,"Model::addAtom"); + dbgEnd(Debug::Calls,"Model::addAtom"); return newatom; } // Add atom copy Atom *Model::addCopy(Atom *source) { - dbgBegin(DM_CALLS,"Model::addCopy"); + dbgBegin(Debug::Calls,"Model::addCopy"); Atom *newatom = atoms_.add(); newatom->copy(source); newatom->setId(atoms_.nItems() - 1); @@ -74,14 +74,14 @@ Atom *Model::addCopy(Atom *source) Change *newchange = recordingState_->addChange(); newchange->set(UE_ATOM,newatom); } - dbgEnd(DM_CALLS,"Model::addCopy"); + dbgEnd(Debug::Calls,"Model::addCopy"); return newatom; } // Add atom copy at specified position in list Atom *Model::addCopy(Atom *afterthis, Atom *source) { - dbgBegin(DM_CALLS,"Model::addCopy"); + dbgBegin(Debug::Calls,"Model::addCopy"); Atom *newatom = atoms_.insert(afterthis); //printf("Adding copy after... %li %li\n",afterthis,source); newatom->copy(source); @@ -95,14 +95,14 @@ Atom *Model::addCopy(Atom *afterthis, Atom *source) Change *newchange = recordingState_->addChange(); newchange->set(UE_ATOM,newatom); } - dbgEnd(DM_CALLS,"Model::addCopy"); + dbgEnd(Debug::Calls,"Model::addCopy"); return newatom; } // Remove atom void Model::removeAtom(Atom *xatom) { - dbgBegin(DM_CALLS,"Model::removeAtom"); + dbgBegin(Debug::Calls,"Model::removeAtom"); // Delete a specific atom (passed as xatom) mass_ -= elements.atomicMass(xatom->element()); if (mass_ < 0.0) mass_ = 0.0; @@ -118,16 +118,16 @@ void Model::removeAtom(Atom *xatom) newchange->set(-UE_ATOM,xatom); } atoms_.remove(xatom); - dbgEnd(DM_CALLS,"Model::removeAtom"); + dbgEnd(Debug::Calls,"Model::removeAtom"); } // Delete Atom void Model::deleteAtom(Atom *xatom) { - dbgBegin(DM_CALLS,"Model::deleteAtom"); + dbgBegin(Debug::Calls,"Model::deleteAtom"); // The atom may be present in other, unassociated lists (e.g. measurements), so we must // also check those lists for this atom and remove it. - if (xatom == NULL) msg(DM_NONE,"No atom to delete.\n"); + if (xatom == NULL) msg(Debug::None,"No atom to delete.\n"); else { // Remove measurements @@ -145,14 +145,14 @@ void Model::deleteAtom(Atom *xatom) // Finally, delete the atom removeAtom(xatom); } - dbgEnd(DM_CALLS,"Model::deleteAtom"); + dbgEnd(Debug::Calls,"Model::deleteAtom"); } // Transmute atom void Model::transmuteAtom(Atom *i, int el) { - dbgBegin(DM_CALLS,"Model::transmuteAtom"); - if (i == NULL) msg(DM_NONE,"No atom to transmute.\n"); + dbgBegin(Debug::Calls,"Model::transmuteAtom"); + if (i == NULL) msg(Debug::None,"No atom to transmute.\n"); else { int oldel = i->element(); @@ -171,7 +171,7 @@ void Model::transmuteAtom(Atom *i, int el) } } } - dbgEnd(DM_CALLS,"Model::transmuteAtom"); + dbgEnd(Debug::Calls,"Model::transmuteAtom"); } // Return (and autocreate if necessary) the static atoms array @@ -183,14 +183,14 @@ Atom **Model::atomArray() // Clear atoms void Model::clearAtoms() { - dbgBegin(DM_CALLS,"Model::clearAtoms"); + dbgBegin(Debug::Calls,"Model::clearAtoms"); Atom *i = atoms_.first(); while (i != NULL) { deleteAtom(i); i = atoms_.first(); } - dbgEnd(DM_CALLS,"Model::clearAtoms"); + dbgEnd(Debug::Calls,"Model::clearAtoms"); } // Find atom @@ -213,7 +213,7 @@ Atom *Model::findAtomByTempi(int tempi) // Renumber Atoms void Model::renumberAtoms(Atom *from) { - dbgBegin(DM_CALLS,"Model::renumberAtoms"); + dbgBegin(Debug::Calls,"Model::renumberAtoms"); static int count; static Atom *i; if (from == NULL) @@ -231,38 +231,38 @@ void Model::renumberAtoms(Atom *from) i->setId(count); count ++; } - dbgEnd(DM_CALLS,"Model::renumberAtoms"); + dbgEnd(Debug::Calls,"Model::renumberAtoms"); } // Return atom 'n' in the model Atom *Model::atom(int n) { - dbgBegin(DM_CALLS,"Model::atom"); + dbgBegin(Debug::Calls,"Model::atom"); // Check range first if ((n < 0) || (n >= atoms_.nItems())) { printf("Model::atom <<<< Atom id '%i' is out of range for model >>>>\n",n); - dbgEnd(DM_CALLS,"Model::atom"); + dbgEnd(Debug::Calls,"Model::atom"); return NULL; } - dbgEnd(DM_CALLS,"Model::atom"); + dbgEnd(Debug::Calls,"Model::atom"); return atoms_.array()[n]; } // Reset forces on all atoms void Model::zeroForces() { - dbgBegin(DM_CALLS,"Model::zeroForces"); + dbgBegin(Debug::Calls,"Model::zeroForces"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->f().zero(); - dbgEnd(DM_CALLS,"Model::zeroForces"); + dbgEnd(Debug::Calls,"Model::zeroForces"); } // Reset forces on all fixed atoms void Model::zeroForcesFixed() { - dbgBegin(DM_CALLS,"Model::zeroForcesFixed"); + dbgBegin(Debug::Calls,"Model::zeroForcesFixed"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) if (i->hasFixedPosition()) i->f().zero(); - dbgEnd(DM_CALLS,"Model::zeroForcesFixed"); + dbgEnd(Debug::Calls,"Model::zeroForcesFixed"); } // Set visibility of specified atom @@ -276,7 +276,7 @@ void Model::setHidden(Atom *i, bool hidden) void Model::normaliseForces(double norm) { // 'Normalise' the forces in linecfg such that the largest force is equal to the maximum cartesian step size - dbgBegin(DM_CALLS,"Model::normaliseForces"); + dbgBegin(Debug::Calls,"Model::normaliseForces"); double maxfrc; static Vec3 f; Atom **modelatoms = atomArray(); @@ -293,7 +293,7 @@ void Model::normaliseForces(double norm) // Normalise with respect to this force maxfrc *= norm; for (i=0; if() /= maxfrc; - dbgEnd(DM_CALLS,"Model::normaliseForces"); + dbgEnd(Debug::Calls,"Model::normaliseForces"); } // Move specified atom (channel for undo/redo) diff --git a/src/model/bond.cpp b/src/model/bond.cpp index 0c48b890a..332853d3e 100644 --- a/src/model/bond.cpp +++ b/src/model/bond.cpp @@ -31,8 +31,8 @@ void Model::bondAtoms(Atom *i, Atom *j, Bond::BondType bt) { // Create a new bond each atom and add them to the atom's own lists. - dbgBegin(DM_CALLS,"Model::bondAtoms"); - if (i == j) msg(DM_NONE,"Cannot bond an atom to itself!\n"); + dbgBegin(Debug::Calls,"Model::bondAtoms"); + if (i == j) msg(Debug::None,"Cannot bond an atom to itself!\n"); else { // Search for old bond between atoms @@ -69,16 +69,16 @@ void Model::bondAtoms(Atom *i, Atom *j, Bond::BondType bt) } } } - dbgEnd(DM_CALLS,"Model::bondAtoms"); + dbgEnd(Debug::Calls,"Model::bondAtoms"); } // Add Bond (id's) void Model::bondAtoms(int ii, int jj, Bond::BondType bt) { // Create a new bond for each atom and add them to the atom's own lists. - dbgBegin(DM_CALLS,"Model::bondAtoms[int]"); + dbgBegin(Debug::Calls,"Model::bondAtoms[int]"); //printf("Atom ids given to Model::bondAtoms() are %i and %i (natoms=%i)\n",ii,jj,atoms_.nItems()); - if (ii == jj) msg(DM_NONE,"Cannot bond an atom to itself!\n"); + if (ii == jj) msg(Debug::None,"Cannot bond an atom to itself!\n"); else { // First, locate the two atoms with the specified id's @@ -87,19 +87,19 @@ void Model::bondAtoms(int ii, int jj, Bond::BondType bt) if (i == NULL || j == NULL) { printf("Couldn't locate one or both atoms in bond with specified ids %i and %i\n",ii,jj); - dbgEnd(DM_CALLS,"Model::bondAtoms[int]"); + dbgEnd(Debug::Calls,"Model::bondAtoms[int]"); return; } bondAtoms(i,j,bt); } - dbgEnd(DM_CALLS,"Model::bondAtoms[int]"); + dbgEnd(Debug::Calls,"Model::bondAtoms[int]"); } // Delete Bond void Model::unbondAtoms(Atom *i, Atom *j, Bond *bij) { // Delete info from bond lists for atoms i and j. - dbgBegin(DM_CALLS,"Model::unbondAtoms"); + dbgBegin(Debug::Calls,"Model::unbondAtoms"); // Find bond between atoms (unless already supplied) Bond *b; if (bij != NULL) b = bij; @@ -109,7 +109,7 @@ void Model::unbondAtoms(Atom *i, Atom *j, Bond *bij) if (b == NULL) { printf("Couldn't locate bond to unbond!\n"); - dbgEnd(DM_CALLS,"Model::unbondAtoms"); + dbgEnd(Debug::Calls,"Model::unbondAtoms"); return; } } @@ -124,13 +124,13 @@ void Model::unbondAtoms(Atom *i, Atom *j, Bond *bij) Change *newchange = recordingState_->addChange(); newchange->set(-UE_BOND,i->id(),j->id(),bt); } - dbgEnd(DM_CALLS,"Model::unbondAtoms"); + dbgEnd(Debug::Calls,"Model::unbondAtoms"); } // Delete All Bonding void Model::clearBonding() { - dbgBegin(DM_CALLS,"Model::clearBonding"); + dbgBegin(Debug::Calls,"Model::clearBonding"); // Clear the bond list. for (Atom *i = atoms_.first(); i != NULL; i = i->next) { @@ -145,21 +145,21 @@ void Model::clearBonding() } } logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::clearBonding"); + dbgEnd(Debug::Calls,"Model::clearBonding"); } // Calculate Bonding void Model::calculateBonding() { // Given the atoms alone, calculate bonding between them using common VDW radii. - dbgBegin(DM_CALLS,"Model::calculateBonding"); + dbgBegin(Debug::Calls,"Model::calculateBonding"); Atom *i, *j; int el; double dist; double tolerance = prefs.bondTolerance(); double radius_i, radsum; clearBonding(); - msg(DM_NONE,"Calculating bonds in model (tolerance = %5.2f)...",tolerance); + msg(Debug::None,"Calculating bonds in model (tolerance = %5.2f)...",tolerance); for (i = atoms_.first(); i != NULL; i = i->next) { // Check for excluded elements @@ -175,21 +175,21 @@ void Model::calculateBonding() if (dist < radsum*tolerance) bondAtoms(i,j,Bond::Single); } } - msg(DM_NONE," Done.\n"); - dbgEnd(DM_CALLS,"Model::calculateBonding"); + msg(Debug::None," Done.\n"); + dbgEnd(Debug::Calls,"Model::calculateBonding"); } // Calculate Bonding within Patterns void Model::patternCalculateBonding() { - dbgBegin(DM_CALLS,"Model::patternCalculateBonding"); + dbgBegin(Debug::Calls,"Model::patternCalculateBonding"); Atom *i,*j; int ii, jj, el, m; double dist; double tolerance = prefs.bondTolerance(); double radius_i, radsum; clearBonding(); - msg(DM_NONE,"Calculating bonds within patterns (tolerance = %5.2f)...",tolerance); + msg(Debug::None,"Calculating bonds within patterns (tolerance = %5.2f)...",tolerance); // For all the pattern nodes currently defined, bond within molecules for (Pattern *p = patterns_.first(); p != NULL; p = p->next) { @@ -229,14 +229,14 @@ void Model::patternCalculateBonding() i = i->next; } } - msg(DM_NONE," Done.\n"); - dbgEnd(DM_CALLS,"Model::patternCalculateBonding"); + msg(Debug::None," Done.\n"); + dbgEnd(Debug::Calls,"Model::patternCalculateBonding"); } // Calculate Bonding in current selection void Model::selectionCalculateBonding() { - dbgBegin(DM_CALLS,"Model::selectionCalculateBonding"); + dbgBegin(Debug::Calls,"Model::selectionCalculateBonding"); double tolerance = prefs.bondTolerance(); double radsum, dist; Atom *i, *j; @@ -257,14 +257,14 @@ void Model::selectionCalculateBonding() } } } - dbgEnd(DM_CALLS,"Model::selectionCalculateBonding"); + dbgEnd(Debug::Calls,"Model::selectionCalculateBonding"); } // Bond all atoms in current selection void Model::selectionBondAll() { // Add bonds between all atoms in current selection - dbgBegin(DM_CALLS,"Model::selectionBondAll"); + dbgBegin(Debug::Calls,"Model::selectionBondAll"); Atom *i, *j; for (i = atoms_.first(); i != NULL; i = i->next) { @@ -277,14 +277,14 @@ void Model::selectionBondAll() } } } - dbgEnd(DM_CALLS,"Model::selectionBondAll"); + dbgEnd(Debug::Calls,"Model::selectionBondAll"); } // Clear Bonding in current selection void Model::selectionClearBonding() { // Clear all bonds between currently selected atoms - dbgBegin(DM_CALLS,"Model::selectionClearBonding"); + dbgBegin(Debug::Calls,"Model::selectionClearBonding"); Atom *i, *j; for (i = atoms_.first(); i != NULL; i = i->next) { @@ -297,7 +297,7 @@ void Model::selectionClearBonding() } } } - dbgEnd(DM_CALLS,"Model::selectionClearBonding"); + dbgEnd(Debug::Calls,"Model::selectionClearBonding"); } // Alter type of bond @@ -327,7 +327,7 @@ void Model::augmentBond(Bond *b, int change) { // Increase the type of the bond between this atom and 'j' by as much as both atoms will allow. // Assumes current bond order differences are held in i->tempi. - dbgBegin(DM_CALLS,"Model::augmentBond"); + dbgBegin(Debug::Calls,"Model::augmentBond"); int maxchg, n; Atom *i = b->atomI(); Atom *j = b->atomJ(); @@ -337,12 +337,12 @@ void Model::augmentBond(Bond *b, int change) // Sanity check if ((change == +1) && (maxchg >= 0)) { - dbgEnd(DM_CALLS,"Model::augmentBond"); + dbgEnd(Debug::Calls,"Model::augmentBond"); return; } if ((change == -1) && (maxchg <= 0)) { - dbgEnd(DM_CALLS,"Model::augmentBond"); + dbgEnd(Debug::Calls,"Model::augmentBond"); return; } // Store current bond order @@ -356,13 +356,13 @@ void Model::augmentBond(Bond *b, int change) } // Set the new bond order changeBond(b,(Bond::BondType) oldorder); - dbgEnd(DM_CALLS,"Model::augmentBond"); + dbgEnd(Debug::Calls,"Model::augmentBond"); } // Augment bonding for all model patterns void Model::augmentBonding() { - dbgBegin(DM_CALLS,"Model::augmentBonding"); + dbgBegin(Debug::Calls,"Model::augmentBonding"); /* Assign bond types to the pattern, i.e. automatically determine double, triple, resonant bonds etc. We do this by assuming that the structure is chemically 'correct' - i.e. each element is bound to a likely @@ -372,10 +372,10 @@ void Model::augmentBonding() */ if (!autocreatePatterns()) { - msg(DM_NONE,"Can't augment bonding without a valid pattern.\n"); - dbgBegin(DM_CALLS,"Model::augmentBonding"); + msg(Debug::None,"Can't augment bonding without a valid pattern.\n"); + dbgBegin(Debug::Calls,"Model::augmentBonding"); return; } for (Pattern *p = patterns_.first(); p != NULL; p = p->next) p->augment(); - dbgEnd(DM_CALLS,"Model::augmentBonding"); + dbgEnd(Debug::Calls,"Model::augmentBonding"); } diff --git a/src/model/build.cpp b/src/model/build.cpp index f86ce4458..09b708700 100644 --- a/src/model/build.cpp +++ b/src/model/build.cpp @@ -30,7 +30,7 @@ void Model::hydrogenSatisfy(Atom *target) { // Cycles over atoms in model (or only the atom supplied), and works out how many hydrogens (and in which geometry) should be added to each - dbgBegin(DM_CALLS,"Model::hydrogenSatisfy"); + dbgBegin(Debug::Calls,"Model::hydrogenSatisfy"); int numh, tbo, nsingle, ndouble; Atom *i, *endatom; i = (target == NULL ? atoms_.first() : target); @@ -54,14 +54,14 @@ void Model::hydrogenSatisfy(Atom *target) } } projectAll(); - dbgEnd(DM_CALLS,"Model::hydrogenSatisfy"); + dbgEnd(Debug::Calls,"Model::hydrogenSatisfy"); } // Iteratively add hydrogens to specified atom (giving supplied geometry) void Model::addHydrogens(Atom *target, int nhydrogen, Atom::HAddGeom geometry) { // Iteratively add hydrogens to the molecule conforming to the desired geometry specified - dbgBegin(DM_CALLS,"atom::addHydrogens"); + dbgBegin(Debug::Calls,"atom::addHydrogens"); Atom *a1, *a2, *a3; Atom *newh; Vec3 mim_a1, mim_a2, mim_a3, perp, perp2, newhpos, tempv; @@ -148,5 +148,5 @@ void Model::addHydrogens(Atom *target, int nhydrogen, Atom::HAddGeom geometry) bondAtoms(newh,target,Bond::Single); projectAtom(newh); } - dbgEnd(DM_CALLS,"Model::addHydrogens"); + dbgEnd(Debug::Calls,"Model::addHydrogens"); } diff --git a/src/model/cell.cpp b/src/model/cell.cpp index 9aba7f86e..7c682ee58 100644 --- a/src/model/cell.cpp +++ b/src/model/cell.cpp @@ -59,7 +59,7 @@ int Model::spacegroup() // Set cell (vectors) void Model::setCell(Vec3 lengths, Vec3 angles) { - dbgBegin(DM_CALLS,"Model::setCell[vectors]"); + dbgBegin(Debug::Calls,"Model::setCell[vectors]"); Vec3 oldlengths = cell_.lengths(); Vec3 oldangles = cell_.angles(); // Set new axes @@ -71,13 +71,13 @@ void Model::setCell(Vec3 lengths, Vec3 angles) Change *newchange = recordingState_->addChange(); newchange->set(UE_CELL, &oldlengths, &oldangles, &lengths, &angles); } - dbgEnd(DM_CALLS,"Model::setCell[vectors]"); + dbgEnd(Debug::Calls,"Model::setCell[vectors]"); } // Set cell (axes) void Model::setCell(Mat3 axes) { - dbgBegin(DM_CALLS,"Model::setCell[axes]"); + dbgBegin(Debug::Calls,"Model::setCell[axes]"); Vec3 oldlengths = cell_.lengths(); Vec3 oldangles = cell_.angles(); // Set new axes @@ -89,41 +89,41 @@ void Model::setCell(Mat3 axes) Change *newchange = recordingState_->addChange(); newchange->set(UE_CELL, &oldlengths, &oldangles, &cell_.lengths(), &cell_.angles()); } - dbgEnd(DM_CALLS,"Model::setCell[axes]"); + dbgEnd(Debug::Calls,"Model::setCell[axes]"); } // Remove cell void Model::removeCell() { - dbgBegin(DM_CALLS,"Model::removeCell"); + dbgBegin(Debug::Calls,"Model::removeCell"); cell_.reset(); logChange(LOG_VISUAL); logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::removeCell"); + dbgEnd(Debug::Calls,"Model::removeCell"); } // Fold All Atoms void Model::foldAllAtoms() { - dbgBegin(DM_CALLS,"Model::foldAllAtoms"); + dbgBegin(Debug::Calls,"Model::foldAllAtoms"); // Standard fold - individual atoms for (Atom *i = atoms_.first(); i != NULL; i = i->next) cell_.fold(i); logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"Model::foldAllAtoms"); + dbgEnd(Debug::Calls,"Model::foldAllAtoms"); } // Fold All Molecules void Model::foldAllMolecules() { - dbgBegin(DM_CALLS,"Model::foldAllMolecules"); + dbgBegin(Debug::Calls,"Model::foldAllMolecules"); int n,m; Atom *i, *first; Pattern *p; // Molecular fold - fold first atom, other in molecule are MIM'd to this point if (!autocreatePatterns()) { - msg(DM_NONE,"Model::foldAllMolecules : Molecular fold cannot be performed without a valid pattern definition.\n"); - dbgEnd(DM_CALLS,"Model::foldAllMolecules"); + msg(Debug::None,"Model::foldAllMolecules : Molecular fold cannot be performed without a valid pattern definition.\n"); + dbgEnd(Debug::Calls,"Model::foldAllMolecules"); return; } p = patterns_.first(); @@ -147,23 +147,23 @@ void Model::foldAllMolecules() p = p->next; } logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"Model::foldAllMolecules"); + dbgEnd(Debug::Calls,"Model::foldAllMolecules"); } // Apply individual symmetry generator to current atom selection void Model::pack(int gen) { - dbgBegin(DM_CALLS,"Model::pack[gen,atom]"); + dbgBegin(Debug::Calls,"Model::pack[gen,atom]"); Clipboard clip; Vec3 newr; int oldnatoms; if (gen == 0) { // Ignore this operator since it is the identity operator - dbgBegin(DM_CALLS,"Model::pack[gen,atom]"); + dbgBegin(Debug::Calls,"Model::pack[gen,atom]"); return; } - msg(DM_VERBOSE,"...Applying generator '%s' (no. %i)\n", master.generators[gen].description, gen); + msg(Debug::Verbose,"...Applying generator '%s' (no. %i)\n", master.generators[gen].description, gen); // Store current number of atoms in model oldnatoms = atoms_.nItems(); // Copy selection to clipboard @@ -179,17 +179,17 @@ void Model::pack(int gen) cell_.fold(newr); i->r() = newr; } - dbgEnd(DM_CALLS,"Model::pack[gen,atom]"); + dbgEnd(Debug::Calls,"Model::pack[gen,atom]"); } // Apply model's spacegroup symmetry generators void Model::pack() { - dbgBegin(DM_CALLS,"Model::pack"); - if (spacegroup_ == 0) msg(DM_NONE,"No spacegroup defined in model - no packing will be performed.\n"); + dbgBegin(Debug::Calls,"Model::pack"); + if (spacegroup_ == 0) msg(Debug::None,"No spacegroup defined in model - no packing will be performed.\n"); else { - msg(DM_NONE,"Packing cell according to spacegroup '%s'...\n", master.spacegroups[spacegroup_].name); + msg(Debug::None,"Packing cell according to spacegroup '%s'...\n", master.spacegroups[spacegroup_].name); selectAll(); for (int n=0; n &scale) { - dbgBegin(DM_CALLS,"Model::scaleCell"); + dbgBegin(Debug::Calls,"Model::scaleCell"); Vec3 oldcog, newcog, newpos; Cell newcell; Mat3 newaxes; @@ -214,13 +214,13 @@ void Model::scaleCell(const Vec3 &scale) // First, make sure we have a cell and a valid pattern if (cell_.type() == CT_NONE) { - msg(DM_NONE,"No cell to scale.\n"); - dbgEnd(DM_CALLS,"Model::scaleCell"); + msg(Debug::None,"No cell to scale.\n"); + dbgEnd(Debug::Calls,"Model::scaleCell"); return; } if (!autocreatePatterns()) { - dbgEnd(DM_CALLS,"Model::scaleCell"); + dbgEnd(Debug::Calls,"Model::scaleCell"); return; } calcenergy = createExpression(); @@ -255,18 +255,18 @@ void Model::scaleCell(const Vec3 &scale) if (calcenergy) { newe = totalEnergy(this); - msg(DM_NONE,"Energy change was %12.7e %s\n", newe-olde, text_from_EU(prefs.energyUnit())); + msg(Debug::None,"Energy change was %12.7e %s\n", newe-olde, text_from_EU(prefs.energyUnit())); } // Set new cell and update model setCell(newaxes); logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"Model::scaleCell"); + dbgEnd(Debug::Calls,"Model::scaleCell"); } // Replicate Cell void Model::replicateCell(const Vec3 &neg, const Vec3 &pos) { - dbgBegin(DM_CALLS,"Model::replicateCell"); + dbgBegin(Debug::Calls,"Model::replicateCell"); int count; bool stop; Vec3 tvec; @@ -275,8 +275,8 @@ void Model::replicateCell(const Vec3 &neg, const Vec3 &pos) // If this isn't a periodic model, exit if (cell_.type() == CT_NONE) { - msg(DM_NONE,"No cell to replicate.\n"); - dbgEnd(DM_CALLS,"Model::replicateCell"); + msg(Debug::None,"No cell to replicate.\n"); + dbgEnd(Debug::Calls,"Model::replicateCell"); return; } @@ -329,7 +329,7 @@ void Model::replicateCell(const Vec3 &neg, const Vec3 &pos) tvec += oldaxes.rows[2] * kk; //tvec.print(); clip.pasteToModel(this,tvec); - msg(DM_VERBOSE,"Created copy for vector %8.4f %8.4f %8.4f\n",tvec.x,tvec.y,tvec.z); + msg(Debug::Verbose,"Created copy for vector %8.4f %8.4f %8.4f\n",tvec.x,tvec.y,tvec.z); if (!master.updateProgress(++count)) { stop = TRUE; @@ -374,13 +374,13 @@ void Model::replicateCell(const Vec3 &neg, const Vec3 &pos) master.cancelProgress(); logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::replicateCell"); + dbgEnd(Debug::Calls,"Model::replicateCell"); } // Frac to Real void Model::fracToReal() { - dbgBegin(DM_CALLS,"Model::fracToReal"); + dbgBegin(Debug::Calls,"Model::fracToReal"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->r() = cell_.fracToReal(i->r()); - dbgEnd(DM_CALLS,"Model::fracToReal"); + dbgEnd(Debug::Calls,"Model::fracToReal"); } diff --git a/src/model/energy.cpp b/src/model/energy.cpp index 7339d4d02..c41080f30 100644 --- a/src/model/energy.cpp +++ b/src/model/energy.cpp @@ -30,12 +30,12 @@ // Calculate total energy of model (from supplied coordinates) double Model::totalEnergy(Model *srcmodel) { - dbgBegin(DM_CALLS,"Model::totalEnergy"); + dbgBegin(Debug::Calls,"Model::totalEnergy"); // Check the expression validity if (!isExpressionValid()) { - msg(DM_NONE,"Model::totalEnergy - No valid energy expression defined for model.\n"); - dbgEnd(DM_CALLS,"Model::totalEnergy"); + msg(Debug::None,"Model::totalEnergy - No valid energy expression defined for model.\n"); + dbgEnd(Debug::Calls,"Model::totalEnergy"); return 0.0; } // Clear the energy store @@ -75,7 +75,7 @@ double Model::totalEnergy(Model *srcmodel) switch (emodel) { case (EM_OFF): - msg(DM_NONE,"Electrostatics requested but no method of calculation chosen!\n"); + msg(Debug::None,"Electrostatics requested but no method of calculation chosen!\n"); break; case (EM_COULOMB): p->coulombIntraPatternEnergy(srcmodel,&energy); @@ -104,24 +104,24 @@ double Model::totalEnergy(Model *srcmodel) p = p->next; } energy.totalise(); - dbgEnd(DM_CALLS,"Model::totalEnergy"); + dbgEnd(Debug::Calls,"Model::totalEnergy"); return energy.total(); } // Calculate total interaction energy of specified molecule with remainder of model double Model::moleculeEnergy(Model *srcmodel, Pattern *molpattern, int molecule) { - dbgBegin(DM_CALLS,"Model::moleculeEnergy"); + dbgBegin(Debug::Calls,"Model::moleculeEnergy"); // Check the expression validity if (!isExpressionValid()) { - msg(DM_NONE,"Model::moleculeEnergy - No valid energy expression defined for model.\n"); - dbgEnd(DM_CALLS,"Model::moleculeEnergy"); + msg(Debug::None,"Model::moleculeEnergy - No valid energy expression defined for model.\n"); + dbgEnd(Debug::Calls,"Model::moleculeEnergy"); return 0.0; } // Clear the energy store energy.clear(); - Pattern *p, *p2; + Pattern *p; // Prepare Ewald (if necessary) ElecMethod emodel = prefs.electrostaticsMethod(); if (prefs.calculateElec()) @@ -131,17 +131,15 @@ double Model::moleculeEnergy(Model *srcmodel, Pattern *molpattern, int molecule) if (emodel != EM_COULOMB) fourier.prepare(srcmodel,prefs.ewaldKvec()); } // Calculate VDW interactions between 'molecule' in pattern 'molpattern' and molecules in it and other's patterns - //printf("Begin VDW Inter...\n"); for (p = patterns_.first(); p != NULL; p = p->next) molpattern->vdwInterPatternEnergy(srcmodel, p, &energy, molecule); - //printf("Done.\n"); // Electrostatic Interactions between 'molecule' in pattern 'molpattern' and molecules in it and other's patterns if (prefs.calculateElec()) { switch (emodel) { case (EM_OFF): - msg(DM_NONE,"Electrostatics requested but no method of calculation chosen!\n"); + msg(Debug::None,"Electrostatics requested but no method of calculation chosen!\n"); break; case (EM_COULOMB): for (p = patterns_.first(); p != NULL; p = p->next) molpattern->coulombInterPatternEnergy(srcmodel,p,&energy); @@ -155,7 +153,7 @@ double Model::moleculeEnergy(Model *srcmodel, Pattern *molpattern, int molecule) } } energy.totalise(); - dbgEnd(DM_CALLS,"Model::moleculeEnergy"); + dbgEnd(Debug::Calls,"Model::moleculeEnergy"); return energy.total(); } @@ -163,12 +161,12 @@ double Model::moleculeEnergy(Model *srcmodel, Pattern *molpattern, int molecule) void Model::calculateForces(Model *srcmodel) { // Calculate the forces for the atoms of 'srcmodel' from the expression defined in the *this model - dbgBegin(DM_CALLS,"Model::calculateForces"); + dbgBegin(Debug::Calls,"Model::calculateForces"); // Check the expression validity if (!isExpressionValid()) { - msg(DM_NONE,"calculateForces : No valid energy expression defined for model.\n"); - dbgEnd(DM_CALLS,"Model::calculateForces"); + msg(Debug::None,"calculateForces : No valid energy expression defined for model.\n"); + dbgEnd(Debug::Calls,"Model::calculateForces"); return; } srcmodel->zeroForces(); @@ -209,7 +207,7 @@ void Model::calculateForces(Model *srcmodel) switch (emodel) { case (EM_OFF): - msg(DM_NONE,"Electrostatics requested but no method of calculation chosen!\n"); + msg(Debug::None,"Electrostatics requested but no method of calculation chosen!\n"); break; case (EM_COULOMB): //p->coulombInterPatternForces(xxcfg); @@ -236,6 +234,6 @@ void Model::calculateForces(Model *srcmodel) } p = p->next; } - dbgEnd(DM_CALLS,"Model::calculateForces"); + dbgEnd(Debug::Calls,"Model::calculateForces"); } diff --git a/src/model/expression.cpp b/src/model/expression.cpp index c6f30faa1..2c2549fdd 100644 --- a/src/model/expression.cpp +++ b/src/model/expression.cpp @@ -45,23 +45,23 @@ void Model::invalidateExpression() bool Model::createExpression(bool vdwOnly) { // This routine should be called before any operation (or series of operations) requiring calculation of energy / forces. Here, we check the validity / existence of an energy expression for the specified model, and create / recreate if necessary. - dbgBegin(DM_CALLS,"Model::createExpression"); + dbgBegin(Debug::Calls,"Model::createExpression"); // 0) If the expression is already valid, return if (isExpressionValid()) { - dbgEnd(DM_CALLS,"Model::createExpression"); + dbgEnd(Debug::Calls,"Model::createExpression"); return TRUE; } // Reset some variables prefs.invalidateEwaldAuto(); uniqueTypes_.clear(); - if (vdwOnly) msg(DM_NONE,"Creating VDW-only expression for model %s...\n",name_.get()); - else msg(DM_NONE,"Creating expression for model %s...\n",name_.get()); + if (vdwOnly) msg(Debug::None,"Creating VDW-only expression for model %s...\n",name_.get()); + else msg(Debug::None,"Creating expression for model %s...\n",name_.get()); // 1) Assign internal atom type data (hybridisations). [typeAll also performs create_pattern()] if (!typeAll()) { - msg(DM_NONE,"Couldn't type atoms.\n"); - dbgEnd(DM_CALLS,"Model::createExpression"); + msg(Debug::None,"Couldn't type atoms.\n"); + dbgEnd(Debug::Calls,"Model::createExpression"); return FALSE; } // 2) Remove old expression data and create new @@ -81,22 +81,22 @@ bool Model::createExpression(bool vdwOnly) switch (emodel) { case (EM_OFF): - msg(DM_NONE,"Electrostatics are off.\n"); + msg(Debug::None,"Electrostatics are off.\n"); break; case (EM_COULOMB): - if (cell_.type() != CT_NONE) msg(DM_NONE,"!!! Coulomb sum requested for periodic model.\n"); + if (cell_.type() != CT_NONE) msg(Debug::None,"!!! Coulomb sum requested for periodic model.\n"); break; default: // Ewald - issue warnings, but don't return FALSE if (cell_.type() == CT_NONE) { - msg(DM_NONE,"!!! Ewald sum cannot be used for a non-periodic model.\n"); - //dbgEnd(DM_CALLS,"Model::createExpression"); + msg(Debug::None,"!!! Ewald sum cannot be used for a non-periodic model.\n"); + //dbgEnd(Debug::Calls,"Model::createExpression"); //return FALSE; } else if (cell_.type() != CT_CUBIC) { - msg(DM_NONE,"!!! Ewald sum only implemented for cubic cells.\n"); - //dbgEnd(DM_CALLS,"Model::createExpression"); + msg(Debug::None,"!!! Ewald sum only implemented for cubic cells.\n"); + //dbgEnd(Debug::Calls,"Model::createExpression"); //return FALSE; } break; @@ -118,6 +118,6 @@ bool Model::createExpression(bool vdwOnly) ffa->copy(ri->item); } expressionPoint_ = logs_[LOG_STRUCTURE]; - dbgEnd(DM_CALLS,"Model::createExpression"); + dbgEnd(Debug::Calls,"Model::createExpression"); return TRUE; } diff --git a/src/model/measure.cpp b/src/model/measure.cpp index b726d81df..c490ae281 100644 --- a/src/model/measure.cpp +++ b/src/model/measure.cpp @@ -39,42 +39,42 @@ void Model::clearMeasurements() void Model::measureDistance(Atom *i, Atom *j) { // Measure distances between atoms - dbgBegin(DM_CALLS,"Model::measureDistance"); + dbgBegin(Debug::Calls,"Model::measureDistance"); Measurement *newdist = findMeasurement(GT_DISTANCE,i,j); // If this distance isn't currently in the list, add it. Otherwise, delete it if (newdist == NULL) addMeasurement(GT_DISTANCE,i,j); else removeMeasurement(newdist); - dbgEnd(DM_CALLS,"Model::measureDistance"); + dbgEnd(Debug::Calls,"Model::measureDistance"); } // Add angle measurement void Model::measureAngle(Atom *i, Atom *j, Atom *k) { // Measure angles between atoms - dbgBegin(DM_CALLS,"Model::measureAngle"); + dbgBegin(Debug::Calls,"Model::measureAngle"); Measurement *newangle = findMeasurement(GT_ANGLE,i,j,k); // Check that this angle isn't already in the list. If it is, delete it if (newangle == NULL) addMeasurement(GT_ANGLE,i,j,k); else removeMeasurement(newangle); - dbgEnd(DM_CALLS,"Model::measureAngle"); + dbgEnd(Debug::Calls,"Model::measureAngle"); } // Add torsion measurement void Model::measureTorsion(Atom *i, Atom *j, Atom *k, Atom *l) { // Measure torsions between atoms - dbgBegin(DM_CALLS,"Model::measureTorsion"); + dbgBegin(Debug::Calls,"Model::measureTorsion"); Measurement *newtorsion = findMeasurement(GT_TORSION,i,j,k,l); // If this torsion isn't in the list, add it. Otherwise, delete it. if (newtorsion == NULL) addMeasurement(GT_TORSION,i,j,k,l); else removeMeasurement(newtorsion); - dbgEnd(DM_CALLS,"Model::measureTorsion"); + dbgEnd(Debug::Calls,"Model::measureTorsion"); } // Remove specific measurement void Model::removeMeasurement(Measurement *me) { - dbgBegin(DM_CALLS,"Model::removeMeasurement"); + dbgBegin(Debug::Calls,"Model::removeMeasurement"); // Add the change to the undo state (if there is one) if (recordingState_ != NULL) { @@ -95,13 +95,13 @@ void Model::removeMeasurement(Measurement *me) } } measurements_.remove(me); - dbgEnd(DM_CALLS,"Model::removeMeasurement"); + dbgEnd(Debug::Calls,"Model::removeMeasurement"); } // Clear measurements of specific type void Model::removeMeasurements(GeometryType gt) { - dbgBegin(DM_CALLS,"Model::removeMeasurements"); + dbgBegin(Debug::Calls,"Model::removeMeasurements"); Measurement *me = measurements_.first(), *meNext; while (me != NULL) { @@ -114,14 +114,14 @@ void Model::removeMeasurements(GeometryType gt) me = meNext; } } - dbgEnd(DM_CALLS,"Model::removeMeasurements"); + dbgEnd(Debug::Calls,"Model::removeMeasurements"); } // Delete measurements involving specific atom void Model::removeMeasurements(Atom *xatom) { // Search the lists of measurements for the supplied atom, and remove any that use it - dbgBegin(DM_CALLS,"Model::removeMeasurements[atom]"); + dbgBegin(Debug::Calls,"Model::removeMeasurements[atom]"); int n; bool remove; Measurement *nextm, *m; @@ -140,13 +140,13 @@ void Model::removeMeasurements(Atom *xatom) } else m = m->next; } - dbgEnd(DM_CALLS,"Model::removeMeasurements[atom]"); + dbgEnd(Debug::Calls,"Model::removeMeasurements[atom]"); } // Add Measurement void Model::addMeasurement(GeometryType gt, Atom *first, ...) { - dbgBegin(DM_CALLS,"Model::addMeasurement"); + dbgBegin(Debug::Calls,"Model::addMeasurement"); Atom *i, **atoms; Measurement *newm = measurements_.add(); newm->setType(gt); @@ -192,13 +192,13 @@ void Model::addMeasurement(GeometryType gt, Atom *first, ...) } } } - dbgEnd(DM_CALLS,"Model::addMeasurement"); + dbgEnd(Debug::Calls,"Model::addMeasurement"); } // Add measurements in selection void Model::addMeasurementsInSelection(GeometryType gt) { - dbgBegin(DM_CALLS,"Model::addMeasurementsInSelection"); + dbgBegin(Debug::Calls,"Model::addMeasurementsInSelection"); Atom *i, *j, *k, *l; Refitem *b1, *b2, *b3; switch (gt) @@ -284,13 +284,13 @@ void Model::addMeasurementsInSelection(GeometryType gt) } break; } - dbgEnd(DM_CALLS,"Model::addMeasurementsInSelection"); + dbgEnd(Debug::Calls,"Model::addMeasurementsInSelection"); } // Find Measurement Measurement *Model::findMeasurement(GeometryType gt, Atom *first, ...) { - dbgBegin(DM_CALLS,"Model::findMeasurement"); + dbgBegin(Debug::Calls,"Model::findMeasurement"); Measurement *result, *m; int n, matched1, matched2; bool proceed; @@ -338,7 +338,7 @@ Measurement *Model::findMeasurement(GeometryType gt, Atom *first, ...) if (result != NULL) break; } } - dbgEnd(DM_CALLS,"Model::findMeasurement"); + dbgEnd(Debug::Calls,"Model::findMeasurement"); return result; } @@ -387,7 +387,7 @@ double Model::torsion(int i, int j, int k, int l) // Update measurements void Model::updateMeasurements() { - dbgBegin(DM_CALLS,"Model::updateMeasurements"); + dbgBegin(Debug::Calls,"Model::updateMeasurements"); for (Measurement *m = measurements_.first(); m != NULL; m = m->next) m->calculate(&cell_); - dbgEnd(DM_CALLS,"Model::updateMeasurements"); + dbgEnd(Debug::Calls,"Model::updateMeasurements"); } diff --git a/src/model/model.cpp b/src/model/model.cpp index ecda2c16d..5a90c555e 100644 --- a/src/model/model.cpp +++ b/src/model/model.cpp @@ -161,10 +161,10 @@ void Model::clear() void Model::calculateMass() { // Calculate the mass of the atoms in the model. - dbgBegin(DM_CALLS,"Model::calculateMass"); + dbgBegin(Debug::Calls,"Model::calculateMass"); mass_ = 0.0; for (Atom *i = atoms_.first(); i != NULL; i = i->next) mass_ += elements.atomicMass(i); - dbgEnd(DM_CALLS,"Model::calculateMass"); + dbgEnd(Debug::Calls,"Model::calculateMass"); } /* @@ -176,7 +176,7 @@ void Model::assignCharges(ChargeSource qs) { // Assign atom-type charges from the currently associated forcefield to the model // Perform forcefield typing if necessary - dbgBegin(DM_CALLS,"Model::assignCharges"); + dbgBegin(Debug::Calls,"Model::assignCharges"); Pattern *p; Atom *i; Forcefield *xff, *patff; @@ -187,7 +187,7 @@ void Model::assignCharges(ChargeSource qs) case (QS_FF): if (!arePatternsValid()) { - msg(DM_NONE,"Model::assignCharges - Cannot assign atomic charges without a valid pattern setup.\n"); + msg(Debug::None,"Model::assignCharges - Cannot assign atomic charges without a valid pattern setup.\n"); break; } typeAll(); @@ -200,7 +200,7 @@ void Model::assignCharges(ChargeSource qs) // Grab pattern forcefield in preference to model's if (patff != NULL) xff = patff; if (xff == NULL) - msg(DM_NONE,"assignCharges : No forcefield is currently assigned to pattern %s. No charges assigned.\n",p->name()); + msg(Debug::None,"assignCharges : No forcefield is currently assigned to pattern %s. No charges assigned.\n",p->name()); else { i = p->firstAtom(); @@ -224,7 +224,7 @@ void Model::assignCharges(ChargeSource qs) printf("Gasteiger and QEq charges are not currently implemented.\n"); break; } - dbgEnd(DM_CALLS,"Model::assignCharges"); + dbgEnd(Debug::Calls,"Model::assignCharges"); } // Set model's forcefield @@ -235,7 +235,7 @@ void Model::setForcefield(Forcefield *newff) { invalidateExpression(); forcefield_ = newff; - msg(DM_NONE,"Forcefield '%s' now associated with model '%s'.\n",forcefield_->name(),name_.get()); + msg(Debug::None,"Forcefield '%s' now associated with model '%s'.\n",forcefield_->name(),name_.get()); } } @@ -243,9 +243,9 @@ void Model::setForcefield(Forcefield *newff) void Model::removeTyping() { // Remove all atom typing from the current model - dbgBegin(DM_CALLS,"Model::removeTyping"); + dbgBegin(Debug::Calls,"Model::removeTyping"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) setAtomtype(i, NULL, FALSE); - dbgEnd(DM_CALLS,"Model::removeTyping"); + dbgEnd(Debug::Calls,"Model::removeTyping"); } /* @@ -321,20 +321,20 @@ void Model::selectionAddLabels(Atom::AtomLabel al) void Model::printCoords() { - dbgBegin(DM_CALLS,"Model::printCoords"); + dbgBegin(Debug::Calls,"Model::printCoords"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) { printf("Atom %3i %s %11.6f %11.6f %11.6f %9.6f\n", i->id(), elements.symbol(i), i->r().x, i->r().y, i->r().z, i->charge()); // printf("Atom %3i %s %11.6f %11.6f %11.6f %9.6f %s\n",i->id(),elements.symbol(i),r.x,r.y,r.z, // i->get_charge(),(ff == NULL ? " " : ff->name(i))); } - dbgEnd(DM_CALLS,"Model::printCoords"); + dbgEnd(Debug::Calls,"Model::printCoords"); } // Calculate the density of the system (if periodic) void Model::calculateDensity() { - dbgBegin(DM_CALLS,"Model::calculateDensity"); + dbgBegin(Debug::Calls,"Model::calculateDensity"); double v = 0.0; if (cell_.type() != CT_NONE) { @@ -350,14 +350,14 @@ void Model::calculateDensity() } } else density_ = -1.0; - dbgEnd(DM_CALLS,"Model::calculateDensity"); + dbgEnd(Debug::Calls,"Model::calculateDensity"); } // Bohr to Angstrom void Model::bohrToAngstrom() { // Convert coordinates and cell from Bohr to Angstrom - dbgBegin(DM_CALLS,"Model::bohrToAngstrom"); + dbgBegin(Debug::Calls,"Model::bohrToAngstrom"); // Coordinates for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->r() *= ANGBOHR; // Cell @@ -369,35 +369,35 @@ void Model::bohrToAngstrom() cell_.set(lengths,cell_.angles()); } logChange(LOG_COORDS); - dbgEnd(DM_CALLS,"Model::bohrToAngstrom"); + dbgEnd(Debug::Calls,"Model::bohrToAngstrom"); } // Reset atom tempi's void Model::resetTempi(int value) { - dbgBegin(DM_CALLS,"Model::resetTempi"); + dbgBegin(Debug::Calls,"Model::resetTempi"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->tempi = value; - dbgEnd(DM_CALLS,"Model::resetTempi"); + dbgEnd(Debug::Calls,"Model::resetTempi"); } // Clear charges void Model::clearCharges() { - dbgBegin(DM_CALLS,"Model::clearCharges"); + dbgBegin(Debug::Calls,"Model::clearCharges"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->setCharge(0.0); - dbgEnd(DM_CALLS,"Model::clearCharges"); + dbgEnd(Debug::Calls,"Model::clearCharges"); } // Print void Model::print() { - dbgBegin(DM_CALLS,"Model::print"); - msg(DM_NONE," Name : %s\n",name_.get()); - msg(DM_NONE," File : %s\n",filename_.get()); - msg(DM_NONE," Mass : %f\n",mass_); - if (cell_.type() != CT_NONE) msg(DM_NONE," Cell : %s\nDensity : %f %s\n",text_from_CT(cell_.type()),density_,text_from_DU(prefs.densityUnit())); - msg(DM_NONE," Atoms : %i\n",atoms_.nItems()); - msg(DM_NONE," Id El FFType X Y Z Q S \n"); + dbgBegin(Debug::Calls,"Model::print"); + msg(Debug::None," Name : %s\n",name_.get()); + msg(Debug::None," File : %s\n",filename_.get()); + msg(Debug::None," Mass : %f\n",mass_); + if (cell_.type() != CT_NONE) msg(Debug::None," Cell : %s\nDensity : %f %s\n",text_from_CT(cell_.type()),density_,text_from_DU(prefs.densityUnit())); + msg(Debug::None," Atoms : %i\n",atoms_.nItems()); + msg(Debug::None," Id El FFType X Y Z Q S \n"); // Print from pattern definition if possible, otherwise just use model atom list Atom *i; int n; @@ -412,7 +412,7 @@ void Model::print() } } else for (i = atoms_.first(); i != NULL; i = i->next) i->printSummary(); - dbgEnd(DM_CALLS,"Model::print"); + dbgEnd(Debug::Calls,"Model::print"); } // Print Forces @@ -440,12 +440,12 @@ void Model::copy(Model *srcmodel) // Copy atom data from specified model void Model::copyAtomData(Model *srcmodel, int dat) { - dbgBegin(DM_CALLS,"Model::copyAtomData"); + dbgBegin(Debug::Calls,"Model::copyAtomData"); // Simple failsafe - check atom numbers in each are the same if (atoms_.nItems() != srcmodel->atoms_.nItems()) { printf("Model::copyAtomData <<<< Models have different numbers of atoms (%i/%i) >>>>\n", atoms_.nItems(), srcmodel->atoms_.nItems()); - dbgEnd(DM_CALLS,"Model::copyAtomData"); + dbgEnd(Debug::Calls,"Model::copyAtomData"); return; } Atom *i, *j; @@ -461,21 +461,21 @@ void Model::copyAtomData(Model *srcmodel, int dat) if ((dat&Atom::FixedData) || (dat == Atom::AllData)) i->setPositionFixed(j->hasFixedPosition()); j = j->next; } - //msg(DM_VERBOSE,"Copied data for %i atoms from model '%s' to model '%s'.\n", count); + //msg(Debug::Verbose,"Copied data for %i atoms from model '%s' to model '%s'.\n", count); // name(), srcmodel->name()); - dbgEnd(DM_CALLS,"Model::copyAtomData"); + dbgEnd(Debug::Calls,"Model::copyAtomData"); } // Copy range of atom data from specified model void Model::copyAtomData(Model *srcmodel, int dat, int startatom, int ncopy) { - dbgBegin(DM_CALLS,"Model::copyAtomData[range]"); + dbgBegin(Debug::Calls,"Model::copyAtomData[range]"); // Simple failsafe - check atom numbers in each are the same int numatoms = atoms_.nItems(); if (numatoms != srcmodel->atoms_.nItems()) { printf("Model::copyAtomData[range] <<<< Models have different numbers of atoms (%i/%i) >>>>\n", numatoms, srcmodel->atoms_.nItems()); - dbgEnd(DM_CALLS,"Model::copyAtomData[range]"); + dbgEnd(Debug::Calls,"Model::copyAtomData[range]"); return; } // Check limits of requested copy @@ -499,16 +499,16 @@ void Model::copyAtomData(Model *srcmodel, int dat, int startatom, int ncopy) if ((dat&Atom::ChargeData) || (dat == Atom::AllData)) ii[n]->setCharge(jj[n]->charge()); if ((dat&Atom::FixedData) || (dat == Atom::AllData)) ii[n]->setPositionFixed(jj[n]->hasFixedPosition()); } - msg(DM_VERBOSE,"Copied data for %i atoms starting at %i from model '%s' to model '%s'.\n", ncopy, startatom, name_.get(), srcmodel->name_.get()); + msg(Debug::Verbose,"Copied data for %i atoms starting at %i from model '%s' to model '%s'.\n", ncopy, startatom, name_.get(), srcmodel->name_.get()); } } - dbgEnd(DM_CALLS,"Model::copyAtomData[range]"); + dbgEnd(Debug::Calls,"Model::copyAtomData[range]"); } // Calculate and return RMS of current atomic forces double Model::calculateRmsForce() { - dbgBegin(DM_CALLS,"Model::calculateRmsForce"); + dbgBegin(Debug::Calls,"Model::calculateRmsForce"); double rmsforce = 0.0; Atom **modelatoms = atomArray(); for (int i=0; if().z * modelatoms[i]->f().z; } rmsforce /= atoms_.nItems(); - dbgEnd(DM_CALLS,"Model::calculateRmsForce"); + dbgEnd(Debug::Calls,"Model::calculateRmsForce"); return sqrt(rmsforce); } diff --git a/src/model/molecule.cpp b/src/model/molecule.cpp index 8820d0045..a07034b6c 100644 --- a/src/model/molecule.cpp +++ b/src/model/molecule.cpp @@ -26,13 +26,13 @@ // Position molecule at specified coordinates void Model::positionMolecule(Pattern *p, int mol, const Vec3 &v) { - dbgBegin(DM_CALLS,"Model::positionMolecule"); + dbgBegin(Debug::Calls,"Model::positionMolecule"); static Vec3 newpos, cog; static int pnatoms, offset, n; Atom **modelatoms = atomArray(); pnatoms = p->nAtoms(); offset = p->startAtom() + pnatoms * mol; - msg(DM_VERBOSE,"Model::positionMolecule : Moving %i atoms starting at %i (config can hold %i atoms)\n", pnatoms, offset, atoms_.nItems()); + msg(Debug::Verbose,"Model::positionMolecule : Moving %i atoms starting at %i (config can hold %i atoms)\n", pnatoms, offset, atoms_.nItems()); if (offset < atoms_.nItems()) { cog = p->calculateCog(this,mol); @@ -49,29 +49,29 @@ void Model::positionMolecule(Pattern *p, int mol, const Vec3 &v) } } else printf("Model::positionMolecule : Requested a molecule past end of config contents. (%s %i)\n",p->name(),mol); - dbgEnd(DM_CALLS,"Model::positionMolecule"); + dbgEnd(Debug::Calls,"Model::positionMolecule"); } // Translate molecule along vector void Model::translateMolecule(Pattern *p, int mol, const Vec3 &v) { // Vector 'v' should be normalised before passing - dbgBegin(DM_CALLS,"Model::translateMolecule"); + dbgBegin(Debug::Calls,"Model::translateMolecule"); static int pnatoms, offset, n; Atom **modelatoms = atomArray(); pnatoms = p->nAtoms(); offset = p->startAtom() + pnatoms * mol; - msg(DM_VERBOSE,"Model::translateMolecule : Moving %i atoms starting at %i (%i atoms currently in model)\n", pnatoms, offset, atoms_.nItems()); + msg(Debug::Verbose,"Model::translateMolecule : Moving %i atoms starting at %i (%i atoms currently in model)\n", pnatoms, offset, atoms_.nItems()); if (offset < atoms_.nItems()) for (n=offset; nr() += v; else printf("Model::translateMolecule : Requested a molecule past end of model contents. (%s %i)\n", p->name(), mol); - dbgEnd(DM_CALLS,"Model::translateMolecule"); + dbgEnd(Debug::Calls,"Model::translateMolecule"); } void Model::rotateMolecule(Pattern *p, int mol, double rotx, double roty) { // Rotate the coordinates of the atoms in pattern p, molecule mol, about their centre of geometry. // rotx and roty are the rotations about the x and y axes respectively, in degrees - dbgBegin(DM_CALLS,"Model::rotateMolecule"); + dbgBegin(Debug::Calls,"Model::rotateMolecule"); static double cosx, cosy, sinx, siny; static Mat3 rotmat; static Vec3 delta, newpos, cog; @@ -103,18 +103,18 @@ void Model::rotateMolecule(Pattern *p, int mol, double rotx, double roty) modelatoms[n]->r() = newpos; } else printf("Model::rotateMolecule : Requested a molecule past end of model contents. (%s %i)\n", p->name(), mol); - dbgEnd(DM_CALLS,"Model::rotateMolecule"); + dbgEnd(Debug::Calls,"Model::rotateMolecule"); } // Set the hidden flag on atoms of the specified molecule void Model::hideMolecule(Pattern *p, int mol, bool visible) { - dbgBegin(DM_CALLS,"Model::hideMolecule"); + dbgBegin(Debug::Calls,"Model::hideMolecule"); static int pnatoms, offset, n; Atom **modelatoms = atomArray(); pnatoms = p->nAtoms(); offset = p->startAtom() + pnatoms * mol; if (offset < atoms_.nItems()) for (n=offset; nsetHidden(visible); else printf("Model::hideMolecule : Requested a molecule past end of model contents. (%s %i)\n", p->name(), mol); - dbgEnd(DM_CALLS,"Model::hideMolecule"); + dbgEnd(Debug::Calls,"Model::hideMolecule"); } diff --git a/src/model/pattern.cpp b/src/model/pattern.cpp index be1503a8e..8c0cabecc 100644 --- a/src/model/pattern.cpp +++ b/src/model/pattern.cpp @@ -59,7 +59,7 @@ Pattern *Model::pattern(int id) // Add Pattern Node Pattern *Model::addPattern(int mols, int numatoms, const char *patname) { - dbgBegin(DM_CALLS,"Model::addPattern"); + dbgBegin(Debug::Calls,"Model::addPattern"); // Determine starting atom... Pattern *lastp = patterns_.last(); int start = (lastp == NULL ? 0 : lastp->startAtom() + lastp->nMols() * lastp->nAtoms()); @@ -67,20 +67,20 @@ Pattern *Model::addPattern(int mols, int numatoms, const char *patname) newpnode->setParent(this); newpnode->setName(patname); newpnode->initialise(patterns_.nItems()-1,start,mols,numatoms); - msg(DM_VERBOSE,"New pattern '%s' added - startatom %i, %i mols, %i atoms per mol.\n",patname,start,mols,numatoms); + msg(Debug::Verbose,"New pattern '%s' added - startatom %i, %i mols, %i atoms per mol.\n",patname,start,mols,numatoms); if ((start + mols*numatoms) == atoms_.nItems()) { - msg(DM_NONE,"Pattern description completed (spans %i atoms).\n",atoms_.nItems()); + msg(Debug::None,"Pattern description completed (spans %i atoms).\n",atoms_.nItems()); energy.resize(patterns_.nItems()); // Create representative molecules - msg(DM_NONE,"Creating representative molecules..."); + msg(Debug::None,"Creating representative molecules..."); createPatternMolecules(); - msg(DM_NONE,"Done.\n"); + msg(Debug::None,"Done.\n"); // Patterns depend only on the properties / relation of the atoms, and not the positions.. patternsPoint_ = logs_[LOG_STRUCTURE]; } - else if ((start + mols*numatoms) > atoms_.nItems()) msg(DM_NONE,"New pattern '%s' extends %i atoms past number of atoms in owner model.\n",patname,(start + mols*numatoms) - atoms_.nItems()); - dbgEnd(DM_CALLS,"Model::addPattern"); + else if ((start + mols*numatoms) > atoms_.nItems()) msg(Debug::None,"New pattern '%s' extends %i atoms past number of atoms in owner model.\n",patname,(start + mols*numatoms) - atoms_.nItems()); + dbgEnd(Debug::Calls,"Model::addPattern"); return newpnode; } @@ -93,7 +93,7 @@ void Model::cutPattern(Pattern *source) // Own pattern void Model::ownPattern(Pattern *source, bool own) { - dbgBegin(DM_CALLS,"Model::ownPattern"); + dbgBegin(Debug::Calls,"Model::ownPattern"); // Set the starting atom from the last pattern in the model's list Pattern *p = patterns_.last(); int start = (p == NULL ? 0 : p->startAtom() + p->nMols() * p->nAtoms()); @@ -105,14 +105,14 @@ void Model::ownPattern(Pattern *source, bool own) source->setId(patterns_.nItems()-1); //source->set_id(patterns_.nItems()-1); if (own) source->setParent(this); - dbgEnd(DM_CALLS,"Model::ownPattern"); + dbgEnd(Debug::Calls,"Model::ownPattern"); } // Set 'fixed' propety of patterns void Model::setPatternsFixed(int upto) { // Set all patterns in the current model to be 'fixed' - dbgBegin(DM_CALLS,"Model::setPatternsFixed"); + dbgBegin(Debug::Calls,"Model::setPatternsFixed"); Pattern *p = patterns_.first(); int count = 0; while (p != NULL) @@ -122,20 +122,20 @@ void Model::setPatternsFixed(int upto) p = p->next; count ++; } - dbgEnd(DM_CALLS,"Model::setPatternsFixed"); + dbgEnd(Debug::Calls,"Model::setPatternsFixed"); } // Determine the locality of the supplied atom Atomaddress Model::locateAtom(Atom *i) { - dbgBegin(DM_CALLS,"Model::locateAtom"); + dbgBegin(Debug::Calls,"Model::locateAtom"); int n, patternno, molno, atomno, id; Pattern *p; Atomaddress result; if (!autocreatePatterns()) { - msg(DM_NONE,"Model::locateAtom : No valid pattern available for model.\n"); - dbgEnd(DM_CALLS,"Model::locateAtom"); + msg(Debug::None,"Model::locateAtom : No valid pattern available for model.\n"); + dbgEnd(Debug::Calls,"Model::locateAtom"); return result; } id = i->id(); @@ -154,7 +154,7 @@ Atomaddress Model::locateAtom(Atom *i) if (patternno == -1) { printf("Fatal error - could not find owner pattern for atom!\n"); - dbgEnd(DM_CALLS,"Model::locateAtom"); + dbgEnd(Debug::Calls,"Model::locateAtom"); return result; } // Next, find its molecule id @@ -166,26 +166,26 @@ Atomaddress Model::locateAtom(Atom *i) result.setPattern(p); result.setMolecule(molno); result.setOffset(atomno); - dbgEnd(DM_CALLS,"Model::locateAtom"); + dbgEnd(Debug::Calls,"Model::locateAtom"); return result; } // Clar patterns void Model::clearPatterns() { - dbgBegin(DM_CALLS,"Model::clearPatterns"); + dbgBegin(Debug::Calls,"Model::clearPatterns"); patterns_.clear(); patternsPoint_ = -1; expressionPoint_ = -1; - msg(DM_NONE,"Pattern list cleared for model '%s'.\n",name_.get()); - dbgEnd(DM_CALLS,"Model::clearPatterns"); + msg(Debug::None,"Pattern list cleared for model '%s'.\n",name_.get()); + dbgEnd(Debug::Calls,"Model::clearPatterns"); } // Autocreate patterns bool Model::autocreatePatterns() { // Determine the pattern (molecule) layout of the model - dbgBegin(DM_CALLS,"Model::autocreatePatterns"); + dbgBegin(Debug::Calls,"Model::autocreatePatterns"); int n, atomid, nsel2, nmols, idi, idj, idoff; bool same; static Dnchar emp; @@ -197,18 +197,18 @@ bool Model::autocreatePatterns() // Check current pattern first... if (arePatternsValid()) { - dbgEnd(DM_CALLS,"Model::autocreatePatterns"); + dbgEnd(Debug::Calls,"Model::autocreatePatterns"); return TRUE; } // Delete all old nodes first. - msg(DM_NONE,"Autodetecting patterns for model '%s'..\n",name_.get()); + msg(Debug::None,"Autodetecting patterns for model '%s'..\n",name_.get()); patterns_.clear(); // If there are no atoms in the molecule, exit here. if (atoms_.nItems() == 0) { - msg(DM_NONE,"No patterns defined for model '%s' - no atoms present.\n",name_.get()); + msg(Debug::None,"No patterns defined for model '%s' - no atoms present.\n",name_.get()); patternsPoint_ = logs_[LOG_STRUCTURE]; - dbgEnd(DM_CALLS,"Model::autocreatePatterns"); + dbgEnd(Debug::Calls,"Model::autocreatePatterns"); return TRUE; } // To autodetect, we start off at atoms_head in the model, tree-select this atom and copy the selection to the clipboard. Use the clipboard to check subsequent selections, and if its the same just increase the nmols counter by one. If it's different, assume its the start of a new type of molecule and reset the counters. @@ -232,13 +232,13 @@ bool Model::autocreatePatterns() } if (nsel2 != nSelected_) { - msg(DM_NONE,"Warning - model cannot be divided into molecules because of non-ordered atoms_.\nPattern for model will be 1*N.\n"); + msg(Debug::None,"Warning - model cannot be divided into molecules because of non-ordered atoms_.\nPattern for model will be 1*N.\n"); // Remove any patterns added so far and set values so we create a generic 1*N pattern instead patterns_.clear(); nmols = 0; selectAll(); selectionEmpirical(emp); - msg(DM_NONE,"Added default pattern: %s\n",emp.get()); + msg(Debug::None,"Added default pattern: %s\n",emp.get()); p = addPattern(1,atoms_.nItems(),emp.get()); break; } @@ -310,7 +310,7 @@ bool Model::autocreatePatterns() else { // Not the same as the last stored pattern, so store old data and start a new one - msg(DM_NONE,"New pattern found: %s\n",emp.get()); + msg(Debug::None,"New pattern found: %s\n",emp.get()); p = addPattern(nmols,patclip.nAtoms(),emp.get()); patclip.copySelection(this); selectionEmpirical(emp); @@ -321,7 +321,7 @@ bool Model::autocreatePatterns() // Store last pattern data if (nmols != 0) { - msg(DM_NONE,"New pattern found: %s\n",emp.get()); + msg(Debug::None,"New pattern found: %s\n",emp.get()); p = addPattern(nmols,patclip.nAtoms(),emp.get()); } @@ -331,14 +331,14 @@ bool Model::autocreatePatterns() // Patterns depend only on the properties / relation of the atoms, and not the positions.. patternsPoint_ = logs_[LOG_STRUCTURE]; - dbgEnd(DM_CALLS,"Model::autocreatePatterns"); + dbgEnd(Debug::Calls,"Model::autocreatePatterns"); return TRUE; } // Create representative molecules for patterns void Model::createPatternMolecules() { - dbgBegin(DM_CALLS,"Model::createPatternMolecules"); + dbgBegin(Debug::Calls,"Model::createPatternMolecules"); Clipboard clip; for (Pattern *p = patterns_.first(); p != NULL; p = p->next) { @@ -360,13 +360,13 @@ void Model::createPatternMolecules() p->molecule->selectNone(); } selectNone(); - dbgEnd(DM_CALLS,"Model::createPatternMolecules"); + dbgEnd(Debug::Calls,"Model::createPatternMolecules"); } // Get empirical formula of selection void Model::selectionEmpirical(Dnchar &target) { - dbgBegin(DM_CALLS,"Model::selectionEmpirical"); + dbgBegin(Debug::Calls,"Model::selectionEmpirical"); int elcount[elements.nElements()]; //string result; target.clear(); @@ -386,18 +386,18 @@ void Model::selectionEmpirical(Dnchar &target) target.cat(elements.symbol(n)); if (elcount[n] > 1) target.cat(itoa(elcount[n])); } - dbgEnd(DM_CALLS,"Model::selectionEmpirical"); + dbgEnd(Debug::Calls,"Model::selectionEmpirical"); } // Get atom fingerprint of current selection void Model::selectionAtomFingerprint(Dnchar &target) { - dbgBegin(DM_CALLS,"Model::selectionAtomFingerprint"); + dbgBegin(Debug::Calls,"Model::selectionAtomFingerprint"); target.clear(); Atom *i = firstSelected(); if (i == NULL) { - dbgEnd(DM_CALLS,"Model::selectionAtomFingerprint"); + dbgEnd(Debug::Calls,"Model::selectionAtomFingerprint"); return; } int lastel = i->element(), newel; @@ -421,13 +421,13 @@ void Model::selectionAtomFingerprint(Dnchar &target) target.cat(elements.symbol(lastel)); target.cat(itoa(count)); } - dbgEnd(DM_CALLS,"Model::selectionAtomFingerprint"); + dbgEnd(Debug::Calls,"Model::selectionAtomFingerprint"); } // Get bond fingerprint of current selection void Model::selectionBondFingerprint(Dnchar &target) { - dbgBegin(DM_CALLS,"Model::selectionBondFingerprint"); + dbgBegin(Debug::Calls,"Model::selectionBondFingerprint"); target.clear(); int count = 0, diff; Refitem *ri; @@ -455,25 +455,25 @@ void Model::selectionBondFingerprint(Dnchar &target) } i = i->next; } - dbgEnd(DM_CALLS,"Model::selectionBondFingerprint"); + dbgEnd(Debug::Calls,"Model::selectionBondFingerprint"); } // Find pattern by name Pattern *Model::findPattern(const char *s) { - dbgBegin(DM_CALLS,"Model::findPattern"); + dbgBegin(Debug::Calls,"Model::findPattern"); Pattern *p = NULL; for (p = patterns_.first(); p != NULL; p = p->next) if (strcmp(p->name(),s) == 0) break; - if (p == NULL) msg(DM_NONE,"Pattern '%s' does not exist in model '%s'.\n",s,name_.get()); - dbgEnd(DM_CALLS,"Model::findPattern"); + if (p == NULL) msg(Debug::None,"Pattern '%s' does not exist in model '%s'.\n",s,name_.get()); + dbgEnd(Debug::Calls,"Model::findPattern"); return p; } // Charge pattern atom void Model::chargePatternAtom(Pattern *p, int id, double q) { - dbgBegin(DM_CALLS,"Model::chargePatternAtom"); + dbgBegin(Debug::Calls,"Model::chargePatternAtom"); int n,m,pnatoms; Atom *i = p->firstAtom(); pnatoms = p->nAtoms(); @@ -486,37 +486,37 @@ void Model::chargePatternAtom(Pattern *p, int id, double q) for (m=0; mnext; i->setCharge(q); } - dbgEnd(DM_CALLS,"Model::chargePatternAtom"); + dbgEnd(Debug::Calls,"Model::chargePatternAtom"); } // Find pattern for given atom Pattern *Model::pattern(Atom *i) { - dbgBegin(DM_CALLS,"Model::pattern[atom]"); + dbgBegin(Debug::Calls,"Model::pattern[atom]"); int id = i->id(); Pattern *p; for (p = patterns_.first(); p != NULL; p = p->next) if ((id >= p->startAtom()) && (id <= p->endAtom())) break; - dbgEnd(DM_CALLS,"Model::pattern[atom]"); + dbgEnd(Debug::Calls,"Model::pattern[atom]"); return p; } // Print patterns void Model::printPatterns() { - dbgBegin(DM_CALLS,"Model::printPatterns"); + dbgBegin(Debug::Calls,"Model::printPatterns"); Pattern *p = patterns_.first(); - if (p == NULL) msg(DM_NONE,"No patterns defined for model '%s'.\n",name_.get()); + if (p == NULL) msg(Debug::None,"No patterns defined for model '%s'.\n",name_.get()); else { - msg(DM_NONE,"Pattern info for model '%s':\n", name_.get()); - msg(DM_NONE," ID NMols Starti Endi Name Forcefield\n"); + msg(Debug::None,"Pattern info for model '%s':\n", name_.get()); + msg(Debug::None," ID NMols Starti Endi Name Forcefield\n"); while (p != NULL) { - msg(DM_NONE," %2i %5i %6i %6i %-16s %s\n", p->id(), p->nMols(), p->startAtom(), p->endAtom(), p->name(), p->forcefield() ? p->forcefield()->name() : "< Inherited >"); + msg(Debug::None," %2i %5i %6i %6i %-16s %s\n", p->id(), p->nMols(), p->startAtom(), p->endAtom(), p->name(), p->forcefield() ? p->forcefield()->name() : "< Inherited >"); p = p->next; } } - dbgEnd(DM_CALLS,"Model::printPatterns"); + dbgEnd(Debug::Calls,"Model::printPatterns"); } diff --git a/src/model/select.cpp b/src/model/select.cpp index 2953a6b71..5a3c3f450 100644 --- a/src/model/select.cpp +++ b/src/model/select.cpp @@ -28,7 +28,7 @@ // Select Atom void Model::selectAtom(Atom *i) { - dbgBegin(DM_MORECALLS,"Model::selectAtom (%li)",i); + dbgBegin(Debug::MoreCalls,"Model::selectAtom (%li)",i); if (!i->isSelected()) { i->setSelected(TRUE); @@ -41,13 +41,13 @@ void Model::selectAtom(Atom *i) newchange->set(UE_SELECT,i->id()); } } - dbgEnd(DM_MORECALLS,"Model::selectAtom (%li)",i); + dbgEnd(Debug::MoreCalls,"Model::selectAtom (%li)",i); } // Deselect Atom void Model::deselectAtom(Atom *i) { - dbgBegin(DM_MORECALLS,"Model::deselectAtom (%li)",i); + dbgBegin(Debug::MoreCalls,"Model::deselectAtom (%li)",i); if (i->isSelected()) { i->setSelected(FALSE); @@ -60,30 +60,30 @@ void Model::deselectAtom(Atom *i) newchange->set(-UE_SELECT,i->id()); } } - dbgEnd(DM_MORECALLS,"Model::deselectAtom (%li)",i); + dbgEnd(Debug::MoreCalls,"Model::deselectAtom (%li)",i); } // Toggle Selection State void Model::selectionToggle(Atom *i) { - dbgBegin(DM_MORECALLS,"Model::selectionToggle (%li)",i); + dbgBegin(Debug::MoreCalls,"Model::selectionToggle (%li)",i); i->isSelected() ? deselectAtom(i) : selectAtom(i); - dbgEnd(DM_MORECALLS,"Model::selectionToggle (%li)",i); + dbgEnd(Debug::MoreCalls,"Model::selectionToggle (%li)",i); } // Invert Current Selection void Model::selectionInvert() { - dbgBegin(DM_CALLS,"Model::selectionInvert"); + dbgBegin(Debug::Calls,"Model::selectionInvert"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) i->isSelected() ? deselectAtom(i) : selectAtom(i); - dbgEnd(DM_CALLS,"Model::selectionInvert"); + dbgEnd(Debug::Calls,"Model::selectionInvert"); } // Delete Selected Atoms void Model::selectionDelete() { - dbgBegin(DM_CALLS,"Model::selectionDelete"); + dbgBegin(Debug::Calls,"Model::selectionDelete"); Atom *i, *tempi; int count = 0; master.initialiseProgress("Deleting atoms_...", atoms_.nItems()); @@ -100,13 +100,13 @@ void Model::selectionDelete() if (!master.updateProgress(++count)) break; } master.cancelProgress(); - dbgEnd(DM_CALLS,"Model::selectionDelete"); + dbgEnd(Debug::Calls,"Model::selectionDelete"); } // Expand Current Selection void Model::selectionExpand() { - dbgBegin(DM_CALLS,"Model::selectionExpand"); + dbgBegin(Debug::Calls,"Model::selectionExpand"); Atom *i; Refitem *bref; // Store the current selection state in i->tempi @@ -114,24 +114,24 @@ void Model::selectionExpand() // Now use the temporary state to find atoms where we select atomic neighbours for (i = atoms_.first(); i != NULL; i = i->next) if (i->tempi) for (bref = i->bonds(); bref != NULL; bref = bref->next) selectAtom(bref->item->partner(i)); - dbgEnd(DM_CALLS,"Model::selectionExpand"); + dbgEnd(Debug::Calls,"Model::selectionExpand"); } // Select All Atoms void Model::selectAll() { - dbgBegin(DM_CALLS,"Model::selectAll"); + dbgBegin(Debug::Calls,"Model::selectAll"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) if (!i->isSelected()) selectAtom(i); - dbgEnd(DM_CALLS,"Model::selectAll"); + dbgEnd(Debug::Calls,"Model::selectAll"); } // Deselect All Atoms void Model::selectNone() { - dbgBegin(DM_CALLS,"Model::selectNone"); + dbgBegin(Debug::Calls,"Model::selectNone"); for (Atom *i = atoms_.first(); i != NULL; i = i->next) if (i->isSelected()) deselectAtom(i); nSelected_ = 0; - dbgEnd(DM_CALLS,"Model::selectNone"); + dbgEnd(Debug::Calls,"Model::selectNone"); } // Atom at Screen Coordinates @@ -139,7 +139,7 @@ Atom *Model::atomOnScreen(double x1, double y1) { // See if an atom exists under the coordinates x1,y1 // Ignore 'hidden' atoms_. - dbgBegin(DM_CALLS,"Model::atomOnScreen"); + dbgBegin(Debug::Calls,"Model::atomOnScreen"); // Make sure we have a valid projection projectAll(); Atom *closest = NULL; @@ -170,7 +170,7 @@ Atom *Model::atomOnScreen(double x1, double y1) i = i->next; } #endif - dbgEnd(DM_CALLS,"Model::atomOnScreen"); + dbgEnd(Debug::Calls,"Model::atomOnScreen"); return closest; } @@ -178,7 +178,7 @@ Atom *Model::atomOnScreen(double x1, double y1) void Model::selectBox(double x1, double y1, double x2, double y2) { // Box selection - choose all the atoms within the selection area - dbgBegin(DM_CALLS,"Model::selectBox"); + dbgBegin(Debug::Calls,"Model::selectBox"); #ifdef HAS_GUI float t; Atom *i, *closest; @@ -195,7 +195,7 @@ void Model::selectBox(double x1, double y1, double x2, double y2) if ((sr.y >= y1) && (sr.y <= y2)) selectAtom(i); } #endif - dbgEnd(DM_CALLS,"Model::selectBox"); + dbgEnd(Debug::Calls,"Model::selectBox"); } // Tree Select @@ -205,7 +205,7 @@ void Model::selectTree(Atom *i) // From here, select all atoms that are bound - if they are already // selected then ignore them. If they are not already selected, then // recursively call the routine on that atom. - dbgBegin(DM_CALLS,"Model::selectTree"); + dbgBegin(Debug::Calls,"Model::selectTree"); selectAtom(i); Refitem *bref = i->bonds(); while (bref != NULL) @@ -218,21 +218,21 @@ void Model::selectTree(Atom *i) } bref = bref->next; } - dbgEnd(DM_CALLS,"Model::selectTree"); + dbgEnd(Debug::Calls,"Model::selectTree"); } // Select by Element void Model::selectElement(Atom *target) { // Select all atoms which are the same element as the atom i - dbgBegin(DM_CALLS,"Model::selectElement"); + dbgBegin(Debug::Calls,"Model::selectElement"); Atom *i = atoms_.first(); while (i != NULL) { if (i->element() == target->element()) selectAtom(i); i = i->next; } - dbgEnd(DM_CALLS,"Model::selectElement"); + dbgEnd(Debug::Calls,"Model::selectElement"); } // Select by element (from ID) @@ -247,7 +247,7 @@ void Model::selectElement(int id) void Model::selectRadial(Atom *target, double radius) { // Select all atoms which are within the distance 'radius' from atom 'target' - dbgBegin(DM_CALLS,"Model::selectRadial"); + dbgBegin(Debug::Calls,"Model::selectRadial"); Atom *i = atoms_.first(); printf("Selection radius is %8.4f Angstroms\n",radius); while (i != NULL) @@ -256,27 +256,27 @@ void Model::selectRadial(Atom *target, double radius) else if (distance(target,i) < radius) selectAtom(i); i = i->next; } - dbgEnd(DM_CALLS,"Model::selectRadial"); + dbgEnd(Debug::Calls,"Model::selectRadial"); } // Select Pattern void Model::selectPattern(Pattern *p) { // Select all atoms covered by the specified pattern. - dbgBegin(DM_CALLS,"Model::selectPattern"); + dbgBegin(Debug::Calls,"Model::selectPattern"); Atom *i = p->firstAtom(); for (int n=0; ntotalAtoms(); n++) { selectAtom(i); i = i->next; } - dbgEnd(DM_CALLS,"Model::selectPattern"); + dbgEnd(Debug::Calls,"Model::selectPattern"); } // Get first selected Atom *Model::firstSelected() { - dbgBegin(DM_CALLS,"Model::firstSelected"); + dbgBegin(Debug::Calls,"Model::firstSelected"); Atom *result = NULL; Atom *i = atoms_.first(); while (i != NULL) @@ -288,14 +288,14 @@ Atom *Model::firstSelected() } i = i->next; } - dbgEnd(DM_CALLS,"Model::firstSelected"); + dbgEnd(Debug::Calls,"Model::firstSelected"); return result; } // Select overlapping atoms void Model::selectOverlaps(double tolerance) { - dbgBegin(DM_CALLS,"Model::selectOverlaps"); + dbgBegin(Debug::Calls,"Model::selectOverlaps"); Atom *i, *j; double deltar; selectNone(); @@ -307,10 +307,10 @@ void Model::selectOverlaps(double tolerance) deltar = cell_.distance(i, j); if (deltar < tolerance) { - msg(DM_NONE,"Atom %i (%s) is %f from atom %i (%s).\n", j->id()+1, elements.symbol(j), deltar, i->id()+1, elements.symbol(i)); + msg(Debug::None,"Atom %i (%s) is %f from atom %i (%s).\n", j->id()+1, elements.symbol(j), deltar, i->id()+1, elements.symbol(i)); selectAtom(j); } } } - dbgEnd(DM_CALLS,"Model::selectOverlaps"); + dbgEnd(Debug::Calls,"Model::selectOverlaps"); } diff --git a/src/model/selection.cpp b/src/model/selection.cpp index 4f8878614..087c63379 100644 --- a/src/model/selection.cpp +++ b/src/model/selection.cpp @@ -30,11 +30,11 @@ int Model::nSelected() // Move atoms 'up' void Model::shiftSelectionUp() { - dbgBegin(DM_CALLS,"Model::shiftSelectionUp"); + dbgBegin(Debug::Calls,"Model::shiftSelectionUp"); if (nSelected_ == 0) { - msg(DM_NONE,"No atoms selected."); - dbgEnd(DM_CALLS,"Model::shiftSelectionUp"); + msg(Debug::None,"No atoms selected."); + dbgEnd(Debug::Calls,"Model::shiftSelectionUp"); } int tempid, oldid; Atom *i, *next; @@ -62,17 +62,17 @@ void Model::shiftSelectionUp() i = next; } logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::shiftSelectionUp"); + dbgEnd(Debug::Calls,"Model::shiftSelectionUp"); } // Move atoms 'down' void Model::shiftSelectionDown() { - dbgBegin(DM_CALLS,"Model::shiftSelectionDown"); + dbgBegin(Debug::Calls,"Model::shiftSelectionDown"); if (nSelected_ == 0) { - msg(DM_NONE,"No atoms selected."); - dbgEnd(DM_CALLS,"Model::shiftSelectionDown"); + msg(Debug::None,"No atoms selected."); + dbgEnd(Debug::Calls,"Model::shiftSelectionDown"); } int tempid, oldid; Atom *i, *next; @@ -101,13 +101,13 @@ void Model::shiftSelectionDown() i = next; } logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::shiftSelectionDown"); + dbgEnd(Debug::Calls,"Model::shiftSelectionDown"); } // Move atoms to start void Model::moveSelectionToStart() { - dbgBegin(DM_CALLS,"Model::moveSelectionToStart"); + dbgBegin(Debug::Calls,"Model::moveSelectionToStart"); int n; Atom *next, *i; // For each selected atom in the model, shift it to the end of the list @@ -121,13 +121,13 @@ void Model::moveSelectionToStart() // Renumber atoms renumberAtoms(); logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::moveSelectionToStart"); + dbgEnd(Debug::Calls,"Model::moveSelectionToStart"); } // Move atoms to end void Model::moveSelectionToEnd() { - dbgBegin(DM_CALLS,"Model::moveSelectionToEnd"); + dbgBegin(Debug::Calls,"Model::moveSelectionToEnd"); int n; Atom *next, *i; // For each selected atom in the model, shift it to the end of the list @@ -141,7 +141,7 @@ void Model::moveSelectionToEnd() // Renumber atoms renumberAtoms(); logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::moveSelectionToEnd"); + dbgEnd(Debug::Calls,"Model::moveSelectionToEnd"); } // Get selection cog diff --git a/src/model/site.cpp b/src/model/site.cpp index c408dc2df..49a759077 100644 --- a/src/model/site.cpp +++ b/src/model/site.cpp @@ -25,10 +25,10 @@ // Find site by name Site *Model::findSite(const char *s) { - dbgBegin(DM_CALLS,"Model::findSite"); + dbgBegin(Debug::Calls,"Model::findSite"); Site *result = NULL; for (result = sites.first(); result != NULL; result = result->next) if (strcmp(result->name(),s) == 0) break; - dbgEnd(DM_CALLS,"Model::findSite"); + dbgEnd(Debug::Calls,"Model::findSite"); return result; } diff --git a/src/model/trajectory.cpp b/src/model/trajectory.cpp index cd6755201..80884bdf8 100644 --- a/src/model/trajectory.cpp +++ b/src/model/trajectory.cpp @@ -71,7 +71,7 @@ int Model::framePosition() void Model::clearTrajectory() { // Clear frames - can simply delete the master config pointed to by 'frames_head' - dbgBegin(DM_CALLS,"Model::clearTrajectory"); + dbgBegin(Debug::Calls,"Model::clearTrajectory"); frames_.clear(); if (trajectoryFile_ != NULL) { @@ -83,14 +83,14 @@ void Model::clearTrajectory() totalFrames_ = 0; framePosition_ = 0; trajectoryCached_ = FALSE; - dbgEnd(DM_CALLS,"Model::clearTrajectory"); + dbgEnd(Debug::Calls,"Model::clearTrajectory"); } // Initialise trajectory bool Model::initialiseTrajectory(const char *fname, Filter *f) { // Associate the supplied trajectory file with the model - dbgBegin(DM_CALLS,"Model::initialiseTrajectory"); + dbgBegin(Debug::Calls,"Model::initialiseTrajectory"); bool success; // Delete old frames and unset old file if (trajectoryFile_ != NULL) trajectoryFile_->close(); @@ -99,11 +99,11 @@ bool Model::initialiseTrajectory(const char *fname, Filter *f) trajectoryFile_ = new ifstream(fname,ios::in); if (!trajectoryFile_->good()) { - msg(DM_NONE,"Trajectory file '%s' couldn't be opened.\n",fname); + msg(Debug::None,"Trajectory file '%s' couldn't be opened.\n",fname); trajectoryFile_->close(); trajectoryFile_ = NULL; trajectoryFilter_ = NULL; - dbgEnd(DM_CALLS,"Model::initialiseTrajectory"); + dbgEnd(Debug::Calls,"Model::initialiseTrajectory"); return FALSE; } // Associate the file with the trajectory @@ -112,11 +112,11 @@ bool Model::initialiseTrajectory(const char *fname, Filter *f) // Read header if (!trajectoryFilter_->execute("",trajectoryFile_,TRUE,this)) { - msg(DM_NONE,"Error reading header of trajectory file.\n"); + msg(Debug::None,"Error reading header of trajectory file.\n"); trajectoryFile_->close(); trajectoryFile_ = NULL; trajectoryFilter_ = NULL; - dbgEnd(DM_CALLS,"Model::initialiseTrajectory"); + dbgEnd(Debug::Calls,"Model::initialiseTrajectory"); return FALSE; } // Store this file position, since it should represent the start of the frame data @@ -128,41 +128,41 @@ bool Model::initialiseTrajectory(const char *fname, Filter *f) //printf("Initialised config\n"); if (!trajectoryFilter_->execute("",trajectoryFile_,FALSE,&testframe)) { - msg(DM_NONE,"Error testing frame read from trajectory.\n"); + msg(Debug::None,"Error testing frame read from trajectory.\n"); trajectoryFile_->close(); trajectoryFile_ = NULL; trajectoryFilter_ = NULL; - dbgEnd(DM_CALLS,"Model::initialiseTrajectory"); + dbgEnd(Debug::Calls,"Model::initialiseTrajectory"); return FALSE; } streampos endofframe = trajectoryFile_->tellg(); frameSize_ = endofframe - trajectoryFirstFrame_; - msg(DM_NONE,"Single frame is %i kb.\n",frameSize_/1024); + msg(Debug::None,"Single frame is %i kb.\n",frameSize_/1024); trajectoryFile_->seekg(0,ios::end); streampos endoffile = trajectoryFile_->tellg(); totalFrames_ = (endoffile - trajectoryFirstFrame_) / frameSize_; trajectoryLastFrame_ = trajectoryFirstFrame_ + streampos((totalFrames_ - 1) * frameSize_); - msg(DM_VERBOSE,"File position of first = %lu, frameSize_ = %i, nframes =%i\n", int(trajectoryFirstFrame_),frameSize_,totalFrames_); + msg(Debug::Verbose,"File position of first = %lu, frameSize_ = %i, nframes =%i\n", int(trajectoryFirstFrame_),frameSize_,totalFrames_); trajectoryFile_->seekg(trajectoryFirstFrame_); // Pre-Cache frame(s) - msg(DM_NONE,"Successfully associated trajectory.\n"); - msg(DM_NONE,"Number of frames in file : %i\n",totalFrames_); + msg(Debug::None,"Successfully associated trajectory.\n"); + msg(Debug::None,"Number of frames in file : %i\n",totalFrames_); // If we are caching the trajectory, read in all frames here. Otherwise, just the first - msg(DM_NONE,"Estimated trajectory size is %li kb, cache limit = %i kb\n", totalFrames_ * frameSize_/1024, prefs.cacheLimit()); + msg(Debug::None,"Estimated trajectory size is %li kb, cache limit = %i kb\n", totalFrames_ * frameSize_/1024, prefs.cacheLimit()); if ((totalFrames_ * frameSize_)/1024 < prefs.cacheLimit()) { - msg(DM_NONE,"Caching all frames from trajectory...\n"); + msg(Debug::None,"Caching all frames from trajectory...\n"); // Read all frames from trajectory file for (int n=0; nsetTrajectoryParent(this); success = trajectoryFilter_->execute("", trajectoryFile_, FALSE, newframe); - if (success) msg(DM_NONE,"Read frame %i from file.\n",n+1); + if (success) msg(Debug::None,"Read frame %i from file.\n",n+1); else { frames_.remove(newframe); - msg(DM_NONE,"Cached %i frames from trajectory before fail.\n", n-1); + msg(Debug::None,"Cached %i frames from trajectory before fail.\n", n-1); break; } } @@ -177,26 +177,26 @@ bool Model::initialiseTrajectory(const char *fname, Filter *f) if (!trajectoryFilter_->execute("", trajectoryFile_, FALSE, newframe)) { frames_.remove(newframe); - msg(DM_NONE,"Error when reading frame data.\n"); - dbgEnd(DM_CALLS,"Model::initialiseTrajectory"); + msg(Debug::None,"Error when reading frame data.\n"); + dbgEnd(Debug::Calls,"Model::initialiseTrajectory"); return FALSE; } } setRenderFromFrames(); - dbgEnd(DM_CALLS,"Model::initialiseTrajectory"); + dbgEnd(Debug::Calls,"Model::initialiseTrajectory"); return TRUE; } // Add frame to trajectory Model *Model::addFrame() { - dbgBegin(DM_CALLS,"Model::addFrame"); + dbgBegin(Debug::Calls,"Model::addFrame"); Model *newframe = frames_.add(); nCachedFrames_ ++; // Set currentFrame_ here (always points to the last added frame) currentFrame_ = newframe; framePosition_ = nCachedFrames_; - dbgEnd(DM_CALLS,"Model::addFrame"); + dbgEnd(Debug::Calls,"Model::addFrame"); return newframe; } @@ -204,29 +204,29 @@ Model *Model::addFrame() void Model::removeFrame(Model *xframe) { // Delete the specified frame from the trajectory structure - dbgBegin(DM_CALLS,"Model::removeFrame"); + dbgBegin(Debug::Calls,"Model::removeFrame"); if (xframe == currentFrame_) currentFrame_ = (xframe->next == NULL ? xframe->prev : xframe->next); frames_.remove(xframe); nCachedFrames_ --; - dbgEnd(DM_CALLS,"trajectory::deleteFrame"); + dbgEnd(Debug::Calls,"trajectory::deleteFrame"); } // Seek to first frame void Model::seekFirstFrame() { // Seek to the first frame in the trajectory - dbgBegin(DM_CALLS,"Model::seekFirstFrame"); + dbgBegin(Debug::Calls,"Model::seekFirstFrame"); // Check that a trajectory exists! if (totalFrames_ == 0) { - msg(DM_NONE,"No trajectory is available.\n"); - dbgEnd(DM_CALLS,"Model::seekFirstFrame"); + msg(Debug::None,"No trajectory is available.\n"); + dbgEnd(Debug::Calls,"Model::seekFirstFrame"); return; } if (framePosition_ == 1) { - msg(DM_NONE,"Already at start of trajectory.\n"); - dbgEnd(DM_CALLS,"Model::seekFirstFrame"); + msg(Debug::None,"Already at start of trajectory.\n"); + dbgEnd(Debug::Calls,"Model::seekFirstFrame"); return; } currentFrame_ = frames_.first(); @@ -238,53 +238,53 @@ void Model::seekFirstFrame() } framePosition_ = 1; logChange(LOG_VISUAL); - msg(DM_NONE,"Seek to frame %i\n",framePosition_); - dbgEnd(DM_CALLS,"Model::seekFirstFrame"); + msg(Debug::None,"Seek to frame %i\n",framePosition_); + dbgEnd(Debug::Calls,"Model::seekFirstFrame"); } // Seek to next frame void Model::seekNextFrame() { // Seek to the next frame in the trajectory - dbgBegin(DM_CALLS,"Model::seekNextFrame"); + dbgBegin(Debug::Calls,"Model::seekNextFrame"); // Check that a trajectory exists! if (totalFrames_ == 0) { - msg(DM_NONE,"No trajectory is available.\n"); - dbgEnd(DM_CALLS,"Model::seekNextFrame"); + msg(Debug::None,"No trajectory is available.\n"); + dbgEnd(Debug::Calls,"Model::seekNextFrame"); return; } bool success; if (framePosition_ == totalFrames_) { - msg(DM_NONE,"Already at end of trajectory (frame %i).\n",framePosition_); - dbgEnd(DM_CALLS,"Model::seekNextFrame"); + msg(Debug::None,"Already at end of trajectory (frame %i).\n",framePosition_); + dbgEnd(Debug::Calls,"Model::seekNextFrame"); return; } if (trajectoryCached_) currentFrame_ = currentFrame_->next; else success = trajectoryFilter_->execute("", trajectoryFile_, FALSE, frames_.first()); framePosition_ ++; logChange(LOG_VISUAL); - msg(DM_NONE,"Seek to frame %i\n",framePosition_); - dbgEnd(DM_CALLS,"Model::seekNextFrame"); + msg(Debug::None,"Seek to frame %i\n",framePosition_); + dbgEnd(Debug::Calls,"Model::seekNextFrame"); } // Seek to previous frame void Model::seekPreviousFrame() { // Seek to the previous frame in the trajectory - dbgBegin(DM_CALLS,"Model::seekPreviousFrame"); + dbgBegin(Debug::Calls,"Model::seekPreviousFrame"); // Check that a trajectory exists! if (totalFrames_ == 0) { - msg(DM_NONE,"No trajectory is available.\n"); - dbgEnd(DM_CALLS,"Model::seekPreviousFrame"); + msg(Debug::None,"No trajectory is available.\n"); + dbgEnd(Debug::Calls,"Model::seekPreviousFrame"); return; } if (framePosition_ == 1) { - msg(DM_NONE,"Already at start of trajectory.\n"); - dbgEnd(DM_CALLS,"Model::seekPreviousFrame"); + msg(Debug::None,"Already at start of trajectory.\n"); + dbgEnd(Debug::Calls,"Model::seekPreviousFrame"); return; } if (trajectoryCached_) currentFrame_ = currentFrame_->prev; @@ -297,20 +297,20 @@ void Model::seekPreviousFrame() } framePosition_ --; logChange(LOG_VISUAL); - msg(DM_NONE,"Seek to frame %i\n",framePosition_); - dbgEnd(DM_CALLS,"Model::seekPreviousFrame"); + msg(Debug::None,"Seek to frame %i\n",framePosition_); + dbgEnd(Debug::Calls,"Model::seekPreviousFrame"); } // Seek to last frame void Model::seekLastFrame() { // Seek to the last frame in the trajectory - dbgBegin(DM_CALLS,"Model::seekLastFrame"); + dbgBegin(Debug::Calls,"Model::seekLastFrame"); // Check that a trajectory exists! if (totalFrames_ == 0) { - msg(DM_NONE,"No trajectory is available.\n"); - dbgEnd(DM_CALLS,"Model::seekLastFrame"); + msg(Debug::None,"No trajectory is available.\n"); + dbgEnd(Debug::Calls,"Model::seekLastFrame"); return; } if (trajectoryCached_) currentFrame_ = frames_.last(); @@ -322,6 +322,6 @@ void Model::seekLastFrame() } framePosition_ = totalFrames_; logChange(LOG_VISUAL); - msg(DM_NONE,"Seek to frame %i\n",framePosition_); - dbgEnd(DM_CALLS,"Model::seekLastFrame"); + msg(Debug::None,"Seek to frame %i\n",framePosition_); + dbgEnd(Debug::Calls,"Model::seekLastFrame"); } diff --git a/src/model/transform.cpp b/src/model/transform.cpp index efa81fd03..9e2ec8718 100644 --- a/src/model/transform.cpp +++ b/src/model/transform.cpp @@ -49,10 +49,10 @@ void Model::prepareTransform() // work properly in periodic systems). We re-fold the positions on mouse-up. int nadded; // Return if no cog could be defined (i.e. no atoms selected) - dbgBegin(DM_CALLS,"Model::prepareTransform"); + dbgBegin(Debug::Calls,"Model::prepareTransform"); if (nSelected_ < 1) { - dbgEnd(DM_CALLS,"Model::prepareTransform"); + dbgEnd(Debug::Calls,"Model::prepareTransform"); return; } cog.zero(); @@ -63,7 +63,7 @@ void Model::prepareTransform() localcog = cog; Vec4 pvec = worldToScreen(localcog); translateScale_ = pvec.w; - dbgEnd(DM_CALLS,"Model::prepareTransform"); + dbgEnd(Debug::Calls,"Model::prepareTransform"); } // Finalize Model Manipulation @@ -98,7 +98,7 @@ void Model::rotateSelectionWorld(double dx, double dy) // We are passed the 2D-movement of the mouse, which we use to generate a rotation matrix. // We then apply this to the stored *world* coordinates of // the selected atoms, which we then unproject to get the new model coordinates. - dbgBegin(DM_CALLS,"Model::rotateSelectionWorld"); + dbgBegin(Debug::Calls,"Model::rotateSelectionWorld"); static double rotx, roty, theta, cosx, cosy, sinx, siny; static Vec3 newr; static Mat3 rotmat; @@ -122,21 +122,21 @@ void Model::rotateSelectionWorld(double dx, double dy) } logChange(LOG_VISUAL); projectSelection(); - dbgEnd(DM_CALLS,"Model::rotateSelectionWorld"); + dbgEnd(Debug::Calls,"Model::rotateSelectionWorld"); } // Rotate about defined vector void Model::rotateSelectionVector(Vec3 origin, Vec3 vector, double step) { - dbgBegin(DM_CALLS,"Model::rotateSelectionVector"); + dbgBegin(Debug::Calls,"Model::rotateSelectionVector"); static Mat3 r, u, ut, gr, Igr; Vec3 tempv; int n,m,o; Atom *i = firstSelected(); if (i == NULL) { - msg(DM_NONE,"No atoms selected!\n"); - dbgEnd(DM_CALLS,"Model::rotateSelectionVector"); + msg(Debug::None,"No atoms selected!\n"); + dbgEnd(Debug::Calls,"Model::rotateSelectionVector"); return; } // Generate target coordinate system, defined from xaxis == v and orthogonal vectors from first atom @@ -171,26 +171,26 @@ void Model::rotateSelectionVector(Vec3 origin, Vec3 vector, doub i = i->nextSelected(); } logChange(LOG_STRUCTURE); - dbgEnd(DM_CALLS,"Model::rotateSelectionVector"); + dbgEnd(Debug::Calls,"Model::rotateSelectionVector"); } // Rotation of selection about screen Z-axis void Model::rotateSelectionZaxis(double dz) { // Rotate about the perceived z-axis by changing the up vector of the camera. - dbgBegin(DM_CALLS,"Model::rotateSelectionZaxis"); + dbgBegin(Debug::Calls,"Model::rotateSelectionZaxis"); //GLdouble newx, newy; //dx = (dx / DEGRAD ) * 2.0f; //master.activemodel->adjust_camera(0.0,0.0,0.0,dx); //master.activemodel->mmatTransform_all(); - dbgEnd(DM_CALLS,"Model::rotateSelectionZaxis"); + dbgEnd(Debug::Calls,"Model::rotateSelectionZaxis"); } // Translate Selection in world coordinates void Model::translateSelectionWorld(const Vec3 &v) { // Translate the selected atoms in the local XY plane - dbgBegin(DM_CALLS,"Model::translateSelectionWorld"); + dbgBegin(Debug::Calls,"Model::translateSelectionWorld"); static Vec3 newr; // No need to account for orientation / rotation of view, since we do the transformation in world coordinates. // So, take the local coordinates of each selected atom and add our position delta to it. @@ -205,24 +205,24 @@ void Model::translateSelectionWorld(const Vec3 &v) } logChange(LOG_VISUAL); projectSelection(); - dbgEnd(DM_CALLS,"Model::translateSelectionWorld"); + dbgEnd(Debug::Calls,"Model::translateSelectionWorld"); } // Move selected atoms in local space void Model::translateSelectionLocal(const Vec3 &tvec) { // Translate the model's current selection by the vector supplied. - dbgBegin(DM_CALLS,"Model::translateSelectionLocal"); + dbgBegin(Debug::Calls,"Model::translateSelectionLocal"); for (Atom *i = firstSelected(); i != NULL; i = i->nextSelected()) translateAtom(i,tvec); //logChange(LOG_VISUAL); projectSelection(); - dbgEnd(DM_CALLS,"Model::translateSelectionLocal"); + dbgEnd(Debug::Calls,"Model::translateSelectionLocal"); } // Mirror selection in local coordinates void Model::mirrorSelectionLocal(int axis) { - dbgBegin(DM_CALLS,"Model::mirrorSelectionLocal"); + dbgBegin(Debug::Calls,"Model::mirrorSelectionLocal"); // Get selection's local COG Vec3 cog = selectionCog(); Vec3 mimd; @@ -237,15 +237,15 @@ void Model::mirrorSelectionLocal(int axis) } logChange(LOG_VISUAL); projectSelection(); - dbgEnd(DM_CALLS,"Model::mirrorSelectionLocal"); + dbgEnd(Debug::Calls,"Model::mirrorSelectionLocal"); } // Centre current selection at specified coordinates void Model::centre(double newx, double newy, double newz) { - dbgBegin(DM_CALLS,"Model::centre"); + dbgBegin(Debug::Calls,"Model::centre"); Vec3 cog(newx, newy, newz); cog -= selectionCog(); translateSelectionLocal(cog); - dbgEnd(DM_CALLS,"Model::centre"); + dbgEnd(Debug::Calls,"Model::centre"); } diff --git a/src/model/typing.cpp b/src/model/typing.cpp index 6cbc397ae..5173bdba9 100644 --- a/src/model/typing.cpp +++ b/src/model/typing.cpp @@ -55,7 +55,7 @@ void printstuff(Pattern *p) Atom *i = p->firstAtom(); for (int n=0; nnAtoms(); n++) { - msg(DM_VERBOSE,"Atom %i, %s[%i], nbonds=%i, valency=%i, type=%s\n",n,elements.symbol(i), + msg(Debug::Verbose,"Atom %i, %s[%i], nbonds=%i, valency=%i, type=%s\n",n,elements.symbol(i), i->id(),i->nBonds(),elements.valency(i),text_from_AE(i->env())); i = i->next; } @@ -73,7 +73,7 @@ void Model::setAtomtype(Atom *i, ForcefieldAtom *ffa, bool fixed) void Model::describeAtoms() { // Locate ring structures, augment bonding, and assign atom hybridisations in all patterns. - dbgBegin(DM_CALLS,"Model::describeAtoms"); + dbgBegin(Debug::Calls,"Model::describeAtoms"); for (Pattern *p = patterns_.first(); p != NULL; p = p->next) { // 1) Locate ring structures @@ -89,7 +89,7 @@ void Model::describeAtoms() // 4) Go through the ring list and see if any are aromatic for (Ring *r = p->rings(); r != NULL; r = r->next) if (r->isAromatic()) r->setAromatic(); } - dbgEnd(DM_CALLS,"Model::describeAtoms"); + dbgEnd(Debug::Calls,"Model::describeAtoms"); } // Type all atoms @@ -98,13 +98,13 @@ bool Model::typeAll() // Perform forcefield typing on all patterns in the model. // Most routines here only use the first molecule in the pattern, so we must propagate the type info // to other molecules at the end. - dbgBegin(DM_CALLS,"Model::typeAll"); + dbgBegin(Debug::Calls,"Model::typeAll"); // Must have a valid pattern... autocreatePatterns(); if (!arePatternsValid()) { - msg(DM_NONE,"Atom typing cannot be performed without a valid pattern.\n Check pattern definition.\n"); - dbgEnd(DM_CALLS,"Model::typeAll"); + msg(Debug::None,"Atom typing cannot be performed without a valid pattern.\n Check pattern definition.\n"); + dbgEnd(Debug::Calls,"Model::typeAll"); return FALSE; } // Describe the atoms / rings in the patterns @@ -112,18 +112,18 @@ bool Model::typeAll() // Assign forcefield types to atoms for (Pattern *p = patterns_.first(); p != NULL; p = p->next) { - msg(DM_NONE,"Typing pattern %s...",p->name()); + msg(Debug::None,"Typing pattern %s...",p->name()); if (!p->typeAtoms()) { - dbgEnd(DM_CALLS,"Model::typeAll"); + dbgEnd(Debug::Calls,"Model::typeAll"); return FALSE; } // Finally, propagate the data now contained in the initial molecule in each pattern to all other molecules p->propagateAtomtypes(); p->propagateBondTypes(); - msg(DM_NONE,"Done.\n"); + msg(Debug::None,"Done.\n"); } - dbgEnd(DM_CALLS,"Model::typeAll"); + dbgEnd(Debug::Calls,"Model::typeAll"); return TRUE; } @@ -131,21 +131,21 @@ bool Model::typeAll() void Pattern::clearHybrids() { // Set all environment flags of the atoms in pattern to AE_UNSPECIFIED - dbgBegin(DM_CALLS,"Pattern::clearHybrids"); + dbgBegin(Debug::Calls,"Pattern::clearHybrids"); Atom *i = firstAtom_; for (int n=0; nsetEnv(AE_UNSPECIFIED); i = i->next; } - dbgEnd(DM_CALLS,"Pattern::clearHybrids"); + dbgEnd(Debug::Calls,"Pattern::clearHybrids"); } // Assign hybridisation data void Pattern::assignHybrids() { // Assign hybridisation types to the atoms in this pattern. - dbgBegin(DM_CALLS,"Pattern::assignHybrids"); + dbgBegin(Debug::Calls,"Pattern::assignHybrids"); Atom *i = firstAtom_; for (int n=0; nnext; } - dbgEnd(DM_CALLS,"Pattern::assignHybrids"); + dbgEnd(Debug::Calls,"Pattern::assignHybrids"); } // Type atoms in pattern @@ -182,7 +182,7 @@ bool Pattern::typeAtoms() // type description, we reject it. Otherwise, store the number of criteria that matched and only // accept a different atom type if we manage to match a complete set containing more rules. // Return FALSE if one or more atoms could not be typed - dbgBegin(DM_CALLS,"Pattern::typeAtoms"); + dbgBegin(Debug::Calls,"Pattern::typeAtoms"); int a, n, newmatch, bestmatch, nfailed; Atomtype *at; Atom *i; @@ -194,8 +194,8 @@ bool Pattern::typeAtoms() if (forcefield_ == NULL) forcefield_ = master.defaultForcefield(); if (forcefield_ == NULL) { - msg(DM_NONE,"Can't type pattern '%s' - no FF associated to pattern or model, and no default set.\n",name_.get()); - dbgEnd(DM_CALLS,"Pattern::typeAtoms"); + msg(Debug::None,"Can't type pattern '%s' - no FF associated to pattern or model, and no default set.\n",name_.get()); + dbgEnd(Debug::Calls,"Pattern::typeAtoms"); return FALSE; } // Loop over atoms in the pattern's molecule @@ -209,13 +209,13 @@ bool Pattern::typeAtoms() i = i->next; continue; } - msg(DM_TYPING,"Pattern::typeAtoms : FFTyping atom number %i, element %s\n",a,elements.symbol(i->element())); + msg(Debug::Typing,"Pattern::typeAtoms : FFTyping atom number %i, element %s\n",a,elements.symbol(i->element())); bestmatch = 0; parent_->setAtomtype(i, NULL, FALSE); // Check for element 'XX' first if (i->element() == 0) { - msg(DM_NONE,"Failed to type atom %i since it has no element type.\n",i->id()+1); + msg(Debug::None,"Failed to type atom %i since it has no element type.\n",i->id()+1); nfailed ++; result = FALSE; } @@ -227,9 +227,9 @@ bool Pattern::typeAtoms() // First, check element is the same, otherwise skip if (i->element() != at->characterElement()) continue; // See how well this ff description matches the environment of our atom 'i' - msg(DM_TYPING,"Pattern::typeAtoms : Matching type id %i\n",ffa->typeId()); + msg(Debug::Typing,"Pattern::typeAtoms : Matching type id %i\n",ffa->typeId()); newmatch = at->matchAtom(i,&rings_,parent_,i); - msg(DM_TYPING,"Pattern::typeAtoms : ...Total match score for type %i = %i\n",ffa->typeId(),newmatch); + msg(Debug::Typing,"Pattern::typeAtoms : ...Total match score for type %i = %i\n",ffa->typeId(),newmatch); if (newmatch > bestmatch) { // Better match found... @@ -237,25 +237,25 @@ bool Pattern::typeAtoms() i->setType(ffa); } } - msg(DM_TYPING,"Pattern::typeAtoms : FFType for atom is : %i\n",i->type()); + msg(Debug::Typing,"Pattern::typeAtoms : FFType for atom is : %i\n",i->type()); if (i->type() == NULL) { - msg(DM_NONE,"Failed to type atom - %s, id = %i, nbonds = %i.\n",elements.name(i),i->id()+1,i->nBonds()); + msg(Debug::None,"Failed to type atom - %s, id = %i, nbonds = %i.\n",elements.name(i),i->id()+1,i->nBonds()); nfailed ++; result = FALSE; } i = i->next; } // Print warning if we failed... - if (nfailed != 0) msg(DM_NONE,"Failed to type %i atoms in pattern '%s'.\n",nfailed,name_.get()); - dbgEnd(DM_CALLS,"Pattern::typeAtoms"); + if (nfailed != 0) msg(Debug::None,"Failed to type %i atoms in pattern '%s'.\n",nfailed,name_.get()); + dbgEnd(Debug::Calls,"Pattern::typeAtoms"); return result; } // Set atomtypes of selected atoms void Model::selectionSetType(ForcefieldAtom *ffa, bool fixed) { - dbgBegin(DM_CALLS,"Pattern::selectionSetType"); + dbgBegin(Debug::Calls,"Pattern::selectionSetType"); for (Atom *i = firstSelected(); i != NULL; i = i->nextSelected()) setAtomtype(i, ffa, fixed); - dbgEnd(DM_CALLS,"Pattern::selectionSetType"); + dbgEnd(Debug::Calls,"Pattern::selectionSetType"); } diff --git a/src/model/undo.cpp b/src/model/undo.cpp index e066b394e..835e0e727 100644 --- a/src/model/undo.cpp +++ b/src/model/undo.cpp @@ -38,12 +38,12 @@ Undostate *Model::currentRedoState() // Start recording a new undo state void Model::beginUndostate(const char *text) { - dbgBegin(DM_CALLS,"Model::beginUndostate"); + dbgBegin(Debug::Calls,"Model::beginUndostate"); // First, check that we're not already recording a state if (recordingState_ != NULL) { printf("Model::beginUndostate <<<< Last state has not been stored >>>>\n"); - dbgEnd(DM_CALLS,"Model::beginUndostate"); + dbgEnd(Debug::Calls,"Model::beginUndostate"); return; } // Create a new state for us to add to @@ -52,27 +52,27 @@ void Model::beginUndostate(const char *text) recordingState_->setStartLog(LOG_STRUCTURE, logs_[LOG_STRUCTURE]); recordingState_->setStartLog(LOG_COORDS, logs_[LOG_COORDS]); recordingState_->setStartLog(LOG_SELECTION, logs_[LOG_SELECTION]); - msg(DM_VERBOSE,"Undo list prepped for new state.\n"); - msg(DM_VERBOSE," --- Logs at start of state are: structure = %i, coords = %i, selection = %i\n", logs_[LOG_STRUCTURE], logs_[LOG_COORDS], logs_[LOG_SELECTION]); - dbgEnd(DM_CALLS,"Model::beginUndostate"); + msg(Debug::Verbose,"Undo list prepped for new state.\n"); + msg(Debug::Verbose," --- Logs at start of state are: structure = %i, coords = %i, selection = %i\n", logs_[LOG_STRUCTURE], logs_[LOG_COORDS], logs_[LOG_SELECTION]); + dbgEnd(Debug::Calls,"Model::beginUndostate"); } // Finish recording the new undo state void Model::endUndostate() { - dbgBegin(DM_CALLS,"Model::endUndostate"); + dbgBegin(Debug::Calls,"Model::endUndostate"); // Make sure that we have a valid state to store... if (recordingState_ == NULL) { printf("Model::endUndostate <<<< No state to store >>>>\n"); - dbgEnd(DM_CALLS,"Model::endUndostate"); + dbgEnd(Debug::Calls,"Model::endUndostate"); return; } // ...and that it contains something if (recordingState_->nChanges() == 0) { recordingState_ = NULL; - dbgEnd(DM_CALLS,"Model::endUndostate"); + dbgEnd(Debug::Calls,"Model::endUndostate"); return; } recordingState_->setEndLog(LOG_STRUCTURE, logs_[LOG_STRUCTURE]); @@ -85,21 +85,21 @@ void Model::endUndostate() undoStates_.own(recordingState_); // Set the current undo level to the new state and nullify the pointer currentUndostate_ = recordingState_; - msg(DM_VERBOSE,"Undo list now has %i states (%i events caught in last state).\n",undoStates_.nItems(),currentUndostate_->nChanges()); - msg(DM_VERBOSE," --- Logs at end of state are: structure = %i, coords = %i, selection = %i\n", logs_[LOG_STRUCTURE], logs_[LOG_COORDS], logs_[LOG_SELECTION]); + msg(Debug::Verbose,"Undo list now has %i states (%i events caught in last state).\n",undoStates_.nItems(),currentUndostate_->nChanges()); + msg(Debug::Verbose," --- Logs at end of state are: structure = %i, coords = %i, selection = %i\n", logs_[LOG_STRUCTURE], logs_[LOG_COORDS], logs_[LOG_SELECTION]); // Nullify the redostate pointer, since we must now be at the top of the undo stack currentRedoState_ = NULL; recordingState_ = NULL; // Check the size of the undoStates_ list - if greater than prefs.maxundo, must remove the first item in the list if (undoStates_.nItems() == (prefs.maxUndoLevels()+1)) undoStates_.remove(undoStates_.first()); - dbgEnd(DM_CALLS,"Model::endUndostate"); + dbgEnd(Debug::Calls,"Model::endUndostate"); } // Perform actions in current Undostate void Model::undo() { - dbgBegin(DM_CALLS,"Model::undo"); - if (currentUndostate_ == NULL) msg(DM_NONE,"Nothing to undo.\n"); + dbgBegin(Debug::Calls,"Model::undo"); + if (currentUndostate_ == NULL) msg(Debug::None,"Nothing to undo.\n"); else { // Undo the changes @@ -112,14 +112,14 @@ void Model::undo() currentRedoState_ = currentUndostate_; currentUndostate_ = currentUndostate_->prev; } - dbgEnd(DM_CALLS,"Model::undo"); + dbgEnd(Debug::Calls,"Model::undo"); } // Perform actions in current Undostate void Model::redo() { - dbgBegin(DM_CALLS,"Model::redo"); - if (currentRedoState_ == NULL) msg(DM_NONE,"Nothing to redo.\n"); + dbgBegin(Debug::Calls,"Model::redo"); + if (currentRedoState_ == NULL) msg(Debug::None,"Nothing to redo.\n"); else { // Undo the changes @@ -132,5 +132,5 @@ void Model::redo() currentUndostate_ = currentRedoState_; currentRedoState_ = currentRedoState_->next; } - dbgEnd(DM_CALLS,"Model::redo"); + dbgEnd(Debug::Calls,"Model::redo"); } diff --git a/src/model/view.cpp b/src/model/view.cpp index bdbab7757..d2d659739 100644 --- a/src/model/view.cpp +++ b/src/model/view.cpp @@ -89,7 +89,7 @@ double Model::orthoSize() void Model::setRotation(double rotx, double roty) { // Rotate the whole system by the amounts specified. - dbgBegin(DM_CALLS,"Model::setRotation"); + dbgBegin(Debug::Calls,"Model::setRotation"); static double sinx, cosx, siny, cosy; rotationMatrix_.setIdentity(); // Calculate cos/sin terms for needless speedup! @@ -105,14 +105,14 @@ void Model::setRotation(double rotx, double roty) calculateViewMatrix(); // Log camera change logChange(LOG_CAMERA); - dbgEnd(DM_CALLS,"Model::setRotation"); + dbgEnd(Debug::Calls,"Model::setRotation"); } // Adjust Camera void Model::adjustCamera(double dx, double dy, double dz, double angle) { // Adjust the models camera variables - dbgBegin(DM_CALLS,"Model::adjustCamera"); + dbgBegin(Debug::Calls,"Model::adjustCamera"); double sincam, coscam; rCamera_.x += dx; rCamera_.y += dy; @@ -129,13 +129,13 @@ void Model::adjustCamera(double dx, double dy, double dz, double angle) calculateViewMatrix(); // Log camera change logChange(LOG_CAMERA); - dbgEnd(DM_CALLS,"Model::adjustCamera"); + dbgEnd(Debug::Calls,"Model::adjustCamera"); } // Adjust orthographic size void Model::adjustOrthoSize(double delta) { - dbgBegin(DM_CALLS,"Model::adjustOrthoSize"); + dbgBegin(Debug::Calls,"Model::adjustOrthoSize"); #ifdef HAS_GUI orthoSize_ += delta; if (orthoSize_ < 1.0) orthoSize_ = 1.0; @@ -145,14 +145,14 @@ void Model::adjustOrthoSize(double delta) // Log camera change logChange(LOG_CAMERA); #endif - dbgEnd(DM_CALLS,"Model::adjustOrthoSize"); + dbgEnd(Debug::Calls,"Model::adjustOrthoSize"); } // Reset Camera void Model::resetCamera(const Vec3 &newr) { // Adjust the models camera variables - dbgBegin(DM_CALLS,"Model::resetCamera"); + dbgBegin(Debug::Calls,"Model::resetCamera"); #ifdef HAS_GUI rCamera_ = newr; cameraRotation_ = 0.0; @@ -166,14 +166,14 @@ void Model::resetCamera(const Vec3 &newr) // Log camera change logChange(LOG_CAMERA); #endif - dbgEnd(DM_CALLS,"Model::resetCamera"); + dbgEnd(Debug::Calls,"Model::resetCamera"); } // Reset View void Model::resetView() { // Reset the modelview matrix and the camera - dbgBegin(DM_CALLS,"Model::resetView"); + dbgBegin(Debug::Calls,"Model::resetView"); #ifdef HAS_GUI static Vec3 newcam, newscreen; Atom *i, target; @@ -207,14 +207,14 @@ void Model::resetView() // Log camera change logChange(LOG_CAMERA); #endif - dbgEnd(DM_CALLS,"Model::resetView"); + dbgEnd(Debug::Calls,"Model::resetView"); } // Rotate free void Model::rotate(double dx, double dy) { // Rotate the whole system by the amounts specified. - dbgBegin(DM_CALLS,"Model::rotate"); + dbgBegin(Debug::Calls,"Model::rotate"); static double rotx, roty, theta, sinx, cosx, siny, cosy; static Mat4 newrotmat, oldrotmat; cameraRotation_ > PI ? theta = cameraRotation_-2.0*PI : theta = cameraRotation_; @@ -237,7 +237,7 @@ void Model::rotate(double dx, double dy) calculateViewMatrix(); // Log camera change logChange(LOG_CAMERA); - dbgEnd(DM_CALLS,"Model::rotate"); + dbgEnd(Debug::Calls,"Model::rotate"); } // Calculate View Matrix @@ -254,7 +254,7 @@ void Model::calculateViewMatrix() void Model::projectAll() { // Transform the model coordinates of all atoms into world GL and 2D screen coordinates - dbgBegin(DM_CALLS,"Model::projectAll"); + dbgBegin(Debug::Calls,"Model::projectAll"); #ifdef HAS_GUI if (projectionPoint_ != (logs_[LOG_COORDS] + logs_[LOG_CAMERA])) { @@ -262,28 +262,28 @@ void Model::projectAll() projectionPoint_ = logs_[LOG_COORDS] + logs_[LOG_CAMERA]; } #endif - dbgEnd(DM_CALLS,"Model::projectAll"); + dbgEnd(Debug::Calls,"Model::projectAll"); } // Project the coordinates of all selected atoms in the model void Model::projectSelection() { - dbgBegin(DM_CALLS,"Model::projectSelection"); + dbgBegin(Debug::Calls,"Model::projectSelection"); #ifdef HAS_GUI if (gui.mainView.isValid()) for (Atom *i = atoms_.first(); i != NULL; i = i->next) if (i->isSelected()) projectAtom(i); #endif - dbgEnd(DM_CALLS,"Model::projectSelection"); + dbgEnd(Debug::Calls,"Model::projectSelection"); } // Project the coordinates of a single atom in the model void Model::projectAtom(Atom *i) { // Transform the model coordinates of specified atom into world GL and 2D screen coordinates - dbgBegin(DM_MORECALLS,"Model::projectAtom"); + dbgBegin(Debug::MoreCalls,"Model::projectAtom"); #ifdef HAS_GUI if (!gui.mainView.isValid()) { - dbgEnd(DM_MORECALLS,"Model::projectAtom"); + dbgEnd(Debug::MoreCalls,"Model::projectAtom"); return; } static Vec4 modelr, screenr, worldr; @@ -312,14 +312,14 @@ void Model::projectAtom(Atom *i) screenr.y /= screenr.w; i->setScreenRadius(fabs( (vmat[0] + vmat[2]*(screenr.x+1)/2.0) - srx)); #endif - dbgEnd(DM_MORECALLS,"Model::projectAtom"); + dbgEnd(Debug::MoreCalls,"Model::projectAtom"); } Vec4 &Model::worldToScreen(const Vec3 &v) { // Project the supplied world coordinates into screen coordinates. // The returned vec4's 'w' component is the unit 'radius' at that point. - dbgBegin(DM_CALLS,"Model::worldToScreen"); + dbgBegin(Debug::Calls,"Model::worldToScreen"); static Vec4 modelr, screenr, worldr, result; static double x1,x2,radius; static GLint *vmat; @@ -327,7 +327,7 @@ Vec4 &Model::worldToScreen(const Vec3 &v) screenr.zero(); if (!gui.mainView.isValid()) { - dbgEnd(DM_CALLS,"Model::worldToScreen"); + dbgEnd(Debug::Calls,"Model::worldToScreen"); return screenr; } // Projection formula is : worldr = P x M x modelr @@ -349,14 +349,14 @@ Vec4 &Model::worldToScreen(const Vec3 &v) // Store info and return result.w = radius; #endif - dbgEnd(DM_CALLS,"Model::worldToScreen"); + dbgEnd(Debug::Calls,"Model::worldToScreen"); return result; } Vec3 Model::guideToModel(double sx, double sy) { // Convert the screen coordinates passed to a position on the drawing guide, and then into model coordinates - dbgBegin(DM_CALLS,"Model::guideToModel"); + dbgBegin(Debug::Calls,"Model::guideToModel"); static Vec4 guidepoint; static Vec3 newpoint; double radius, depth; @@ -376,7 +376,7 @@ Vec3 Model::guideToModel(double sx, double sy) // Also need to account for periodic systems (which are translated so the cell midpoint is centred in the screen) by adding the cell's centre coordinate newpoint += cell_.centre(); #endif - dbgEnd(DM_CALLS,"Model::guideToModel"); + dbgEnd(Debug::Calls,"Model::guideToModel"); return newpoint; } diff --git a/src/parse/filter.cpp b/src/parse/filter.cpp index 68e5b43dd..7e8502183 100644 --- a/src/parse/filter.cpp +++ b/src/parse/filter.cpp @@ -129,7 +129,7 @@ const char *Filter::description() // Load filter (from file) bool Filter::load(ifstream &filterFile) { - dbgBegin(DM_CALLS,"Filter::load"); + dbgBegin(Debug::Calls,"Filter::load"); Command *c; CommandAction ca; FilterCommmand fc; @@ -145,8 +145,8 @@ bool Filter::load(ifstream &filterFile) success = parser.getArgsDelim(&filterFile,PO_USEQUOTES+PO_SKIPBLANKS); if (success == 1) { - msg(DM_NONE,"Filter::load - Error reading filter file.\n"); - dbgEnd(DM_CALLS,"Filter::load"); + msg(Debug::None,"Filter::load - Error reading filter file.\n"); + dbgEnd(Debug::Calls,"Filter::load"); return FALSE; } else if (success == -1) break; @@ -156,7 +156,7 @@ bool Filter::load(ifstream &filterFile) // Create long filefilter string sprintf(longname,"%s (%s)",name_.get(),glob_.get()); description_ = longname; - dbgEnd(DM_CALLS,"Filter::load"); + dbgEnd(Debug::Calls,"Filter::load"); return TRUE; } // Check for filter specification commands @@ -206,15 +206,15 @@ bool Filter::load(ifstream &filterFile) if (commands_.addCommand(ca)) continue; else { - msg(DM_NONE,"Filter::load <<< Error adding command '%s' >>>>\n", parser.argc(0)); - dbgEnd(DM_CALLS,"Filter::load"); + msg(Debug::None,"Filter::load <<< Error adding command '%s' >>>>\n", parser.argc(0)); + dbgEnd(Debug::Calls,"Filter::load"); return FALSE; } } else { - msg(DM_NONE,"Unrecognised command '%s' in filter.\n", parser.argc(0)); - dbgEnd(DM_CALLS,"Filter::load"); + msg(Debug::None,"Unrecognised command '%s' in filter.\n", parser.argc(0)); + dbgEnd(Debug::Calls,"Filter::load"); return FALSE; } break; @@ -228,17 +228,17 @@ bool Filter::load(ifstream &filterFile) if (itemsleft != 0) { printf("Filter::load <<<< %i block%s not been terminated >>>>\n", itemsleft, (itemsleft == 1 ? " has" : "s have")); - dbgEnd(DM_CALLS,"Filter::load"); + dbgEnd(Debug::Calls,"Filter::load"); return FALSE; } - dbgEnd(DM_CALLS,"Filter::load"); + dbgEnd(Debug::Calls,"Filter::load"); return TRUE; } // Set type (and initialise any necessary variables) void Filter::setType(FilterType ft) { - dbgBegin(DM_CALLS,"Filter::setType"); + dbgBegin(Debug::Calls,"Filter::setType"); type_ = ft; Variable *v; switch (type_) @@ -287,26 +287,26 @@ void Filter::setType(FilterType ft) case (FT_GRID_EXPORT): break; } - dbgEnd(DM_CALLS,"Filter::setType"); + dbgEnd(Debug::Calls,"Filter::setType"); } // Print void Filter::print() { - dbgBegin(DM_CALLS,"Filter::print"); + dbgBegin(Debug::Calls,"Filter::print"); printf("Filter Name : '%s'\n",name_.get()); printf(" Shell glob : '%s'\n",glob_.get()); printf(" Extensions : '%s'\n",extension_.get()); printf("Exact Names : '%s'\n",exactNames_.get()); printf(" Type : %s\n",text_from_FT(type_)); - dbgEnd(DM_CALLS,"Filter::print"); + dbgEnd(Debug::Calls,"Filter::print"); } // Execute filter bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, Model *framemodel) { - dbgBegin(DM_CALLS,"Filter::execute"); + dbgBegin(Debug::Calls,"Filter::execute"); // Grab pointer Bundle from master Bundle &obj = master.current; // Set element mapping type to that specified in file @@ -316,24 +316,24 @@ bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, switch (type_) { case (FT_MODEL_IMPORT): - msg(DM_NONE,"Load Model : %s (%s)\n", filename, name_.get()); + msg(Debug::None,"Load Model : %s (%s)\n", filename, name_.get()); // Reset reserved variables commands_.variables.set("title","Unnamed"); // Open file and set target if (!commands_.setInputFile(filename)) { - msg(DM_NONE,"Error opening input file '%s'.\n",filename); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Error opening input file '%s'.\n",filename); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } break; case (FT_MODEL_EXPORT): - msg(DM_NONE,"Save Model : %s (%s)...", obj.m->filename(), name_.get()); + msg(Debug::None,"Save Model : %s (%s)...", obj.m->filename(), name_.get()); // Open file and set target if (!commands_.setOutputFile(obj.m->filename())) { - msg(DM_NONE,"Error opening output file '%s'.\n",obj.m->filename()); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Error opening output file '%s'.\n",obj.m->filename()); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } // Set variables @@ -341,12 +341,12 @@ bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, commands_.setCellVariables(obj.m->cell()); break; case (FT_EXPRESSION_EXPORT): - msg(DM_NONE,"Save Field : %s (%s)\n", filename, name_.get()); + msg(Debug::None,"Save Field : %s (%s)\n", filename, name_.get()); // Need a valid pattern and energy expression to export if (!obj.m->autocreatePatterns() || !obj.m->createExpression()) { - msg(DM_NONE,"Filter::execute - Must have valid pattern and energy expression to export a field file\n."); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Filter::execute - Must have valid pattern and energy expression to export a field file\n."); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } // Set variables @@ -357,28 +357,28 @@ bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, // Open file... if (!commands_.setOutputFile(filename)) { - msg(DM_NONE,"Error opening field file '%s'.\n", filename); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Error opening field file '%s'.\n", filename); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } break; case (FT_GRID_IMPORT): - msg(DM_NONE,"Load Grid : %s (%s)\n", filename, name_.get()); + msg(Debug::None,"Load Grid : %s (%s)\n", filename, name_.get()); // Open file... if (!commands_.setInputFile(filename)) { - msg(DM_NONE,"Error opening grid file '%s'.\n", filename); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Error opening grid file '%s'.\n", filename); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } break; case (FT_GRID_EXPORT): - msg(DM_NONE,"Save Grid : %s (%s)\n",filename,name_.get()); + msg(Debug::None,"Save Grid : %s (%s)\n",filename,name_.get()); // Open file... if (!commands_.setOutputFile(filename)) { - msg(DM_NONE,"Error opening grid file '%s'.\n", filename); - dbgEnd(DM_CALLS,"Filter::execute"); + msg(Debug::None,"Error opening grid file '%s'.\n", filename); + dbgEnd(Debug::Calls,"Filter::execute"); return FALSE; } break; @@ -392,8 +392,8 @@ bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, Model *parent = framemodel->trajectoryParent(); if (parent == NULL) { - msg(DM_NONE,"Filter::read_trajectory <<<< Trajectory parent is not set in frame model >>>>\n"); - dbgEnd(DM_CALLS,"Filter::read_trajectory(frame)"); + msg(Debug::None,"Filter::read_trajectory <<<< Trajectory parent is not set in frame model >>>>\n"); + dbgEnd(Debug::Calls,"Filter::read_trajectory(frame)"); return FALSE; } commands_.variables.set("natoms",parent->nAtoms()); @@ -416,32 +416,32 @@ bool Filter::execute(const char *filename, ifstream *trajfile, bool trajheader, // Reset element mapping style prefs.setZmapType(temp_zmap); commands_.closeFiles(); - msg(DM_NONE,"Model import %s.\n",(result ? "completed" : "failed")); + msg(Debug::None,"Model import %s.\n",(result ? "completed" : "failed")); break; case (FT_MODEL_EXPORT): obj.m->updateSavePoint(); commands_.closeFiles(); - msg(DM_NONE,"Model export %s.\n",(result ? "completed" : "failed")); + msg(Debug::None,"Model export %s.\n",(result ? "completed" : "failed")); break; case (FT_EXPRESSION_EXPORT): commands_.closeFiles(); - msg(DM_NONE,"Field export %s.\n",(result ? "completed" : "failed")); + msg(Debug::None,"Field export %s.\n",(result ? "completed" : "failed")); break; case (FT_TRAJECTORY_IMPORT): //commands_.close_files(); - //if (trajheader) (result ? msg(DM_NONE,"Trajectory opened successfully.\n") : msg(DM_NONE,"Failed to open trajectory.\n")); - //else if (!result) msg(DM_NONE,"Failed to read frame from trajectory.\n"); + //if (trajheader) (result ? msg(Debug::None,"Trajectory opened successfully.\n") : msg(Debug::None,"Failed to open trajectory.\n")); + //else if (!result) msg(Debug::None,"Failed to read frame from trajectory.\n"); break; case (FT_GRID_IMPORT): commands_.closeFiles(); - msg(DM_NONE,"Grid import %s.\n",(result ? "completed" : "failed")); + msg(Debug::None,"Grid import %s.\n",(result ? "completed" : "failed")); break; case (FT_GRID_EXPORT): commands_.closeFiles(); - msg(DM_NONE,"Grid export %s.\n",(result ? "completed" : "failed")); + msg(Debug::None,"Grid export %s.\n",(result ? "completed" : "failed")); break; } - dbgEnd(DM_CALLS,"Filter::execute"); + dbgEnd(Debug::Calls,"Filter::execute"); return result; } diff --git a/src/parse/forcefield.cpp b/src/parse/forcefield.cpp index 3d92ea052..c3d3da048 100644 --- a/src/parse/forcefield.cpp +++ b/src/parse/forcefield.cpp @@ -37,7 +37,7 @@ double vscale14 = 0.5; // Load the specified forcefield bool Forcefield::load(const char *filename) { - dbgBegin(DM_CALLS,"Forcefield::load"); + dbgBegin(Debug::Calls,"Forcefield::load"); bool done, okay; int success, n, m, count; EnergyUnit ffunit = EU_J, newunit; @@ -45,24 +45,24 @@ bool Forcefield::load(const char *filename) if (!fffile.good()) { fffile.close(); - msg(DM_NONE,"Failed to open forcefield file.\n"); - dbgEnd(DM_CALLS,"Forcefield::load"); + msg(Debug::None,"Failed to open forcefield file.\n"); + dbgEnd(Debug::Calls,"Forcefield::load"); return FALSE; } // Grab the path of the forcefield path_.set(filename); // Now follows blocks of keywords done = FALSE; - msg(DM_NONE,"Opening forcefield : %s...\n",filename); + msg(Debug::None,"Opening forcefield : %s...\n",filename); do { okay = FALSE; success = parser.getArgsDelim(&fffile,PO_USEQUOTES+PO_SKIPBLANKS); if (success == 1) { - msg(DM_NONE,"EreadVdwor reading FF directive.\n"); + msg(Debug::None,"EreadVdwor reading FF directive.\n"); fffile.close(); - dbgEnd(DM_CALLS,"Forcefield::load"); + dbgEnd(Debug::Calls,"Forcefield::load"); return FALSE; } if (success == -1) break; @@ -71,7 +71,7 @@ bool Forcefield::load(const char *filename) { case (FFK_NAME): name_.set(parser.argc(1)); - msg(DM_NONE,"\t: '%s'\n",name_.get()); + msg(Debug::None,"\t: '%s'\n",name_.get()); okay = TRUE; break; case (FFK_UNITS): @@ -79,13 +79,13 @@ bool Forcefield::load(const char *filename) if (newunit != EU_NITEMS) { ffunit = newunit; - msg(DM_NONE,"\t: Energy units are %s\n",text_from_EU(ffunit)); + msg(Debug::None,"\t: Energy units are %s\n",text_from_EU(ffunit)); okay = TRUE; } break; case (FFK_RULES): rules_ = FFR_from_text(parser.argc(1)); - msg(DM_NONE,"\t: Rule-set to use is '%s'\n", text_from_FFR(rules_)); + msg(Debug::None,"\t: Rule-set to use is '%s'\n", text_from_FFR(rules_)); okay = TRUE; break; case (FFK_TYPES): @@ -99,7 +99,7 @@ bool Forcefield::load(const char *filename) break; case (FFK_CONVERT): // Check that generator data has been initialised - if (nGenerators_ == 0) msg(DM_NONE, "\t: ERROR - Energetic parameters to convert must be specified *after* 'generator' keyword.\n"); + if (nGenerators_ == 0) msg(Debug::None, "\t: ERROR - Energetic parameters to convert must be specified *after* 'generator' keyword.\n"); else for (n=1; nname()); - dbgEnd(DM_CALLS,"Forcefield::readTypes"); + msg(Debug::None,"Duplicate forcefield type ID '%i' - already used by type '%s'.\n", newffid, idsearch->name()); + dbgEnd(Debug::Calls,"Forcefield::readTypes"); return FALSE; } ffa = types_.add(); @@ -191,12 +191,12 @@ bool Forcefield::readTypes(ifstream &fffile) } while (!done); if (types_.nItems() == 1) { - msg(DM_NONE,"No atom types specified!\n"); - dbgEnd(DM_CALLS,"Forcefield::readTypes"); + msg(Debug::None,"No atom types specified!\n"); + dbgEnd(Debug::Calls,"Forcefield::readTypes"); return FALSE; } - msg(DM_NONE,"\t: Read in %i type descriptions\n",types_.nItems()); - dbgEnd(DM_CALLS,"Forcefield::readTypes"); + msg(Debug::None,"\t: Read in %i type descriptions\n",types_.nItems()); + dbgEnd(Debug::Calls,"Forcefield::readTypes"); return TRUE; } @@ -205,7 +205,7 @@ bool Forcefield::readGenerator(ifstream &fffile) // Read in generator data for atom types in rule-based forcefields // We expect there to be the same number of sets of data as there are types... // Argument to 'generator' keyword is number of data per atom - dbgBegin(DM_CALLS,"Forcefield::readGenerator"); + dbgBegin(Debug::Calls,"Forcefield::readGenerator"); int count, success, n; ForcefieldAtom *ffa; bool done = FALSE; @@ -221,9 +221,9 @@ bool Forcefield::readGenerator(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor while reading generator data for atom %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file while reading generator data for atom %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readGenerator"); + if (success == 1) msg(Debug::None,"File ereadVdwor while reading generator data for atom %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file while reading generator data for atom %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readGenerator"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -235,8 +235,8 @@ bool Forcefield::readGenerator(ifstream &fffile) ffa = findType(parser.argi(0)); if (ffa == NULL) { - msg(DM_NONE,"Unrecognised forcefield atom id in generator list: '%s'\n",parser.argc(0)); - dbgEnd(DM_CALLS,"Forcefield::readGenerator"); + msg(Debug::None,"Unrecognised forcefield atom id in generator list: '%s'\n",parser.argc(0)); + dbgEnd(Debug::Calls,"Forcefield::readGenerator"); return FALSE; } ffa->initialiseGenerator(); @@ -246,12 +246,12 @@ bool Forcefield::readGenerator(ifstream &fffile) } while (!done); if (count != types_.nItems()-1) { - msg(DM_NONE,"Not all (%i) atom types had generator data defined.\n", types_.nItems()-count-1); - dbgEnd(DM_CALLS,"Forcefield::readGenerator"); + msg(Debug::None,"Not all (%i) atom types had generator data defined.\n", types_.nItems()-count-1); + dbgEnd(Debug::Calls,"Forcefield::readGenerator"); return FALSE; } - msg(DM_NONE,"\t: Read in %i generator data for %i atomtypes.\n", nGenerators_, count); - dbgEnd(DM_CALLS,"Forcefield::readGenerator"); + msg(Debug::None,"\t: Read in %i generator data for %i atomtypes.\n", nGenerators_, count); + dbgEnd(Debug::Calls,"Forcefield::readGenerator"); return TRUE; } @@ -262,7 +262,7 @@ bool Forcefield::readEquivalents(ifstream &fffile) Here, we search/replace specified definitions and set the equiv names to the first name in the list. The equivname doesn't have to exist in the atomtypes itself since the equivalent names are only used in intramolecular parameter searching. */ - dbgBegin(DM_CALLS,"Forcefield::readEquivalents"); + dbgBegin(Debug::Calls,"Forcefield::readEquivalents"); int count, success, argpos; ForcefieldAtom *ffa; bool done = FALSE; @@ -272,9 +272,9 @@ bool Forcefield::readEquivalents(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor while reading equivalents data for atom %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file while reading equivalents data for atom %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readEquivalents"); + if (success == 1) msg(Debug::None,"File ereadVdwor while reading equivalents data for atom %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file while reading equivalents data for atom %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readEquivalents"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -290,8 +290,8 @@ bool Forcefield::readEquivalents(ifstream &fffile) count ++; } } while (!done); - msg(DM_NONE,"\t: Processed %i atomtype equivalents.\n",count); - dbgEnd(DM_CALLS,"Forcefield::readEquivalents"); + msg(Debug::None,"\t: Processed %i atomtype equivalents.\n",count); + dbgEnd(Debug::Calls,"Forcefield::readEquivalents"); return TRUE; } @@ -300,7 +300,7 @@ bool Forcefield::readVdw(ifstream &fffile) // Format of lines is: 'fftype charge data1 data2 ... dataN' // Need not specify the data in the same order as for the type data above, // so search for the fftype read in... - dbgBegin(DM_CALLS,"Forcefield::readVdw"); + dbgBegin(Debug::Calls,"Forcefield::readVdw"); int success, count; ForcefieldAtom *ffa; // Get functional form of vdw @@ -308,7 +308,7 @@ bool Forcefield::readVdw(ifstream &fffile) if (vdwstyle == VF_NITEMS) { vdwstyle = VF_UNSPECIFIED; - msg(DM_NONE,"VDW functional form not recognised - '%s'\n",parser.argc(1)); + msg(Debug::None,"VDW functional form not recognised - '%s'\n",parser.argc(1)); return FALSE; } // TODO allow 'same' directive? @@ -320,9 +320,9 @@ bool Forcefield::readVdw(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor reading VDW data for atom %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file while reading VDW data for atom %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readVdw"); + if (success == 1) msg(Debug::None,"File ereadVdwor reading VDW data for atom %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file while reading VDW data for atom %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readVdw"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -331,8 +331,8 @@ bool Forcefield::readVdw(ifstream &fffile) ffa = findType(parser.argi(0)); if (ffa == NULL) { - msg(DM_NONE,"Unrecognised forcefield atom id in VDW list: '%s'\n",parser.argc(0)); - dbgEnd(DM_CALLS,"Forcefield::readVdw"); + msg(Debug::None,"Unrecognised forcefield atom id in VDW list: '%s'\n",parser.argc(0)); + dbgEnd(Debug::Calls,"Forcefield::readVdw"); return FALSE; } ffa->setCharge(parser.argd(2)); @@ -340,19 +340,19 @@ bool Forcefield::readVdw(ifstream &fffile) ffa->params().data[1] = parser.argd(4); ffa->params().data[2] = parser.argd(5); ffa->setVdwForm(vdwstyle); - msg(DM_VERBOSE,"VDW Data %i : %s %8.4f %8.4f %8.4f %8.4f\n", ffa->typeId(), ffa->name(), ffa->params().data[0], ffa->params().data[1], ffa->params().data[2], ffa->charge()); + msg(Debug::Verbose,"VDW Data %i : %s %8.4f %8.4f %8.4f %8.4f\n", ffa->typeId(), ffa->name(), ffa->params().data[0], ffa->params().data[1], ffa->params().data[2], ffa->charge()); count ++; } } while (!done); - msg(DM_NONE,"\t: Read in %i atomic VDW parameters\n",count); - dbgEnd(DM_CALLS,"Forcefield::readVdw"); + msg(Debug::None,"\t: Read in %i atomic VDW parameters\n",count); + dbgEnd(Debug::Calls,"Forcefield::readVdw"); return TRUE; } bool Forcefield::readBonds(ifstream &fffile) { // Read in bond specifications - dbgBegin(DM_CALLS,"Forcefield::readBonds"); + dbgBegin(Debug::Calls,"Forcefield::readBonds"); ForcefieldBound *newffbond; bool done = FALSE; int count, success, n; @@ -361,7 +361,7 @@ bool Forcefield::readBonds(ifstream &fffile) if (bondstyle == BF_NITEMS) { bondstyle = BF_UNSPECIFIED; - msg(DM_NONE,"Bond stretch functional form not recognised - '%s'\n",parser.argc(1)); + msg(Debug::None,"Bond stretch functional form not recognised - '%s'\n",parser.argc(1)); return FALSE; } count = 0; @@ -372,9 +372,9 @@ bool Forcefield::readBonds(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor reading bond data %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file ereadVdwor reading bond data %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readBonds"); + if (success == 1) msg(Debug::None,"File ereadVdwor reading bond data %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file ereadVdwor reading bond data %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readBonds"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -385,7 +385,7 @@ bool Forcefield::readBonds(ifstream &fffile) for (n=0; n<2; n++) { if ((strchr(parser.argc(n),'*') == NULL) && (findType(parser.argc(n)) == NULL)) - msg(DM_NONE,"\t... Warning - bond atom '%s' does not exist in the forcefield!\n", parser.argc(n)); + msg(Debug::None,"\t... Warning - bond atom '%s' does not exist in the forcefield!\n", parser.argc(n)); } // Create new ff_bond structure newffbond = bonds_.add(); @@ -395,19 +395,19 @@ bool Forcefield::readBonds(ifstream &fffile) newffbond->setBondStyle(bondstyle); newffbond->params().data[0] = parser.argd(2); newffbond->params().data[1] = parser.argd(3); - msg(DM_VERBOSE,"BOND %i : %s %s %8.4f %8.4f\n", n, newffbond->typeName(0), newffbond->typeName(1) , newffbond->params().data[0], newffbond->params().data[1]); + msg(Debug::Verbose,"BOND %i : %s %s %8.4f %8.4f\n", n, newffbond->typeName(0), newffbond->typeName(1) , newffbond->params().data[0], newffbond->params().data[1]); count ++; } } while (!done); - msg(DM_NONE,"\t: Read in %i bond definitions (%s)\n",count,text_from_BF(bondstyle)); - dbgEnd(DM_CALLS,"Forcefield::readBonds"); + msg(Debug::None,"\t: Read in %i bond definitions (%s)\n",count,text_from_BF(bondstyle)); + dbgEnd(Debug::Calls,"Forcefield::readBonds"); return TRUE; } bool Forcefield::readAngles(ifstream &fffile) { // Read in angle specifications - dbgBegin(DM_CALLS,"Forcefield::readAngles"); + dbgBegin(Debug::Calls,"Forcefield::readAngles"); ForcefieldBound *newffangle; int count, success, n; // Grab functional form of angle potential @@ -415,7 +415,7 @@ bool Forcefield::readAngles(ifstream &fffile) if (anglestyle == AF_NITEMS) { anglestyle = AF_UNSPECIFIED; - msg(DM_NONE,"Angle bend functional form not recognised - '%s'\n",parser.argc(1)); + msg(Debug::None,"Angle bend functional form not recognised - '%s'\n",parser.argc(1)); return FALSE; } bool done = FALSE; @@ -427,9 +427,9 @@ bool Forcefield::readAngles(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor reading angle data %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file ereadVdwor reading angle data %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readAngles"); + if (success == 1) msg(Debug::None,"File ereadVdwor reading angle data %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file ereadVdwor reading angle data %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readAngles"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -440,7 +440,7 @@ bool Forcefield::readAngles(ifstream &fffile) for (n=0; n<3; n++) { if ((strchr(parser.argc(n),'*') == NULL) && (findType(parser.argc(n)) == NULL)) - msg(DM_NONE,"\t... Warning - angle atom '%s' does not exist in the forcefield!\n",parser.argc(n)); + msg(Debug::None,"\t... Warning - angle atom '%s' does not exist in the forcefield!\n",parser.argc(n)); } // Create new ff_angle structure newffangle = angles_.add(); @@ -451,19 +451,19 @@ bool Forcefield::readAngles(ifstream &fffile) newffangle->setAngleStyle(anglestyle); newffangle->params().data[0] = parser.argd(3); newffangle->params().data[1] = parser.argd(4); - msg(DM_VERBOSE,"ANGLE %i : %s %s %s %8.4f %8.4f\n", n, newffangle->typeName(0), newffangle->typeName(1), newffangle->typeName(2), newffangle->params().data[0], newffangle->params().data[1]); + msg(Debug::Verbose,"ANGLE %i : %s %s %s %8.4f %8.4f\n", n, newffangle->typeName(0), newffangle->typeName(1), newffangle->typeName(2), newffangle->params().data[0], newffangle->params().data[1]); count ++; } } while (!done); - msg(DM_NONE,"\t: Read in %i angle definitions (%s)\n",count,text_from_AF(anglestyle)); - dbgEnd(DM_CALLS,"Forcefield::readAngles"); + msg(Debug::None,"\t: Read in %i angle definitions (%s)\n",count,text_from_AF(anglestyle)); + dbgEnd(Debug::Calls,"Forcefield::readAngles"); return TRUE; } bool Forcefield::readTorsions(ifstream &fffile) { // Read in torsion data - dbgBegin(DM_CALLS,"Forcefield::readTorsions"); + dbgBegin(Debug::Calls,"Forcefield::readTorsions"); ForcefieldBound *newfftorsion; int count, success, n; // Get functional form of torsion potential @@ -471,7 +471,7 @@ bool Forcefield::readTorsions(ifstream &fffile) if (torsionstyle == TF_NITEMS) { torsionstyle = TF_UNSPECIFIED; - msg(DM_NONE,"Torsion twist functional form not recognised - '%s'\n",parser.argc(1)); + msg(Debug::None,"Torsion twist functional form not recognised - '%s'\n",parser.argc(1)); return FALSE; } count = 0; @@ -483,9 +483,9 @@ bool Forcefield::readTorsions(ifstream &fffile) success = parser.getArgsDelim(&fffile,PO_SKIPBLANKS); if (success != 0) { - if (success == 1) msg(DM_NONE,"File ereadVdwor reading torsion data %i.\n",count+1); - if (success == -1) msg(DM_NONE,"End of file ereadVdwor reading torsion data %i.\n",count+1); - dbgEnd(DM_CALLS,"Forcefield::readTorsions"); + if (success == 1) msg(Debug::None,"File ereadVdwor reading torsion data %i.\n",count+1); + if (success == -1) msg(Debug::None,"End of file ereadVdwor reading torsion data %i.\n",count+1); + dbgEnd(Debug::Calls,"Forcefield::readTorsions"); return FALSE; } if (strcmp(parser.argc(0),"end") == 0) done = TRUE; @@ -496,7 +496,7 @@ bool Forcefield::readTorsions(ifstream &fffile) for (n=0; n<4; n++) { if ((strchr(parser.argc(n),'*') == NULL) && (findType(parser.argc(n)) == NULL)) - msg(DM_NONE,"\t... Warning - torsion atom '%s' does not exist in the forcefield!\n",parser.argc(n)); + msg(Debug::None,"\t... Warning - torsion atom '%s' does not exist in the forcefield!\n",parser.argc(n)); } // Create new ff_angle structure newfftorsion = torsions_.add(); @@ -512,11 +512,11 @@ bool Forcefield::readTorsions(ifstream &fffile) newfftorsion->params().data[3] = parser.argd(7); newfftorsion->params().data[TF_ESCALE] = escale14; newfftorsion->params().data[TF_VSCALE] = vscale14; - msg(DM_VERBOSE,"TORSION %i : %s %s %s %s %8.4f %8.4f %8.4f %8.4f\n", n, newfftorsion->typeName(0), newfftorsion->typeName(1), newfftorsion->typeName(2), newfftorsion->typeName(3), newfftorsion->params().data[0], newfftorsion->params().data[1], newfftorsion->params().data[2], newfftorsion->params().data[3]); + msg(Debug::Verbose,"TORSION %i : %s %s %s %s %8.4f %8.4f %8.4f %8.4f\n", n, newfftorsion->typeName(0), newfftorsion->typeName(1), newfftorsion->typeName(2), newfftorsion->typeName(3), newfftorsion->params().data[0], newfftorsion->params().data[1], newfftorsion->params().data[2], newfftorsion->params().data[3]); count ++; } } while (!done); - msg(DM_NONE,"\t: Read in %i torsion definitions (%s)\n",count,text_from_TF(torsionstyle)); - dbgEnd(DM_CALLS,"Forcefield::readTorsions"); + msg(Debug::None,"\t: Read in %i torsion definitions (%s)\n",count,text_from_TF(torsionstyle)); + dbgEnd(Debug::Calls,"Forcefield::readTorsions"); return TRUE; } diff --git a/src/parse/format.cpp b/src/parse/format.cpp index 2f6c618b3..0f34da93e 100644 --- a/src/parse/format.cpp +++ b/src/parse/format.cpp @@ -68,7 +68,7 @@ FormatNode* Format::nodes() // Set format node bool FormatNode::set(const char *s, VariableList &vlist) { - dbgBegin(DM_PARSE,"FormatNode::set"); + dbgBegin(Debug::Parse,"FormatNode::set"); // Format of formatters is 'F@n.m': F = format quantity/variable, n.m = length,precision int m, pos1, pos2; static char specifier[512], len[32], pre[32]; @@ -101,7 +101,7 @@ bool FormatNode::set(const char *s, VariableList &vlist) pre[pos1-(pos2+1)] = '\0'; } } - msg(DM_PARSE,"FormatNode::set : Parsed specifier[%s] length[%s] precision[%s]\n", specifier, len, pre); + msg(Debug::Parse,"FormatNode::set : Parsed specifier[%s] length[%s] precision[%s]\n", specifier, len, pre); // If we're given a variable, check that is has been declared if (specifier[0] == '$') { @@ -119,14 +119,14 @@ bool FormatNode::set(const char *s, VariableList &vlist) // Store the data length_ = (len[0] == '\0' ? 0 : atoi(len)); precision_ = (pre[0] == '\0' ? 0 : atoi(pre)); - dbgEnd(DM_PARSE,"FormatNode::set"); + dbgEnd(Debug::Parse,"FormatNode::set"); return TRUE; } // Create using delimited arguments bool Format::createDelimited(const char *s, VariableList &vlist) { - dbgBegin(DM_PARSE,"Format::createDelimited"); + dbgBegin(Debug::Parse,"Format::createDelimited"); int n; FormatNode *fn; static Parser lp; @@ -142,19 +142,19 @@ bool Format::createDelimited(const char *s, VariableList &vlist) if (!fn->set(lp.argc(n), vlist)) { printf("Failed to add format node '%s'.\n", lp.argc(n)); - dbgEnd(DM_PARSE,"Format::createDelimited"); + dbgEnd(Debug::Parse,"Format::createDelimited"); return FALSE; } } - //if (nfailed != 0) msg(DM_NONE,"Warning : Format string contained %i unrecognised identifiers.\n",nfailed); - dbgEnd(DM_PARSE,"Format::createDelimited"); + //if (nfailed != 0) msg(Debug::None,"Warning : Format string contained %i unrecognised identifiers.\n",nfailed); + dbgEnd(Debug::Parse,"Format::createDelimited"); return TRUE; } // Create using character-by-character method bool Format::createExact(const char *s, VariableList &vlist) { - dbgBegin(DM_PARSE,"Format::createExact"); + dbgBegin(Debug::Parse,"Format::createExact"); // Go through supplied string, converting variables as we go static char text[512], varstr[512]; int nchars = 0, vchars = 0, n; @@ -225,7 +225,7 @@ bool Format::createExact(const char *s, VariableList &vlist) if (!fn->set(varstr, vlist)) { printf("Failed to add format node '%s'.\n", varstr); - dbgEnd(DM_PARSE,"Format::createExact"); + dbgEnd(Debug::Parse,"Format::createExact"); return FALSE; } // Reset vchars for the next cycle @@ -248,11 +248,11 @@ bool Format::createExact(const char *s, VariableList &vlist) if (!fn->set(varstr, vlist)) { printf("Failed to add format node '%s'.\n", varstr); - dbgEnd(DM_PARSE,"Format::createExact"); + dbgEnd(Debug::Parse,"Format::createExact"); return FALSE; } } - dbgEnd(DM_PARSE,"Format::createExact"); + dbgEnd(Debug::Parse,"Format::createExact"); return TRUE; } @@ -266,7 +266,7 @@ bool Format::create(const char *s, VariableList &vars, bool delimited) const char *Format::createString() { // Creates a formatted output string from the model supplied - dbgBegin(DM_PARSE,"Format::createString"); + dbgBegin(Debug::Parse,"Format::createString"); static char result[8096], bit[1024], fmt[16]; static Variable *v; result[0] = '\0'; @@ -297,9 +297,9 @@ const char *Format::createString() default: printf("Variables of type '%s' cannot be used in a format string.\n", text_from_VT(v->type())); } - msg(DM_PARSE,"Format:::createString - added [%s], format [%s]\n", bit, fmt); + msg(Debug::Parse,"Format:::createString - added [%s], format [%s]\n", bit, fmt); strcat(result,bit); } - dbgEnd(DM_PARSE,"Format::createString"); + dbgEnd(Debug::Parse,"Format::createString"); return result; } diff --git a/src/parse/parser.cpp b/src/parse/parser.cpp index 260f51552..d22ca32d7 100644 --- a/src/parse/parser.cpp +++ b/src/parse/parser.cpp @@ -47,7 +47,7 @@ Parser::Parser() bool Parser::getNextArg(int destarg) { // Get the next input chunk from the internal string and put into argument specified - dbgBegin(DM_PARSE,"Parser::getNextArg"); + dbgBegin(Debug::Parse,"Parser::getNextArg"); static int n, arglen; static bool done, hadquotes; static char c, quotechar; @@ -124,7 +124,7 @@ bool Parser::getNextArg(int destarg) // Strip off the characters up to position 'n', but not including position 'n' itself line_.eraseStart(n+1); //printf("Rest of line is now [%s]\n",line.get()); - dbgEnd(DM_PARSE,"Parser::getNextArg"); + dbgEnd(Debug::Parse,"Parser::getNextArg"); return (arglen == 0 ? (hadquotes ? TRUE : FALSE) : TRUE); } @@ -132,12 +132,12 @@ bool Parser::getNextArg(int destarg) bool Parser::getNextN(int length) { // Put the next 'length' characters from source into temparg. - dbgBegin(DM_PARSE,"Parser::getNextN"); + dbgBegin(Debug::Parse,"Parser::getNextN"); int arglen = 0; char c; if (line_.length() == 0) { - dbgEnd(DM_PARSE,"Parser::getNextN"); + dbgEnd(Debug::Parse,"Parser::getNextN"); return FALSE; } if (length > line_.length()) length = line_.length(); @@ -164,7 +164,7 @@ bool Parser::getNextN(int length) // Add terminating character to temparg tempArg_[arglen] = '\0'; line_.eraseStart(length); - dbgEnd(DM_PARSE,"Parser::getNextN"); + dbgEnd(Debug::Parse,"Parser::getNextN"); return TRUE; } @@ -172,7 +172,7 @@ bool Parser::getNextN(int length) void Parser::getAllArgsDelim(Dnchar &source) { // Parse the string in 'source' into arguments in 'args' - dbgBegin(DM_PARSE,"Parser::getAllArgsDelim[string]"); + dbgBegin(Debug::Parse,"Parser::getAllArgsDelim[string]"); nArgs_ = 0; for (int n=0; nlength()); if (!parseresult) { - msg(DM_VERBOSE,"Parser::getAllArgsFormatted <<<< '%s' passed end of line >>>>\n",fn->variable()->name()); + msg(Debug::Verbose,"Parser::getAllArgsFormatted <<<< '%s' passed end of line >>>>\n",fn->variable()->name()); fn->variable()->reset(); } else fn->variable()->set(tempArg_); fn = fn->next; } - dbgEnd(DM_PARSE,"Parser::getAllArgsFormatted"); + dbgEnd(Debug::Parse,"Parser::getAllArgsFormatted"); } /* @@ -221,7 +221,7 @@ int Parser::getArgsDelim(ifstream *xfile, int options) { // Standard file parse routine. // Splits the line from the file into delimited arguments via the 'parseline' function - dbgBegin(DM_PARSE,"Parser::getArgsDelim[file]"); + dbgBegin(Debug::Parse,"Parser::getArgsDelim[file]"); bool done = FALSE; static char linefromfile[MAXLINELENGTH]; // Lines beginning with '#' are ignored as comments @@ -234,13 +234,13 @@ int Parser::getArgsDelim(ifstream *xfile, int options) if (xfile->eof()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::getArgsDelim[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsDelim[file]"); return -1; } if (xfile->fail()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::getArgsDelim[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsDelim[file]"); return 1; } line_ = linefromfile; @@ -250,14 +250,14 @@ int Parser::getArgsDelim(ifstream *xfile, int options) getAllArgsDelim(line_); if ((optionMask_&PO_SKIPBLANKS) && (nArgs_ == 0)) done = FALSE; } while (!done); - dbgEnd(DM_PARSE,"Parser::getArgsDelim[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsDelim[file]"); return 0; } // Get next argument (delimited) from file stream const char *Parser::getArgDelim(ifstream *xfile) { - dbgBegin(DM_PARSE,"Parser::getArgDelim[file]"); + dbgBegin(Debug::Parse,"Parser::getArgDelim[file]"); static char result[512]; static int length; static bool done; @@ -333,7 +333,7 @@ void Parser::getLinesDelim(const char *s) // Skip lines from file int Parser::skipLines(ifstream *xfile, int nlines) { - dbgBegin(DM_PARSE,"Parser::skipLines"); + dbgBegin(Debug::Parse,"Parser::skipLines"); static char skipline[MAXLINELENGTH]; for (int n=0; neof()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::skipLines"); + dbgEnd(Debug::Parse,"Parser::skipLines"); return -1; } if (xfile->fail()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::skipLines"); + dbgEnd(Debug::Parse,"Parser::skipLines"); return 1; } } - dbgEnd(DM_PARSE,"Parser::skipLines"); + dbgEnd(Debug::Parse,"Parser::skipLines"); return 0; } @@ -363,7 +363,7 @@ int Parser::skipLines(ifstream *xfile, int nlines) int Parser::getArgsFormatted(ifstream *xfile, int options, Format *fmt) { // Splits the line from the file into parts determiend by the supplied format - dbgBegin(DM_PARSE,"Parser::getArgsFormatted[file]"); + dbgBegin(Debug::Parse,"Parser::getArgsFormatted[file]"); static char linefromfile[MAXLINELENGTH]; bool done = FALSE; // Lines beginning with '#' are ignored as comments @@ -377,13 +377,13 @@ int Parser::getArgsFormatted(ifstream *xfile, int options, Format *fmt) if (xfile->eof()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::getArgsFormatted[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsFormatted[file]"); return -1; } if (xfile->fail()) { xfile->close(); - dbgEnd(DM_PARSE,"Parser::getArgsFormatted[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsFormatted[file]"); return 1; } line_ = linefromfile; @@ -393,7 +393,7 @@ int Parser::getArgsFormatted(ifstream *xfile, int options, Format *fmt) getAllArgsFormatted(line_,fmt); if ((optionMask_&PO_SKIPBLANKS) && (nArgs_ == 0)) done = FALSE; } while (!done); - dbgEnd(DM_PARSE,"Parser::getArgsFormatted[file]"); + dbgEnd(Debug::Parse,"Parser::getArgsFormatted[file]"); return 0; } @@ -401,14 +401,14 @@ int Parser::getArgsFormatted(ifstream *xfile, int options, Format *fmt) void Parser::getArgsFormatted(const char *source, int options, Format *fmt) { // Splits the line from the file into parts determiend by the supplied format - dbgBegin(DM_PARSE,"Parser::getArgsFormatted[string]"); + dbgBegin(Debug::Parse,"Parser::getArgsFormatted[string]"); // Lines beginning with '#' are ignored as comments // Blank lines are skipped if blankskip == TRUE. // Returns : 0=ok, 1=error, -1=eof line_ = source; optionMask_ = options; getAllArgsFormatted(line_,fmt); - dbgEnd(DM_PARSE,"Parser::getArgsFormatted[string]"); + dbgEnd(Debug::Parse,"Parser::getArgsFormatted[string]"); } /* @@ -420,7 +420,7 @@ const char *Parser::parseAtomtypeString(Dnchar &source) // Cut the next atomtype command from the supplied string. Put in 'dest', along with any bracketed // argument part. Use brackets a bit like quotes are used above, except we don't toggle the flag. // Ignore spaces and horizontal tabs. Commas separate commands. - dbgBegin(DM_PARSE,"Parser::parseAtomtypeString"); + dbgBegin(Debug::Parse,"Parser::parseAtomtypeString"); static int n, nchars, bracketlevel; static bool done, el_list; static Dnchar typecmd; @@ -478,7 +478,7 @@ const char *Parser::parseAtomtypeString(Dnchar &source) source.eraseStart(n+1); //printf("Result = "); //typecmd.print(); - dbgEnd(DM_PARSE,"Parser::parseAtomtypeString"); + dbgEnd(Debug::Parse,"Parser::parseAtomtypeString"); return typecmd.get(); } @@ -486,7 +486,7 @@ const char *Parser::trimAtomtypeKeyword(Dnchar &source) { // Remove the keyword part of the command and put in 'dest', leaving the options (minus brackets) // in the original string. Remove '[' and ']' from keyword since this is only used to keep a list of elements together. - dbgBegin(DM_PARSE,"Parser::trimAtomtypeKeyword"); + dbgBegin(Debug::Parse,"Parser::trimAtomtypeKeyword"); static bool done, equals; static Dnchar keywd; done = FALSE; @@ -535,14 +535,14 @@ const char *Parser::trimAtomtypeKeyword(Dnchar &source) source.eraseStart(1); source.eraseEnd(1); } - dbgEnd(DM_PARSE,"Parser::trimAtomtypeKeyword"); + dbgEnd(Debug::Parse,"Parser::trimAtomtypeKeyword"); return keywd.get(); } // Parse tokens in numerical expression bool Parser::getArgsExpression(const char *s) { - dbgBegin(DM_PARSE,"Parser::getArgsExpression"); + dbgBegin(Debug::Parse,"Parser::getArgsExpression"); nArgs_ = 0; for (int n=0; nname()); - dbgEnd(DM_CALLS,"master::probeFile"); + if (result == NULL) msg(Debug::None,"Couldn't determine format of file '%s'.\n",filename); + else msg(Debug::Verbose,"master::probeFile - Selected filter '%s'\n",result->name()); + dbgEnd(Debug::Calls,"master::probeFile"); return result; } diff --git a/src/render/atoms.cpp b/src/render/atoms.cpp index 6cad476ea..5a0015744 100644 --- a/src/render/atoms.cpp +++ b/src/render/atoms.cpp @@ -26,7 +26,7 @@ // Render model atoms and bonds void Canvas::renderModelAtoms() { - dbgBegin(DM_CALLS,"Canvas::renderModelAtoms"); + dbgBegin(Debug::Calls,"Canvas::renderModelAtoms"); static Atom::DrawStyle style_i, renderstyle; static GLfloat ambient[4], diffuse[4]; static short int cindex; @@ -288,5 +288,5 @@ void Canvas::renderModelAtoms() if (!prefs.hasGlOption(GO_LINEALIASING) && !prefs.hasGlOption(GO_POLYALIASING)) glDisable(GL_BLEND); // Reset line width to 1.0 glLineWidth(1.0); - dbgEnd(DM_CALLS,"Canvas::renderModelAtoms"); + dbgEnd(Debug::Calls,"Canvas::renderModelAtoms"); } diff --git a/src/render/extra.cpp b/src/render/extra.cpp index 1914fe85a..b0ec1fc86 100644 --- a/src/render/extra.cpp +++ b/src/render/extra.cpp @@ -28,7 +28,7 @@ // Render other 3D objects void Canvas::renderExtra3d() { - dbgBegin(DM_CALLS,"Canvas::renderExtra3d"); + dbgBegin(Debug::Calls,"Canvas::renderExtra3d"); // Draw on 3D embellishments for active modes static double radius; static Vec3 r, mouse; @@ -97,13 +97,13 @@ void Canvas::renderExtra3d() glPopMatrix(); break; } - dbgEnd(DM_CALLS,"Canvas::renderExtra3d"); + dbgEnd(Debug::Calls,"Canvas::renderExtra3d"); } // Render 2D objects void Canvas::renderExtra2d() { - dbgBegin(DM_CALLS,"Canvas::renderExtra2d"); + dbgBegin(Debug::Calls,"Canvas::renderExtra2d"); // Draw on any 2D objects, e.g. selection boxes, labels etc. static int n, i; static double dx, dy, halfw; @@ -176,13 +176,13 @@ void Canvas::renderExtra2d() float midy = height_ / 2; //glBegin( } - dbgEnd(DM_CALLS,"Canvas::renderExtra2d"); + dbgEnd(Debug::Calls,"Canvas::renderExtra2d"); } // Render disordered insertion regions void Canvas::renderRegions() { - dbgBegin(DM_CALLS,"Canvas::renderRegions"); + dbgBegin(Debug::Calls,"Canvas::renderRegions"); static Vec3 centre, size; static GLfloat colour[4]; int i = 0; @@ -221,5 +221,5 @@ void Canvas::renderRegions() // Turn off blending (if not antialiasing) if (!prefs.hasGlOption(GO_LINEALIASING) && !prefs.hasGlOption(GO_POLYALIASING)) glDisable(GL_BLEND); glDisable(GL_LIGHTING); - dbgEnd(DM_CALLS,"Canvas::renderRegions"); + dbgEnd(Debug::Calls,"Canvas::renderRegions"); } diff --git a/src/render/glyph.cpp b/src/render/glyph.cpp index 8b633466c..79a260a17 100644 --- a/src/render/glyph.cpp +++ b/src/render/glyph.cpp @@ -26,7 +26,7 @@ // Render model glyphs void Canvas::renderModelGlyphs() { - dbgBegin(DM_CALLS,"Canvas::renderModelGlyphs"); + dbgBegin(Debug::Calls,"Canvas::renderModelGlyphs"); static Vec3 vec[MAXGLYPHDATA], avg, normal; GLfloat col[4] = { 0.0f, 0.0f, 0.9f, 0.5f }; @@ -114,5 +114,5 @@ void Canvas::renderModelGlyphs() // gl_ellipsoid(i->r(),i->v(),i->f()); // break; } - dbgEnd(DM_CALLS,"Canvas::renderModelGlyphs"); + dbgEnd(Debug::Calls,"Canvas::renderModelGlyphs"); } diff --git a/src/render/model.cpp b/src/render/model.cpp index 59aa37911..439b911c3 100644 --- a/src/render/model.cpp +++ b/src/render/model.cpp @@ -27,7 +27,7 @@ // Render atom labels void Canvas::renderModelLabels() { - dbgBegin(DM_CALLS,"Canvas::renderModelLabels"); + dbgBegin(Debug::Calls,"Canvas::renderModelLabels"); // Annotate the model with 2D labels static char text[64]; static Atom *i; @@ -81,13 +81,13 @@ void Canvas::renderModelLabels() } glText(i->r() - cellCentre, text); } - dbgEnd(DM_CALLS,"Canvas::renderModelLabels"); + dbgEnd(Debug::Calls,"Canvas::renderModelLabels"); } // Render measurements void Canvas::renderModelMeasurements() { - dbgBegin(DM_CALLS,"Canvas::renderModelMeasurements"); + dbgBegin(Debug::Calls,"Canvas::renderModelMeasurements"); static Vec3 ri, rj, rk, rl, labpos, cellCentre; static char text[256]; static Atom **atoms; @@ -138,19 +138,19 @@ void Canvas::renderModelMeasurements() glText(labpos, text); } glPopMatrix(); - dbgEnd(DM_CALLS,"Canvas::renderModelMeasurements"); + dbgEnd(Debug::Calls,"Canvas::renderModelMeasurements"); } // Render force arrows void Canvas::renderModelForceArrows() { - dbgBegin(DM_CALLS,"Canvas::renderModelForceArrows"); + dbgBegin(Debug::Calls,"Canvas::renderModelForceArrows"); for (Atom *i = displayModel_->atoms(); i != NULL; i = i->next) { // Scale forces to more reasonable values TODO User scaling glArrow(i->r(),i->f() / 30.0); } - dbgEnd(DM_CALLS,"Canvas::renderModelForceArrows"); + dbgEnd(Debug::Calls,"Canvas::renderModelForceArrows"); } // Render model cell diff --git a/src/render/render.cpp b/src/render/render.cpp index f2e0dd405..f4de98861 100644 --- a/src/render/render.cpp +++ b/src/render/render.cpp @@ -26,7 +26,7 @@ // Render model void Canvas::renderScene(Model *source) { - dbgBegin(DM_CALLS,"Canvas::renderScene"); + dbgBegin(Debug::Calls,"Canvas::renderScene"); static double rotmat[16], cammat[16]; static Model *trajparent; static double camrot; @@ -34,7 +34,7 @@ void Canvas::renderScene(Model *source) // Begin the GL commands if (!beginGl()) { - dbgEnd(DM_CALLS,"Canvas::renderScene"); + dbgEnd(Debug::Calls,"Canvas::renderScene"); return; } @@ -57,7 +57,7 @@ void Canvas::renderScene(Model *source) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glRasterPos2i(1,(int)height_-13); glText(1.0,height_-10.0,"No model to display."); - dbgEnd(DM_CALLS,"Canvas::renderScene"); + dbgEnd(Debug::Calls,"Canvas::renderScene"); return; } @@ -122,7 +122,7 @@ void Canvas::renderScene(Model *source) if (renderPoint_ == displayModel_->log(LOG_TOTAL)) glCallList(list_[GLOB_MODEL]); else { - msg(DM_VERBOSE,"Recreating display list for model '%s'...", displayModel_->name()); + msg(Debug::Verbose,"Recreating display list for model '%s'...", displayModel_->name()); //glDeleteLists(list_[GLOB_MODEL],1); glNewList(list_[GLOB_MODEL],GL_COMPILE_AND_EXECUTE); // Draw the model cell (this also translates our drawing position to the -half cell point. @@ -135,7 +135,7 @@ void Canvas::renderScene(Model *source) if (prefs.shouldRender(VO_FORCEARROWS)) renderModelForceArrows(); glEndList(); renderPoint_ = displayModel_->log(LOG_TOTAL); - msg(DM_VERBOSE," Done. (New point = %i)\n",renderPoint_); + msg(Debug::Verbose," Done. (New point = %i)\n",renderPoint_); } // Render surfaces if (prefs.shouldRender(VO_SURFACES)) renderSurfaces(); @@ -191,5 +191,5 @@ void Canvas::renderScene(Model *source) glFlush(); endGl(); - dbgEnd(DM_CALLS,"Canvas::renderScene"); + dbgEnd(Debug::Calls,"Canvas::renderScene"); } diff --git a/src/render/surface.cpp b/src/render/surface.cpp index 96751a99e..54c2199b3 100644 --- a/src/render/surface.cpp +++ b/src/render/surface.cpp @@ -457,7 +457,7 @@ void cubeIt(Grid *g, SurfaceStyle ss) // Render surfaces void Canvas::renderSurfaces() { - dbgBegin(DM_CALLS,"Canvas::renderSurfaces"); + dbgBegin(Debug::Calls,"Canvas::renderSurfaces"); // Loop over surfaces held by the master, rendering those that are visible. // If the log of a particular surface is out of data, recreate its display list first static GLuint list; @@ -502,5 +502,5 @@ void Canvas::renderSurfaces() glCallList(list); glPopMatrix(); } - dbgEnd(DM_CALLS,"Canvas::renderSurfaces"); + dbgEnd(Debug::Calls,"Canvas::renderSurfaces"); } diff --git a/src/templates/matrix3.h b/src/templates/matrix3.h index 7b39605ec..8ff2b8684 100644 --- a/src/templates/matrix3.h +++ b/src/templates/matrix3.h @@ -345,7 +345,7 @@ template void Mat3::matrix3Invert(int matsize, double *A) int *pivoted; int row, col, n, m; double *B, large, element; - dbgBegin(DM_CALLS,"invert[GJ]"); + dbgBegin(Debug::Calls,"invert[GJ]"); // Create and blank temporary arrays we need pivotrows = new int[matsize]; pivotcols = new int[matsize]; @@ -410,7 +410,7 @@ template void Mat3::matrix3Invert(int matsize, double *A) delete[] pivotrows; delete[] pivotcols; delete[] pivoted; - dbgEnd(DM_CALLS,"invert[GJ]"); + dbgEnd(Debug::Calls,"invert[GJ]"); } #endif diff --git a/src/templates/matrix4.h b/src/templates/matrix4.h index a14372186..f599619c4 100644 --- a/src/templates/matrix4.h +++ b/src/templates/matrix4.h @@ -279,7 +279,7 @@ template void Mat4::matrix4Invert(int matsize, double *A) int *pivoted; int row, col, n, m; double *B, large, element; - dbgBegin(DM_CALLS,"invert[GJ]"); + dbgBegin(Debug::Calls,"invert[GJ]"); // Create and blank temporary arrays we need pivotrows = new int[matsize]; pivotcols = new int[matsize]; @@ -341,7 +341,7 @@ template void Mat4::matrix4Invert(int matsize, double *A) delete[] pivotrows; delete[] pivotcols; delete[] pivoted; - dbgEnd(DM_CALLS,"invert[GJ]"); + dbgEnd(Debug::Calls,"invert[GJ]"); } #endif