Open caseyolen opened 2 years ago
def uff_optimize_chemdraw(chemdraw_file: str, concurrent=4):
"""This will convert chemdraw to xml file to a collection and optimize all collection contents with UFF. DO NOT CONFUSE THIS WITH OPTIMIZE COMBINATORIAL COLLECTION, AS THIS FUNCTION REQUIRES A CHEMDRAW FILE INPUT"""
file_no_cdxml = chemdraw_file.replace('.cdxml','')
collection = ml.parsing.split_cdxml(chemdraw_file)
obabel = ml.OpenBabelDriver("ob", scratch_dir='.')
# collection.to_zip('admix.zip')
# #Change the backup directory at some point please
# collection = ml.Collection.from_zip('admix.zip')
_preoptimized = ml.Concurrent(collection, backup_dir=".", concurrent=concurrent, update=5)(obabel.hadd_opt)(ff='UFF')
pprint(_preoptimized)
uff_optimized = ml.Collection(f'{collection}', _preoptimized)
uff_optimized.to_zip(f'uff_opt_{file_no_cdxml}.zip')
called optimize on windows system. did not produce stdout or stderr and gave code 1. worked fine on wsl.