code: @Override
      public DescriptorValue calculate(IAtomContainer container) {
          double weight = 0;
          double hydrogenNaturalMass;
          try {
              IIsotope hydrogen = Isotopes.getInstance().getMajorIsotope("H");
              hydrogenNaturalMass = Isotopes.getInstance().getNaturalMass(hydrogen);
          } catch (IOException e) {
              return getDummyDescriptorValue(e);
          }
  
          if (elementName.equals("*")) {
              try {
                  for (IAtom atom : container.atoms()) {
                      weight += Isotopes.getInstance().getNaturalMass(atom);
                      Integer implicitHydrogenCount = atom.getImplicitHydrogenCount();
                      if (implicitHydrogenCount == CDKConstants.UNSET) {
                          implicitHydrogenCount = 0;
                      }
                      weight += (implicitHydrogenCount * hydrogenNaturalMass);
                  }
              } catch (Exception e) {
                  return getDummyDescriptorValue(e);
              }
          } else if (elementName.equals("H")) {
              try {
                  for (IAtom atom : container.atoms()) {
                      if (atom.getSymbol().equals(elementName)) {
                          weight += hydrogenNaturalMass;
                      } else {
                          weight += (atom.getImplicitHydrogenCount() * hydrogenNaturalMass);
                      }
                  }
              } catch (Exception e) {
                  return getDummyDescriptorValue(e);
              }
          } else {
              try {
                  for (IAtom atom : container.atoms()) {
                      if (atom.getSymbol().equals(elementName)) {
                          weight += Isotopes.getInstance().getNaturalMass(atom);
                      }
                  }
              } catch (Exception e) {
                  return getDummyDescriptorValue(e);
              }
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(weight),
                  getDescriptorNames());
  
      }
docs: Calculate the natural weight of specified elements type in the supplied {@link IAtomContainer}.
  
  @param  container The AtomContainer for which this descriptor is to be calculated. If 'H'
  is specified as the element symbol make sure that the AtomContainer has hydrogens.
  @return The total natural weight of atoms of the specified element type