Dear cdk-users,
I have molecule in SD format (benzene.sdf, below)
and a Java code that calculates the surface of a molecule.
The code generates an exception during the surface calculation
and I would like to know for
which reason and what could be done as a remedy.
I came to this problem during the calculation of the TPSA descriptor
that returned NaN instead of a regular number.
I use CDK-1.2.5.
Best regards,
Jean-Marc Nuzillard
benzene.sdf
CDK 3/15/10,18:21
6 6 0 0 0 0 0 0 0 0999 V2000
0.0000 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2990 -0.7500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.5981 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.5981 1.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2990 2.2500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2 1 2 0 0 0 0
3 2 1 0 0 0 0
4 3 2 0 0 0 0
5 4 1 0 0 0 0
6 5 2 0 0 0 0
6 1 1 0 0 0 0
M END
$$$$
testSurface.java
import org.openscience.cdk.*;
import org.openscience.cdk.io.iterator.IteratingMDLReader;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.tools.CDKHydrogenAdder;
import org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector;
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.geometry.surface.NumericalSurface;
import java.io.*;
class testSurface {
public static void main(String[] args) throws CDKException {
FileReader sdfile = null;
try {
sdfile=new FileReader(new File(args[0]));
}
catch (FileNotFoundException e) {
System.err.println("File not found: " + args[0]);
System.exit(1);
}
catch (ArrayIndexOutOfBoundsException e) {
System.err.println("You need to give the name of an .sd
file");
System.exit(1);
}
IteratingMDLReader myiter = new IteratingMDLReader(sdfile,
DefaultChemObjectBuilder.getInstance());
Molecule mol = null;
while (myiter.hasNext()) {
mol = (Molecule)myiter.next();
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
CDKHydrogenAdder hAdder =
CDKHydrogenAdder.getInstance(mol.getBuilder());
hAdder.addImplicitHydrogens(mol);
CDKHueckelAromaticityDetector.detectAromaticity(mol);
AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);
AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
IAtomContainer container;
try {
container = (IAtomContainer) mol.clone();
} catch (CloneNotSupportedException e) {
throw new CDKException("Error during clone");
}
NumericalSurface surface;
try {
surface = new NumericalSurface(container);
surface.calculateSurface();
} catch (NullPointerException npe) {
System.out.print("Error in surface area
calculation\n");
}
}
}
}
------------------------------------------------------------------------------
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user