Skip to content

Commit

Permalink
Add verbose to AtomPacker.packing method
Browse files Browse the repository at this point in the history
  • Loading branch information
jvsguerra committed Jan 17, 2024
1 parent f708619 commit a5cd563
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion AtomPacker/AtomPacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,24 @@ def _clean_tempfiles(self):
except FileNotFoundError:
pass

def packing(self, replicates: int = 1):
def packing(self, replicates: int = 1, verbose: bool = False):
"""Run Packmol"""

if replicates < 1:
raise ValueError("replicates must be > 0")

if verbose:
print(f"[==> Packing atoms in {replicates} replicates")

# Make packmol.inp file
self._make_packmol_input()

# Create an empty list of replicates
self.packed = [None] * replicates

for replicate in range(replicates):
if verbose:
print(f"> Replicate {replicate}")
# Run packmol: packmol < packmol.inp
self._run_packmol()

Expand All @@ -539,8 +544,12 @@ def packing(self, replicates: int = 1):
self._update_smc()

# Detect cavity
if verbose:
print("[==> Detecting cavity")
self._detect_cavity()

if verbose:
print("[==> Filtering atoms inside cavity")
for replicate in range(replicates):
# Filter atoms inside cavity
self._filter_atoms_inside_cavity(replicate)
Expand All @@ -549,6 +558,8 @@ def packing(self, replicates: int = 1):
self._clean_tempfiles()

# Pandas DataFrame with atoms packed in each replicate
if verbose:
print("[==> Summarizing data")
self.summary = self._summary(replicates)
self.summary.to_csv(os.path.join(self.basedir, "PackedAtoms.csv"))

Expand Down

0 comments on commit a5cd563

Please sign in to comment.