Dear all, I find another API in CDK. The add3DCoordinates1 function of AtomTools can add 3D coordinate on hydrogens (http://cdk.github.io/cdk/2.2/docs/api/org/openscience/cdk/geometry/AtomTools.html). I had modify the source code add3DCoordinates1 in AtomTools as above content. It can add 3D hydrogen coordinates on molecules now. I share the source code with you as below: " AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol); // Add hydrogen without coordinates. AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol); // delete hydrogen. AtomContainerManipulator.suppressHydrogens(mol); // add hydrogen. CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol); AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol); // add hydrogen coordinates. AtomTools.add3DCoordinates1(mol); " If it has some problems, please tell me. Thanks. Regards, Qifeng Bai ------------------------------------------------------------------ Sender:John Mayfield <john.wilkinson...@gmail.com> Sent At:2019 Feb. 23 (Sat.) 16:20 Recipient:love_software0 <love_softwa...@aliyun.com> Cc:cdk-user@lists.sourceforge.net <cdk-user@lists.sourceforge.net> Subject:Re: [Cdk-user] How to add hydrogens with 3D coordinate?
Unfortunately there is no easy way to do this ATM other then regeneration 3D coordinates and that support is pretty limited in CDK. Of course the question is then do you want minimised hydrogens or any old reasonably valid positions. As a first approximation you can set the hydrogen coordinates to the same as the atom they are attached. However I think it's a reasonable thing to do if a 3D (or 2D) molecule comes in and will add something like OESet3DHydrogenGeom. Please can you add a GitHub issue for this. Thanks, John On Sat, 16 Feb 2019 at 12:38, love_software0 via Cdk-user <cdk-user@lists.sourceforge.net> wrote: Dear all, The Chemistry Development Kit(CDK) is very useful for my current work. However, I meet a problem: when I read and add hydrogens on the sybyl mol2 format 3D molecule by using CDK, it seems the added hydrogens have no coordinates. I use the code as below: "AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); CDKHydrogenAdder.getInstance(mol.getBuilder()).addImplicitHydrogens(mol); AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol); " The added hydrogens with coordinates is very important for my current project. I had checked the API of CDK, but I can not find the suitable way to solve this problem. So could anyone gives me some codes or suggestions on adding hydrogens with 3D coordinates on molecules? Thanks for your help. Sincerely, Qifeng _______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user
_______________________________________________ Cdk-user mailing list Cdk-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cdk-user