Repository navigation
Expand file tree
/
Copy pathraw2set.sh
More file actions
executable file
·59 lines (52 loc) · 1.74 KB
/
Copy pathraw2set.sh
File metadata and controls
executable file
·59 lines (52 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
nline_per_set=100000
if test $# -ge 1; then
nline_per_set=$1
fi
echo nframe is `cat energy.raw | wc -l`
echo nline per set is $nline_per_set
split box.raw -l $nline_per_set -d -a 3 box.raw
split coord.raw -l $nline_per_set -d -a 3 coord.raw
test -f energy.raw && split energy.raw -l $nline_per_set -d -a 3 energy.raw
test -f force.raw && split force.raw -l $nline_per_set -d -a 3 force.raw
test -f virial.raw && split virial.raw -l $nline_per_set -d -a 3 virial.raw
nset=`ls | grep box.raw[0-9] | wc -l`
nset_1=$(($nset-1))
echo will make $nset sets
for ii in `seq 0 $nset_1`
do
echo making set $ii ...
pi=`printf %03d $ii`
mkdir set.$pi
mv box.raw$pi set.$pi/box.raw
mv coord.raw$pi set.$pi/coord.raw
test -f energy.raw$pi && mv energy.raw$pi set.$pi/energy.raw
test -f force.raw$pi && mv force.raw$pi set.$pi/force.raw
test -f virial.raw$pi && mv virial.raw$pi set.$pi/virial.raw
cd set.$pi
python -c 'import numpy as np; data = np.loadtxt("box.raw" ); data = data.astype (np.float32); np.save ("box", data)'
python -c 'import numpy as np; data = np.loadtxt("coord.raw" ); data = data.astype (np.float32); np.save ("coord", data)'
python -c \
'import numpy as np; import os.path;
if os.path.isfile("energy.raw"):
data = np.loadtxt("energy.raw");
data = data.astype (np.float32);
np.save ("energy", data)
'
python -c \
'import numpy as np; import os.path;
if os.path.isfile("force.raw" ):
data = np.loadtxt("force.raw" );
data = data.astype (np.float32);
np.save ("force", data)
'
python -c \
'import numpy as np; import os.path;
if os.path.isfile("virial.raw"):
data = np.loadtxt("virial.raw");
data = data.astype (np.float32);
np.save ("virial", data)
'
rm *.raw
cd ../
done