Skip to content

Commit

Permalink
Merge pull request #7 from Kitaolab/v1.1.2
Browse files Browse the repository at this point in the history
V1.1.2
  • Loading branch information
kh01734 authored Nov 7, 2024
2 parents 1e48b7b + a1955f7 commit 49f544b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
18 changes: 14 additions & 4 deletions pacs/mdrun/Cycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,21 @@ def is_needed(self) -> bool:
fn = f"{self.settings.each_cycle(_cycle=self.cycle)}/summary/progress.log"
if not Path(fn).exists():
return True

export_needed: bool = True
rmmol_needed: bool = self.settings.rmmol
rmfile_needed: bool = self.settings.rmfile

with open(fn, "r") as f:
a = f.readlines()
if len(a) == 0:
return True
return "export to" not in a[-1]
for line in f:
if "export to" in line:
export_needed = False
if "reduced" in line:
rmmol_needed = False
if "rmfile" in line:
rmfile_needed = False

return any([export_needed, rmmol_needed, rmfile_needed])

# def genrepresent(self) -> None:
# genrepresent.genrepresent(self.settings)
Expand Down
12 changes: 10 additions & 2 deletions pacs/utils/rmfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path

from pacs.models.settings import MDsettings
from pacs.utils.logger import generate_logger
from pacs.utils.logger import close_logger, generate_logger

LOGGER = generate_logger(__name__)

Expand Down Expand Up @@ -98,7 +98,15 @@ def rmfile(settings: MDsettings, cycle: int) -> None:

continue

LOGGER.info(f"rmfile completed successfully in cycle{cycle:03}")
# LOGGER.info(f"rmfile completed successfully in cycle{cycle:03}")
record_finished(settings, cycle)


def record_finished(settings: MDsettings, cycle: int) -> None:
dir = settings.each_cycle(_cycle=cycle)
logger = generate_logger(f"{cycle}_rmfile", f"{dir}/summary/progress.log")
logger.info(f"rmfile completed successfully in cycle{cycle:03}")
close_logger(logger)


def rmfile_all(settings: MDsettings) -> None:
Expand Down
20 changes: 14 additions & 6 deletions pacs/utils/rmmol.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pathlib import Path

from pacs.models.settings import MDsettings
from pacs.utils.logger import generate_logger
from pacs.utils.logger import close_logger, generate_logger

LOGGER = generate_logger(__name__)

Expand Down Expand Up @@ -170,7 +170,8 @@ def rmmol(settings: MDsettings, cycle: int, last_cycle: bool) -> None:
for p in processes:
p.close()

LOGGER.info(f"trajectory files in cycle{cycle:03} have been reduced")
# LOGGER.info(f"trajectory files in cycle{cycle:03} have been reduced")
record_finished(settings, cycle)


def rmmol_replica_mdtraj(
Expand Down Expand Up @@ -291,12 +292,19 @@ def rmmol_log_add_info(settings: MDsettings) -> None:
exit(1)


def record_finished(settings: MDsettings, cycle: int) -> None:
dir = settings.each_cycle(_cycle=cycle)
logger = generate_logger(f"{cycle}_rmmol", f"{dir}/summary/progress.log")
logger.info(f"trajectory files in cycle{cycle:03} have been reduced")
close_logger(logger)


def rmmol_log_add_info_gmx(settings: MDsettings) -> None:
LOGGER.info("prd.tpr files are probably no longer needed")
LOGGER.info("it is recommended to remove prd.tpr files to save disk space")
LOGGER.info("The 'prd.tpr' files are probably no longer needed.")
LOGGER.info("It is recommended to remove 'prd.tpr' files to save disk space.")
LOGGER.info(
"you can manually regenerate the prd.tpr files from input.gro files \
even if you need them later"
"If needed later, you can manually regenerate the 'prd.tpr' files from "
"the 'input.gro' files."
)


Expand Down

0 comments on commit 49f544b

Please sign in to comment.