diff --git a/src/tools/DLLoader.cpp b/src/tools/DLLoader.cpp index ae3488a18d82d4621bcb829ef37cbf1704206666..775af050b87a85801fbda3f68cf2d590e9d8baf2 100644 --- a/src/tools/DLLoader.cpp +++ b/src/tools/DLLoader.cpp @@ -20,7 +20,6 @@ along with plumed. If not, see <http://www.gnu.org/licenses/>. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ #include "DLLoader.h" -#include "Exception.h" #ifdef __PLUMED_HAS_DLOPEN #include <dlfcn.h> diff --git a/src/tools/DLLoader.h b/src/tools/DLLoader.h index 674d7e05a151da04f4b886c2e218244e41d5c7ae..0baf920d56004a2afc0938c4b807aed1053bdd62 100644 --- a/src/tools/DLLoader.h +++ b/src/tools/DLLoader.h @@ -53,7 +53,7 @@ public: void* load(const std::string&); /// Returns the last error in dynamic loader const std::string & error(); -/// Returs true if the dynamic loader is available (on some systems it may not). +/// Returns true if the dynamic loader is available (on some systems it may not). static bool installed(); }; diff --git a/src/tools/Exception.h b/src/tools/Exception.h index 4194c345c32005431c9e3a90cdbde379e69e2821..9ddfc057e593604674f9af80a3ac2940a13a51bd 100644 --- a/src/tools/Exception.h +++ b/src/tools/Exception.h @@ -59,6 +59,12 @@ extensive error message can be added. if(a<=0) plumed_error(); if(a<=0) plumed_merror("a should be larger than zero"); \endverbatim +The additional macros +plumed_dbg_assert() and plumed_dbg_massert() are similar +to plumed_assert() and plumed_massert() respectively, but the corresponding +check is only performed when NDEBUG macro is not defined. They should +be used when the check is expensive and should be skipped in production +code. By default, execution is terminated imediately and a message is printed on stderr. @@ -133,7 +139,7 @@ public: /// Conditionally print file/line/function information and exit when NDEBUG flag is not present #define plumed_dbg_assert(test) if(!(test)) throw PLMD::Exception("assertion failed " #test,__FILE__,__LINE__,__PRETTY_FUNCTION__) /// \relates PLMD::Exception -/// Conditionally print file/line/function information plus msg and exit when NDEBUG flast is not present +/// Conditionally print file/line/function information plus msg and exit when NDEBUG flag is not present #define plumed_dbg_massert(test,msg) if(!(test)) throw PLMD::Exception("assertion failed " #test ", " msg,__FILE__,__LINE__,__PRETTY_FUNCTION__) #endif diff --git a/src/tools/Log.h b/src/tools/Log.h index f37f0613451ebac27b0102f6e2e18359d7f39fc9..b7d3bea3a06e88c4012314c26b7b4e9d0f9aa504 100644 --- a/src/tools/Log.h +++ b/src/tools/Log.h @@ -26,8 +26,6 @@ namespace PLMD{ -class Communicator; - /// Class containing the log stream. /// /// It is similar to a FILE stream. It allows a printf() function, and diff --git a/src/tools/Units.h b/src/tools/Units.h index 732a1dab5558c381412e3c952314a2653782ccc5..f89bbc635defc447de05af2bbe928987ec3894ac 100644 --- a/src/tools/Units.h +++ b/src/tools/Units.h @@ -26,10 +26,18 @@ namespace PLMD{ -/// Small utility class. -/// It has no implemented methods, and all its data are public. -/// It just simplify the syntax of functions which should pass the -/// value of all the units. +/** +\ingroup TOOLBOX +Small utility class that contains information about units. + +This class can be used to contain in a single place all the +information about units. Units are expressed in terms of +standard PLUMED units, i.e. kj/mol, nm, and ps. +Units can be set as double or as string. In the latter case, +one can also use strings such as kcal/mol. + + +*/ class Units{ /// Units for energy, expressed in kj/mol (e.g. 4.184 means kcal/mol) double energy; @@ -41,19 +49,40 @@ class Units{ double time; std::string timeString; public: -// Constructor, setting default values (1.0) +/// Constructor, setting default values (1.0) Units(); +/// Set energy units from string. +/// Also understands the following strings: +/// kj/mol, kcal/mol, j/mol, and eV. void setEnergy(const std::string &); +/// Set time units from string. +/// Also understands the following strings: +/// ps, ns, fs. void setTime(const std::string &); +/// Set lengh units from string. +/// Also understands the following strings: +/// nm, A, um. void setLength(const std::string &); - void setEnergy(const double); - void setTime(const double); - void setLength(const double); +/// Set energy units from double. +/// Should be specified in units of kj/mol (e.g. 4.184 means kcal/mol) + void setEnergy(double); +/// Set time units from double. +/// Should be specified in units of ps (e.g. 0.001 means fs) + void setTime(double); +/// Set lenght units from double. +/// Should be specified in units of nm (e.g. 0.1 means A) + void setLength(double); +/// Get energy units as double. const double & getEnergy()const; +/// Get length units as double. const double & getLength()const; +/// Get time units as double. const double & getTime()const; +/// Get energy units as string. const std::string & getEnergyString()const; +/// Get length units as string. const std::string & getLengthString()const; +/// Get time units as string. const std::string & getTimeString()const; };