dump2rotorang.pyをargpase対応にした

This commit is contained in:
2026-06-29 11:48:50 +09:00
parent 2c740bbb43
commit fe967172d0
+15 -10
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
import argparse
import numpy as np import numpy as np
import io import io
import re import re
@@ -86,13 +87,17 @@ def run(trjfile):
dset[temp]["orientation"] = df dset[temp]["orientation"] = df
for k in ["D3d-o", "D3d-p"]: par = argparse.ArgumentParser(description="test")
dset = {} par.add_argument('-f', '--files')
files = sorted(glob.glob(f"{k}_*K.lammpstrj")) args = par.parse_args()
for f in files:
print(f) # for k in ["D3d-o", "D3d-p"]:
run(f) # dset = {}
outfile = f"{k}.pkl" # files = sorted(glob.glob(f"{k}_*K.lammpstrj"))
with open(outfile, "wb") as f: # for f in files:
pickle.dump(dset, f) # print(f)
print(f"{outfile} was created.") # run(f)
# outfile = f"{k}.pkl"
# with open(outfile, "wb") as f:
# pickle.dump(dset, f)
# print(f"{outfile} was created.")