Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts to generate si_diffusion_small dataset and fix to data prepro… #16

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crystal_diffusion/data/diffusion/data_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _convert_coords_to_relative(row: pd.Series) -> List[float]:
"""
x_lim, y_lim, z_lim = row['box']
coord_red = [coord for triple in zip(row['x'], row['y'], row['z']) for coord in
(triple[0] / x_lim, triple[1] / y_lim, triple[2] / z_lim)]
((triple[0] / x_lim) % 1, (triple[1] / y_lim) % 1, (triple[2] / z_lim) % 1)]
return coord_red

def get_x_relative(self, df: pd.DataFrame) -> pd.DataFrame:
Expand Down
40 changes: 40 additions & 0 deletions data/si_diffusion_small/create_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

TEMPERATURE=300
BOX_SIZE=2
STEP=10000
CROP=10000
NTRAIN_RUN=10
NVALID_RUN=5

NRUN=$(($NTRAIN_RUN + $NVALID_RUN))

for SEED in $(seq 2 $NRUN);
do
if [ "$SEED" -le $NTRAIN_RUN ]; then
MODE="train"
else
MODE="valid"
fi
echo $MODE $SEED
mkdir -p "${MODE}_run_${SEED}"
cd "${MODE}_run_${SEED}"
lmp < ../in.si.lammps -v STEP $(($STEP + $CROP)) -v T $TEMPERATURE -v S $BOX_SIZE -v SEED $SEED

# extract the thermodynamic outputs in a yaml file
egrep '^(keywords:|data:$|---$|\.\.\.$| - \[)' log.lammps > thermo_log.yaml

mkdir -p "uncropped_outputs"
mv "dump.si-${TEMPERATURE}-${BOX_SIZE}.yaml" uncropped_outputs/
mv thermo_log.yaml uncropped_outputs/

tail -n 760076 uncropped_outputs/dump.si-300-2.yaml > lammps_dump.yaml

python ../../crop_lammps_outputs.py \
--lammps_yaml "uncropped_outputs/dump.si-${TEMPERATURE}-${BOX_SIZE}.yaml" \
--lammps_thermo "uncropped_outputs/thermo_log.yaml" \
--crop $CROP \
--output_dir ./

cd ..
done
29 changes: 29 additions & 0 deletions data/si_diffusion_small/in.si.lammps
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
log log.lammps

units metal
atom_style atomic
atom_modify map array

lattice diamond 5.43
region simbox block 0 ${S} 0 ${S} 0 ${S}
create_box 1 simbox
create_atoms 1 region simbox

mass 1 28.0855

group Si type 1

pair_style sw
pair_coeff * * ../../si.sw Si

velocity all create ${T} ${SEED}

dump 1 all yaml 1 dump.si-${T}-${S}.yaml id type x y z fx fy fz

thermo_style yaml
thermo 1
#==========================Output files========================

fix 1 all nvt temp ${T} ${T} 0.01
run ${STEP}
unfix 1
6 changes: 3 additions & 3 deletions tests/data/diffusion/test_data_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ def sample_coordinates(box_coordinates):
# Sample data frame
return pd.DataFrame({
'box': [box_coordinates],
'x': [[60, 6, 0.6, 0.06]],
'y': [[120, 12, 1.2, 0.12]],
'z': [[180, 18, 1.8, 0.18]]
'x': [[0.6, 0.06, 0.006, 0.00006]],
'y': [[1.2, 0.12, 0.0012, 0.00012]],
'z': [[1.8, 0.18, 0.018, 0.0018]]
})


Expand Down
Loading