Index: src/Actions/AnalysisAction/CalculateMolarMassAction.cpp
===================================================================
--- src/Actions/AnalysisAction/CalculateMolarMassAction.cpp	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ src/Actions/AnalysisAction/CalculateMolarMassAction.cpp	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,56 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * CalculateMolarMassAction.cpp
+ *
+ *  Created on: Nov 02, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "CodePatterns/Log.hpp"
+
+#include "atom.hpp"
+#include "Element/element.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+#include "CalculateMolarMassAction.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "CalculateMolarMassAction.def"
+#include "Reaction_impl_pre.hpp"
+
+#include "Reaction_impl.hpp"
+
+/** =========== define the function ====================== */
+double * AnalysisCalculateMolarMassAction::doCalc() {
+  double mass = 0.;
+  size_t totalnumber = 0;
+  // calculate volume from Box
+  for(World::AtomSelectionConstIterator iter = World::getInstance().beginAtomSelection();
+      iter != World::getInstance().endAtomSelection();
+      ++iter) {
+    mass += iter->second->getType()->getMass();
+    ++totalnumber;
+  }
+  LOG(0, "RESULT: The mass of " << totalnumber << " selected atoms is " << mass << " atomicmassunit.");
+
+  return (new double(mass));
+}
+/** =========== end of function ====================== */
Index: src/Actions/AnalysisAction/CalculateMolarMassAction.def
===================================================================
--- src/Actions/AnalysisAction/CalculateMolarMassAction.def	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ src/Actions/AnalysisAction/CalculateMolarMassAction.def	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,32 @@
+/*
+ * CalculateMolarMassAction.def
+ *
+ *  Created on: Nov 02, 2011
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required, use (NODEFAULT) for each (undefined) default value
+#undef paramtypes
+#undef paramreferences
+#undef paramtokens
+#undef paramdescriptions
+#undef paramdefaults
+
+// Reaction cannot be undone, hence no state
+
+#define returntype double
+
+// some defines for all the names, you may use REACTION and PARAMS
+#define CATEGORY Analysis
+#define MENUNAME "analysis"
+#define MENUPOSITION 3
+#define ACTIONNAME CalculateMolarMass
+#define TOKEN "calculate-molar-mass"
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "Calculates the molar mass of all selected atoms"
+#undef SHORTFORM
Index: src/Actions/AnalysisAction/CalculateMolarMassAction.hpp
===================================================================
--- src/Actions/AnalysisAction/CalculateMolarMassAction.hpp	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ src/Actions/AnalysisAction/CalculateMolarMassAction.hpp	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,22 @@
+/*
+ * CalculateMolarMassAction.hpp
+ *
+ *  Created on: Nov 02, 2011
+ *      Author: heber
+ */
+
+#ifndef CALCULATEMOLARMASSACTION_HPP_
+#define CALCULATEMOLARMASSACTION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Reaction.hpp"
+
+#include "CalculateMolarMassAction.def"
+#include "Reaction_impl_header.hpp"
+
+#endif /* CALCULATEMOLARMASSACTION_HPP_ */
Index: src/Actions/GlobalListOfActions.hpp
===================================================================
--- src/Actions/GlobalListOfActions.hpp	(revision 6c61a977646015caffe230700aebdc01790a832d)
+++ src/Actions/GlobalListOfActions.hpp	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -48,5 +48,6 @@
 	(ParserSetParserParameters) \
 	(ParserSetOutputFormats) \
-  (AnalysisCalculateCellVolume) \
+	(AnalysisCalculateCellVolume) \
+	(AnalysisCalculateMolarMass) \
 	(AnalysisDipoleAngularCorrelation) \
 	(AnalysisDipoleCorrelation) \
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision 6c61a977646015caffe230700aebdc01790a832d)
+++ src/Actions/Makefile.am	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -87,5 +87,6 @@
 
 ANALYSISACTIONSOURCE = \
-	Actions/AnalysisAction/CalculateCellVolumeAction.cpp \
+  Actions/AnalysisAction/CalculateCellVolumeAction.cpp \
+  Actions/AnalysisAction/CalculateMolarMassAction.cpp \
   Actions/AnalysisAction/DipoleAngularCorrelationAction.cpp \
   Actions/AnalysisAction/DipoleCorrelationAction.cpp \
@@ -96,5 +97,6 @@
   Actions/AnalysisAction/SurfaceCorrelationAction.cpp
 ANALYSISACTIONHEADER = \
-	Actions/AnalysisAction/CalculateCellVolumeAction.hpp \
+  Actions/AnalysisAction/CalculateCellVolumeAction.hpp \
+  Actions/AnalysisAction/CalculateMolarMassAction.hpp \
   Actions/AnalysisAction/DipoleAngularCorrelationAction.hpp \
   Actions/AnalysisAction/DipoleCorrelationAction.hpp \
@@ -105,5 +107,6 @@
   Actions/AnalysisAction/SurfaceCorrelationAction.hpp
 ANALYSISACTIONDEFS = \
-	Actions/AnalysisAction/CalculateCellVolumeAction.def \
+  Actions/AnalysisAction/CalculateCellVolumeAction.def \
+  Actions/AnalysisAction/CalculateMolarMassAction.def \
   Actions/AnalysisAction/DipoleAngularCorrelationAction.def \
   Actions/AnalysisAction/DipoleCorrelationAction.def \
Index: tests/regression/Analysis/CalculateMolarMass/pre/argon.xyz
===================================================================
--- tests/regression/Analysis/CalculateMolarMass/pre/argon.xyz	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ tests/regression/Analysis/CalculateMolarMass/pre/argon.xyz	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,4 @@
+1
+	# test file for create-molar-mass
+Ar	0.	0.	0.
+
Index: tests/regression/Analysis/CalculateMolarMass/pre/water.xyz
===================================================================
--- tests/regression/Analysis/CalculateMolarMass/pre/water.xyz	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ tests/regression/Analysis/CalculateMolarMass/pre/water.xyz	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,5 @@
+3
+	Created by molecuilder on Thu Dec 30 10:10:30 2010
+O	0	0	0
+H	0.758602	0	0.504284
+H	0.758602	0	-0.504284
Index: tests/regression/Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at
===================================================================
--- tests/regression/Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
+++ tests/regression/Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -0,0 +1,26 @@
+### calculate molar mass
+
+AT_SETUP([Analysis - Calculate molar mass])
+AT_KEYWORDS([analysis reaction calculate-molar-mass])
+
+# empty domain
+AT_CHECK([../../molecuilder --calculate-molar-mass], 0, [stdout], [stderr])
+AT_CHECK([egrep "RESULT" stdout], 0, [ignore], [ignore])
+AT_CHECK([egrep "mass.* is 0 " stdout], 0, [ignore], [ignore])
+
+# nothing selection
+AT_CHECK([../../molecuilder -l ${abs_top_srcdir}/tests/regression/Analysis/CalculateMolarMass/pre/argon.xyz --calculate-molar-mass], 0, [stdout], [stderr])
+AT_CHECK([egrep "RESULT" stdout], 0, [ignore], [ignore])
+AT_CHECK([egrep "mass.*is 0 " stdout], 0, [ignore], [ignore])
+
+# all selected
+AT_CHECK([../../molecuilder -l ${abs_top_srcdir}/tests/regression/Analysis/CalculateMolarMass/pre/argon.xyz --select-all-atoms --calculate-molar-mass], 0, [stdout], [stderr])
+AT_CHECK([egrep "RESULT" stdout], 0, [ignore], [ignore])
+AT_CHECK([egrep "mass.*is 39.94" stdout], 0, [ignore], [ignore])
+
+# only hydrogen selected
+AT_CHECK([../../molecuilder -l ${abs_top_srcdir}/tests/regression/Analysis/CalculateMolarMass/pre/water.xyz --select-atom-by-element  1 --calculate-molar-mass], 0, [stdout], [stderr])
+AT_CHECK([egrep "RESULT" stdout], 0, [ignore], [ignore])
+AT_CHECK([egrep "mass.*is 2.016" stdout], 0, [ignore], [ignore])
+
+AT_CLEANUP
Index: tests/regression/Analysis/testsuite-analysis.at
===================================================================
--- tests/regression/Analysis/testsuite-analysis.at	(revision 6c61a977646015caffe230700aebdc01790a832d)
+++ tests/regression/Analysis/testsuite-analysis.at	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -27,2 +27,5 @@
 # calculates cell volume
 m4_include([Analysis/CalculateCellVolume/testsuite-analysis-calculate-cell-volume.at])
+
+# calculates molar mass
+m4_include([Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at])
Index: tests/regression/Makefile.am
===================================================================
--- tests/regression/Makefile.am	(revision 6c61a977646015caffe230700aebdc01790a832d)
+++ tests/regression/Makefile.am	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -35,4 +35,5 @@
 	$(srcdir)/Analysis/testsuite-analysis.at \
 	$(srcdir)/Analysis/CalculateCellVolume/testsuite-analysis-calculate-cell-volume.at \
+	$(srcdir)/Analysis/CalculateMolarMass/testsuite-analysis-calculate-molar-mass.at \
 	$(srcdir)/Analysis/DipoleAngularCorrelation/testsuite-analysis-dipole-angular-correlation.at \
 	$(srcdir)/Analysis/DipoleCorrelation-Empty/testsuite-analysis-dipole-correlation-empty.at \
Index: tests/regression/Python/AllActions/options.dat
===================================================================
--- tests/regression/Python/AllActions/options.dat	(revision 6c61a977646015caffe230700aebdc01790a832d)
+++ tests/regression/Python/AllActions/options.dat	(revision 55f299a96cda2fac6f625bb867138422ecaec949)
@@ -33,4 +33,5 @@
 bond-file	"bond.dat"
 bond-table	"table.dat"
+calculate-molar-mass	""
 center-in-box	"10 0 0 10 0 10"
 change-box	"10 0 0 10 0 10"
