code: @Override
      public DescriptorValue calculate(IAtomContainer mol) {
          try {
              mol = mol.clone();
          } catch (CloneNotSupportedException ex) {
          }
          double polar = 0, weight = 0;
          try {
              // type & assign implicit hydrogens
              IChemObjectBuilder builder = mol.getBuilder();
              CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(builder);
              for (IAtom atom : mol.atoms()) {
                  IAtomType type = matcher.findMatchingAtomType(mol, atom);
                  AtomTypeManipulator.configure(atom, type);
              }
              CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(builder);
              adder.addImplicitHydrogens(mol);
  
              // polar surface area: chain it off the TPSADescriptor
              TPSADescriptor tpsa = new TPSADescriptor();
              DescriptorValue value = tpsa.calculate(mol);
              polar = ((DoubleResult) value.getValue()).doubleValue();
  
              //  molecular weight
              for (IAtom atom : mol.atoms()) {
                  weight += Isotopes.getInstance().getMajorIsotope(atom.getSymbol()).getExactMass();
                  Integer hcount = atom.getImplicitHydrogenCount();
                  if (hcount != CDKConstants.UNSET) weight += hcount * 1.00782504;
              }
          } catch (CDKException | IOException exception) {
              return getDummyDescriptorValue(exception);
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                  weight == 0 ? 0 : polar / weight), getDescriptorNames());
      }
docs: Calculates the topological polar surface area and expresses it as a ratio to molecule size.
  
  @param mol The {@link IAtomContainer} whose volume is to be calculated
  @return descriptor(s) retaining to polar surface area