// Smiles reading
if (cor.accepts(IAtomContainerSet.class) && chemModel==null) {
// try to read a Molecule set
try {
IAtomContainerSet som = (AtomContainerSet) cor.read(new AtomContainerSet());
chemModel = new ChemModel();
chemModel.setMoleculeSet(som);
if (chemModel == null) {
error = "The object chemModel was empty unexpectedly!";
}
} catch (Exception exception) {
error = "Error while reading file: " + exception.getMessage();
exception.printStackTrace();
}
}
// MDLV3000 reading
if (cor.accepts(IAtomContainer.class) && chemModel==null) {
// try to read a Molecule
IAtomContainer mol = (AtomContainer) cor.read(new AtomContainer());
if(mol!=null )
try{
IAtomContainerSet newSet = new AtomContainerSet();
newSet.addAtomContainer(mol);
chemModel = new ChemModel();
chemModel.setMoleculeSet(newSet);
if (chemModel == null) {
error = "The object chemModel was empty unexpectedly!";
}