Skip to content

Commit 48e5ee5

Browse files
committed
Return wrapper instance instead of result dictionary
1 parent b703272 commit 48e5ee5

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

isicle/md.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ def finish(self):
490490
for key in result.keys() & rename.keys():
491491
result[rename[key]] = result.pop(key)
492492

493-
return result
493+
# Assign to attribute
494+
self.result = result
495+
return self.result
494496

495497
def parse(self):
496498
"""
@@ -543,9 +545,9 @@ def run(self, geom, **kwargs):
543545
self.submit()
544546

545547
# Finish/clean up
546-
result = self.finish()
548+
self.finish()
547549

548-
return result
550+
return self
549551

550552

551553
class RDKitWrapper(Geometry, WrapperInterface):
@@ -564,7 +566,7 @@ class RDKitWrapper(Geometry, WrapperInterface):
564566
The number of conformers to generate.
565567
"""
566568

567-
_defaults = ["geom", "method", "numConfs"]
569+
_defaults = ["geom", "method", "numConfs", "result"]
568570
_default_value = None
569571

570572
def __init__(self, **kwargs):
@@ -715,7 +717,8 @@ def finish(self):
715717
for conf, label in zip(conformers, range(conf_count)):
716718
conf.__dict__.update(conformerID=label, basename=self.geom.basename)
717719

718-
return isicle.conformers.ConformationalEnsemble(conformers)
720+
self.result = isicle.conformers.ConformationalEnsemble(conformers)
721+
return self.result
719722

720723
def run(self, geom, **kwargs):
721724
"""
@@ -749,4 +752,6 @@ def run(self, geom, **kwargs):
749752
self.submit()
750753

751754
# Finish/clean up
752-
return self.finish()
755+
self.finish()
756+
757+
return self

isicle/qm.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,9 +978,9 @@ def run(self, geom, template=None, tasks='energy', functional='b3lyp',
978978
self.submit()
979979

980980
# Finish/clean up
981-
result = self.finish()
981+
self.finish()
982982

983-
return result
983+
return self
984984

985985
def save(self, path):
986986
"""
@@ -1281,10 +1281,10 @@ def run(self, geom, **kwargs):
12811281
# Run QM simulation
12821282
self.submit()
12831283

1284-
# Parse outputs
1284+
# Finish/clean-up outputs
12851285
self.finish()
12861286

1287-
return self.result
1287+
return self
12881288

12891289
def save(self, path):
12901290
"""

0 commit comments

Comments
 (0)