To address this, the IChemObject interface has been extended with the methods setNotification(boolean) and getNotification(), which allow to temporarily disable change notifications. There are no helper methods yet to disable it for a complete data structure, like ChemModelManipulator.setNotification(ChemModel, boolean), but I expect these to be written soon.
Alternatively, special data classes may be used if notification is never needed for a special setup, for example, in case the QSAR descriptor calculation. In such cases, the new NoNotificationChemObjectBuilder can be used:
IChemObjectReader reader = new MDLReader(new FileInputStream(new File("some.mol")));
IChemObjectBuilder builder = NoNotificationChemObjectBuilder.getInstance();
IMolecule molecule = reader.read(builder.newMolecule());
// then perform some operation in which the molecule changes a lot
The advantage is that you do not have to manually disable notification for each class you instantiate. This should give a considerable speed up, and I hope soon to give some statistics.
No comments:
Post a Comment