Skip to content

Commit 93056ff

Browse files
run LAMMPS in cwd, not output_dir
1 parent 61a38ad commit 93056ff

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

test_driver/helper_functions.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ def run_lammps(modelname: str, temperature_K: float, pressure_bar: float, timest
7676
pdamp = timestep_ps * 1000.0
7777
tdamp = timestep_ps * 100.0
7878

79-
# Lammps will be run directly in output_dir so all paths are with respect to that directory.
80-
log_filename = "lammps.log"
81-
restart_filename = "final_configuration.restart"
82-
melted_crystal_filename = "melted_crystal.dump"
83-
average_position_filename = "average_position.dump"
84-
average_cell_filename = "average_cell.dump"
79+
log_filename = os.path.join(output_dir, "lammps.log")
80+
restart_filename = os.path.join(output_dir, "final_configuration.restart")
81+
melted_crystal_filename = os.path.join(output_dir, "melted_crystal.dump")
82+
average_position_filename = os.path.join(output_dir, "average_position.dump")
83+
average_cell_filename = os.path.join(output_dir, "average_cell.dump")
8584
variables = {
8685
"modelname": modelname,
8786
"temperature": temperature_K,
@@ -92,12 +91,12 @@ def run_lammps(modelname: str, temperature_K: float, pressure_bar: float, timest
9291
"timestep": timestep_ps,
9392
"thermo_sampling_period": thermo_sampling_period,
9493
"species": " ".join(species),
95-
"zero_temperature_crystal_filename": "zero_temperature_crystal.lmp",
94+
"zero_temperature_crystal_filename": os.path.join(output_dir, "zero_temperature_crystal.lmp"),
9695
"average_position_filename": f"{average_position_filename}.*",
9796
"average_cell_filename": average_cell_filename,
9897
"write_restart_filename": restart_filename,
99-
"trajectory_filename": "trajectory.lammpstrj",
100-
"msd_trajectory_filename": "msd_trajectory.lammpstrj",
98+
"trajectory_filename": os.path.join(output_dir, "trajectory.lammpstrj"),
99+
"msd_trajectory_filename": os.path.join(output_dir, "msd_trajectory.lammpstrj"),
101100
"msd_threshold": msd_threshold_angstrom_squared_per_sampling_timesteps,
102101
"msd_timesteps": number_msd_timesteps,
103102
"rlc_run_length": rlc_run_length,
@@ -109,9 +108,9 @@ def run_lammps(modelname: str, temperature_K: float, pressure_bar: float, timest
109108
f"{lammps_command} "
110109
+ " ".join(f"-var {key} '{item}'" for key, item in variables.items())
111110
+ f" -log {log_filename}"
112-
+ f" -in npt.lammps")
111+
+ f" -in {os.path.join(output_dir, 'npt.lammps')}")
113112

114-
subprocess.run(command, check=True, shell=True, cwd=output_dir)
113+
subprocess.run(command, check=True, shell=True)
115114

116115
if equilibration_plots:
117116
plot_property_from_lammps_log(f"{output_dir}/{log_filename}",

0 commit comments

Comments
 (0)