@@ -53,6 +53,7 @@ def __init__(self, logger=logger):
53
53
54
54
logger .debug ("Initializing the PACKMOL installer object." )
55
55
56
+ self .environment = "seamm-packmol"
56
57
self .section = "packmol-step"
57
58
self .executables = ["packmol" ]
58
59
self .resource_path = Path (pkg_resources .resource_filename (__name__ , "data/" ))
@@ -61,144 +62,6 @@ def __init__(self, logger=logger):
61
62
logger .debug (f"data directory: { self .resource_path } " )
62
63
self .environment_file = self .resource_path / "seamm-packmol.yml"
63
64
64
- def check (self ):
65
- """Check the status of the Packmol installation."""
66
- print ("Checking the Packmol installation." )
67
-
68
- # What Conda environment is the default?
69
- path = self .configuration .path .parent / "packmol.ini"
70
- if not path .exists ():
71
- text = (self .resource_path / "packmol.ini" ).read_text ()
72
- path .write_text (text )
73
- print (f" The packmol.ini file did not exist. Created { path } " )
74
-
75
- self .exe_config .path = path
76
-
77
- # Get the current values
78
- data = self .exe_config .get_values ("local" )
79
-
80
- if "conda-environment" in data and data ["conda-environment" ] != "" :
81
- self .environment = data ["conda-environment" ]
82
- else :
83
- self .environment = "seamm-packmol"
84
-
85
- super ().check ()
86
-
87
- def install (self ):
88
- """Install Packmol in a conda environment."""
89
- print ("Installing Packmol." )
90
-
91
- # What Conda environment is the default?
92
- path = self .configuration .path .parent / "packmol.ini"
93
- if not path .exists ():
94
- text = (self .resource_path / "packmol.ini" ).read_text ()
95
- path .write_text (text )
96
- print (f" The packmol.ini file did not exist. Created { path } " )
97
-
98
- self .exe_config .path = path
99
-
100
- # Get the current values
101
- data = self .exe_config .get_values ("local" )
102
-
103
- if "conda-environment" in data and data ["conda-environment" ] != "" :
104
- self .environment = data ["conda-environment" ]
105
- else :
106
- self .environment = "seamm-packmol"
107
-
108
- super ().install ()
109
-
110
- def show (self ):
111
- """Show the status of the Packmol installation."""
112
- print ("Showing the Packmol installation." )
113
-
114
- # What Conda environment is the default?
115
- path = self .configuration .path .parent / "packmol.ini"
116
- if not path .exists ():
117
- text = (self .resource_path / "packmol.ini" ).read_text ()
118
- path .write_text (text )
119
- print (f" The packmol.ini file does not exist at { path } " )
120
- print (" The 'check' command will create it if Packmol is installed." )
121
- print (" Otherwise 'install' will install Packmol." )
122
- return
123
-
124
- self .exe_config .path = path
125
-
126
- if not self .exe_config .section_exists ("local" ):
127
- print (
128
- " Packmol is not configured: there is no 'local' section in "
129
- f" { path } ."
130
- )
131
- return
132
-
133
- # Get the current values
134
- data = self .exe_config .get_values ("local" )
135
-
136
- if "conda-environment" in data and data ["conda-environment" ] != "" :
137
- self .environment = data ["conda-environment" ]
138
- else :
139
- self .environment = "seamm-packmol"
140
-
141
- super ().show ()
142
-
143
- def uninstall (self ):
144
- """Uninstall the Packmol installation."""
145
- print ("Uninstall the Packmol installation." )
146
-
147
- # What Conda environment is the default?
148
- path = self .configuration .path .parent / "packmol.ini"
149
- if not path .exists ():
150
- text = (self .resource_path / "packmol.ini" ).read_text ()
151
- path .write_text (text )
152
- print (
153
- f"""" The packmol.ini file does not exist at { path }
154
- Perhaps Packmol is not installed, but if it is the 'check' command may locate it
155
- and create the ini file, after which 'uninstall' will remove it."""
156
- )
157
- return
158
-
159
- self .exe_config .path = path
160
-
161
- if not self .exe_config .section_exists ("local" ):
162
- print (
163
- f"""" The packmol.ini file at { path } does not have local section.
164
- Perhaps Packmol is not installed, but if it is the 'check' command may locate it
165
- and update the ini file, after which 'uninstall' will remove it."""
166
- )
167
- return
168
-
169
- # Get the current values
170
- data = self .exe_config .get_values ("local" )
171
-
172
- if "conda-environment" in data and data ["conda-environment" ] != "" :
173
- self .environment = data ["conda-environment" ]
174
- else :
175
- self .environment = "seamm-packmol"
176
-
177
- super ().uninstall ()
178
-
179
- def update (self ):
180
- """Updates the Packmol installation."""
181
- print ("Updating the Packmol installation." )
182
-
183
- # What Conda environment is the default?
184
- path = self .configuration .path .parent / "packmol.ini"
185
- if not path .exists ():
186
- text = (self .resource_path / "packmol.ini" ).read_text ()
187
- path .write_text (text )
188
- print (f" The packmol.ini file did not exist. Created { path } " )
189
-
190
- self .exe_config .path = path
191
-
192
- # Get the current values
193
- data = self .exe_config .get_values ("local" )
194
-
195
- if "conda-environment" in data and data ["conda-environment" ] != "" :
196
- self .environment = data ["conda-environment" ]
197
- else :
198
- self .environment = "seamm-packmol"
199
-
200
- super ().update ()
201
-
202
65
def exe_version (self , config ):
203
66
"""Get the version of the PACKMOL executable.
204
67
0 commit comments