1
1
using Unitful
2
2
using YAML
3
- using PyCall
3
+ using PythonCall
4
4
using StaticArrays
5
5
6
6
module Calc
@@ -131,7 +131,7 @@ function getatomdictfromrdkit(mol)
131
131
atmD = Dict {String,Int64} ()
132
132
molecularweight = 0.0
133
133
for atm in mol. GetAtoms ()
134
- v = elementdict[atm. GetAtomicNum ()]
134
+ v = elementdict[PythonCall . pyconvert (Int64, atm. GetAtomicNum () )]
135
135
if v in keys (atmD)
136
136
atmD[v] += 1
137
137
else
@@ -140,9 +140,9 @@ function getatomdictfromrdkit(mol)
140
140
end
141
141
nbonds = length (mol. GetBonds ())
142
142
try
143
- molecularweight = Desc. MolWt (mol)/ 1000.0
144
- catch
145
- @warn (" unable to compute molecular weight" )
143
+ molecularweight = PythonCall . pyconvert (Float64, Desc. MolWt (mol)) / 1000.0
144
+ catch e
145
+ @warn (" unable to compute molecular weight: $e " )
146
146
end
147
147
return atmD,nbonds,molecularweight
148
148
end
@@ -151,15 +151,15 @@ export getatomdictfromrdkit
151
151
function getatomdictfromrmg (mol)
152
152
atmD = Dict {String,Int64} ()
153
153
for atm in mol. atoms
154
- v = elementdict[atm. element. number]
154
+ v = elementdict[PythonCall . pyconvert (Int64, atm. element. number) ]
155
155
if v in keys (atmD)
156
156
atmD[v] += 1
157
157
else
158
158
atmD[v] = 1
159
159
end
160
160
end
161
161
nbonds = length (mol. get_all_edges ())
162
- molecularweight = mol. get_molecular_weight ()
162
+ molecularweight = PythonCall . pyconvert (Float64, mol. get_molecular_weight () )
163
163
return atmD,nbonds,molecularweight
164
164
end
165
165
function getatomdictsmiles (smiles)
0 commit comments