Skip to content

Commit

Permalink
Use isinstance to type check correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hwpang committed Oct 13, 2023
1 parent b8158f6 commit 9d07ded
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,10 @@ export getatomdictsmiles
getatomdictinchi(inchi) = getatomdictfromrdkit(Chem.AddHs(Chem.MolFromInchi(inchi)))
export getatomdictinchi
function getatomdictadjlist(adjlist)
try
mol = species.Species().from_adjacency_list(adjlist).molecule[1]
catch
@error("Unable to parse adjlist $adjlist")
end
if isa(mol, molecule.Molecule)
mol = species.Species().from_adjacency_list(adjlist).molecule[1]
if pybuiltin(:isinstance)(mol, molecule.Molecule)
getatomdictfromrmg(mol)
elseif isa(mol, fragment.Fragment)
elseif pybuiltin(:isinstance)(mol, fragment.Fragment)
mol.assign_representative_molecule()
getatomdictfromrmg(mol.mol_repr)
else
Expand Down

0 comments on commit 9d07ded

Please sign in to comment.