diff --git a/crystal_diffusion/data/parse_lammps.sh b/crystal_diffusion/data/parse_lammps.sh new file mode 100755 index 00000000..bcbb2079 --- /dev/null +++ b/crystal_diffusion/data/parse_lammps.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +EXP_DIR="lammps_scripts/Si/si-custom/" +DUMP_FILENAME="dump.si-300-1.yaml" +THERMO_FILENAME="thermo_log.yaml" +OUTPUT_NAME="demo.parquet" + +python crystal_diffusion/data/parse_lammps_outputs.py \ + --dump_file ${EXP_DIR}/${DUMP_FILENAME} \ + --thermo_file ${EXP_DIR}/${THERMO_FILENAME} \ + --output_name ${EXP_DIR}/${OUTPUT_NAME} diff --git a/crystal_diffusion/data/parse_lammps_outputs.py b/crystal_diffusion/data/parse_lammps_outputs.py index f118067c..db84fe99 100644 --- a/crystal_diffusion/data/parse_lammps_outputs.py +++ b/crystal_diffusion/data/parse_lammps_outputs.py @@ -30,6 +30,7 @@ def parse_lammps_output(lammps_dump: str, lammps_thermo_log: str, output_name: s if 'id' not in doc['keywords']: # sanity check raise ValueError('id should be in LAMMPS dump file') atoms_info = defaultdict(list) # store information on atoms positions and forces here + for data in doc['data']: # loop over the atoms to get their positions and forces for key, v in zip(doc['keywords'], data): if key not in ['id', 'type', 'x', 'y', 'z', 'fx', 'fy', 'fz']: diff --git a/data/run_lammps_example.sh b/data/run_lammps_example.sh index 7f17d2e1..526ab608 100644 --- a/data/run_lammps_example.sh +++ b/data/run_lammps_example.sh @@ -3,7 +3,11 @@ TEMPERATURE=300 BOX_SIZE=1 +<<<<<<< HEAD lmp < lammps_input_example.lammps -v STEP 10 -v T $TEMPERATURE -v S $BOX_SIZE # extract the thermodynamic outputs in a yaml file -egrep '^(keywords:|data:$|---$|\.\.\.$| - \[)' log.lammps > log.yaml \ No newline at end of file +egrep '^(keywords:|data:$|---$|\.\.\.$| - \[)' log.lammps > log.yaml +======= +lmp < lammps_input_example.lammps -v STEP 10 -v T $TEMPERATURE -v S $BOX_SIZE +>>>>>>> 5927511b163780d0be25d5db4a0eb8868b12f8b2