User a9d76a1173
29-03-2012 20:42:04
Hi,
How do I connect a proton to a given atom in the molecule to create a protonated species using API.
Suppose I have a molecule and the index of the atom to which I want to connect the proton..
Thanks.
User a9d76a1173
29-03-2012 20:42:04
Hi,
How do I connect a proton to a given atom in the molecule to create a protonated species using API.
Suppose I have a molecule and the index of the atom to which I want to connect the proton..
Thanks.
ChemAxon d26931946c
30-03-2012 12:12:38
Hi,
You want to add a charge to an atom or you want to attach an explicit H+ atom to the molecule?
User a9d76a1173
30-03-2012 12:31:45
Explicit H+ or add a Hydrogen and change charge to +1..either way
ChemAxon d26931946c
30-03-2012 17:04:53
Then the following code should work:
MolAtom hydrogen = new MolAtom(1);
hydrogen.setCharge(1);
MolAtom bondTo = molecule.getAtom(index);
MolBond bond = new MolBond(bondTo, hydrogen);
molecule.add(hydrogen);
molecule.add(bond);
molecule.valenceCheck();
First, I create a new atom with atomic number 1, and I set it's charge to 1. Then I create a bond between the Hydrogen and the atom in the molecule I want to bond it. Finally, I add the new atom and the bond to the molecule and run valenceCheck to clean up the implicit Hydrogen count on the atom I added a new bond to.
Best regards,
Peter