-
Notifications
You must be signed in to change notification settings - Fork 255
Vdw bonds #2706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Vdw bonds #2706
Changes from 4 commits
32c6af2
c4fea25
e6ef712
f143e9e
4fa53c7
495c893
2076aeb
3153f51
61e05e6
5c4d2e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -97,7 +97,7 @@ def to_rdkit_mol(mol, remove_h=True, return_mapping=False, sanitize=True, save_o | |
| label_dict[label] = [saved_index] | ||
| rd_bonds = Chem.rdchem.BondType | ||
| orders = {'S': rd_bonds.SINGLE, 'D': rd_bonds.DOUBLE, 'T': rd_bonds.TRIPLE, 'B': rd_bonds.AROMATIC, | ||
| 'Q': rd_bonds.QUADRUPLE} | ||
| 'Q': rd_bonds.QUADRUPLE, 'vdW': rd_bonds.UNSPECIFIED} | ||
|
||
| # Add the bonds | ||
| for atom1 in mol.vertices: | ||
| for atom2, bond in atom1.edges.items(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1214,6 +1214,9 @@ def _render_bond(self, atom1, atom2, bond, cr): | |||||||||||||||||||
| elif bond.is_hydrogen_bond(): | ||||||||||||||||||||
| # Draw a dashed line | ||||||||||||||||||||
| self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) | ||||||||||||||||||||
| elif bond.is_van_der_waals(): | ||||||||||||||||||||
| # Draw a dashed line | ||||||||||||||||||||
| self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) | ||||||||||||||||||||
|
||||||||||||||||||||
| elif bond.is_hydrogen_bond(): | |
| # Draw a dashed line | |
| self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) | |
| elif bond.is_van_der_waals(): | |
| # Draw a dashed line | |
| self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) | |
| elif bond.is_hydrogen_bond() or bond.is_van_der_waals(): | |
| # Draw a dashed line for hydrogen bonds and van der Waals interactions | |
| self._draw_line(cr, x1, y1, x2, y2, dashed=True, dash_sizes=[0.5, 3.5]) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,7 +62,7 @@ | |
|
|
||
| ################################################################################ | ||
|
|
||
| bond_orders = {'S': 1, 'D': 2, 'T': 3, 'B': 1.5} | ||
| bond_orders = {'S': 1, 'D': 2, 'T': 3, 'B': 1.5, 'vdW': 0} | ||
|
|
||
| globals().update({ | ||
| 'bond_orders': bond_orders, | ||
|
|
@@ -1258,9 +1258,19 @@ def remove_van_der_waals_bonds(self): | |
| Remove all van der Waals bonds. | ||
| """ | ||
| cython.declare(bond=Bond) | ||
| for bond in self.get_all_edges(): | ||
| if bond.is_van_der_waals(): | ||
| self.remove_bond(bond) | ||
| if self.is_multidentate(): | ||
| #bond_types = | ||
| #possible_bonds_with_resonance = #TODO: Include possible nitrogen bonds | ||
| if any([k in ['O-X', 'C#X', 'C=X', 'C-X'] for k in self.enumerate_bonds()]): | ||
| pass | ||
|
||
| else: | ||
| for bond in self.get_all_edges(): | ||
| if bond.is_van_der_waals(): | ||
| self.remove_bond(bond) | ||
| else: | ||
| for bond in self.get_all_edges(): | ||
| if bond.is_van_der_waals(): | ||
| self.remove_bond(bond) | ||
|
||
|
|
||
| def sort_atoms(self): | ||
| """ | ||
|
|
@@ -2942,6 +2952,8 @@ def get_desorbed_molecules(self): | |
| bonded_atom.increment_radical() | ||
| bonded_atom.increment_lone_pairs() | ||
| bonded_atom.label = '*4' | ||
| elif bond.is_van_der_waals(): | ||
| bonded_atom.label = '*5' | ||
|
||
| else: | ||
| raise NotImplementedError("Can't remove surface bond of type {}".format(bond.order)) | ||
| desorbed_molecule.remove_atom(site) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a behavior switch based on a hard-coded substring match of
self.label, which makes the forbidden-structure logic depend on naming conventions rather than an explicit family attribute/configuration. This is fragile (label changes become behavior changes). Prefer exposing an explicit flag/attribute on the family (or configuring this in the family definition/data) to control whether mixed covalent+vdWmultidentate surface bindings are allowed.