Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix Kekulize error #30

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hgraph/chemutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def set_atommap(mol, num=0):

def get_mol(smiles):
mol = Chem.MolFromSmiles(smiles)
if mol is not None: Chem.Kekulize(mol)
if mol is not None: Chem.Kekulize(mol, clearAromaticFlags=True)
return mol

def get_smiles(mol):
Expand Down
7 changes: 7 additions & 0 deletions hgraph/hgnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ def reconstruct(self, batch):

root_vecs, root_kl = self.rsample(root_vecs, self.R_mean, self.R_var, perturb=False)
return self.decoder.decode((root_vecs, root_vecs, root_vecs), greedy=True, max_decode_step=150)

def embed(self, batch):
graphs, tensors, _ = batch
tree_tensors, graph_tensors = tensors = make_cuda(tensors)
root_vecs, tree_vecs, _, graph_vecs = self.encoder(tree_tensors, graph_tensors)

return root_vecs

def forward(self, graphs, tensors, orders, beta, perturb_z=True):
tree_tensors, graph_tensors = tensors = make_cuda(tensors)
Expand Down