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

For abacus change the virial information in the second line to the stress information #847

Merged
merged 3 commits into from
Jan 3, 2025
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
17 changes: 7 additions & 10 deletions tools/abacus2xyz/multipleFrames-abacus2nep-exyz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
### HOW TO USE #################################################################################
### SYNTAX: ./multipleFrames-abacus2nep-exyz.sh dire_name
### NOTE: 1).'dire_name' is the directory containing running_md.log and MD_dump file.
### Email: yanzhowang@gmail.com if any questions
### Modified by Yuwen Zhang
### Modified by Shunda Chen
### Modified by Zihan Yan
### Email: tang070205@proton.me if any questions
### Modified by Yuwen Zhang, Shunda Chen, Zihan Yan
### Modified by Benrui Tang
################################################################################################
#--- DEFAULT ASSIGNMENTS ---------------------------------------------------------------------
isol_ener=0 # Shifted energy, specify the value?
viri_logi=0 # Logical value for virial, true=1, false=0
stress_logi=0 # Logical value for virial, true=1, false=0
#--------------------------------------------------------------------------------------------
read_dire=$1
if [ -z "$read_dire" ]; then
Expand All @@ -24,12 +22,11 @@ rm -rf $writ_dire; mkdir $writ_dire
configuration=$(pwd | awk -F'/' '{print $(NF-2)"/"$(NF-1)"/"$NF}')
syst_numb_atom=$(grep "TOTAL ATOM NUMBER" running_md.log |awk '{print $5}')
ener_values=($(grep 'etot' running_md.log |awk '{print $4}'))
if [[ $viri_logi -eq 1 ]]; then
if [[ $stress_logi -eq 1 ]]; then
mdstep_lines=($(grep -n 'MDSTEP' MD_dump | awk -F: '{print $1+12+'$syst_numb_atom'}'))
else
mdstep_lines=($(grep -n 'MDSTEP' MD_dump | awk -F: '{print $1+9+'$syst_numb_atom'}'))
fi
conversion_value=$(grep "Volume (A^3)" running_md.log |awk '{print $4/1602.1766208}')
N_counts=$(( ${#mdstep_lines[@]} - 1 ))


Expand All @@ -41,9 +38,9 @@ for ((i=1; i<${#mdstep_lines[@]}; i++)); do
sed -n "${start_line},${end_line}p" MD_dump > temp.file
echo "$syst_numb_atom" >> "$writ_dire/$writ_file"
latt=$(grep -A 3 "LATTICE_VECTORS" temp.file | tail -n 3 | awk '{for (i = 1; i <= NF; i++) {printf "%.8f ", $i}}' |xargs)
if [[ $viri_logi -eq 1 ]]; then
viri=$(grep -A 3 "VIRIAL (kbar)" temp.file | tail -n 3 | awk '{for (i = 1; i <= NF; i++) {printf "%.8f ", $i * '$conversion_value'}}' |xargs)
echo "Config_type=$configuration Weight=1.0 Lattice=\"$latt\" Energy=$ener Virial=\"$viri\" pbc=\"T T T\" Properties=species:S:1:pos:R:3:forces:R:3" >> "$writ_dire/$writ_file"
if [[ $stress_logi -eq 1 ]]; then
stress=$(grep -A 3 "VIRIAL (kbar)" temp.file | tail -n 3 | awk '{for (i = 1; i <= NF; i++) {printf "%.8f ", $i * 0.1}}' |xargs)
echo "Config_type=$configuration Weight=1.0 Lattice=\"$latt\" Energy=$ener Stress=\"$stress\" pbc=\"T T T\" Properties=species:S:1:pos:R:3:forces:R:3" >> "$writ_dire/$writ_file"
else
echo "Config_type=$configuration Weight=1.0 Lattice=\"$latt\" Energy=$ener Properties=species:S:1:pos:R:3:forces:R:3 pbc=\"T T T\"" >> "$writ_dire/$writ_file"
fi
Expand Down
12 changes: 5 additions & 7 deletions tools/abacus2xyz/singleFrame-abacus2nep-exyz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
### SYNTAX: ./singleFrame-abacus2nep-exyz.sh dire_name
### NOTE: 1).'dire_name' is the directory containing running_scf.logs
### Email: tang070205@proton.me if have questions
### Modified by Yanzhou Wang
### Modified by Shunda Chen
### Modified by Yanzhou Wang Shunda Chen
### Modified by Benrui Tang
################################################################################################
#--- DEFAULT ASSIGNMENTSts ---------------------------------------------------------------------
isol_ener=0 # Shifted energy, specify the value?
viri_logi=1 # Logical value for virial, true=1, false=0
stress_logi=1 # Logical value for virial, true=1, false=0
#--------------------------------------------------------------------------------------------
read_dire=$1
if [ -z $read_dire ]; then
Expand All @@ -28,11 +27,10 @@ do
echo $syst_numb_atom >> $writ_dire/$writ_file
latt=$(grep -A 3 "Lattice vectors" $i | tail -n 3 | sed 's/+//g' | awk '{ for (i=1; i<=NF; i++) printf "%.8f ", $i}')
ener=$(grep "FINAL_ETOT_IS" $i | awk '{printf "%.6f\n", $2 - '$syst_numb_atom' * '$isol_ener'}')
if [ $viri_logi -eq 1 ]
if [ $stress_logi -eq 1 ]
then
conversion_value=$(grep "Volume (A^3)" $i |awk '{print $4/1602.1766208}')
viri=$(grep -A 4 "TOTAL-STRESS" $i | tail -n 3 | awk '{for (i = 1; i <= NF; i++) {printf "%.8f ", $i * '$conversion_value'}}' |xargs)
echo Energy=$ener Lattice=\"$latt\" Virial=\"$viri\" "Config_type=$configuration Weight=1.0 Properties=species:S:1:pos:R:3:forces:R:3" >> $writ_dire/$writ_file
stress=$(grep -A 4 "TOTAL-STRESS" $i | tail -n 3 | awk '{for (i = 1; i <= NF; i++) {printf "%.8f ", $i * 0.1}}' |xargs)
echo Energy=$ener Lattice=\"$latt\" Stress=\"$stress\" "Config_type=$configuration Weight=1.0 Properties=species:S:1:pos:R:3:forces:R:3" >> $writ_dire/$writ_file
else
echo Energy=$ener Lattice=\"$latt\" "Config_type=$configuration Weight=1.0 Properties=species:S:1:pos:R:3:forces:R:3" >> $writ_dire/$writ_file
fi
Expand Down
Loading