From 7c650f0666863ce24057a08cf58d155396f78dbd Mon Sep 17 00:00:00 2001 From: my-name Date: Mon, 15 Apr 2024 18:02:55 +0200 Subject: [PATCH] Debugging BACZUB --- cell2mol/charge_assignment.py | 16 +- cell2mol/classes.py | 1 + cell2mol/test/test_one_by_one_BACZUB.ipynb | 1822 +++++++++++++++++--- 3 files changed, 1595 insertions(+), 244 deletions(-) diff --git a/cell2mol/charge_assignment.py b/cell2mol/charge_assignment.py index 318b3692..d42bee5a 100644 --- a/cell2mol/charge_assignment.py +++ b/cell2mol/charge_assignment.py @@ -211,6 +211,8 @@ def get_protonation_states_specie(specie: object, debug: int=0) -> list: if debug >= 2: print(" GET_PROTONATION_STATES: addressing group with hapticity:", g.haptic_type) if debug >= 2: print(" GET_PROTONATION_STATES: and parent indices:", parent_indices) + + if "h5-Cp" in g.haptic_type and not Selected_Hapticity: Selected_Hapticity = True tobeadded = 1 @@ -223,7 +225,7 @@ def get_protonation_states_specie(specie: object, debug: int=0) -> list: tmp_added_atoms += 1 else: block[idx] = 1 - elif "h7-Cicloheptatrienyl" in g.haptic_type and not Selected_Hapticity: + elif "h7-Cycloheptatrienyl" in g.haptic_type and not Selected_Hapticity: Selected_Hapticity = True tobeadded = 1 tmp_added_atoms = 0 @@ -320,6 +322,14 @@ def get_protonation_states_specie(specie: object, debug: int=0) -> list: if idx in parent_indices and a.mconnec == 1: block[idx] = 1 + elif "h2-P=C" in g.haptic_type and not Selected_Hapticity: + if debug >= 2: print(" GET_PROTONATION_STATES: No action is required") + Selected_Hapticity = True + tobeadded = 0 + for idx, a in enumerate(ligand.atoms): + if idx in parent_indices and a.mconnec == 1: + block[idx] = 1 + # If the group hapticity type is not recognized -or instructions are not defined-, nothing is done if not Selected_Hapticity: if debug >= 2: print(f" GET_PROTONATION_STATES: {g.haptic_type} not recognized or new rules are necessary") @@ -899,7 +909,8 @@ def set_charges_create_bonds (specie, unique_indices, unique_species, final_char cs = specie.possible_cs[idx] #prot = cs.protonation specie.set_charges(cs.corr_total_charge, cs.corr_atom_charges, cs.smiles, cs.rdkit_obj) - specie.create_bonds(debug=debug) + # TODO : correct create_bonds + # specie.create_bonds(debug=debug) else: if debug > 1: print(f"ERROR: Target charge {target_charge} of {formula} does not exist in {charge_list}." ) return None @@ -1175,6 +1186,7 @@ def __init__(self, labels, coord, cov_factor, added_atoms, addedlist, block, met self.labels = labels self.coords = coord self.natoms = len(labels) + self.formula = labels2formula(labels) self.added_atoms = added_atoms self.addedlist = addedlist self.block = block diff --git a/cell2mol/classes.py b/cell2mol/classes.py index 85a2629e..d2f2320c 100644 --- a/cell2mol/classes.py +++ b/cell2mol/classes.py @@ -754,6 +754,7 @@ def get_hapticity(self, debug: int=0): # Other less common types of haptic ligands elif numC == 0 and numAs == 5: self.haptic_type = ["h5-AsCp"]; self.is_haptic = True elif numC == 0 and numP == 5: self.haptic_type = ["h5-Pentaphosphole"]; self.is_haptic = True + elif numC == 1 and numP == 1: self.haptic_type = ["h2-P=C"]; self.is_haptic = True return self.haptic_type ####################################################### diff --git a/cell2mol/test/test_one_by_one_BACZUB.ipynb b/cell2mol/test/test_one_by_one_BACZUB.ipynb index 9b38defb..3504e078 100644 --- a/cell2mol/test/test_one_by_one_BACZUB.ipynb +++ b/cell2mol/test/test_one_by_one_BACZUB.ipynb @@ -2,19 +2,18 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 7, "id": "4b985e29", "metadata": {}, "outputs": [], "source": [ "import cell2mol\n", - "import numpy as np\n", "import os" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 8, "id": "b06260dd", "metadata": {}, "outputs": [], @@ -24,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 9, "id": "bc3b2bd0", "metadata": {}, "outputs": [], @@ -37,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 12, "id": "23e75d0d", "metadata": {}, "outputs": [], @@ -47,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 11, "id": "6268eaa8", "metadata": {}, "outputs": [], @@ -57,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 13, "id": "09c5cef3", "metadata": { "scrolled": false @@ -505,24 +504,15 @@ "labels, pos, ref_labels, ref_fracs, cellvec, cellparam = readinfo(infopath)\n", "# Initiates cell\n", "newcell = cell(name, labels, pos, cellvec, cellparam)\n", - "# # Loads the reference molecules and checks_missing_H\n", - "# # TODO : reconstruct the unit cell without using reference molecules\n", - "# # TODO : reconstruct the unit cell using (only reconstruction of) reference molecules and Space group\n", + "\n", + "# Loads the reference molecules and checks_missing_H\n", "newcell.get_reference_molecules(ref_labels, ref_fracs, debug=debug) \n", - "newcell.assess_errors()\n", - "# newcell.save(ref_cell_fname)\n", - "# ######################\n", - "# ### CALLS CELL2MOL ###\n", - "# ######################\n", - "# print(f\"ENTERING cell2mol with debug={debug}\")\n", - "# cell = cell2mol(newcell, reconstruction=True, charge_assignment=True, spin_assignment=True, debug=debug)\n", - "# cell.assess_errors()\n", - "# cell.save(cell_fname)" + "newcell.assess_errors()" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 14, "id": "8e7b1211", "metadata": { "scrolled": true @@ -534,7 +524,7 @@ "False" ] }, - "execution_count": 7, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -545,7 +535,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 15, "id": "93fd5a67", "metadata": {}, "outputs": [ @@ -557,15 +547,315 @@ "##############################################\n", "FRAG_RECONSTRUCT. 8 molecules submitted to SEQUENTIAL with Heavy\n", "##############################################\n", - "FRAG_RECONSTRUCT. 1 molecules and 2 fragments out of SEQUENTIAL with Heavy\n", - "FRAG_RECONSTRUCT. 6 molecules submitted to sequential with All\n", - "FINISHED succesfully\n", - "FRAG_RECONSTRUCT. No remaining Molecules after Hydrogen reconstruction\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 4\n", + " Formula = Cl3-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 3\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 11\n", + " Formula = H4-C5-Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 11\n", + " Formula = H4-C5-Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 4\n", + " Formula = Cl3-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 3\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 11\n", + " Formula = H4-C5-Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 20\n", + " Formula = H7-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 20\n", + " Formula = H7-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 20\n", + " Formula = H7-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 20\n", + " Formula = H7-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 4\n", + " Formula = Cl3-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 3\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[]\n", + "badlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 2\n", + " Formula = Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Heavy\n", + " Number of Atoms = 9\n", + " Formula = H3-C5-Fe\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.get_moleclist\n", + " Number of Ligands = 1\n", + " Number of Metals = 1\n", + "---------------------------------------------------\n", + "]\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 11\n", + " Formula = H4-C5-Cl-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 20\n", + " Formula = H7-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Cl', 'Cl', 'Cl', 'Hg', 'Cl', 'Cl', 'Cl']\n", "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 4]\n", "MOLECULE.SPLIT COMPLEX: rest_idx=[1, 2, 3, 5, 6, 7]\n", "SPLIT COMPLEX: rest labels: ['Cl', 'Cl', 'Cl', 'Cl', 'Cl', 'Cl']\n", - "SPLIT COMPLEX: rest coord: [[1.3562608, -0.0638992, 5.1197601], [2.9351153, 0.5309238, 9.0521877], [3.4671199, 3.2061439, 5.7530764], [4.8684929, -0.5616564000000004, 5.7432997], [3.2896384000000003, -1.1564794000000003, 1.8108721], [2.7576338000000002, -3.8316994000000006, 5.1099833]]\n", + "SPLIT COMPLEX: rest coord: [[4.8684929, -0.5616564000000004, 5.7432997], [3.2896384000000003, -1.1564794000000003, 1.8108721], [2.7576338000000002, -3.8316994000000006, 5.1099833], [1.3562608, -0.0638992, 5.1197601], [2.9351153, 0.5309238, 9.0521877], [3.4671199, 3.2061439, 5.7530764]]\n", "SPLIT COMPLEX: rest indices: [1, 2, 3, 5, 6, 7]\n", "SPLIT COMPLEX: rest radii: [1.02, 1.02, 1.02, 1.02, 1.02, 1.02]\n", "SPLIT COMPLEX: splitting species with 6 atoms in block\n", @@ -584,92 +874,584 @@ "CREATING LIGAND: Cl\n", "PREPARING BLOCK: [0]\n", "CREATING LIGAND: Cl\n", - "MOLECULE.SPLIT COMPLEX: labels=['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Hg', 'Cl', 'Fe', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H']\n", - "MOLECULE.SPLIT COMPLEX: metal_idx=[9, 11]\n", - "MOLECULE.SPLIT COMPLEX: rest_idx=[0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", - "SPLIT COMPLEX: rest labels: ['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Cl', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H']\n", - "SPLIT COMPLEX: rest coord: [[6.1022008, 2.0607668, 3.3610307], [5.5104028, 3.0110239, 2.5441286], [5.2421926, 3.8561355, 2.8254818], [5.3684013, 2.5137605, 1.2025407], [5.001188, 2.9553237, 0.4714568], [5.8997816, 1.2250349, 1.2351299], [5.9443431, 0.6468013, 0.5073049], [6.3650269, 0.9240044, 2.5495601], [6.7663014, 0.1315989, 2.8243955], [6.985123, 2.3016164, 7.6030555], [8.4662071, 4.3093526, 1.5686258], [8.1312516, 5.1688089, 1.6978962], [8.4177716, 3.6384001, 0.3649988], [9.0069, 2.4157695, 0.5757422], [9.425084, 2.3344473, 1.9879399], [9.843130200000001, 1.6213751, 2.4050814], [9.061447600000001, 3.5520773, 2.5593369], [9.1963008, 3.805643, 3.4435899], [8.0561789, 3.9460315, -0.4334360000000004], [9.1306494, 1.7496592, -0.06517830000000124]]\n", - "SPLIT COMPLEX: rest indices: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", - "SPLIT COMPLEX: rest radii: [0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 1.02, 0.73, 0.31, 0.73, 0.73, 0.73, 0.31, 0.73, 0.31, 0.31, 0.31]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[3.4671199, 3.2061439, 5.7530764]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[2.9351153, 0.5309238, 9.0521877]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[1.3562608, -0.0638992, 5.1197601]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[2.7576338000000002, -3.8316994000000006, 5.1099833]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[3.2896384000000003, -1.1564794000000003, 1.8108721]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[4.8684929, -0.5616564000000004, 5.7432997]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([3.4671199, 3.2061439, 5.7530764]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([2.9351153, 0.5309238, 9.0521877]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 2.7576338, -3.8316994, 5.1099833]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 3.2896384, -1.1564794, 1.8108721]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "reordered_newmolec=------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "COMPARE_SPECIES. Comparing:\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "['Hg', 'Cl', 'Cl', 'Cl', 'Hg', 'Cl', 'Cl', 'Cl']\n", + "['Hg', 'Cl', 'Cl', 'Cl', 'Hg', 'Cl', 'Cl', 'Cl']\n", + "mol1.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "mol2.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "goodlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "]\n", + "avglist=[]\n", + "badlist=[]\n", + "FRAG_RECONSTRUCT. 1 molecules and 2 fragments out of SEQUENTIAL with Heavy\n", + "FRAG_RECONSTRUCT. 6 molecules submitted to sequential with All\n", + "H7-C10-Cl-Fe-Hg Rec. Fragment ['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Hg', 'Cl', 'Fe', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H']\n", + "H7-C10-Cl-Fe-Hg Rec. Fragment ['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Hg', 'Cl', 'Fe', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H']\n", + "H H ['H']\n", + "H H ['H']\n", + "H H ['H']\n", + "H H ['H']\n", + "sublist 2 ['H7-C10-Cl-Fe-Hg', 'H']\n", + "list1 2 ['H7-C10-Cl-Fe-Hg', 'H7-C10-Cl-Fe-Hg']\n", + "list2 4 ['H', 'H', 'H', 'H']\n", + "keeplist1 1 ['H7-C10-Cl-Fe-Hg']\n", + "keeplist2 3 ['H', 'H', 'H']\n", + "\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 21\n", + " Formula = H8-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", + "sublist 2 ['H8-C10-Cl-Fe-Hg', 'H']\n", + "list1 2 ['H8-C10-Cl-Fe-Hg', 'H7-C10-Cl-Fe-Hg']\n", + "list2 3 ['H', 'H', 'H']\n", + "keeplist1 1 ['H7-C10-Cl-Fe-Hg']\n", + "keeplist2 2 ['H', 'H']\n", + "\n", + "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 1]\n", + "MOLECULE.SPLIT COMPLEX: rest_idx=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest labels: ['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "SPLIT COMPLEX: rest coord: [[6.985123, 2.3016164, 7.6030555], [8.4662071, 4.3093526, 1.5686258], [8.1312516, 5.1688089, 1.6978962], [8.4177716, 3.6384001, 0.3649988], [8.0561789, 3.9460315, -0.4334360000000004], [9.0069, 2.4157695, 0.5757422], [9.1306494, 1.7496592, -0.06517830000000124], [9.425084, 2.3344473, 1.9879399], [9.843130200000001, 1.6213751, 2.4050814], [9.061447600000001, 3.5520773, 2.5593369], [9.1963008, 3.805643, 3.4435899], [6.1022008, 2.0607668, 3.3610307], [5.5104028, 3.0110239, 2.5441286], [5.2421926, 3.8561355, 2.8254818], [5.3684013, 2.5137605, 1.2025407], [5.001188, 2.9553237, 0.4714568], [5.8997816, 1.2250349, 1.2351299], [5.9443431, 0.6468013, 0.5073049], [6.3650269, 0.9240044, 2.5495601], [6.7663014, 0.1315989, 2.8243955]]\n", + "SPLIT COMPLEX: rest indices: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest radii: [1.02, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31]\n", "SPLIT COMPLEX: splitting species with 20 atoms in block\n", - "labels=['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Cl', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H'] 20\n", + "labels=['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H'] 20\n", "indices=None\n", "SPLIT COMPLEX: received 3 blocks\n", - "PREPARING BLOCK: [0, 1, 2, 3, 4, 5, 6, 7, 8]\n", - "CREATING LIGAND: H4-C5\n", - "PREPARING BLOCK: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n", + "PREPARING BLOCK: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", "CREATING LIGAND: H5-C5\n", - "PREPARING BLOCK: [9]\n", - "CREATING LIGAND: Cl\n", - "MOLECULE.SPLIT COMPLEX: labels=['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Hg', 'Cl', 'Fe', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H']\n", - "MOLECULE.SPLIT COMPLEX: metal_idx=[9, 11]\n", - "MOLECULE.SPLIT COMPLEX: rest_idx=[0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", - "SPLIT COMPLEX: rest labels: ['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Cl', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H']\n", - "SPLIT COMPLEX: rest coord: [[-2.7651809, 6.6251757, 7.5020291], [-2.1733829, 5.6749186, 8.3189312], [-1.9051726, 4.8298069, 8.0375779], [-2.0313814, 6.1721819, 9.660519], [-1.6641681, 5.7306187, 10.391603], [-2.5627616, 7.4609076, 9.6279299], [-2.6073232, 8.0391411, 10.3557549], [-3.028007, 7.7619381, 8.3134996], [-3.4292814, 8.5543436, 8.0386642], [-3.6481031, 6.3843261, 3.2600042], [-5.1291871, 4.3765899, 9.2944339], [-4.7942317, 3.5171335, 9.1651635], [-5.0807517, 5.0475424, 10.4980609], [-5.66988, 6.2701729, 10.2873176], [-6.088064, 6.3514951, 8.8751198], [-6.5061102, 7.0645673, 8.4579783], [-5.7244276, 5.1338652, 8.3037229], [-5.8592809, 4.8802994, 7.4194698], [-5.7936295, 6.9362832, 10.928238100000002], [-4.7191589, 4.7399109, 11.2964958]]\n", - "SPLIT COMPLEX: rest indices: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", - "SPLIT COMPLEX: rest radii: [0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 1.02, 0.73, 0.31, 0.73, 0.73, 0.73, 0.31, 0.73, 0.31, 0.31, 0.31]\n", - "SPLIT COMPLEX: splitting species with 20 atoms in block\n", - "labels=['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'Cl', 'C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H'] 20\n", - "indices=None\n", - "SPLIT COMPLEX: received 3 blocks\n", - "PREPARING BLOCK: [0, 1, 2, 3, 4, 5, 6, 7, 8]\n", + "PREPARING BLOCK: [11, 12, 13, 14, 15, 16, 17, 18, 19]\n", "CREATING LIGAND: H4-C5\n", - "PREPARING BLOCK: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n", - "CREATING LIGAND: H5-C5\n", - "PREPARING BLOCK: [9]\n", - "CREATING LIGAND: Cl\n" - ] - }, - { - "data": { - "text/plain": [ - "[------------- Cell2mol MOLECULE Object --------------\n", - " Version = 0.1\n", - " Type = specie\n", - " Sub-Type = molecule\n", - " Number of Atoms = 8\n", - " Formula = Cl6-Hg2\n", - " Has Adjacency Matrix = YES\n", - " Origin = cell.reconstruct\n", - " Number of Ligands = 6\n", - " Number of Metals = 2\n", - " ---------------------------------------------------,\n", - " ------------- Cell2mol MOLECULE Object --------------\n", - " Version = 0.1\n", - " Type = specie\n", - " Sub-Type = molecule\n", - " Number of Atoms = 22\n", - " Formula = H9-C10-Cl-Fe-Hg\n", - " Has Adjacency Matrix = YES\n", - " Origin = cell.reconstruct\n", - " Number of Ligands = 3\n", - " Number of Metals = 2\n", - " ---------------------------------------------------,\n", - " ------------- Cell2mol MOLECULE Object --------------\n", - " Version = 0.1\n", - " Type = specie\n", - " Sub-Type = molecule\n", - " Number of Atoms = 22\n", - " Formula = H9-C10-Cl-Fe-Hg\n", - " Has Adjacency Matrix = YES\n", - " Origin = cell.reconstruct\n", - " Number of Ligands = 3\n", - " Number of Metals = 2\n", - " ---------------------------------------------------]" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "newcell.reconstruct(debug=debug) " - ] - }, + "PREPARING BLOCK: [0]\n", + "CREATING LIGAND: Cl\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0, 2, 4, 6, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[8.4662071, 4.3093526, 1.5686258], [8.4177716, 3.6384001, 0.3649988], [9.0069, 2.4157695, 0.5757422], [9.425084, 2.3344473, 1.9879399], [9.061447600000001, 3.5520773, 2.5593369]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0, 1, 3, 5, 7]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[6.1022008, 2.0607668, 3.3610307], [5.5104028, 3.0110239, 2.5441286], [5.3684013, 2.5137605, 1.2025407], [5.8997816, 1.2250349, 1.2351299], [6.3650269, 0.9240044, 2.5495601]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[6.985123, 2.3016164, 7.6030555]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.065 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Fe \tdistance : 2.062 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.045 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.084 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.104 \tthres : 2.501\n", + "ratio_list=[0.826, 0.824, 0.818, 0.833, 0.841] std_dev=0.008\n", + "\tAtom 0 : C \tMetal : Hg \tdistance : 2.042 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Fe \tdistance : 2.051 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.081 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.068 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.077 \tthres : 2.501\n", + "ratio_list=[0.816, 0.82, 0.832, 0.827, 0.83] std_dev=0.006\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([6.985123 , 2.3016164, 7.6030555]) and tgt.coord=[6.4998052, 2.1910413, 5.3595078]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "reordered_newmolec=------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "COMPARE_SPECIES. Comparing:\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "mol1.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "mol2.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "goodlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "]\n", + "avglist=[]\n", + "badlist=[]\n", + "sublist 2 ['H7-C10-Cl-Fe-Hg', 'H']\n", + "list1 1 ['H7-C10-Cl-Fe-Hg']\n", + "list2 2 ['H', 'H']\n", + "keeplist1 0 []\n", + "keeplist2 1 ['H']\n", + "\n", + "goodlist=[]\n", + "avglist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = Rec. Fragment\n", + " Number of Atoms = 21\n", + " Formula = H8-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + "---------------------------------------------------\n", + "]\n", + "badlist=[]\n", + "sublist 2 ['H8-C10-Cl-Fe-Hg', 'H']\n", + "list1 1 ['H8-C10-Cl-Fe-Hg']\n", + "list2 1 ['H']\n", + "keeplist1 0 []\n", + "keeplist2 0 []\n", + "\n", + "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 1]\n", + "MOLECULE.SPLIT COMPLEX: rest_idx=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest labels: ['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "SPLIT COMPLEX: rest coord: [[-3.6481031, 6.3843261, 3.2600042], [-3.028007, 7.7619381, 8.3134996], [-3.4292814, 8.5543436, 8.0386642], [-2.7651809, 6.6251757, 7.5020291], [-4.7191589, 4.7399109, 11.2964958], [-2.1733829, 5.6749186, 8.3189312], [-1.9051726, 4.8298069, 8.0375779], [-2.0313814, 6.1721819, 9.660519], [-1.6641681, 5.7306187, 10.391603], [-2.5627616, 7.4609076, 9.6279299], [-2.6073232, 8.0391411, 10.3557549], [-5.0807517, 5.0475424, 10.4980609], [-5.66988, 6.2701729, 10.2873176], [-5.7936295, 6.9362832, 10.928238100000002], [-6.088064, 6.3514951, 8.8751198], [-6.5061102, 7.0645673, 8.4579783], [-5.7244276, 5.1338652, 8.3037229], [-5.8592809, 4.8802994, 7.4194698], [-5.1291871, 4.3765899, 9.2944339], [-4.7942317, 3.5171335, 9.1651635]]\n", + "SPLIT COMPLEX: rest indices: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest radii: [1.02, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31]\n", + "SPLIT COMPLEX: splitting species with 20 atoms in block\n", + "labels=['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H'] 20\n", + "indices=None\n", + "SPLIT COMPLEX: received 3 blocks\n", + "PREPARING BLOCK: [1, 2, 3, 5, 6, 7, 8, 9, 10]\n", + "CREATING LIGAND: H4-C5\n", + "PREPARING BLOCK: [4, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n", + "CREATING LIGAND: H5-C5\n", + "PREPARING BLOCK: [0]\n", + "CREATING LIGAND: Cl\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0, 2, 3, 5, 7]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-3.028007, 7.7619381, 8.3134996], [-2.7651809, 6.6251757, 7.5020291], [-2.1733829, 5.6749186, 8.3189312], [-2.0313814, 6.1721819, 9.660519], [-2.5627616, 7.4609076, 9.6279299]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[1, 2, 4, 6, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-5.0807517, 5.0475424, 10.4980609], [-5.66988, 6.2701729, 10.2873176], [-6.088064, 6.3514951, 8.8751198], [-5.7244276, 5.1338652, 8.3037229], [-5.1291871, 4.3765899, 9.2944339]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-3.6481031, 6.3843261, 3.2600042]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.077 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Hg \tdistance : 2.042 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.051 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.081 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.068 \tthres : 2.501\n", + "ratio_list=[0.83, 0.816, 0.82, 0.832, 0.827] std_dev=0.006\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.062 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Fe \tdistance : 2.045 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.084 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.104 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.065 \tthres : 2.501\n", + "ratio_list=[0.824, 0.818, 0.833, 0.841, 0.826] std_dev=0.008\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([-3.6481031, 6.3843261, 3.2600042]) and tgt.coord=[-3.1627853000000004, 6.4949012, 5.503552]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "reordered_newmolec=------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "COMPARE_SPECIES. Comparing:\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "\n", + "['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "mol1.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "mol2.adj_types=array([[0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " ...,\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0],\n", + " [0, 0, 0, ..., 0, 0, 0]])\n", + "goodlist=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "]\n", + "avglist=[]\n", + "badlist=[]\n", + "FINISHED succesfully\n", + "finalmols=[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + ", ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + "---------------------------------------------------\n", + "]\n", + "remfrag=[]\n", + "FRAG_RECONSTRUCT. No remaining Molecules after Hydrogen reconstruction\n", + "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Cl', 'Cl', 'Cl', 'Hg', 'Cl', 'Cl', 'Cl']\n", + "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 4]\n", + "MOLECULE.SPLIT COMPLEX: rest_idx=[1, 2, 3, 5, 6, 7]\n", + "SPLIT COMPLEX: rest labels: ['Cl', 'Cl', 'Cl', 'Cl', 'Cl', 'Cl']\n", + "SPLIT COMPLEX: rest coord: [[4.8684929, -0.5616564000000004, 5.7432997], [3.2896384000000003, -1.1564794000000003, 1.8108721], [2.7576338000000002, -3.8316994000000006, 5.1099833], [1.3562608, -0.0638992, 5.1197601], [2.9351153, 0.5309238, 9.0521877], [3.4671199, 3.2061439, 5.7530764]]\n", + "SPLIT COMPLEX: rest indices: [1, 2, 3, 5, 6, 7]\n", + "SPLIT COMPLEX: rest radii: [1.02, 1.02, 1.02, 1.02, 1.02, 1.02]\n", + "SPLIT COMPLEX: splitting species with 6 atoms in block\n", + "labels=['Cl', 'Cl', 'Cl', 'Cl', 'Cl', 'Cl'] 6\n", + "indices=None\n", + "SPLIT COMPLEX: received 6 blocks\n", + "PREPARING BLOCK: [5]\n", + "CREATING LIGAND: Cl\n", + "PREPARING BLOCK: [4]\n", + "CREATING LIGAND: Cl\n", + "PREPARING BLOCK: [3]\n", + "CREATING LIGAND: Cl\n", + "PREPARING BLOCK: [2]\n", + "CREATING LIGAND: Cl\n", + "PREPARING BLOCK: [1]\n", + "CREATING LIGAND: Cl\n", + "PREPARING BLOCK: [0]\n", + "CREATING LIGAND: Cl\n", + "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 1]\n", + "MOLECULE.SPLIT COMPLEX: rest_idx=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest labels: ['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "SPLIT COMPLEX: rest coord: [[6.985123, 2.3016164, 7.6030555], [8.4662071, 4.3093526, 1.5686258], [8.1312516, 5.1688089, 1.6978962], [8.4177716, 3.6384001, 0.3649988], [8.0561789, 3.9460315, -0.4334360000000004], [9.0069, 2.4157695, 0.5757422], [9.1306494, 1.7496592, -0.06517830000000124], [9.425084, 2.3344473, 1.9879399], [9.843130200000001, 1.6213751, 2.4050814], [9.061447600000001, 3.5520773, 2.5593369], [9.1963008, 3.805643, 3.4435899], [6.1022008, 2.0607668, 3.3610307], [5.5104028, 3.0110239, 2.5441286], [5.2421926, 3.8561355, 2.8254818], [5.3684013, 2.5137605, 1.2025407], [5.001188, 2.9553237, 0.4714568], [5.8997816, 1.2250349, 1.2351299], [5.9443431, 0.6468013, 0.5073049], [6.3650269, 0.9240044, 2.5495601], [6.7663014, 0.1315989, 2.8243955]]\n", + "SPLIT COMPLEX: rest indices: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest radii: [1.02, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31]\n", + "SPLIT COMPLEX: splitting species with 20 atoms in block\n", + "labels=['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H'] 20\n", + "indices=None\n", + "SPLIT COMPLEX: received 3 blocks\n", + "PREPARING BLOCK: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "CREATING LIGAND: H5-C5\n", + "PREPARING BLOCK: [11, 12, 13, 14, 15, 16, 17, 18, 19]\n", + "CREATING LIGAND: H4-C5\n", + "PREPARING BLOCK: [0]\n", + "CREATING LIGAND: Cl\n", + "MOLECULE.SPLIT COMPLEX: labels=['Hg', 'Fe', 'Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "MOLECULE.SPLIT COMPLEX: metal_idx=[0, 1]\n", + "MOLECULE.SPLIT COMPLEX: rest_idx=[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest labels: ['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "SPLIT COMPLEX: rest coord: [[-3.6481031, 6.3843261, 3.2600042], [-3.028007, 7.7619381, 8.3134996], [-3.4292814, 8.5543436, 8.0386642], [-2.7651809, 6.6251757, 7.5020291], [-4.7191589, 4.7399109, 11.2964958], [-2.1733829, 5.6749186, 8.3189312], [-1.9051726, 4.8298069, 8.0375779], [-2.0313814, 6.1721819, 9.660519], [-1.6641681, 5.7306187, 10.391603], [-2.5627616, 7.4609076, 9.6279299], [-2.6073232, 8.0391411, 10.3557549], [-5.0807517, 5.0475424, 10.4980609], [-5.66988, 6.2701729, 10.2873176], [-5.7936295, 6.9362832, 10.928238100000002], [-6.088064, 6.3514951, 8.8751198], [-6.5061102, 7.0645673, 8.4579783], [-5.7244276, 5.1338652, 8.3037229], [-5.8592809, 4.8802994, 7.4194698], [-5.1291871, 4.3765899, 9.2944339], [-4.7942317, 3.5171335, 9.1651635]]\n", + "SPLIT COMPLEX: rest indices: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]\n", + "SPLIT COMPLEX: rest radii: [1.02, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31, 0.73, 0.31]\n", + "SPLIT COMPLEX: splitting species with 20 atoms in block\n", + "labels=['Cl', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H'] 20\n", + "indices=None\n", + "SPLIT COMPLEX: received 3 blocks\n", + "PREPARING BLOCK: [1, 2, 3, 5, 6, 7, 8, 9, 10]\n", + "CREATING LIGAND: H4-C5\n", + "PREPARING BLOCK: [4, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n", + "CREATING LIGAND: H5-C5\n", + "PREPARING BLOCK: [0]\n", + "CREATING LIGAND: Cl\n" + ] + }, + { + "data": { + "text/plain": [ + "[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.reconstruct(debug=debug) " + ] + }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 16, "id": "1a4d5062", "metadata": { "scrolled": true @@ -681,7 +1463,7 @@ "False" ] }, - "execution_count": 9, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -714,47 +1496,150 @@ { "cell_type": "code", "execution_count": 11, - "id": "f10195bc", + "id": "3e82eb55", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[------------- Cell2mol LIGAND Object --------------\n", + "[------------- Cell2mol MOLECULE Object --------------\n", " Version = 0.1\n", " Type = specie\n", - " Sub-Type = ligand\n", - " Number of Atoms = 1\n", - " Formula = Cl\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", " Has Adjacency Matrix = YES\n", - " Origin = split_complex\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", " ---------------------------------------------------,\n", - " ------------- Cell2mol METAL Object --------------\n", - " Version = 0.1\n", - " Type = atom\n", - " Sub-Type = metal\n", - " Label = Hg\n", - " Atomic Number = 80\n", - " Index in Molecule = 0\n", - " Metal Adjacency (mconnec) = 4\n", - " Regular Adjacencies (connec) = 4\n", - " Coordination Sphere Formula = Cl4\n", - " ----------------------------------------------------,\n", - " ------------- Cell2mol LIGAND Object --------------\n", + " ------------- Cell2mol MOLECULE Object --------------\n", " Version = 0.1\n", " Type = specie\n", - " Sub-Type = ligand\n", - " Number of Atoms = 9\n", - " Formula = H4-C5\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", " Has Adjacency Matrix = YES\n", - " Origin = split_complex\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", " ---------------------------------------------------,\n", - " ------------- Cell2mol LIGAND Object --------------\n", + " ------------- Cell2mol MOLECULE Object --------------\n", " Version = 0.1\n", " Type = specie\n", - " Sub-Type = ligand\n", - " Number of Atoms = 10\n", - " Formula = H5-C5\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + " ---------------------------------------------------]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.refmoleclist" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "d3a63460", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.moleclist" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "f10195bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[------------- Cell2mol LIGAND Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = ligand\n", + " Number of Atoms = 1\n", + " Formula = Cl\n", + " Has Adjacency Matrix = YES\n", + " Origin = split_complex\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol METAL Object --------------\n", + " Version = 0.1\n", + " Type = atom\n", + " Sub-Type = metal\n", + " Label = Hg\n", + " Atomic Number = 80\n", + " Index in Molecule = 0\n", + " Metal Adjacency (mconnec) = 4\n", + " Regular Adjacencies (connec) = 4\n", + " Coordination Sphere Formula = Cl4\n", + " ----------------------------------------------------,\n", + " ------------- Cell2mol LIGAND Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = ligand\n", + " Number of Atoms = 10\n", + " Formula = H5-C5\n", + " Has Adjacency Matrix = YES\n", + " Origin = split_complex\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol LIGAND Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = ligand\n", + " Number of Atoms = 9\n", + " Formula = H4-C5\n", " Has Adjacency Matrix = YES\n", " Origin = split_complex\n", " ---------------------------------------------------,\n", @@ -764,7 +1649,7 @@ " Sub-Type = metal\n", " Label = Hg\n", " Atomic Number = 80\n", - " Index in Molecule = 9\n", + " Index in Molecule = 0\n", " Metal Adjacency (mconnec) = 2\n", " Regular Adjacencies (connec) = 2\n", " Coordination Sphere Formula = C-Cl\n", @@ -775,14 +1660,14 @@ " Sub-Type = metal\n", " Label = Fe\n", " Atomic Number = 26\n", - " Index in Molecule = 11\n", + " Index in Molecule = 1\n", " Metal Adjacency (mconnec) = 10\n", " Regular Adjacencies (connec) = 10\n", " Coordination Sphere Formula = C10\n", " ----------------------------------------------------]" ] }, - "execution_count": 11, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -793,7 +1678,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "id": "25e6cdaa", "metadata": {}, "outputs": [ @@ -804,14 +1689,14 @@ "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[2.7576338000000002, -3.8316994000000006, 5.1099833]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[3.4671199, 3.2061439, 5.7530764]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 2.7576338, -3.8316994, 5.1099833]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: evaluating apos=array([3.4671199, 3.2061439, 5.7530764]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -840,39 +1725,75 @@ "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[3.2896384000000003, -1.1564794000000003, 1.8108721]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[2.9351153, 0.5309238, 9.0521877]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[4.8684929, -0.5616564000000004, 5.7432997]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[1.3562608, -0.0638992, 5.1197601]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[3.4671199, 3.2061439, 5.7530764]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[2.7576338000000002, -3.8316994000000006, 5.1099833]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[2.9351153, 0.5309238, 9.0521877]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[3.2896384000000003, -1.1564794000000003, 1.8108721]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[1.3562608, -0.0638992, 5.1197601]]\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[4.8684929, -0.5616564000000004, 5.7432997]]\n", "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", "blocklist=[[0]]\n", "LIGAND.SPLIT_LIGAND: block=[0]\n", "\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0, 2, 4, 6, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[8.4662071, 4.3093526, 1.5686258], [8.4177716, 3.6384001, 0.3649988], [9.0069, 2.4157695, 0.5757422], [9.425084, 2.3344473, 1.9879399], [9.061447600000001, 3.5520773, 2.5593369]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.065 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Fe \tdistance : 2.062 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.045 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.084 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.104 \tthres : 2.501\n", + "ratio_list=[0.826, 0.824, 0.818, 0.833, 0.841] std_dev=0.008\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H']\n", + " Type = Local\n", + " Atoms added in positions = [1 0 0 0 0 0 0 0 0 0]\n", + " Atoms blocked (no atoms added) = [1 0 1 0 1 0 1 0 1 0]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[H]C1=C([H])C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C+]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])[C-]([H])C1([H])[H]'\n", + "smiles='[H][C+]1[C+]([H])C([H])([H])[C+]([H])[C-]1[H]'\n", + "H5-C5\n", + "spec.protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H']\n", + " Type = Local\n", + " Atoms added in positions = [1 0 0 0 0 0 0 0 0 0]\n", + " Atoms blocked (no atoms added) = [1 0 1 0 1 0 1 0 1 0]\n", + "---------------------------------------------------\n", + "]\n", + "\n", "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0, 1, 3, 5, 7]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", @@ -909,42 +1830,6 @@ "---------------------------------------------------\n", "]\n", "\n", - "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", - "LIGAND.SPLIT_LIGAND: conn_idx=[0, 2, 3, 4, 6]\n", - "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", - "LIGAND.SPLIT_LIGAND: conn_coord=[[8.4662071, 4.3093526, 1.5686258], [8.4177716, 3.6384001, 0.3649988], [9.0069, 2.4157695, 0.5757422], [9.425084, 2.3344473, 1.9879399], [9.061447600000001, 3.5520773, 2.5593369]]\n", - "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", - "blocklist=[[0, 1, 2, 3, 4]]\n", - "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", - "\tAtom 0 : C \tMetal : Fe \tdistance : 2.065 \tthres : 2.501\n", - "\tAtom 1 : C \tMetal : Fe \tdistance : 2.062 \tthres : 2.501\n", - "\tAtom 2 : C \tMetal : Fe \tdistance : 2.045 \tthres : 2.501\n", - "\tAtom 3 : C \tMetal : Fe \tdistance : 2.084 \tthres : 2.501\n", - "\tAtom 4 : C \tMetal : Fe \tdistance : 2.104 \tthres : 2.501\n", - "ratio_list=[0.826, 0.824, 0.818, 0.833, 0.841] std_dev=0.008\n", - "protonation_states=[------------- Cell2mol Protonation ----------------\n", - " Status = True\n", - " Labels = ['C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H', 'H']\n", - " Type = Local\n", - " Atoms added in positions = [1 0 0 0 0 0 0 0 0 0]\n", - " Atoms blocked (no atoms added) = [1 0 1 1 1 0 1 0 0 0]\n", - "---------------------------------------------------\n", - "]\n", - "smiles='[H]C1=C([H])C([H])([H])C([H])=C1[H]'\n", - "smiles='[H][C+]1[C-]([H])[C-]([H])C([H])([H])[C-]1[H]'\n", - "smiles='[H][C+]1[C-]([H])[C+]([H])C([H])([H])[C-]1[H]'\n", - "smiles='[H][C+]1[C-]([H])[C-]([H])[C-]([H])C1([H])[H]'\n", - "smiles='[H][C+]1[C+]([H])C([H])([H])[C+]([H])[C-]1[H]'\n", - "H5-C5\n", - "spec.protonation_states=[------------- Cell2mol Protonation ----------------\n", - " Status = True\n", - " Labels = ['C', 'H', 'C', 'C', 'C', 'H', 'C', 'H', 'H', 'H', 'H']\n", - " Type = Local\n", - " Atoms added in positions = [1 0 0 0 0 0 0 0 0 0]\n", - " Atoms blocked (no atoms added) = [1 0 1 1 1 0 1 0 0 0]\n", - "---------------------------------------------------\n", - "]\n", - "\n", "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", @@ -954,7 +1839,7 @@ "LIGAND.SPLIT_LIGAND: block=[0]\n", "\n", "\n", - "[[-1], [2], [-2], [-1], [2], [2, 3, 0]]\n" + "[[-1], [2], [-1], [-2], [2], [2, 3, 0]]\n" ] } ], @@ -989,17 +1874,17 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 15, "id": "2972ca26", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[[-1], [2], [-2], [-1], [2], [2, 3, 0]]" + "[[-1], [2], [-1], [-2], [2], [2, 3, 0]]" ] }, - "execution_count": 13, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -1010,7 +1895,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 16, "id": "2de46e92", "metadata": {}, "outputs": [ @@ -1018,38 +1903,32 @@ "name": "stdout", "output_type": "stream", "text": [ - "BALANCE: iterlist [[-1], [2], [-2], [-1], [2], [2, 3, 0]]\n", - "BALANCE: unique_indices [0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 0, 4, 5, 2, 3, 0, 4, 5]\n", - "BALANCE: tmpdistr [(-1, 2, -2, -1, 2, 2), (-1, 2, -2, -1, 2, 3), (-1, 2, -2, -1, 2, 0)]\n", - "BALANCE: alldistr added: [-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 2, -2, -1, -1, 2, 2]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 2, -2, -1, -1, 2, 2]\n", - "BALANCE: alldistr added: [-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 3, -2, -1, -1, 2, 3]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 2, -2, -1, -1, 2, 2]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 3, -2, -1, -1, 2, 3]\n", - "BALANCE: alldistr added: [-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 0, -2, -1, -1, 2, 0]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 2, -2, -1, -1, 2, 2]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 3, -2, -1, -1, 2, 3]\n", - "d=[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 0, -2, -1, -1, 2, 0]\n" + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 3, -2, -1, -1, 2, 3]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 3, -2, -1, -1, 2, 3]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 0, -2, -1, -1, 2, 0]\n" ] } ], "source": [ - "final_charge_distribution = balance_charge(newcell.unique_indices, newcell.unique_species, debug=2)" + "final_charge_distribution = balance_charge(newcell.unique_indices, newcell.unique_species, debug=debug)" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 17, "id": "6e2772ef", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[[-1, -1, -1, -1, -1, -1, 2, 2, -2, -1, -1, 2, 3, -2, -1, -1, 2, 3]]" + "[[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 3, -2, -1, -1, 2, 3]]" ] }, - "execution_count": 15, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -1060,7 +1939,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "86a83037", "metadata": {}, "outputs": [], @@ -1122,7 +2001,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "b8f13537", "metadata": {}, "outputs": [], @@ -1190,18 +2069,45 @@ "# print(l_mol, l_prot, (l_mol == l_prot), c_mol, c_prot, (c_mol==c_prot) ) " ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "acd11a2c", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": 18, - "id": "dcd86634", - "metadata": { - "scrolled": false - }, + "id": "bbe21465", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[H]C1=C([H])C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C+]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])[C-]([H])C1([H])[H]'\n", + "smiles='[H][C+]1[C+]([H])C([H])([H])[C+]([H])[C-]1[H]'\n", + "smiles='[H][C+]1CC([H])([H])[C+]([H])[C-]1[H]'\n", + "smiles='[H]C1=[C-]C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1[C+]([H])C([H])([H])C[C-]1[H]'\n", + "smiles='[H][C+]1CC([H])([H])[C-]([H])[C-]1[H]'\n", + "smiles='[H][C+]1CC([H])([H])[C+]([H])[C+]1[H]'\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 3, -2, -1, -1, 2, 3]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 2, -2, -1, -1, 2, 2]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 3, -2, -1, -1, 2, 3]\n", + "d=[-1, -1, -1, -1, -1, -1, 2, 2, -1, -2, -1, 2, 0, -2, -1, -1, 2, 0]\n", "Cl\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", " Status = True\n", @@ -1216,12 +2122,11 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Cl\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 3.2896384, -1.1564794, 1.8108721]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: evaluating apos=array([2.9351153, 0.5309238, 9.0521877]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -1237,18 +2142,17 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Cl\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", + "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -1264,12 +2168,11 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Cl\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([3.4671199, 3.2061439, 5.7530764]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: evaluating apos=array([ 2.7576338, -3.8316994, 5.1099833]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -1285,12 +2188,11 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Cl\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([2.9351153, 0.5309238, 9.0521877]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: evaluating apos=array([ 3.2896384, -1.1564794, 1.8108721]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -1306,18 +2208,17 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Cl\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "ADD_ATOM: Metalist length 1\n", "ADD_ATOM: Ligand Atoms 1\n", "ADD_ATOM: site= 0\n", - "ADD_ATOM: evaluating apos=array([ 1.3562608, -0.0638992, 5.1197601]) and tgt.coord=[2.8686395, 1.120505, 6.7807219]\n", + "ADD_ATOM: evaluating apos=array([ 4.8684929, -0.5616564, 5.7432997]) and tgt.coord=[3.3561142, -1.7460605999999999, 4.0823379]\n", "ADD_ATOM: received tmpconnec[posadded]=1\n", "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", @@ -1333,9 +2234,22 @@ "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", "smiles='[Cl-]'\n", - "BUILD BONDS: atom 0 Cl\n", "Hg\n", "Hg\n", + "H5-C5\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H']\n", + " Type = Local\n", + " Atoms added in positions = [1 0 0 0 0 0 0 0 0 0]\n", + " Atoms blocked (no atoms added) = [1 0 1 0 1 0 1 0 1 0]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[H]C1=C([H])C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C+]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])[C-]([H])C1([H])[H]'\n", + "smiles='[H][C+]1[C+]([H])C([H])([H])[C+]([H])[C-]1[H]'\n", "H4-C5\n", "protonation_states=[------------- Cell2mol Protonation ----------------\n", " Status = True\n", @@ -1350,39 +2264,463 @@ "smiles='[H][C+]1[C+]([H])C([H])([H])C[C-]1[H]'\n", "smiles='[H][C+]1CC([H])([H])[C-]([H])[C-]1[H]'\n", "smiles='[H][C+]1CC([H])([H])[C+]([H])[C+]1[H]'\n", - "BUILD BONDS: atom 0 C\n", - "BUILD BONDS: bond 0 1 1.0 C C C\n", - "BUILD BONDS: bond 0 7 2.0 C C C\n", - "BUILD BONDS: atom 1 C\n", - "BUILD BONDS: bond 0 1 1.0 C C C\n", - "BUILD BONDS: bond 1 2 1.0 C H H\n", - "BUILD BONDS: bond 1 3 1.0 C C C\n" - ] + "Cl\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([6.985123 , 2.3016164, 7.6030555]) and tgt.coord=[6.4998052, 2.1910413, 5.3595078]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['Cl']\n", + " Type = Local\n", + " Atoms added in positions = [0]\n", + " Atoms blocked (no atoms added) = [1]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "Hg\n", + "Fe\n", + "H4-C5\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0, 2, 3, 5, 7]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-3.028007, 7.7619381, 8.3134996], [-2.7651809, 6.6251757, 7.5020291], [-2.1733829, 5.6749186, 8.3189312], [-2.0313814, 6.1721819, 9.660519], [-2.5627616, 7.4609076, 9.6279299]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.077 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Hg \tdistance : 2.042 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.051 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.081 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.068 \tthres : 2.501\n", + "ratio_list=[0.83, 0.816, 0.82, 0.832, 0.827] std_dev=0.006\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'H']\n", + " Type = Local\n", + " Atoms added in positions = [1 0 0 0 0 0 0 0 0]\n", + " Atoms blocked (no atoms added) = [1 0 0 1 0 1 0 1 0]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[H][C+]1CC([H])([H])[C+]([H])[C-]1[H]'\n", + "smiles='[H]C1=[C-]C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1CC([H])([H])[C-]([H])[C+]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])CC1([H])[H]'\n", + "smiles='[H][C+]1CC([H])([H])[C+]([H])[C+]1[H]'\n", + "H5-C5\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[1, 2, 4, 6, 8]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['C', 'C', 'C', 'C', 'C']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-5.0807517, 5.0475424, 10.4980609], [-5.66988, 6.2701729, 10.2873176], [-6.088064, 6.3514951, 8.8751198], [-5.7244276, 5.1338652, 8.3037229], [-5.1291871, 4.3765899, 9.2944339]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[0.73, 0.73, 0.73, 0.73, 0.73]\n", + "blocklist=[[0, 1, 2, 3, 4]]\n", + "LIGAND.SPLIT_LIGAND: block=[0, 1, 2, 3, 4]\n", + "\tAtom 0 : C \tMetal : Fe \tdistance : 2.062 \tthres : 2.501\n", + "\tAtom 1 : C \tMetal : Fe \tdistance : 2.045 \tthres : 2.501\n", + "\tAtom 2 : C \tMetal : Fe \tdistance : 2.084 \tthres : 2.501\n", + "\tAtom 3 : C \tMetal : Fe \tdistance : 2.104 \tthres : 2.501\n", + "\tAtom 4 : C \tMetal : Fe \tdistance : 2.065 \tthres : 2.501\n", + "ratio_list=[0.824, 0.818, 0.833, 0.841, 0.826] std_dev=0.008\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'H']\n", + " Type = Local\n", + " Atoms added in positions = [0 1 0 0 0 0 0 0 0 0]\n", + " Atoms blocked (no atoms added) = [0 1 1 0 1 0 1 0 1 0]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[H]C1=C([H])C([H])([H])C([H])=C1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C+]([H])C([H])([H])[C-]1[H]'\n", + "smiles='[H][C+]1[C-]([H])[C-]([H])[C-]([H])C1([H])[H]'\n", + "smiles='[H][C+]1[C+]([H])C([H])([H])[C+]([H])[C-]1[H]'\n", + "Cl\n", + "LIGAND.SPLIT_LIGAND: self.indices=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_idx=[0]\n", + "LIGAND.SPLIT_LIGAND: conn_labels=['Cl']\n", + "LIGAND.SPLIT_LIGAND: conn_coord=[[-3.6481031, 6.3843261, 3.2600042]]\n", + "LIGAND.SPLIT_LIGAND: conn_radii=[1.02]\n", + "blocklist=[[0]]\n", + "LIGAND.SPLIT_LIGAND: block=[0]\n", + "ADD_ATOM: Metalist length 1\n", + "ADD_ATOM: Ligand Atoms 1\n", + "ADD_ATOM: site= 0\n", + "ADD_ATOM: evaluating apos=array([-3.6481031, 6.3843261, 3.2600042]) and tgt.coord=[-3.1627853000000004, 6.4949012, 5.503552]\n", + "ADD_ATOM: received tmpconnec[posadded]=1\n", + "ADD_ATOM: Chosen Metal index None. H is added at site 0\n", + "protonation_states=[------------- Cell2mol Protonation ----------------\n", + " Status = True\n", + " Labels = ['Cl']\n", + " Type = Local\n", + " Atoms added in positions = [0]\n", + " Atoms blocked (no atoms added) = [1]\n", + "---------------------------------------------------\n", + "]\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "smiles='[Cl-]'\n", + "Hg\n", + "Fe\n" + ] }, { - "ename": "IndexError", - "evalue": "list index out of range", + "data": { + "text/plain": [ + "[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = -2\n", + " Smiles = ['[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = 1\n", + " Smiles = ['[H]C1=C([H])C([H])([H])C([H])=C1[H]', '[H]C1=[C-]C([H])([H])C([H])=C1[H]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = 1\n", + " Smiles = ['[H]C1=[C-]C([H])([H])C([H])=C1[H]', '[H]C1=C([H])C([H])([H])C([H])=C1[H]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------]" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.assign_charges(debug=debug)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "890d7b32", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 8\n", + " Formula = Cl6-Hg2\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = -2\n", + " Smiles = ['[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 6\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = 1\n", + " Smiles = ['[H]C1=C([H])C([H])([H])C([H])=C1[H]', '[H]C1=[C-]C([H])([H])C([H])=C1[H]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------,\n", + " ------------- Cell2mol MOLECULE Object --------------\n", + " Version = 0.1\n", + " Type = specie\n", + " Sub-Type = molecule\n", + " Number of Atoms = 22\n", + " Formula = H9-C10-Cl-Fe-Hg\n", + " Has Adjacency Matrix = YES\n", + " Total Charge = 1\n", + " Smiles = ['[H]C1=[C-]C([H])([H])C([H])=C1[H]', '[H]C1=C([H])C([H])([H])C([H])=C1[H]', '[Cl-]']\n", + " Origin = cell.reconstruct\n", + " Number of Ligands = 3\n", + " Number of Metals = 2\n", + " ---------------------------------------------------]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.moleclist" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "678fa41f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "newcell.error_prepare_mols" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "6d500255", + "metadata": {}, + "outputs": [], + "source": [ + "def create_bonds_spicie (specie, debug: int=0):\n", + " from cell2mol.classes import bond\n", + "\n", + " # if not hasattr(specie,\"rdkit_obj\"): specie.get_parent(\"cell\").assign_charges()\n", + " for idx, atom in enumerate(specie.atoms):\n", + " # Security Check. Confirms that the labels are the same\n", + " if debug >= 2: print(\"BUILD BONDS: atom\", idx, atom.label)\n", + " rdkitatom = specie.rdkit_obj.GetAtomWithIdx(idx) \n", + " tmp = rdkitatom.GetSymbol()\n", + " if atom.label != tmp: print(\"Error in Create Bonds. Atom labels do not coincide. GMOL vs. MOL:\", atom.label, tmp)\n", + " else:\n", + " # First part. Creates bond information\n", + " for b in rdkitatom.GetBonds():\n", + " bond_startatom = b.GetBeginAtomIdx()\n", + " bond_endatom = b.GetEndAtomIdx()\n", + " bond_order = b.GetBondTypeAsDouble()\n", + " if debug >= 2: print(\"BUILD BONDS: bond\", bond_startatom, bond_endatom, bond_order, \n", + " specie.atoms[bond_startatom].label, specie.atoms[bond_endatom].label, \n", + " specie.rdkit_obj.GetAtomWithIdx(bond_endatom).GetSymbol())\n", + " if (specie.subtype == \"ligand\") and (bond_startatom >= specie.natoms or bond_endatom >= specie.natoms):\n", + " continue\n", + " else:\n", + " if specie.atoms[bond_endatom].label != specie.rdkit_obj.GetAtomWithIdx(bond_endatom).GetSymbol():\n", + " if debug >= 1: \n", + " print(\"Error with Bond EndAtom\", specie.atoms[bond_endatom].label, \n", + " specie.rdkit_obj.GetAtomWithIdx(bond_endatom).GetSymbol())\n", + " else:\n", + " if bond_endatom == idx:\n", + " start = bond_endatom\n", + " end = bond_startatom\n", + " elif bond_startatom == idx:\n", + " start = bond_startatom\n", + " end = bond_endatom\n", + "\n", + " ## This has changed. Now there is a bond object, and we send the atom objects, not only the index\n", + " new_bond = bond(specie.atoms[start], specie.atoms[end], bond_order) \n", + " # print(new_bond)\n", + " # atom.add_bond(new_bond)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "f5dfc5a5", + "metadata": {}, + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'newcell' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)", - "Input \u001b[0;32mIn [18]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0m newcell\u001b[38;5;241m.\u001b[39mmoleclist, newcell\u001b[38;5;241m.\u001b[39merror_prepare_mols \u001b[38;5;241m=\u001b[39m \u001b[43mprepare_mols_v4\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnewcell\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmoleclist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mnewcell\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43munique_indices\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m \u001b[49m\u001b[43mnewcell\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43munique_species\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mselected_cs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mfinal_charge_distribution\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 6\u001b[0m \u001b[43m \u001b[49m\u001b[43mdebug\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdebug\u001b[49m\u001b[43m)\u001b[49m\n", - "Input \u001b[0;32mIn [17]\u001b[0m, in \u001b[0;36mprepare_mols_v4\u001b[0;34m(moleclist, unique_indices, unique_species, selected_cs, final_charge_distribution, debug)\u001b[0m\n\u001b[1;32m 11\u001b[0m tmp_smiles \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m lig \u001b[38;5;129;01min\u001b[39;00m mol\u001b[38;5;241m.\u001b[39mligands: \n\u001b[0;32m---> 14\u001b[0m \u001b[43mset_charges_create_bonds\u001b[49m\u001b[43m(\u001b[49m\u001b[43mlig\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43munique_indices\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43munique_species\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfinal_charge_distribution\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 15\u001b[0m count \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[1;32m 17\u001b[0m tmp_smiles\u001b[38;5;241m.\u001b[39mappend(lig\u001b[38;5;241m.\u001b[39msmiles)\n", - "Input \u001b[0;32mIn [16]\u001b[0m, in \u001b[0;36mset_charges_create_bonds\u001b[0;34m(specie, unique_indices, unique_species, final_charge_distribution)\u001b[0m\n\u001b[1;32m 33\u001b[0m prot \u001b[38;5;241m=\u001b[39m cs\u001b[38;5;241m.\u001b[39mprotonation\n\u001b[1;32m 34\u001b[0m specie\u001b[38;5;241m.\u001b[39mset_charges(cs\u001b[38;5;241m.\u001b[39mcorr_total_charge, cs\u001b[38;5;241m.\u001b[39mcorr_atom_charges, cs\u001b[38;5;241m.\u001b[39msmiles, cs\u001b[38;5;241m.\u001b[39mrdkit_obj)\n\u001b[0;32m---> 35\u001b[0m \u001b[43mspecie\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_bonds\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdebug\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 36\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 37\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m: \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mERROR: Target charge \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mtarget_charge\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m of \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mformula\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m does not exist in \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcharge_list\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m\"\u001b[39m )\n", - "File \u001b[0;32m/opt/anaconda3/envs/cell2mol/lib/python3.10/site-packages/cell2mol/classes.py:314\u001b[0m, in \u001b[0;36mspecie.create_bonds\u001b[0;34m(self, debug)\u001b[0m\n\u001b[1;32m 311\u001b[0m bond_endatom \u001b[38;5;241m=\u001b[39m b\u001b[38;5;241m.\u001b[39mGetEndAtomIdx()\n\u001b[1;32m 312\u001b[0m bond_order \u001b[38;5;241m=\u001b[39m b\u001b[38;5;241m.\u001b[39mGetBondTypeAsDouble()\n\u001b[1;32m 313\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m2\u001b[39m: \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mBUILD BONDS: bond\u001b[39m\u001b[38;5;124m\"\u001b[39m, bond_startatom, bond_endatom, bond_order, \n\u001b[0;32m--> 314\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39matoms[bond_startatom]\u001b[38;5;241m.\u001b[39mlabel, \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43matoms\u001b[49m\u001b[43m[\u001b[49m\u001b[43mbond_endatom\u001b[49m\u001b[43m]\u001b[49m\u001b[38;5;241m.\u001b[39mlabel, \n\u001b[1;32m 315\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mrdkit_obj\u001b[38;5;241m.\u001b[39mGetAtomWithIdx(bond_endatom)\u001b[38;5;241m.\u001b[39mGetSymbol())\n\u001b[1;32m 316\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msubtype \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mligand\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m (bond_startatom \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnatoms \u001b[38;5;129;01mor\u001b[39;00m bond_endatom \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnatoms):\n\u001b[1;32m 317\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n", - "\u001b[0;31mIndexError\u001b[0m: list index out of range" + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", + "Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m atom\u001b[38;5;241m.\u001b[39mSetAtomMapNum(atom\u001b[38;5;241m.\u001b[39mGetIdx())\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m mol\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m mol \u001b[38;5;129;01min\u001b[39;00m \u001b[43mnewcell\u001b[49m\u001b[38;5;241m.\u001b[39mmoleclist:\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mol\u001b[38;5;241m.\u001b[39miscomplex:\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m lig \u001b[38;5;129;01min\u001b[39;00m mol\u001b[38;5;241m.\u001b[39mligands:\n", + "\u001b[0;31mNameError\u001b[0m: name 'newcell' is not defined" ] } ], "source": [ - "newcell.moleclist, newcell.error_prepare_mols = prepare_mols_v4(newcell.moleclist, \n", - " newcell.unique_indices, \n", - " newcell.unique_species, \n", - " selected_cs, \n", - " final_charge_distribution[0], \n", - " debug=debug)" + "def mol_with_atom_index(mol):\n", + " for atom in mol.GetAtoms():\n", + " atom.SetAtomMapNum(atom.GetIdx())\n", + " return mol\n", + "\n", + "for mol in newcell.moleclist:\n", + " if mol.iscomplex:\n", + " for lig in mol.ligands:\n", + " for g in lig.groups:\n", + " parent_indices = g.get_parent_indices(\"ligand\")\n", + " # print(lig.formula, lig.totcharge, lig.smiles)\n", + " # if lig.formula != \"Cl\" :\n", + " # print(\"Before correction\")\n", + " # print(len(lig.atoms), len(lig.rdkit_obj.GetAtoms()))\n", + " # print([(i, atom.label) for i, atom in enumerate(lig.atoms)])\n", + " # print([(i, atom.GetSymbol()) for i, atom in enumerate(lig.rdkit_obj.GetAtoms())])\n", + " for i, atom in enumerate(lig.rdkit_obj.GetAtoms()):\n", + " print(i, atom.GetSymbol(), atom.GetBonds())\n", + " for b in atom.GetBonds():\n", + " bond_startatom = b.GetBeginAtomIdx()\n", + " bond_endatom = b.GetEndAtomIdx()\n", + " bond_order = b.GetBondTypeAsDouble()\n", + " # print(bond_startatom, bond_endatom, lig.rdkit_obj.GetAtomWithIdx(bond_endatom).GetSymbol(), bond_order)\n", + " # for atom, rdkit_atom in zip(lig.atoms, lig.rdkit_obj.GetAtoms()):\n", + " # print(atom.label, rdkit_atom.GetSymbol())\n", + " lig.rdkit_obj = mol_with_atom_index(lig.rdkit_obj)\n", + " display(lig.rdkit_obj)\n", + " # create_bonds_spicie(lig, debug=2)\n", + " # for cs in lig.possible_cs:\n", + " # print(cs.corr_total_charge, cs.uncorr_total_charge, cs.protonation.formula, cs.protonation.natoms, cs.protonation)\n", + " # for atom in lig.atoms:\n", + " # print(atom.bonds)\n", + " # lig_smiles, lig_rdkit_obj = correct_smiles_ligand(lig)\n", + " # print(\"After correction\")\n", + " # print(lig_smiles)\n", + " # display(lig_rdkit_obj)\n", + " for met in mol.metals:\n", + " print(met.label, met.charge) " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ef8d51d6", + "metadata": {}, + "outputs": [], + "source": [ + "for g in ligand.groups:" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "725df503", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "H5-C5 -1 [H]C1=C([H])C([H])([H])C([H])=C1[H]\n", + "['C', 'H', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "[1 0 0 0 0 0 0 0 0 0]\n", + "H4-C5 -2 [H]C1=[C-]C([H])([H])C([H])=C1[H]\n", + "['C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "[0 1 0 0 0 0 0 0 0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n", + "H4-C5 -2 [H]C1=[C-]C([H])([H])C([H])=C1[H]\n", + "['C', 'H', 'C', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "[1 0 0 0 0 0 0 0 0]\n", + "H5-C5 -1 [H]C1=C([H])C([H])([H])C([H])=C1[H]\n", + "['H', 'C', 'C', 'H', 'C', 'H', 'C', 'H', 'C', 'H']\n", + "[0 1 0 0 0 0 0 0 0 0]\n", + "Cl -1 [Cl-]\n", + "['Cl']\n", + "[0]\n" + ] + } + ], + "source": [ + "for mol in newcell.moleclist:\n", + " if mol.iscomplex:\n", + " for lig in mol.ligands:\n", + " print(lig.formula, lig.totcharge, lig.smiles)\n", + " print([atom.label for atom in lig.atoms])\n", + " for cs in lig.possible_cs:\n", + " print(cs.protonation.addedlist)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e48cf3f8", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8a0c7280", + "metadata": {}, + "outputs": [], + "source": [ + "newcell.assign_spin(debug=2)" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "252f2372", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b6142455", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7345cc62", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null,