Skip to content

Commit 7c3c996

Browse files
committed
Make several attributes private
1 parent f23fc51 commit 7c3c996

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

isicle/md.py

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections import defaultdict
55

66
from rdkit import Chem
7-
from rdkit.Chem import rdDetermineBonds, rdDistGeom
7+
from rdkit.Chem import rdDistGeom
88

99
import isicle
1010
from isicle.geometry import Geometry
@@ -75,25 +75,19 @@ class XTBWrapper(WrapperInterface):
7575
----------
7676
temp_dir : str
7777
Path to temporary directory used for simulation.
78-
task_map : dict
79-
Alias mapper for supported molecular dynamic presets. Includes
80-
"optimize", "crest", "nmr", "protonate", "deprotonate", and "tautomer".
8178
geom : :obj:`isicle.geometry.Geometry`
8279
Internal molecule representation.
83-
fmt : str
84-
File extension indicator.
85-
job_list : str
86-
List of commands for simulation.
80+
result : dict
81+
Dictionary containing simulation results.
8782
8883
"""
8984

90-
_defaults = ["geom", "result"]
85+
_defaults = ["geom", "result", "temp_dir"]
9186
_default_value = None
9287

93-
def __init__(self, **kwargs):
94-
self.temp_dir = isicle.utils.mkdtemp()
88+
def __init__(self):
9589
self.__dict__.update(dict.fromkeys(self._defaults, self._default_value))
96-
self.__dict__.update(**kwargs)
90+
self.temp_dir = isicle.utils.mkdtemp()
9791

9892
def set_geometry(self, geom):
9993
"""
@@ -124,13 +118,13 @@ def save_geometry(self, fmt="xyz"):
124118
125119
"""
126120
# Path operations
127-
self.fmt = fmt.lower()
121+
self._fmt = fmt.lower()
128122
geomfile = os.path.join(
129-
self.temp_dir, "{}.{}".format(self.geom.basename, self.fmt.lower())
123+
self.temp_dir, "{}.{}".format(self.geom.basename, self._fmt.lower())
130124
)
131125

132126
# All other formats
133-
isicle.io.save(geomfile, self.geom)
127+
isicle.save(geomfile, self.geom)
134128
self.geom.path = geomfile
135129

136130
def _configure_xtb(self, forcefield="gfn2", optlevel="normal", solvation=None):
@@ -154,7 +148,7 @@ def _configure_xtb(self, forcefield="gfn2", optlevel="normal", solvation=None):
154148
s = "xtb "
155149

156150
# Add geometry
157-
s += "{}.{}".format(self.geom.basename, self.fmt.lower())
151+
s += "{}.{}".format(self.geom.basename, self._fmt.lower())
158152

159153
# Add optimize tag
160154
s += " --opt " + optlevel + " "
@@ -226,7 +220,7 @@ def _configure_crest(
226220
# Add geometry
227221
s += str(
228222
os.path.join(
229-
self.temp_dir, "{}.{}".format(self.geom.basename, self.fmt.lower())
223+
self.temp_dir, "{}.{}".format(self.geom.basename, self._fmt.lower())
230224
)
231225
)
232226

@@ -354,17 +348,17 @@ def configure(
354348
"Task not assigned properly, please choose optimize, conformer, protonate, deprotonate, or tautomerize"
355349
)
356350

357-
self.task = task
351+
self._task = task
358352

359-
self.config = config
353+
self._config = config
360354

361355
def submit(self):
362356
"""
363357
Run xtb or crest simulation according to configured inputs.
364358
"""
365359
cwd = os.getcwd()
366360
os.chdir(self.temp_dir)
367-
subprocess.call(self.config, shell=True)
361+
subprocess.call(self._config, shell=True)
368362
os.chdir(cwd)
369363

370364
def finish(self):
@@ -560,18 +554,19 @@ class RDKitWrapper(Geometry, WrapperInterface):
560554
----------
561555
geom : :obj:`isicle.geometry.Geometry`
562556
Internal molecule representation.
563-
method: str
557+
method : str
564558
Method of RDKit conformer generation specified.
565-
numConfs: int
559+
numConfs : int
566560
The number of conformers to generate.
561+
result : dict
562+
Dictionary containing simulation results.
567563
"""
568564

569565
_defaults = ["geom", "method", "numConfs", "result"]
570566
_default_value = None
571567

572-
def __init__(self, **kwargs):
568+
def __init__(self):
573569
self.__dict__.update(dict.fromkeys(self._defaults, self._default_value))
574-
self.__dict__.update(**kwargs)
575570

576571
def set_geometry(self, geom):
577572
"""
@@ -704,6 +699,9 @@ def submit(self):
704699
raise ValueError(
705700
"Failure to run RDKit MD, method and/or variant not recognized"
706701
)
702+
703+
def parse(self):
704+
print("No need to parse RDKit result. Simply access `result` attribute.")
707705

708706
def finish(self):
709707
"""

0 commit comments

Comments
 (0)