[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xyz2mol implementation bug: DetermineBonds #8006

Open
simonmb opened this issue Nov 14, 2024 · 1 comment
Open

xyz2mol implementation bug: DetermineBonds #8006

simonmb opened this issue Nov 14, 2024 · 1 comment
Labels

Comments

@simonmb
Copy link
simonmb commented Nov 14, 2024

Describe the bug
the xyz2mol implementation in C mostly works for me, but for some xyz files it fails. My goal is to get the molecule from the smiles with a conformer based on the xyz. The example xyz file is below.

To Reproduce

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdDetermineBonds

mol_from_SMILES = Chem.MolFromSmiles('CCCCCCCOc1ccc([N+](=O)[O-])cc1')
xyz_file = 'C13H19NO3_002_pnitrophenylheptylether_CnfS1.xyz'
xyz_mol = Chem.MolFromXYZFile(xyz_file)
rdDetermineBonds.DetermineBonds(xyz_mol, charge=0)
mol = AllChem.AssignBondOrdersFromTemplate(mol_from_SMILES, xyz_mol)

I am however getting the following error when DetermineBonds is run.

Final molecular charge (0) does not match input (-1); could not find valid bond ordering

If I run it using xy2mol, it works:

from xyz2mol import read_xyz_file, xyz2AC
atoms, charge, xyz_coordinates = read_xyz_file(xyz_file)
AC, xyz_mol = xyz2AC(atoms, xyz_coordinates, charge, use_huckel=True)
xyz_mol = Chem.RWMol(xyz_mol)
num_atoms = len(atoms)
for i in range(num_atoms):
    for j in range(i + 1, num_atoms): 
        if AC[i, j] == 1: 
            xyz_mol.AddBond(i, j, Chem.BondType.SINGLE)

mol = AllChem.AssignBondOrdersFromTemplate(mol_from_SMILES, xyz_mol)

Expected behavior
To get a mol with the correct Bonds and one Conformer based on the xyz.

Configuration:

  • RDKit version: 2024.09.1
  • OS: Win 11
  • Python version: 3.11.10
  • Are you using conda Yes, conda-forge
36

C  6.7913196335158501  -0.0448658610313100  0.6657633907078100
C  5.5796381893814502  0.0286675414187900  -0.2684145174546900
C  4.2393604310803497  -0.0268361981844300  0.4740726099932200
C  3.0209198674193800  0.0461533883047300  -0.4526702721837300
C  1.6831508946885501  -0.0109972306435300  0.2938834443797200
C  0.4715355465812700  0.0619997665046200  -0.6440958470506800
C  -0.8373788426356100  -0.0025410445776800  0.1221825576599700
O  -1.9234903022157599  0.0744104271091800  -0.8443248910804400
C  -3.1967180889728302  0.0355514345059300  -0.4009512081350500
C  -3.5642017909650900  -0.0746528518264800  0.9568073026649900
C  -4.9093297646275298  -0.1027946723510800  1.3045262937822999
C  -5.8877832777109198  -0.0227785871984700  0.3067001376863000
N  -7.2898630556333899  -0.0523339321938400  0.6785328450866200
O  -7.5874020266485296  -0.1410161538239700  1.8841807259675400
O  -8.1465471065379607  0.0124377451498300  -0.2225949913409100
C  -5.5342118890905603  0.0851213115809600  -1.0486319366136800
C  -4.1962487433409299  0.1141128838685000  -1.3975903430146399
H  7.7367790466899500  -0.0012604384347300  0.1049228998036600
H  6.7886991932650700  0.7903828120833700  1.3835407433032700
H  6.7884765650123100  -0.9811060759438101  1.2456323017121600
H  5.6236830224402103  -0.7995824244997400  -0.9966377145403600
H  5.6265729985551696  0.9593458727186900  -0.8600155348830300
H  4.1941040444386299  0.8026443577320700  1.2025062103669799
H  4.1911904380928302  -0.9580669195484099  1.0666987824009400
H  3.0676705916069902  0.9779253848865400  -1.0437696879672000
H  3.0657025514730400  -0.7830874863276700  -1.1807365251127500
H  1.6342544344790799  -0.9429248137014300  0.8835755621494200
H  1.6354285103149500  0.8187497301540700  1.0203984671524600
H  0.5039238206117000  0.9985901513697600  -1.2244550736297299
H  0.5072105009306700  -0.7699767718181200  -1.3663598959181800
H  -0.9301330721560700  0.8384182958424300  0.8282839207205001
H  -0.9274431092730200  -0.9475154040530700  0.6817977895860700
H  -2.8097825732277699  -0.1389389581432300  1.7381943786121801
H  -5.2060178016409404  -0.1875148498490600  2.3484973240248301
H  -6.3095329210376896  0.1458565657286300  -1.8101174146670900
H  -3.8935359148631199  0.1984230051920100  -2.4417193492260001
@simonmb simonmb added the bug label Nov 14, 2024
@simonmb simonmb changed the title xyz2mol implementation bug xyz2mol implementation bug: DetermineBonds Nov 18, 2024
@simonmb
Copy link
Author
simonmb commented Nov 18, 2024

I have additionally found, that DetermineBonds completely freezes on the xyz file below:

It happens on the setup as described above but also on AlmaLinux release 8.10, python 3.11.7 and conda-forge rdkit 2024.03.6, while the xyz2mol version still works.

38

O  -4.7025628202143599  -1.8507205184287800  0.3039858372286700
N  -4.2153994361056402  -1.7233996392624999  -0.7949405839041100
O  -4.2705114336889398  -2.4437065089795000  -1.7635635876261300
O  -3.4388382785216902  -0.5160076353212300  -1.0782374702523301
C  -3.2670951603727501  0.3826565430823800  0.0393097517761500
C  -1.8861245279294301  0.2454836801298700  0.6779924520457800
O  -1.6936413893826801  -1.0896876055197899  1.1984618937406999
N  -2.0815889242898900  -1.2685518179715900  2.6123051031258999
O  -2.4988413260261599  -0.3058478680877800  3.2083804426540699
O  -1.9111833255751900  -2.4074529281344601  2.9668979164650300
C  -0.6980247575755100  0.4598938470530900  -0.2963213978786200
O  -0.8625779206994700  1.7603843593598401  -0.8904761268975800
N  -1.0757162355768199  1.7777540130060601  -2.3727687394289401
O  -1.0836759820660000  0.7233920745442400  -2.9536839253428600
O  -1.2120248517968699  2.9065490938642800  -2.7632187880991199
C  0.6722069585550600  0.4102600580062600  0.4110077046657600
O  0.7676263269579300  1.5325050024767599  1.3070956849996500
N  1.0057197220771501  1.1972704757614900  2.7473707017446598
O  1.0831631997253000  2.2010699488347001  3.4042239843335800
O  1.0848549018215199  0.0346786066724300  3.0494187000883701
C  1.8646013520186300  0.5095404045527000  -0.5759999030759100
C  3.2407978503136499  0.5402685118992701  0.0868819404199700
O  3.4608912090774400  -0.6076222397961200  0.9351119277104600
N  4.2857701013328198  -1.6658786768496801  0.3512818922959800
O  4.7671201914592896  -1.4843162758468000  -0.7426263006702400
O  4.3810691004045799  -2.6084193361632102  1.1012764833341000
O  1.7311797749145501  -0.6514580160632500  -1.4275189818972800
N  2.1396965886197101  -0.4413420998424300  -2.8310778667225800
O  2.5299006726248501  0.6566446570080000  -3.1451641901386300
O  2.0136444149573798  -1.4518450695333101  -3.4750286300380999
H  -3.3979089133890601  1.3904685744525700  -0.3768141439565000
H  -4.0485980800122698  0.2080701423807700  0.7884849792367500
H  -1.8243469602732501  0.9781716273387500  1.4964262049281700
H  -0.7150446380922800  -0.3115474985322000  -1.0794910331259899
H  0.7368083270945101  -0.5269577525562700  0.9821287271571700
H  1.7644203380506500  1.4263289105529600  -1.1764466406673100
H  3.3274375122524100  1.4111121127296800  0.7505679591599800
H  4.0267964193309700  0.6022588431824700  -0.6752319773888000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant