Skip to content

Commit 1467b00

Browse files
authored
Merge pull request #40 from molssi-seamm/dev
Update for new installer
2 parents af5f226 + 530548a commit 1467b00

File tree

4 files changed

+7
-140
lines changed

4 files changed

+7
-140
lines changed

HISTORY.rst

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
=======
22
History
33
=======
4+
2025.3.9 -- Update for new installer
5+
* Changes in the installer required changes for codes that installed background
6+
codes, like PACKMOL. This update allows PACKMOL to be automatically installed.
7+
48
2025.1.29 -- Bugfixes: executable and SMILES
59
* The configuration for the executable was not set up correctly.
610
* There was a bug due to change in the SMILES interface for configurations.

devtools/conda-envs/test_env.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- pip
1010

1111
# SEAMM
12+
- libsqlite!=3.49.1
1213
- seamm
1314
- seamm-installer
1415
- pyyaml

packmol_step/installer.py

+1-138
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(self, logger=logger):
5353

5454
logger.debug("Initializing the PACKMOL installer object.")
5555

56+
self.environment = "seamm-packmol"
5657
self.section = "packmol-step"
5758
self.executables = ["packmol"]
5859
self.resource_path = Path(pkg_resources.resource_filename(__name__, "data/"))
@@ -61,144 +62,6 @@ def __init__(self, logger=logger):
6162
logger.debug(f"data directory: {self.resource_path}")
6263
self.environment_file = self.resource_path / "seamm-packmol.yml"
6364

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-
20265
def exe_version(self, config):
20366
"""Get the version of the PACKMOL executable.
20467

packmol_step/packmol_parameters.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
"""Control parameters for Packmol, currently for packing fluids
3-
"""
2+
"""Control parameters for Packmol, currently for packing fluids"""
43

54
import logging
65
import seamm

0 commit comments

Comments
 (0)