Skip to content

Commit

Permalink
No longer look for CIF files during initialization
Browse files Browse the repository at this point in the history
That wasn't even used
  • Loading branch information
WardLT committed Nov 7, 2023
1 parent b67e845 commit 05000d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
18 changes: 3 additions & 15 deletions mofa/simulation/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,17 @@ class LAMMPSRunner:
Args:
lammps_command: Command used to launch LAMMPS
lmp_sims_root_path: Scratch directory for LAMMPS simulations
"""

def __init__(self, lammps_command: str = "npt_tri", lmp_sims_root_path: str = "lmp_sims", cif_files_root_path: str = "cif_files"):
"""Read cif files from input directory, make directory for lammps simulation input files
Args:
lammps_command: lammps simulation type, default: "npt_tri"
lmp_sims_root_path: output directory, default: "lmp_sims"
cif_files_root_path: input directory to look for cif files, default: "cif_files"
Returns:
None
"""
def __init__(self, lammps_command: str = "npt_tri", lmp_sims_root_path: str = "lmp_sims"):
self.lammps_command = lammps_command
self.lmp_sims_root_path = lmp_sims_root_path
self.cif_files_root_path = cif_files_root_path
self.cif_files_paths = [os.path.join(self.cif_files_root_path, x) for x in os.listdir(self.cif_files_root_path) if x.endswith(".cif")]
logging.info("Making LAMMPS simulation root path at: " + os.path.join(os.getcwd(), self.lmp_sims_root_path))
os.makedirs(self.lmp_sims_root_path, exist_ok=True)
logging.info("Scanning cif files at: " + os.path.join(os.getcwd(), self.cif_files_root_path))
logging.info("Found " + "%d" % len(self.cif_files_paths) + " files with .cif extension! \n")

def prep_molecular_dynamics_single(self, cif_path: str, timesteps: int, report_frequency: int, stepsize_fs: float = 0.5) -> (str, int):
"""Use cif2lammps to assign force field to a single MOF and generate input files for lammps simulation
Args:
cif_path: starting structure's cif file path
timesteps: Number of timesteps to run
Expand Down
3 changes: 1 addition & 2 deletions tests/simulation/test_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ def test_lammps_runner(cif_files):
lmprunner = LAMMPSRunner(
lammps_command="npt_tri",
lmp_sims_root_path="lmp_sims",
cif_files_root_path=cif_files
)

for test_file in lmprunner.cif_files_paths:
for test_file in cif_files.glob("*.cif"):
try:
lmp_path = lmprunner.prep_molecular_dynamics_single(test_file,
timesteps=1000,
Expand Down

0 comments on commit 05000d3

Please sign in to comment.