Re: [Open Babel] read molecules from xyz files and merge them

2020-04-09 Thread Geoffrey Hutchison
> >> m1 = mol1.OBMol > >> m2 = mol2.OBMol You'll want to count the number of atoms in each molecule before you do the addition. > >> m1 += m2 > >>#merging the two molecules > >> m1.AddBond(1,2,1)

Re: [Open Babel] Poor CML to LMPDAT Conversion

2020-04-09 Thread Geoffrey Hutchison
> I have a CML file that I'm trying to convert to a LMPDAT format. The > conversion appears to work, … Considering I don't know many people using LMPDAT it would really help to know what the "correct" (e.g. your version) would look like. I know that Albert wrote the code as a quick example that

Re: [Open Babel] read molecules from xyz files and merge them

2020-04-09 Thread Marco Di Gennaro (TME)
Dear Noel, Thank you for the answer. I was able to actually remove all hydrogens, merge the two molecules and reintroduce all the hydrogens. Nevertheless, what I am getting is not methylbenzene (C7H8) but just the same two molecules as before. I believe I also created a new bond but I am pretty

[Open Babel] Poor CML to LMPDAT Conversion

2020-04-09 Thread ntiwari
Hi, I have a CML file that I'm trying to convert to a LMPDAT format. The conversion appears to work, but not particularly well. Some bonds appear to be incorrect, and the atom coordinates are definitely not correct. The command I'm using is: babel -icml file.cml -olmpdat file.lmpdat And

Re: [Open Babel] read molecules from xyz files and merge them

2020-04-09 Thread Noel O'Boyle
Use the Python keyword "next" on an iterator to get the next item: mol1 = next(pybel.readfile() You can add an OBMol to an existing one: m1 += m2 I'd recommend writing it out as SMILES at this point, just to check the structure: print(pybel.Molecule(m1).write("smi")) If the hydrogens are

[Open Babel] read molecules from xyz files and merge them

2020-04-09 Thread mdigennaro
Hello everyone, I have two molecules (benzene and methane) in two separate xyz files. I would like to create a methylbenzene molecule out of these and relax it with a UFF. I am new to pybel (and babel in general). I would like to: - open the two files - remove one hydrogen from the