refactor: update Python version and optimize dice configuration parameters
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import diceplayer.dice.dice_input as dice_input
|
||||
from diceplayer.config import DiceConfig
|
||||
from diceplayer.environment import System
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
@@ -15,14 +16,13 @@ class DiceWrapper:
|
||||
self.dice_config = dice_config
|
||||
self.working_directory = working_directory
|
||||
|
||||
def run(self, dice_config: dice_input.BaseConfig) -> None:
|
||||
input_path = dice_config.write(self.working_directory)
|
||||
def run(self, dice_config: dice_input.DiceInputConfig) -> None:
|
||||
input_path = dice_input.write_config(dice_config, self.working_directory)
|
||||
output_path = input_path.parent / (input_path.name + ".out")
|
||||
|
||||
with open(output_path, "w") as outfile, open(input_path, "r") as infile:
|
||||
bin_path = self.dice_config.progname.expanduser()
|
||||
exit_status = subprocess.call(
|
||||
bin_path, stdin=infile, stdout=outfile, cwd=self.working_directory
|
||||
self.dice_config.progname, stdin=infile, stdout=outfile, cwd=self.working_directory
|
||||
)
|
||||
|
||||
if exit_status != 0:
|
||||
@@ -35,5 +35,9 @@ class DiceWrapper:
|
||||
|
||||
raise RuntimeError(f"Dice simulation failed with exit status {exit_status}")
|
||||
|
||||
def extract_results(self) -> dict:
|
||||
return {}
|
||||
def parse_results(self, system: System) -> dict:
|
||||
results = {}
|
||||
for output_file in sorted(self.working_directory.glob("phb*.xyz")):
|
||||
...
|
||||
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user