-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a lot of tests for RHF, MP2 and FCI
- Loading branch information
Showing
16 changed files
with
1,907 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/bash | ||
|
||
read -d '' RHF << EOF | ||
add_test(NAME %s COMMAND \${PROJECT_SOURCE_DIR}/bin/test/test_rhf %s %s) | ||
set_tests_properties(%s PROPERTIES PASS_REGULAR_EXPRESSION "%s") | ||
EOF | ||
|
||
read -d '' RMP2 << EOF | ||
add_test(NAME %s COMMAND \${PROJECT_SOURCE_DIR}/bin/test/test_rmp2 %s %s) | ||
set_tests_properties(%s PROPERTIES PASS_REGULAR_EXPRESSION "%s") | ||
EOF | ||
|
||
read -d '' RFCI << EOF | ||
add_test(NAME %s COMMAND \${PROJECT_SOURCE_DIR}/bin/test/test_rfci %s %s) | ||
set_tests_properties(%s PROPERTIES PASS_REGULAR_EXPRESSION "%s") | ||
EOF | ||
|
||
create() { | ||
# extract the variables from the function arguments | ||
SYSTEM="$1"; CHARGE="$2"; MULT="$3"; BASIS="${4,,}"; METHOD="$5"; BASISFILE=$(echo "$BASIS" | sed -e 's/+/p/g ; s/*/s/g') | ||
|
||
# create the molecule block | ||
jq -n --arg file "example/molecule/$SYSTEM.xyz" --arg basis "$BASIS" --argjson charge "$CHARGE" --argjson multiplicity "$MULT" '{molecule: $ARGS.named}' > molecule.json | ||
|
||
# create the input file | ||
if [ "$METHOD" == "RHF" ]; then | ||
jq '. + {rhf: {}}' molecule.json > input.json | ||
elif [ "$METHOD" == "RMP2" ]; then | ||
jq '. + {rhf: {}, rmp: {}}' molecule.json > input.json | ||
elif [ "$METHOD" == "RFCI" ]; then | ||
jq '. + {rhf: {}, rci: {}}' molecule.json > input.json | ||
fi | ||
|
||
# run the program with a timeout | ||
$(timeout 1 acorn input.json > output.out 2> /dev/null) | ||
|
||
# create the test | ||
if [ "$METHOD" == "RHF" ]; then | ||
EXPECT=$(grep "RESTRICTED HARTREE-FOCK ENERGY" output.out | awk '{print $4}') | ||
[[ "$EXPECT" ]] && printf "\n\n# test-energy: %s %d %d %s RHF\n" "$SYSTEM" "$CHARGE" "$MULT" "${BASIS^^}"; TNAME="${SYSTEM}_${CHARGE}-${MULT}_${BASISFILE}_rhf_energy" | ||
[[ "$EXPECT" ]] && printf "$RHF" "$TNAME" "$SYSTEM" "$BASIS" "$TNAME" "$(echo $EXPECT | awk '{printf "%.8f", $1}')" | ||
elif [ "$METHOD" == "RMP2" ]; then | ||
EXPECT=$(grep "RESTRICTED MOLLER-PLESSET ENERGY" output.out | awk '{print $4}') | ||
[[ "$EXPECT" ]] && printf "\n\n# test-energy: %s %d %d %s RMP2\n" "$SYSTEM" "$CHARGE" "$MULT" "${BASIS^^}"; TNAME="${SYSTEM}_${CHARGE}-${MULT}_${BASISFILE}_rmp2_energy" | ||
[[ "$EXPECT" ]] && printf "$RMP2" "$TNAME" "$SYSTEM" "$BASIS" "$TNAME" "$(echo $EXPECT | awk '{printf "%.8f", $1}')" | ||
elif [ "$METHOD" == "RFCI" ]; then | ||
EXPECT=$(grep "RESTRICTED CONFIGURATION INTERACTION ENERGY" output.out | awk '{print $5}') | ||
[[ "$EXPECT" ]] && printf "\n\n# test-energy: %s %d %d %s RFCI\n" "$SYSTEM" "$CHARGE" "$MULT" "${BASIS^^}"; TNAME="${SYSTEM}_${CHARGE}-${MULT}_${BASISFILE}_rfci_energy" | ||
[[ "$EXPECT" ]] && printf "$RFCI" "$TNAME" "$SYSTEM" "$BASIS" "$TNAME" "$(echo $EXPECT | awk '{printf "%.8f", $1}')" | ||
fi | ||
|
||
# remove the temporary files | ||
rm molecule.json input.json output.out | ||
} | ||
|
||
printf "# this file is for definitions of tests and can be generated by the testing.sh script in the script folder" | ||
|
||
for SYSTEM in example/molecule/*.xyz; do | ||
for BASIS in basis/*.g94; do | ||
# extract the system name and basis set name | ||
SYSTEM=$(basename "$SYSTEM" .xyz); BASIS=$(basename "$BASIS" .g94 | sed 's/augmentation/aug/g') | ||
|
||
# create the tests | ||
create "$SYSTEM" 0 1 "$BASIS" "RHF"; create "$SYSTEM" 0 1 "$BASIS" "RMP2"; create "$SYSTEM" 0 1 "$BASIS" "RFCI" | ||
done | ||
done | ||
|
||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters