Skip to content

Commit

Permalink
Debugging BACZUB
Browse files Browse the repository at this point in the history
  • Loading branch information
choglass committed Apr 15, 2024
1 parent 77e8a52 commit 7c650f0
Show file tree
Hide file tree
Showing 3 changed files with 1,595 additions and 244 deletions.
16 changes: 14 additions & 2 deletions cell2mol/charge_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions cell2mol/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

#######################################################
Expand Down
Loading

0 comments on commit 7c650f0

Please sign in to comment.