class PartialSigmaChargeDescriptor extends AbstractAtomicDescriptor {

    @Override
    public DescriptorValue calculate(IAtom atom, IAtomContainer ac) {
        if (!isCachedAtomContainer(ac)) {
            Double[] org = new Double[ac.getAtomCount()];
            for (int i = 0; i < org.length; i++)
                org[i] = ac.getAtom(i).getCharge();
            IAtomContainer mol = atom.getBuilder().newInstance(IAtomContainer.class, ac);
            if (maxIterations != 0) peoe.setMaxGasteigerIters(maxIterations);
            try {
                peoe.assignGasteigerMarsiliSigmaPartialCharges(mol, true);
                for (int i = 0; i < ac.getAtomCount(); i++) {
                    // assume same order, so mol.getAtom(i) == ac.getAtom(i)
                    cacheDescriptorValue(ac.getAtom(i), ac, new DoubleResult(mol.getAtom(i).getCharge()));
                }
            } catch (Exception e) {
                return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                        Double.NaN), NAMES, e);
            }
            for (int i = 0; i < org.length; i++)
                mol.getAtom(i).setCharge(org[i]);
        }
        return getCachedDescriptorValue(atom) != null ? new DescriptorValue(getSpecification(), getParameterNames(),
                getParameters(), getCachedDescriptorValue(atom), NAMES) : null;
    }

    public  PartialSigmaChargeDescriptor();

}