rdworks 0.36.1__py3-none-any.whl → 0.36.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rdworks/__init__.py +1 -1
- rdworks/mol.py +57 -45
- {rdworks-0.36.1.dist-info → rdworks-0.36.3.dist-info}/METADATA +1 -1
- {rdworks-0.36.1.dist-info → rdworks-0.36.3.dist-info}/RECORD +7 -7
- {rdworks-0.36.1.dist-info → rdworks-0.36.3.dist-info}/WHEEL +1 -1
- {rdworks-0.36.1.dist-info → rdworks-0.36.3.dist-info}/licenses/LICENSE +0 -0
- {rdworks-0.36.1.dist-info → rdworks-0.36.3.dist-info}/top_level.txt +0 -0
rdworks/__init__.py
CHANGED
rdworks/mol.py
CHANGED
@@ -3,6 +3,7 @@ import itertools
|
|
3
3
|
import json
|
4
4
|
import logging
|
5
5
|
import tempfile
|
6
|
+
import os
|
6
7
|
|
7
8
|
from io import StringIO, BytesIO
|
8
9
|
from pathlib import Path
|
@@ -367,51 +368,62 @@ class Mol:
|
|
367
368
|
self.confs.append(conf)
|
368
369
|
|
369
370
|
elif method.upper() == 'CONFORGE':
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
371
|
+
mol = CDPL.Chem.parseSMILES(self.smiles)
|
372
|
+
# create and initialize an instance of the class ConfGen.ConformerGenerator which
|
373
|
+
# will perform the actual conformer ensemble generation work
|
374
|
+
conf_gen = CDPL.ConfGen.ConformerGenerator()
|
375
|
+
conf_gen.settings.timeout = 60 * 1000 # 60 sec.
|
376
|
+
conf_gen.settings.minRMSD = 0.5
|
377
|
+
conf_gen.settings.energyWindow = 20.0 # kcal/mol(?)
|
378
|
+
conf_gen.settings.maxNumOutputConformers = n
|
379
|
+
# dictionary mapping status codes to human readable strings
|
380
|
+
status_to_str = {
|
381
|
+
CDPL.ConfGen.ReturnCode.UNINITIALIZED : 'uninitialized',
|
382
|
+
CDPL.ConfGen.ReturnCode.TIMEOUT : 'max. processing time exceeded',
|
383
|
+
CDPL.ConfGen.ReturnCode.ABORTED : 'aborted',
|
384
|
+
CDPL.ConfGen.ReturnCode.FORCEFIELD_SETUP_FAILED : 'force field setup failed',
|
385
|
+
CDPL.ConfGen.ReturnCode.FORCEFIELD_MINIMIZATION_FAILED : 'force field structure refinement failed',
|
386
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_LIBRARY_NOT_SET : 'fragment library not available',
|
387
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_FAILED : 'fragment conformer generation failed',
|
388
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_TIMEOUT : 'fragment conformer generation timeout',
|
389
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_ALREADY_PROCESSED : 'fragment already processed',
|
390
|
+
CDPL.ConfGen.ReturnCode.TORSION_DRIVING_FAILED : 'torsion driving failed',
|
391
|
+
CDPL.ConfGen.ReturnCode.CONF_GEN_FAILED : 'conformer generation failed',
|
392
|
+
}
|
393
|
+
|
394
|
+
# We have to create a temporary file and re-read it for storing individual conformers.
|
395
|
+
tmp_dir = os.environ.get('TMPDIR', '/tmp')
|
396
|
+
tmp_name = next(tempfile._get_candidate_names()) + '.sdf'
|
397
|
+
tmp_filename = os.path.join(tmp_dir, tmp_name)
|
398
|
+
|
399
|
+
writer = CDPL.Chem.MolecularGraphWriter(tmp_filename, "sdf" )
|
400
|
+
# SB - io.StringIO does not work with Chem.MolecularGraphWriter()
|
401
|
+
|
402
|
+
try:
|
403
|
+
# prepare the molecule for conformer generation
|
404
|
+
CDPL.ConfGen.prepareForConformerGeneration(mol)
|
405
|
+
# generate the conformer ensemble
|
406
|
+
status = conf_gen.generate(mol)
|
407
|
+
# if successful, store the generated conformer ensemble as
|
408
|
+
# per atom 3D coordinates arrays (= the way conformers are represented in CDPKit)
|
409
|
+
if status == CDPL.ConfGen.ReturnCode.SUCCESS or status == CDPL.ConfGen.ReturnCode.TOO_MUCH_SYMMETRY:
|
410
|
+
# TOO_MUCH_SYMMETRY: output ensemble may contain duplicates
|
411
|
+
conf_gen.setConformers(mol)
|
412
|
+
writer.write(mol)
|
413
|
+
writer.close()
|
414
|
+
else:
|
415
|
+
raise RuntimeError('Error: conformer generation failed: %s' % status_to_str[status])
|
416
|
+
except Exception as e:
|
417
|
+
raise RuntimeError('Error: conformer generation failed: %s' % str(e))
|
418
|
+
|
419
|
+
# tmpfile is automatically closed here but kept, as delete=False was set
|
420
|
+
|
421
|
+
with Chem.SDMolSupplier(tmp_filename, sanitize=True, removeHs=False) as sdf:
|
422
|
+
self.confs = [ Conf(m) for m in sdf if m is not None ]
|
423
|
+
|
424
|
+
# tmpfile is not deleted here because delete=False
|
425
|
+
# we should remove the file when it is no longer needed
|
426
|
+
os.remove(tmp_filename)
|
415
427
|
|
416
428
|
# energy evaluations for ranking
|
417
429
|
for conf in self.confs:
|
@@ -1,10 +1,10 @@
|
|
1
|
-
rdworks/__init__.py,sha256=
|
1
|
+
rdworks/__init__.py,sha256=NUqsdwOfzrq7ScnkWWtLndsZ-yPp6cKnh0xL1Mjrz5Q,1368
|
2
2
|
rdworks/conf.py,sha256=hi8qqcEhDMfiGAj10I7Pl65svVNeV-ihjM7lRKX7OaM,22284
|
3
3
|
rdworks/descriptor.py,sha256=34T_dQ6g8v3u-ym8TLKbQtxIIV5TEo-d3pdedq3o-cg,2106
|
4
4
|
rdworks/display.py,sha256=JR0gR26UpH-JCxVOaqXZCUj2MiGZSrx9Me87FncspVI,13469
|
5
5
|
rdworks/ionized.py,sha256=5oIjMRpkX792RIpEEE2Ir96icfFaN_h21mSihhfQPAw,6713
|
6
6
|
rdworks/matchedseries.py,sha256=A3ON4CUpQV159mu9VqgNiJ8uoQ9ePOry9d3ra4NCAgc,10377
|
7
|
-
rdworks/mol.py,sha256=
|
7
|
+
rdworks/mol.py,sha256=pAzz16jok2xxDxYgL6L08H5Ne225g-iYX61DeLPbZiQ,71402
|
8
8
|
rdworks/mollibr.py,sha256=X4UBO6Ga-QmNS7RwUiaDYAx0Q5hnWs71yTkEpH02Qb4,37696
|
9
9
|
rdworks/pka.py,sha256=NVJVfpcNEMlX5QRyLBgUM7GIT7VMjO-llAR4LWc8J2c,1656
|
10
10
|
rdworks/readin.py,sha256=0bnVcZcAmSLqc6zu1mYcv0LdBv2agQfOpKGwpSRL9VE,11742
|
@@ -65,8 +65,8 @@ rdworks/predefined/misc/reactive-part-3.xml,sha256=LgWHSEbRTVmgBoIO45xbTo1xQJs0X
|
|
65
65
|
rdworks/predefined/misc/reactive.xml,sha256=syedoQ6VYUfRLnxy99ObuDniJ_a_WhrWAJbTKFfJ6VY,11248
|
66
66
|
rdworks/xtb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
67
67
|
rdworks/xtb/wrapper.py,sha256=I0nW89vlJZ5Za5pCjIpjsEOFbTm7HpeNGiPgssheWn8,11350
|
68
|
-
rdworks-0.36.
|
69
|
-
rdworks-0.36.
|
70
|
-
rdworks-0.36.
|
71
|
-
rdworks-0.36.
|
72
|
-
rdworks-0.36.
|
68
|
+
rdworks-0.36.3.dist-info/licenses/LICENSE,sha256=UOkJSBqYyQUvtCp7a-vdCANeEcLE2dnTie_eB1By5SY,1074
|
69
|
+
rdworks-0.36.3.dist-info/METADATA,sha256=EoJiTuFvNQ50TU2n4ZZd7N3tNC-QQqdbaqKjiFRHjkA,1183
|
70
|
+
rdworks-0.36.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
71
|
+
rdworks-0.36.3.dist-info/top_level.txt,sha256=05C98HbvBK2axUBogC_hAT_CdpOeQYGnQ6vRAgawr8s,8
|
72
|
+
rdworks-0.36.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|