10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 15:12:14 +02:00

Merge branch 'master' of github.com:LCPQ/quantum_package

Conflicts:
	src/AOs/aos.irp.f
	src/Dets/determinants.irp.f
	src/NEEDED_MODULES
This commit is contained in:
Manu 2015-01-07 18:05:09 +01:00
commit 7f6e33b9be
57 changed files with 64138 additions and 61497 deletions

View File

@ -28,11 +28,11 @@ EZFIO: bin/irpf90
bin/irpf90:
$(info $(BLUE)===== Fetching IRPF90 from the web ===== $(BLACK))
@sleep 1
#@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
# (echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
#tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
#$(MAKE) -C irpf90 | tee install_irpf90.log
#rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman
@$(FETCH_FROM_WEB) "$(WWW_SERVER)/$(IRPF90_TGZ)" $(IRPF90_TGZ) || \
(echo Unable to download IRPF90 : $(WWW_SERVER)/$(IRPF90_TGZ) ; exit 1)
tar -zxf $(IRPF90_TGZ) && rm $(IRPF90_TGZ)
$(MAKE) -C irpf90 | tee install_irpf90.log
rm -rf -- $$PWD/bin/irpf90 $$PWD/bin/irpman
echo $$PWD/irpf90/bin/irpf90 $$\@ > $$PWD/bin/irpf90
echo $$PWD/irpf90/bin/irpman $$\@ > $$PWD/bin/irpman
chmod +x $$PWD/bin/irpf90 $$PWD/bin/irpman

View File

@ -1,292 +1,466 @@
HYDROGEN
S 2
1 5.4471780 0.1562850
2 0.8245470 0.9046910
1 5.4471780 0.1562850
2 0.8245470 0.9046910
S 1
1 0.1831920 1.0000000
1 0.1831920 1.0000000
S 1
1 0.0360000 1.0000000
1 0.0360000 1.0000000
LITHIUM
S 3
1 36.8382000 0.0696686
2 5.4817200 0.3813460
3 1.1132700 0.6817020
L 2
1 0.5402050 -0.2631270 0.1615460
2 0.1022550 1.1433900 0.9156630
L 1
1 0.0285650 1.0000000 1.0000000
L 1
1 0.0074000 1.0000000 1.0000000
1 36.8382000 0.0696686
2 5.4817200 0.3813460
3 1.1132700 0.6817020
S 2
1 0.5402050 -0.2631270
2 0.1022550 1.1433900
P 2
1 0.5402050 0.1615460
2 0.1022550 0.9156630
S 1
1 0.0285650 1.0000000
P 1
1 0.0285650 1.0000000
S 1
1 0.0074000 1.0000000
P 1
1 0.0074000 1.0000000
BERYLLIUM
S 3
1 71.8876000 0.0644263
2 10.7289000 0.3660960
3 2.2220500 0.6959340
L 2
1 1.2954800 -0.4210640 0.2051320
2 0.2688810 1.2240700 0.8825280
L 1
1 0.0773500 1.0000000 1.0000000
L 1
1 0.0207000 1.0000000 1.0000000
1 71.8876000 0.0644263
2 10.7289000 0.3660960
3 2.2220500 0.6959340
S 2
1 1.2954800 -0.4210640
2 0.2688810 1.2240700
P 2
1 1.2954800 0.2051320
2 0.2688810 0.8825280
S 1
1 0.0773500 1.0000000
P 1
1 0.0773500 1.0000000
S 1
1 0.0207000 1.0000000
P 1
1 0.0207000 1.0000000
BORON
S 3
1 116.4340000 0.0629605
2 17.4314000 0.3633040
3 3.6801600 0.6972550
L 2
1 2.2818700 -0.3686620 0.2311520
2 0.4652480 1.1994400 0.8667640
L 1
1 0.1243280 1.0000000 1.0000000
L 1
1 0.0315000 1.0000000 1.0000000
1 116.4340000 0.0629605
2 17.4314000 0.3633040
3 3.6801600 0.6972550
S 2
1 2.2818700 -0.3686620
2 0.4652480 1.1994400
P 2
1 2.2818700 0.2311520
2 0.4652480 0.8667640
S 1
1 0.1243280 1.0000000
P 1
1 0.1243280 1.0000000
S 1
1 0.0315000 1.0000000
P 1
1 0.0315000 1.0000000
CARBON
S 3
1 172.2560000 0.0617669
2 25.9109000 0.3587940
3 5.5333500 0.7007130
L 2
1 3.6649800 -0.3958970 0.2364600
2 0.7705450 1.2158400 0.8606190
L 1
1 0.1958570 1.0000000 1.0000000
L 1
1 0.0438000 1.0000000 1.0000000
1 172.2560000 0.0617669
2 25.9109000 0.3587940
3 5.5333500 0.7007130
S 2
1 3.6649800 -0.3958970
2 0.7705450 1.2158400
P 2
1 3.6649800 0.2364600
2 0.7705450 0.8606190
S 1
1 0.1958570 1.0000000
P 1
1 0.1958570 1.0000000
S 1
1 0.0438000 1.0000000
P 1
1 0.0438000 1.0000000
NITROGEN
S 3
1 242.7660000 0.0598657
2 36.4851000 0.3529550
3 7.8144900 0.7065130
L 2
1 5.4252200 -0.4133010 0.2379720
2 1.1491500 1.2244200 0.8589530
L 1
1 0.2832050 1.0000000 1.0000000
L 1
1 0.0639000 1.0000000 1.0000000
1 242.7660000 0.0598657
2 36.4851000 0.3529550
3 7.8144900 0.7065130
S 2
1 5.4252200 -0.4133010
2 1.1491500 1.2244200
P 2
1 5.4252200 0.2379720
2 1.1491500 0.8589530
S 1
1 0.2832050 1.0000000
P 1
1 0.2832050 1.0000000
S 1
1 0.0639000 1.0000000
P 1
1 0.0639000 1.0000000
OXYGEN
S 3
1 322.0370000 0.0592394
2 48.4308000 0.3515000
3 10.4206000 0.7076580
L 2
1 7.4029400 -0.4044530 0.2445860
2 1.5762000 1.2215600 0.8539550
L 1
1 0.3736840 1.0000000 1.0000000
L 1
1 0.0845000 1.0000000 1.0000000
1 322.0370000 0.0592394
2 48.4308000 0.3515000
3 10.4206000 0.7076580
S 2
1 7.4029400 -0.4044530
2 1.5762000 1.2215600
P 2
1 7.4029400 0.2445860
2 1.5762000 0.8539550
S 1
1 0.3736840 1.0000000
P 1
1 0.3736840 1.0000000
S 1
1 0.0845000 1.0000000
P 1
1 0.0845000 1.0000000
FLUORINE
S 3
1 413.8010000 0.0585483
2 62.2446000 0.3493080
3 13.4340000 0.7096320
L 2
1 9.7775900 -0.4073270 0.2466800
2 2.0861700 1.2231400 0.8523210
L 1
1 0.4823830 1.0000000 1.0000000
L 1
1 0.1076000 1.0000000 1.0000000
1 413.8010000 0.0585483
2 62.2446000 0.3493080
3 13.4340000 0.7096320
S 2
1 9.7775900 -0.4073270
2 2.0861700 1.2231400
P 2
1 9.7775900 0.2466800
2 2.0861700 0.8523210
S 1
1 0.4823830 1.0000000
P 1
1 0.4823830 1.0000000
S 1
1 0.1076000 1.0000000
P 1
1 0.1076000 1.0000000
NEON
S 3
1 515.7240000 0.0581430
2 77.6538000 0.3479510
3 16.8136000 0.7107140
L 2
1 12.4830000 -0.4099220 0.2474600
2 2.6645100 1.2243100 0.8517430
L 1
1 0.6062500 1.0000000 1.0000000
L 1
1 0.1300000 1.0000000 1.0000000
1 515.7240000 0.0581430
2 77.6538000 0.3479510
3 16.8136000 0.7107140
S 2
1 12.4830000 -0.4099220
2 2.6645100 1.2243100
P 2
1 12.4830000 0.2474600
2 2.6645100 0.8517430
S 1
1 0.6062500 1.0000000
P 1
1 0.6062500 1.0000000
S 1
1 0.1300000 1.0000000
P 1
1 0.1300000 1.0000000
SODIUM
S 3
1 547.6130000 0.0674911
2 82.0678000 0.3935050
3 17.6917000 0.6656050
L 3
1 17.5407000 -0.1119370 0.1282330
2 3.7939800 0.2546540 0.4715330
3 0.9064410 0.8444170 0.6042730
L 2
1 0.5018240 -0.2196600 0.0090665
2 0.0609458 1.0891200 0.9972020
L 1
1 0.0244349 1.0000000 1.0000000
L 1
1 0.0076000 1.0000000 1.0000000
1 547.6130000 0.0674911
2 82.0678000 0.3935050
3 17.6917000 0.6656050
S 3
1 17.5407000 -0.1119370
2 3.7939800 0.2546540
3 0.9064410 0.8444170
P 3
1 17.5407000 0.1282330
2 3.7939800 0.4715330
3 0.9064410 0.6042730
S 2
1 0.5018240 -0.2196600
2 0.0609458 1.0891200
P 2
1 0.5018240 0.0090665
2 0.0609458 0.9972020
S 1
1 0.0244349 1.0000000
P 1
1 0.0244349 1.0000000
S 1
1 0.0076000 1.0000000
P 1
1 0.0076000 1.0000000
MAGNESIUM
S 3
1 652.8410000 0.0675982
2 98.3805000 0.3917780
3 21.2996000 0.6666610
L 3
1 23.3727000 -0.1102460 0.1210140
2 5.1995300 0.1841190 0.4628100
3 1.3150800 0.8963990 0.6069070
L 2
1 0.6113490 -0.3611010 0.0242633
2 0.1418410 1.2150500 0.9866730
L 1
1 0.0464011 1.0000000 1.0000000
L 1
1 0.0146000 1.0000000 1.0000000
1 652.8410000 0.0675982
2 98.3805000 0.3917780
3 21.2996000 0.6666610
S 3
1 23.3727000 -0.1102460
2 5.1995300 0.1841190
3 1.3150800 0.8963990
P 3
1 23.3727000 0.1210140
2 5.1995300 0.4628100
3 1.3150800 0.6069070
S 2
1 0.6113490 -0.3611010
2 0.1418410 1.2150500
P 2
1 0.6113490 0.0242633
2 0.1418410 0.9866730
S 1
1 0.0464011 1.0000000
P 1
1 0.0464011 1.0000000
S 1
1 0.0146000 1.0000000
P 1
1 0.0146000 1.0000000
ALUMINUM
S 3
1 775.7370000 0.0668347
2 116.9520000 0.3890610
3 25.3326000 0.6694680
L 3
1 29.4796000 -0.1079020 0.1175740
2 6.6331400 0.1462450 0.4611740
3 1.7267500 0.9237300 0.6055350
L 2
1 0.9461600 -0.3203270 0.0519383
2 0.2025060 1.1841200 0.9726600
L 1
1 0.0639088 1.0000000 1.0000000
L 1
1 0.0318000 1.0000000 1.0000000
1 775.7370000 0.0668347
2 116.9520000 0.3890610
3 25.3326000 0.6694680
S 3
1 29.4796000 -0.1079020
2 6.6331400 0.1462450
3 1.7267500 0.9237300
P 3
1 29.4796000 0.1175740
2 6.6331400 0.4611740
3 1.7267500 0.6055350
S 2
1 0.9461600 -0.3203270
2 0.2025060 1.1841200
P 2
1 0.9461600 0.0519383
2 0.2025060 0.9726600
S 1
1 0.0639088 1.0000000
P 1
1 0.0639088 1.0000000
S 1
1 0.0318000 1.0000000
P 1
1 0.0318000 1.0000000
SILICON
S 3
1 910.6550000 0.0660823
2 137.3360000 0.3862290
3 29.7601000 0.6723800
L 3
1 36.6716000 -0.1045110 0.1133550
2 8.3172900 0.1074100 0.4575780
3 2.2164500 0.9514460 0.6074270
L 2
1 1.0791300 -0.3761080 0.0671030
2 0.3024220 1.2516500 0.9568830
L 1
1 0.0933392 1.0000000 1.0000000
L 1
1 0.0331000 1.0000000 1.0000000
PHOSPHOROUS
1 910.6550000 0.0660823
2 137.3360000 0.3862290
3 29.7601000 0.6723800
S 3
1 1054.9000000 0.0655410
2 159.1950000 0.3840360
3 34.5304000 0.6745410
L 3
1 44.2866000 -0.1021300 0.1108510
2 10.1019000 0.0815920 0.4564950
3 2.7399700 0.9697880 0.6069360
L 2
1 1.2186500 -0.3714950 0.0915820
2 0.3955460 1.2709900 0.9349240
L 1
1 0.1228110 1.0000000 1.0000000
L 1
1 0.0348000 1.0000000 1.0000000
1 36.6716000 -0.1045110
2 8.3172900 0.1074100
3 2.2164500 0.9514460
P 3
1 36.6716000 0.1133550
2 8.3172900 0.4575780
3 2.2164500 0.6074270
S 2
1 1.0791300 -0.3761080
2 0.3024220 1.2516500
P 2
1 1.0791300 0.0671030
2 0.3024220 0.9568830
S 1
1 0.0933392 1.0000000
P 1
1 0.0933392 1.0000000
S 1
1 0.0331000 1.0000000
P 1
1 0.0331000 1.0000000
PHOSPHORUS
S 3
1 1054.9000000 0.0655410
2 159.1950000 0.3840360
3 34.5304000 0.6745410
S 3
1 44.2866000 -0.1021300
2 10.1019000 0.0815920
3 2.7399700 0.9697880
P 3
1 44.2866000 0.1108510
2 10.1019000 0.4564950
3 2.7399700 0.6069360
S 2
1 1.2186500 -0.3714950
2 0.3955460 1.2709900
P 2
1 1.2186500 0.0915820
2 0.3955460 0.9349240
S 1
1 0.1228110 1.0000000
P 1
1 0.1228110 1.0000000
S 1
1 0.0348000 1.0000000
P 1
1 0.0348000 1.0000000
SULFUR
S 3
1 1210.6200000 0.0650070
2 182.7470000 0.3820400
3 39.6673000 0.6765450
L 3
1 52.2236000 -0.1003100 0.1096460
2 11.9629000 0.0650880 0.4576490
3 3.2891100 0.9814550 0.6042610
L 2
1 1.2238400 -0.2860890 0.1647770
2 0.4573030 1.2280600 0.8708550
L 1
1 0.1422690 1.0000000 1.0000000
L 1
1 0.0405000 1.0000000 1.0000000
1 1210.6200000 0.0650070
2 182.7470000 0.3820400
3 39.6673000 0.6765450
S 3
1 52.2236000 -0.1003100
2 11.9629000 0.0650880
3 3.2891100 0.9814550
P 3
1 52.2236000 0.1096460
2 11.9629000 0.4576490
3 3.2891100 0.6042610
S 2
1 1.2238400 -0.2860890
2 0.4573030 1.2280600
P 2
1 1.2238400 0.1647770
2 0.4573030 0.8708550
S 1
1 0.1422690 1.0000000
P 1
1 0.1422690 1.0000000
S 1
1 0.0405000 1.0000000
P 1
1 0.0405000 1.0000000
CHLORINE
S 3
1 1376.4000000 0.0645827
2 207.8570000 0.3803630
3 45.1554000 0.6781900
L 3
1 60.8014000 -0.0987639 0.1085980
2 13.9765000 0.0511338 0.4586820
3 3.8871000 0.9913370 0.6019620
L 2
1 1.3529900 -0.2224010 0.2192160
2 0.5269550 1.1825200 0.8223210
L 1
1 0.1667140 1.0000000 1.0000000
L 1
1 0.0483000 1.0000000 1.0000000
1 1376.4000000 0.0645827
2 207.8570000 0.3803630
3 45.1554000 0.6781900
S 3
1 60.8014000 -0.0987639
2 13.9765000 0.0511338
3 3.8871000 0.9913370
P 3
1 60.8014000 0.1085980
2 13.9765000 0.4586820
3 3.8871000 0.6019620
S 2
1 1.3529900 -0.2224010
2 0.5269550 1.1825200
P 2
1 1.3529900 0.2192160
2 0.5269550 0.8223210
S 1
1 0.1667140 1.0000000
P 1
1 0.1667140 1.0000000
S 1
1 0.0483000 1.0000000
P 1
1 0.0483000 1.0000000
ARGON
S 3
1 1553.7100000 0.0641707
2 234.6780000 0.3787970
3 51.0121000 0.6797520
L 3
1 70.0453000 -0.0974661 0.1076190
2 16.1473000 0.0390569 0.4595760
3 4.5349200 0.9999160 0.6000410
L 2
1 1.5420900 -0.1768660 0.2556870
2 0.6072670 1.1469000 0.7898420
L 1
1 0.1953730 1.0000000 1.0000000
L 1
1 0.0600000 1.0000000 1.0000000
1 1553.7100000 0.0641707
2 234.6780000 0.3787970
3 51.0121000 0.6797520
S 3
1 70.0453000 -0.0974661
2 16.1473000 0.0390569
3 4.5349200 0.9999160
P 3
1 70.0453000 0.1076190
2 16.1473000 0.4595760
3 4.5349200 0.6000410
S 2
1 1.5420900 -0.1768660
2 0.6072670 1.1469000
P 2
1 1.5420900 0.2556870
2 0.6072670 0.7898420
S 1
1 0.1953730 1.0000000
P 1
1 0.1953730 1.0000000
S 1
1 0.0600000 1.0000000
P 1
1 0.0600000 1.0000000
POTASSIUM
S 3
1 1721.1755000 0.0648747
2 260.0163300 0.3808593
3 56.6245540 0.6773681
L 3
1 71.5572000 -0.1093429 0.1339654
2 15.4389400 0.1130640 0.5302673
3 4.4745510 0.9462575 0.5117992
L 3
1 4.1212750 -0.2699730 0.01994922
2 1.1886210 0.3646323 0.43402130
3 0.3756740 0.8107533 0.64532260
L 2
1 0.2445770 -0.2688250 0.0003081035
2 0.0389720 1.1289830 0.9998787
L 1
1 0.0160630 1.0000000 1.0000000
L 1
1 0.0047000 1.0000000 1.0000000
1 1721.1755000 0.0648747
2 260.0163300 0.3808593
3 56.6245540 0.6773681
S 3
1 71.5572000 -0.1093429
2 15.4389400 0.1130640
3 4.4745510 0.9462575
P 3
1 71.5572000 0.1339654
2 15.4389400 0.5302673
3 4.4745510 0.5117992
S 3
1 4.1212750 -0.2699730
2 1.1886210 0.3646323
3 0.3756740 0.8107533
P 3
1 4.1212750 0.01994922
2 1.1886210 0.43402130
3 0.3756740 0.64532260
S 2
1 0.2445770 -0.2688250
2 0.0389720 1.1289830
P 2
1 0.2445770 0.0003081035
2 0.0389720 0.9998787
S 1
1 0.0160630 1.0000000
P 1
1 0.0160630 1.0000000
S 1
1 0.0047000 1.0000000
P 1
1 0.0047000 1.0000000
CALCIUM
S 3
1 1915.4348000 0.0646240
2 289.5332400 0.3798380
3 63.1063520 0.6783290
L 3
1 80.3974400 -0.1093030 0.1354330
2 17.3307500 0.1089000 0.5372220
3 5.0836240 0.9492770 0.5018040
L 3
1 4.7822290 -0.2816070 0.0190090
2 1.4625580 0.3410510 0.4360380
3 0.4792230 0.8381040 0.6386710
L 2
1 0.4396820 -0.2697050 0.0003080
2 0.0591300 1.1132930 0.9998960
L 1
1 0.0238970 1.0000000 1.0000000
L 1
1 0.0071000 1.0000000 1.0000000
1 1915.4348000 0.0646240
2 289.5332400 0.3798380
3 63.1063520 0.6783290
S 3
1 80.3974400 -0.1093030
2 17.3307500 0.1089000
3 5.0836240 0.9492770
P 3
1 80.3974400 0.1354330
2 17.3307500 0.5372220
3 5.0836240 0.5018040
S 3
1 4.7822290 -0.2816070
2 1.4625580 0.3410510
3 0.4792230 0.8381040
P 3
1 4.7822290 0.0190090
2 1.4625580 0.4360380
3 0.4792230 0.6386710
S 2
1 0.4396820 -0.2697050
2 0.0591300 1.1132930
P 2
1 0.4396820 0.0003080
2 0.0591300 0.9998960
S 1
1 0.0238970 1.0000000
P 1
1 0.0238970 1.0000000
S 1
1 0.0071000 1.0000000
P 1
1 0.0071000 1.0000000

File diff suppressed because it is too large Load Diff

1154
data/basis/6-31g_star Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,11 +18,11 @@ cis_dressed
determinants
n_states 1
n_states_diag determinants_n_states
n_det_max_jacobi 5000
n_det_max_jacobi 1000
threshold_generators 0.99
threshold_selectors 0.999
read_wf False
s2_eig True
s2_eig False
full_ci
n_det_max_fci 10000

View File

@ -52,6 +52,8 @@ let read_one in_channel =
match buffer with
| [ j ; expo ; coef ] ->
begin
let coef = String.tr ~target:'D' ~replacement:'e' coef
in
let p =
Primitive.of_sym_expo sym
(AO_expo.of_float (Float.of_string expo) )

View File

@ -4,7 +4,7 @@ open Core.Std;;
module Ao_basis : sig
type t =
{ ao_basis : string ;
{ ao_basis : AO_basis_name.t;
ao_num : AO_number.t ;
ao_prim_num : AO_prim_number.t array;
ao_prim_num_max : AO_prim_number.t;
@ -14,13 +14,14 @@ module Ao_basis : sig
ao_expo : AO_expo.t array;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val to_string : t -> string
val write : t -> unit
val to_md5 : t -> MD5.t
val to_rst : t -> Rst_string.t
end = struct
type t =
{ ao_basis : string ;
{ ao_basis : AO_basis_name.t;
ao_num : AO_number.t ;
ao_prim_num : AO_prim_number.t array;
ao_prim_num_max : AO_prim_number.t;
@ -34,10 +35,8 @@ end = struct
let get_default = Qpackage.get_ezfio_default "ao_basis";;
let read_ao_basis () =
if not (Ezfio.has_ao_basis_ao_basis ()) then
Ezfio.set_ao_basis_ao_basis ""
;
Ezfio.get_ao_basis_ao_basis ()
|> AO_basis_name.of_string
;;
let read_ao_num () =
@ -94,18 +93,6 @@ end = struct
|> Array.map ~f:AO_expo.of_float
;;
let read () =
{ ao_basis = read_ao_basis ();
ao_num = read_ao_num () ;
ao_prim_num = read_ao_prim_num ();
ao_prim_num_max = read_ao_prim_num_max ();
ao_nucl = read_ao_nucl ();
ao_power = read_ao_power ();
ao_coef = read_ao_coef () ;
ao_expo = read_ao_expo () ;
}
;;
let to_long_basis b =
let ao_num = AO_number.to_int b.ao_num in
let gto_array = Array.init (AO_number.to_int b.ao_num)
@ -135,12 +122,69 @@ end = struct
(Array.to_list gto_array)
(Array.to_list b.ao_nucl)
;;
let to_basis b =
to_long_basis b
|> Long_basis.to_basis
;;
let to_md5 b =
let short_basis = to_basis b in
Basis.to_md5 short_basis
;;
let write_md5 b =
to_md5 b
|> MD5.to_string
|> Ezfio.set_ao_basis_ao_md5
;;
let write_ao_basis name =
AO_basis_name.to_string name
|> Ezfio.set_ao_basis_ao_basis
;;
let write b =
let { ao_basis ;
ao_num ;
ao_prim_num ;
ao_prim_num_max ;
ao_nucl ;
ao_power ;
ao_coef ;
ao_expo ;
} = b
in
write_md5 b ;
write_ao_basis ao_basis;
;;
let read () =
if (Ezfio.has_ao_basis_ao_basis ()) then
begin
let result =
{ ao_basis = read_ao_basis ();
ao_num = read_ao_num () ;
ao_prim_num = read_ao_prim_num ();
ao_prim_num_max = read_ao_prim_num_max ();
ao_nucl = read_ao_nucl ();
ao_power = read_ao_power ();
ao_coef = read_ao_coef () ;
ao_expo = read_ao_expo () ;
}
in
to_md5 result
|> MD5.to_string
|> Ezfio.set_ao_basis_ao_md5 ;
Some result
end
else
None
;;
let to_rst b =
let print_sym =
let l = List.init (Array.length b.ao_power) ~f:(
@ -171,7 +215,7 @@ Basis set ::
%s
======= ========= ===========
" b.ao_basis
" (AO_basis_name.to_string b.ao_basis)
(Basis.to_string short_basis
|> String.split ~on:'\n'
|> List.map ~f:(fun x-> " "^x)
@ -196,11 +240,6 @@ Basis set ::
extract_basis s
;;
let to_md5 b =
let short_basis = to_basis b in
Basis.to_md5 short_basis
;;
let to_string b =
Printf.sprintf "
ao_basis = %s
@ -213,7 +252,7 @@ ao_coef = %s
ao_expo = %s
md5 = %s
"
b.ao_basis
(AO_basis_name.to_string b.ao_basis)
(AO_number.to_string b.ao_num)
(b.ao_prim_num |> Array.to_list |> List.map
~f:(AO_prim_number.to_string) |> String.concat ~sep:", " )

View File

@ -13,7 +13,7 @@ module Bielec_integrals : sig
direct : bool;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -150,7 +150,7 @@ end = struct
if (result.read_mo_integrals &&
result.write_mo_integrals) then
failwith "Read and Write MO integrals are both true.";
result
Some result
;;
let write b =

View File

@ -10,7 +10,7 @@ module Bitmasks : sig
generators : int64 array;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val to_string : t -> string
end = struct
type t =
@ -77,11 +77,15 @@ end = struct
;;
let read () =
{ n_int = read_n_int ();
bit_kind = read_bit_kind ();
n_mask_gen = read_n_mask_gen ();
generators = read_generators ();
}
if (Ezfio.has_mo_basis_mo_tot_num ()) then
Some
{ n_int = read_n_int ();
bit_kind = read_bit_kind ();
n_mask_gen = read_n_mask_gen ();
generators = read_generators ();
}
else
None
;;
let to_string b =

View File

@ -12,7 +12,7 @@ module Cis_dressed : sig
en_2_2 : bool;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val to_string : t -> string
val to_rst : t -> Rst_string.t
val of_rst : Rst_string.t -> t option
@ -86,6 +86,7 @@ end = struct
;;
let read () =
Some
{ n_state_cis = read_n_state_cis ();
n_core_cis = read_n_core_cis ();
n_act_cis = read_n_act_cis ();

View File

@ -9,7 +9,7 @@ module Cisd_sc2 : sig
do_pt2_end : bool;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -71,6 +71,7 @@ end = struct
let read () =
Some
{ n_det_max_cisd_sc2 = read_n_det_max_cisd_sc2 ();
pt2_max = read_pt2_max ();
do_pt2_end = read_do_pt2_end ();

View File

@ -19,7 +19,7 @@ module Determinants : sig
psi_coef : Det_coef.t array;
psi_det : Determinant.t array;
} with sexp
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -311,21 +311,25 @@ end = struct
let read () =
{ n_int = read_n_int () ;
bit_kind = read_bit_kind () ;
mo_label = read_mo_label () ;
n_det = read_n_det () ;
n_states = read_n_states () ;
n_states_diag = read_n_states_diag () ;
n_det_max_jacobi = read_n_det_max_jacobi () ;
threshold_generators = read_threshold_generators () ;
threshold_selectors = read_threshold_selectors () ;
read_wf = read_read_wf () ;
expected_s2 = read_expected_s2 () ;
s2_eig = read_s2_eig () ;
psi_coef = read_psi_coef () ;
psi_det = read_psi_det () ;
}
if (Ezfio.has_mo_basis_mo_tot_num ()) then
Some
{ n_int = read_n_int () ;
bit_kind = read_bit_kind () ;
mo_label = read_mo_label () ;
n_det = read_n_det () ;
n_states = read_n_states () ;
n_states_diag = read_n_states_diag () ;
n_det_max_jacobi = read_n_det_max_jacobi () ;
threshold_generators = read_threshold_generators () ;
threshold_selectors = read_threshold_selectors () ;
read_wf = read_read_wf () ;
expected_s2 = read_expected_s2 () ;
s2_eig = read_s2_eig () ;
psi_coef = read_psi_coef () ;
psi_det = read_psi_det () ;
}
else
None
;;
let write { n_int ;

View File

@ -8,7 +8,7 @@ module Electrons : sig
elec_beta_num : Elec_beta_number.t;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val read_elec_num : unit -> Elec_number.t
val to_string : t -> string
@ -53,9 +53,13 @@ end = struct
let read () =
{ elec_alpha_num = read_elec_alpha_num ();
elec_beta_num = read_elec_beta_num ();
}
if (Ezfio.has_electrons_elec_alpha_num ()) then
Some
{ elec_alpha_num = read_elec_alpha_num ();
elec_beta_num = read_elec_beta_num ();
}
else
None
;;
let write { elec_alpha_num ; elec_beta_num } =

View File

@ -9,7 +9,7 @@ module Full_ci : sig
do_pt2_end : bool;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t-> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -69,9 +69,10 @@ end = struct
let read () =
{ n_det_max_fci = read_n_det_max_fci ();
pt2_max = read_pt2_max ();
do_pt2_end = read_do_pt2_end ();
Some
{ n_det_max_fci = read_n_det_max_fci ();
pt2_max = read_pt2_max ();
do_pt2_end = read_do_pt2_end ();
}
;;

View File

@ -8,7 +8,7 @@ module Hartree_fock : sig
thresh_scf : Threshold.t;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -54,6 +54,7 @@ end = struct
let read () =
Some
{ n_it_scf_max = read_n_it_scf_max ();
thresh_scf = read_thresh_scf ();
}

View File

@ -8,9 +8,10 @@ module Mo_basis : sig
mo_label : MO_label.t;
mo_occ : MO_occ.t array;
mo_coef : (MO_coef.t array) array;
ao_md5 : MD5.t;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val to_string : t -> string
val to_rst : t -> Rst_string.t
end = struct
@ -19,6 +20,7 @@ end = struct
mo_label : MO_label.t;
mo_occ : MO_occ.t array;
mo_coef : (MO_coef.t array) array;
ao_md5 : MD5.t;
} with sexp
;;
@ -32,6 +34,26 @@ end = struct
|> MO_label.of_string
;;
let read_ao_md5 () =
let ao_md5 =
match (Input_ao_basis.Ao_basis.read ()) with
| None -> failwith "Unable to read AO basis"
| Some result -> Input_ao_basis.Ao_basis.to_md5 result
in
let result =
if not (Ezfio.has_mo_basis_ao_md5 ()) then
begin
MD5.to_string ao_md5
|> Ezfio.set_mo_basis_ao_md5
end;
Ezfio.get_mo_basis_ao_md5 ()
|> MD5.of_string
in
if (ao_md5 <> result) then
failwith "The current MOs don't correspond to the current AOs.";
result
;;
let read_mo_tot_num () =
Ezfio.get_mo_basis_mo_tot_num ()
|> MO_number.of_int
@ -68,11 +90,16 @@ end = struct
;;
let read () =
{ mo_tot_num = read_mo_tot_num ();
mo_label = read_mo_label () ;
mo_occ = read_mo_occ ();
mo_coef = read_mo_coef ();
}
if (Ezfio.has_mo_basis_mo_tot_num ()) then
Some
{ mo_tot_num = read_mo_tot_num ();
mo_label = read_mo_label () ;
mo_occ = read_mo_occ ();
mo_coef = read_mo_coef ();
ao_md5 = read_ao_md5 ();
}
else
None
;;
let mo_coef_to_string mo_coef =

View File

@ -10,7 +10,7 @@ module Nuclei : sig
nucl_coord : Point3d.t array;
} with sexp
;;
val read : unit -> t
val read : unit -> t option
val write : t -> unit
val to_string : t -> string
val to_rst : t -> Rst_string.t
@ -111,11 +111,15 @@ end = struct
let read () =
{ nucl_num = read_nucl_num ();
nucl_label = read_nucl_label () ;
nucl_charge = read_nucl_charge ();
nucl_coord = read_nucl_coord ();
}
if (Ezfio.has_nuclei_nucl_num ()) then
Some
{ nucl_num = read_nucl_num ();
nucl_label = read_nucl_label () ;
nucl_charge = read_nucl_charge ();
nucl_coord = read_nucl_coord ();
}
else
None
;;
let write { nucl_num ;

View File

@ -20,13 +20,13 @@ let to_string = function
;;
let of_string s =
match String.lowercase s with
match String.lowercase (String.strip s) with
| "guess" -> Guess
| "canonical" -> Canonical
| "natural" -> Natural
| "localized" -> Localized
| "orthonormalized" -> Orthonormalized
| "none" -> None
| _ -> failwith "MO_label should be one of:
Guess | Orthonormalized | Canonical | Natural | Localized | None."
| _ -> (print_endline s ; failwith "MO_label should be one of:
Guess | Orthonormalized | Canonical | Natural | Localized | None.")
;;

View File

@ -1,5 +1,7 @@
# Check if QPACKAGE_ROOT is defined
.NOPARALLEL:
ifndef QPACKAGE_ROOT
$(info -------------------- Error --------------------)
$(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script)

72
ocaml/qp_basis_clean.ml Normal file
View File

@ -0,0 +1,72 @@
open Core.Std
let filenames =
let dir_name = Qpackage.root^"/data/basis/"
in
Sys.readdir dir_name
|> Array.map ~f:(fun x -> dir_name^x)
|> Array.to_list
;;
let clean_file filename =
let command =
Printf.sprintf "cp -f %s %s.old" filename filename
in
let () =
match Sys.command command with
| 0 -> ()
| i -> failwith (Printf.sprintf "Command %s exited with code %d\n" command i)
in
let lines =
In_channel.with_file filename ~f:In_channel.input_lines
in
Out_channel.with_file filename ~f:(fun out_channel ->
let rec loop ~do_s = function
| [] -> ()
| line :: tail ->
begin
let buffer = String.strip line
|> String.split ~on:' '
|> List.filter ~f:(fun x -> x <> "")
in
let () =
match buffer with
| [] -> Printf.fprintf out_channel "\n"
| [ atom ] -> Printf.fprintf out_channel "%s\n" atom
| [ i ; expo ; coef ] ->
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef
| [ i ; expo ; coef ; coef2 ] ->
if (do_s) then
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef
else
Printf.fprintf out_channel "%3s %14s %14s\n" i expo coef2
| [ sym ; n ] ->
if (sym = "L") then
let () =
Printf.fprintf out_channel "S %3s\n" n
in
let rec build_newlist accu = function
| (0, _)
| (_,[]) -> List.rev ((Printf.sprintf "P %3s\n" n)::accu)
| (i,head::tail) ->
build_newlist (head::accu) ( i-1, tail )
in
let newlist = build_newlist [] ((Int.of_string n),tail)
in
loop ~do_s:true newlist
else
Printf.fprintf out_channel "%s %3s\n" sym n
| _ -> ()
in
loop ~do_s:do_s tail
end
in loop ~do_s:false lines
)
;;
List.iter ~f:clean_file filenames
;;

View File

@ -148,7 +148,7 @@ let run ?o b c m xyz_file =
let alt_channel = basis_channel x.Atom.element in
Basis.read_element alt_channel i x.Atom.element
end
| _ -> assert false
| x -> raise x
)
|> List.concat
in
@ -214,6 +214,12 @@ let run ?o b c m xyz_file =
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_coef) ;
Ezfio.set_ao_basis_ao_expo(Ezfio.ezfio_array_of_list
~rank:2 ~dim:[| ao_num ; ao_prim_num_max |] ~data:ao_expo) ;
match Input.Ao_basis.read () with
| None -> failwith "Error in basis"
| Some x -> Input.Ao_basis.write x
;;
let command =

View File

@ -43,73 +43,93 @@ let make_header kw =
;;
let get s =
let header = (make_header s)
and rst = let open Input in
match s with
| Full_ci ->
Full_ci.(to_rst (read ()))
| Hartree_fock ->
Hartree_fock.(to_rst (read ()))
| Mo_basis ->
Mo_basis.(to_rst (read ()))
| Electrons ->
Electrons.(to_rst (read ()))
| Determinants ->
Determinants.(to_rst (read ()))
| Cisd_sc2 ->
Cisd_sc2.(to_rst (read ()))
| Nuclei ->
Nuclei.(to_rst (read ()))
| Ao_basis ->
Ao_basis.(to_rst (read ()))
| Bielec_integrals ->
Bielec_integrals.(to_rst (read ()))
in header^(Rst_string.to_string rst)
let header = (make_header s) in
let f (read,to_rst) =
match read () with
| Some text -> header ^ (Rst_string.to_string (to_rst text))
| None -> ""
in
let rst =
try
begin
let open Input in
match s with
| Full_ci ->
f Full_ci.(read, to_rst)
| Hartree_fock ->
f Hartree_fock.(read, to_rst)
| Mo_basis ->
f Mo_basis.(read, to_rst)
| Electrons ->
f Electrons.(read, to_rst)
| Cisd_sc2 ->
f Cisd_sc2.(read, to_rst)
| Nuclei ->
f Nuclei.(read, to_rst)
| Ao_basis ->
f Ao_basis.(read, to_rst)
| Bielec_integrals ->
f Bielec_integrals.(read, to_rst)
| Determinants ->
f Determinants.(read, to_rst)
end
with
| Sys_error msg -> (Printf.eprintf "Info: %s\n%!" msg ; "")
in
rst
;;
let set str s =
let header = (make_header s) in
let index_begin = String.substr_index_exn ~pos:0 ~pattern:header str in
let index_begin = index_begin + (String.length header) in
let index_end =
match ( String.substr_index ~pos:(index_begin+(String.length header)+1)
~pattern:"==" str) with
| Some i -> i
| None -> String.length str
in
let l = index_end - index_begin in
let str = String.sub ~pos:index_begin ~len:l str
|> Rst_string.of_string
in
let write (of_rst,w) =
match of_rst str with
| Some data -> w data
| None -> ()
in
let open Input in
match s with
| Hartree_fock -> write Hartree_fock.(of_rst, write)
| Full_ci -> write Full_ci.(of_rst, write)
| Electrons -> write Electrons.(of_rst, write)
| Cisd_sc2 -> write Cisd_sc2.(of_rst, write)
| Bielec_integrals -> write Bielec_integrals.(of_rst, write)
| Determinants -> write Determinants.(of_rst, write)
| Nuclei -> write Nuclei.(of_rst, write)
| Ao_basis -> () (* TODO *)
| Mo_basis -> () (* TODO *)
match String.substr_index ~pos:0 ~pattern:header str with
| None -> ()
| Some idx ->
begin
let index_begin = idx + (String.length header) in
let index_end =
match ( String.substr_index ~pos:(index_begin+(String.length header)+1)
~pattern:"==" str) with
| Some i -> i
| None -> String.length str
in
let l = index_end - index_begin in
let str = String.sub ~pos:index_begin ~len:l str
|> Rst_string.of_string
in
let write (of_rst,w) s =
try
match of_rst str with
| Some data -> w data
| None -> ()
with
| _ -> (Printf.eprintf "Info: Read error in %s\n%!"
(keyword_to_string s))
in
let open Input in
match s with
| Hartree_fock -> write Hartree_fock.(of_rst, write) s
| Full_ci -> write Full_ci.(of_rst, write) s
| Electrons -> write Electrons.(of_rst, write) s
| Cisd_sc2 -> write Cisd_sc2.(of_rst, write) s
| Bielec_integrals -> write Bielec_integrals.(of_rst, write) s
| Determinants -> write Determinants.(of_rst, write) s
| Nuclei -> write Nuclei.(of_rst, write) s
| Ao_basis -> () (* TODO *)
| Mo_basis -> () (* TODO *)
end
;;
let create_temp_file ezfio_filename fields =
let temp_filename = Filename.temp_file "qp_edit_" ".rst" in
Out_channel.with_file temp_filename ~f:(fun out_channel ->
(file_header ezfio_filename) :: (List.map ~f:get fields)
|> String.concat ~sep:"\n"
|> Out_channel.output_string out_channel
);
temp_filename
begin
Out_channel.with_file temp_filename ~f:(fun out_channel ->
(file_header ezfio_filename) :: (List.map ~f:get fields)
|> String.concat ~sep:"\n"
|> Out_channel.output_string out_channel
)
end
; temp_filename
;;
let run ezfio_filename =
@ -133,11 +153,13 @@ let run ezfio_filename =
let tasks = [
Nuclei ;
Ao_basis;
Electrons ;
Bielec_integrals ;
Hartree_fock ;
Cisd_sc2 ;
Full_ci ;
Mo_basis;
Determinants ;
]
in

View File

@ -51,7 +51,10 @@ let run_i ~action ezfio_filename =
let compute_charge () =
let input = Input.Electrons.read () in
let input = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
in
let nucl_charge = Ezfio.get_nuclei_nucl_charge ()
|> Ezfio.flattened_ezfio |> Array.map ~f:(Float.to_int)
and n_alpha = input.Input.Electrons.elec_alpha_num
@ -63,7 +66,10 @@ let run_i ~action ezfio_filename =
in
let compute_multiplicity () =
let input = Input.Electrons.read () in
let input = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
in
let n_alpha = input.Input.Electrons.elec_alpha_num
and n_beta = input.Input.Electrons.elec_beta_num
in Multiplicity.of_alpha_beta n_alpha n_beta

View File

@ -97,9 +97,14 @@ let input_data = "
* MD5 : string
assert ((String.length x) = 32);
assert (String.fold x ~init:true ~f:(fun accu x ->
accu && (x < 'g')));
* Rst_string : string
* AO_basis_name : string
assert (x <> \"\") ;
"
;;

View File

@ -2,7 +2,9 @@ open Qptypes;;
let test_ao () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Ao_basis.read ()
let b = match Input.Ao_basis.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Ao_basis.to_string b);
print_endline (Input.Ao_basis.to_rst b |> Rst_string.to_string);
@ -10,7 +12,9 @@ let test_ao () =
let test_bielec_intergals () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Bielec_integrals.read ()
let b = match Input.Bielec_integrals.read () with
| Some x -> x
| None -> assert false
in
let output = Input.Bielec_integrals.to_string b
in
@ -28,21 +32,27 @@ let test_bielec_intergals () =
let test_bitmasks () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Bitmasks.read ()
let b = match Input.Bitmasks.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Bitmasks.to_string b);
;;
let test_cis () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Cis_dressed.read ()
let b = match Input.Cis_dressed.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Cis_dressed.to_string b);
;;
let test_dets () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Determinants.read ()
let b = match Input.Determinants.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Determinants.to_rst b |> Rst_string.to_string ) ;
print_endline (Input.Determinants.sexp_of_t b |> Sexplib.Sexp.to_string ) ;
@ -59,7 +69,9 @@ let test_dets () =
let test_cisd_sc2 () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Cisd_sc2.read ()
let b = match Input.Cisd_sc2.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Cisd_sc2.to_string b);
let rst = Input.Cisd_sc2.to_rst b in
@ -76,7 +88,9 @@ let test_cisd_sc2 () =
let test_electrons () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Electrons.read ()
let b = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Electrons.to_string b);
let rst = Input.Electrons.to_rst b in
@ -92,7 +106,9 @@ let test_electrons () =
let test_fci () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Full_ci.read ()
let b = match Input.Full_ci.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Full_ci.to_string b);
let rst = Input.Full_ci.to_rst b in
@ -109,7 +125,9 @@ let test_fci () =
let test_hf () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Hartree_fock.read ()
let b = match Input.Hartree_fock.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Hartree_fock.to_string b);
let rst = Input.Hartree_fock.to_rst b in
@ -126,14 +144,19 @@ let test_hf () =
let test_mo () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Mo_basis.read ()
let b = match Input.Mo_basis.read () with
| Some x -> x
| None -> assert false
in
print_endline (Input.Mo_basis.to_string b);
;;
let test_nucl () =
Ezfio.set_file "F2.ezfio" ;
let b = Input.Nuclei.read () in
let b = match Input.Nuclei.read () with
| Some x -> x
| None -> assert false
in
let rst = Input.Nuclei.to_rst b in
let b2 = match Input.Nuclei.of_rst rst with
| Some x -> x

View File

@ -7,5 +7,6 @@ ao_basis
ao_prim_num_max integer = maxval(ao_basis_ao_prim_num)
ao_coef double precision (ao_basis_ao_num,ao_basis_ao_prim_num_max)
ao_expo double precision (ao_basis_ao_num,ao_basis_ao_prim_num_max)
ao_md5 character*(32)

View File

@ -397,3 +397,12 @@ END_PROVIDER
ao_l_char_space(i) = give_ao_character_space
enddo
END_PROVIDER
BEGIN_PROVIDER [ character*(32), ao_md5 ]
BEGIN_DOC
! MD5 key characteristic of the AO basis
END_DOC
implicit none
PROVIDE ezfio_filename
call ezfio_get_ao_basis_ao_md5(ao_md5)
END_PROVIDER

View File

@ -306,7 +306,7 @@ BEGIN_PROVIDER [ double precision, psi_coef, (psi_det_size,N_states_diag) ]
END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_average_norm_contrib, (N_det) ]
BEGIN_PROVIDER [ double precision, psi_average_norm_contrib, (psi_det_size) ]
implicit none
BEGIN_DOC
! Contribution of determinants to the state-averaged density
@ -325,9 +325,143 @@ BEGIN_PROVIDER [ double precision, psi_average_norm_contrib, (N_det) ]
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted, (N_int,2,N_det) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted, (N_det,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_average_norm_contrib_sorted, (N_det) ]
!==============================================================================!
! !
! Independent alpha/beta parts !
! !
!==============================================================================!
integer*8 function spin_det_search_key(det,Nint)
use bitmasks
implicit none
BEGIN_DOC
! Return an integer*8 corresponding to a determinant index for searching
END_DOC
integer, intent(in) :: Nint
integer(bit_kind), intent(in) :: det(Nint)
integer :: i
spin_det_search_key = det(1)
do i=2,Nint
spin_det_search_key = ieor(spin_det_search_key,det(i))
enddo
end
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of alpha determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_alpha(k,i) = psi_det(k,1,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta, (N_int,psi_det_size) ]
implicit none
BEGIN_DOC
! List of beta determinants of psi_det
END_DOC
integer :: i,k
do i=1,N_det
do k=1,N_int
psi_det_beta(k,i) = psi_det(k,2,i)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_alpha_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_alpha_unique ]
implicit none
BEGIN_DOC
! Unique alpha determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_alpha(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_alpha_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_alpha_unique += 1
do k=1,N_int
psi_det_alpha_unique(k,N_det_alpha_unique) = psi_det_alpha(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_beta_unique, (N_int,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_det_beta_unique ]
implicit none
BEGIN_DOC
! Unique beta determinants
END_DOC
integer :: i,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8 :: last_key
integer*8, external :: spin_det_search_key
allocate ( iorder(N_det), bit_tmp(N_det))
do i=1,N_det
iorder(i) = i
bit_tmp(i) = spin_det_search_key(psi_det_beta(1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
N_det_beta_unique = 0
last_key = 0_8
do i=1,N_det
if (bit_tmp(i) /= last_key) then
last_key = bit_tmp(i)
N_det_beta_unique += 1
do k=1,N_int
psi_det_beta_unique(k,N_det_beta_unique) = psi_det_beta(k,iorder(i))
enddo
endif
enddo
deallocate (iorder, bit_tmp)
END_PROVIDER
!==============================================================================!
! !
! Sorting providers !
! !
!==============================================================================!
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted, (psi_det_size,N_states) ]
&BEGIN_PROVIDER [ double precision, psi_average_norm_contrib_sorted, (psi_det_size) ]
implicit none
BEGIN_DOC
! Wave function sorted by determinants contribution to the norm (state-averaged)
@ -356,13 +490,14 @@ END_PROVIDER
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,N_det) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (N_det,N_states) ]
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_bit, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_bit, (psi_det_size,N_states) ]
implicit none
BEGIN_DOC
! Determinants on which we apply <i|H|psi> for perturbation.
!o They are sorted by determinants interpreted as integers. Useful
! to accelerate the search of a determinant
! They are sorted by determinants interpreted as integers. Useful
! to accelerate the search of a random determinant in the wave
! function.
END_DOC
integer :: i,j,k
integer, allocatable :: iorder(:)
@ -393,6 +528,245 @@ END_PROVIDER
END_PROVIDER
subroutine int_of_3_highest_electrons( det_in, res, Nint )
implicit none
use bitmasks
integer,intent(in) :: Nint
integer(bit_kind) :: det_in(Nint)
integer*8 :: res
BEGIN_DOC
! Returns an integer*8 as :
!
! |_<--- 21 bits ---><--- 21 bits ---><--- 21 bits --->|
!
! |0<--- i1 ---><--- i2 ---><--- i3 --->|
!
! It encodes the value of the indices of the 3 highest MOs
! in descending order
!
END_DOC
integer :: i, k, icount
integer(bit_kind) :: ix
res = 0_8
icount = 3
do k=Nint,1,-1
ix = det_in(k)
do while (ix /= 0_bit_kind)
i = bit_kind_size-1-leadz(ix)
ix = ibclr(ix,i)
res = ior(ishft(res, 21), i+ishft(k-1,bit_kind_shift))
icount -= 1
if (icount == 0) then
return
endif
enddo
enddo
end
subroutine filter_3_highest_electrons( det_in, det_out, Nint )
implicit none
use bitmasks
integer,intent(in) :: Nint
integer(bit_kind) :: det_in(Nint), det_out(Nint)
BEGIN_DOC
! Returns a determinant with only the 3 highest electrons
END_DOC
integer :: i, k, icount
integer(bit_kind) :: ix
det_out = 0_8
icount = 3
do k=Nint,1,-1
ix = det_in(k)
do while (ix /= 0_bit_kind)
i = bit_kind_size-1-leadz(ix)
ix = ibclr(ix,i)
det_out(k) = ibset(det_out(k),i)
icount -= 1
if (icount == 0) then
return
endif
enddo
enddo
end
BEGIN_PROVIDER [ integer(bit_kind), psi_det_sorted_ab, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ double precision, psi_coef_sorted_ab, (N_det,N_states) ]
&BEGIN_PROVIDER [ integer, psi_det_sorted_next_ab, (2,psi_det_size) ]
implicit none
BEGIN_DOC
! Determinants on which we apply <i|H|j>.
! They are sorted by the 3 highest electrons in the alpha part,
! then by the 3 highest electrons in the beta part to accelerate
! the research of connected determinants.
END_DOC
call sort_dets_by_3_highest_electrons( &
psi_det, &
psi_coef, &
psi_det_sorted_ab, &
psi_coef_sorted_ab, &
psi_det_sorted_next_ab, &
N_det, N_states, N_int, &
psi_det_size )
END_PROVIDER
subroutine sort_dets_by_3_highest_electrons(det_in,coef_in,det_out,coef_out, &
det_next, Ndet, Nstates, Nint, LDA)
implicit none
integer, intent(in) :: Ndet, Nstates, Nint, LDA
integer(bit_kind), intent(in) :: det_in (Nint,2,Ndet)
integer(bit_kind), intent(out) :: det_out (Nint,2,Ndet)
integer, intent(out) :: det_next (2,Ndet)
double precision, intent(in) :: coef_in (LDA,Nstates)
double precision, intent(out) :: coef_out (LDA,Nstates)
BEGIN_DOC
! Determinants on which we apply <i|H|j>.
! They are sorted by the 3 highest electrons in the alpha part,
! then by the 3 highest electrons in the beta part to accelerate
! the research of connected determinants.
END_DOC
integer :: i,j,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8, external :: det_search_key
allocate ( iorder(Ndet), bit_tmp(Ndet) )
! Sort alpha dets
! ---------------
integer(bit_kind) :: det_tmp(Nint)
do i=1,Ndet
iorder(i) = i
call int_of_3_highest_electrons(psi_det(1,1,i),bit_tmp(i),N_int)
enddo
call i8sort(bit_tmp,iorder,Ndet)
!DIR$ IVDEP
do i=1,Ndet
do j=1,N_int
det_out(j,1,i) = psi_det(j,1,iorder(i))
det_out(j,2,i) = psi_det(j,2,iorder(i))
enddo
do k=1,Nstates
coef_out(i,k) = psi_coef(iorder(i),k)
enddo
enddo
! Find next alpha
! ---------------
integer :: next
next = Ndet+1
det_next(1,Ndet) = next
do i=Ndet-1,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1
endif
det_next(1,i) = next
enddo
! Sort beta dets
! --------------
integer :: istart, iend
integer(bit_kind), allocatable :: det_sorted_temp (:,:)
allocate ( det_sorted_temp (N_int,Ndet) )
do i=1,Ndet
do j=1,N_int
det_sorted_temp(j,i) = det_out(j,2,i)
enddo
iorder(i) = i
call int_of_3_highest_electrons(det_sorted_temp(1,i),bit_tmp(i),N_int)
enddo
istart=1
do while ( istart<Ndet )
iend = det_next(1,istart)
call i8sort(bit_tmp(istart),iorder(istart),iend-istart)
!DIR$ IVDEP
do i=istart,iend-1
do j=1,N_int
det_out(j,2,i) = det_sorted_temp(j,iorder(i))
enddo
do k=1,Nstates
coef_out(i,k) = psi_coef(iorder(i),k)
enddo
enddo
next = iend
det_next(2,iend-1) = next
do i=iend-2,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1
endif
det_next(2,i) = next
enddo
istart = iend
enddo
deallocate(iorder, bit_tmp, det_sorted_temp)
end
!==============================================================================!
! !
! Read/write routines !
! !
!==============================================================================!
subroutine read_dets(det,Nint,Ndet)
use bitmasks
implicit none
BEGIN_DOC
! Reads the determinants from the EZFIO file
END_DOC
integer, intent(in) :: Nint,Ndet
integer(bit_kind), intent(out) :: det(Nint,2,Ndet)
integer*8, allocatable :: psi_det_read(:,:,:)
double precision, allocatable :: psi_coef_read(:,:)
integer*8 :: det_8(100)
integer(bit_kind) :: det_bk((100*8)/bit_kind)
integer :: N_int2
integer :: i,k
equivalence (det_8, det_bk)
call ezfio_get_determinants_N_int(N_int2)
ASSERT (N_int2 == Nint)
call ezfio_get_determinants_bit_kind(k)
ASSERT (k == bit_kind)
N_int2 = (Nint*bit_kind)/8
allocate (psi_det_read(N_int2,2,Ndet))
call ezfio_get_determinants_psi_det (psi_det_read)
! print*,'N_int2 = ',N_int2,N_int
! print*,'k',k,bit_kind
! print*,'psi_det_read = ',Ndet
do i=1,Ndet
do k=1,N_int2
det_8(k) = psi_det_read(k,1,i)
enddo
do k=1,Nint
det(k,1,i) = det_bk(k)
enddo
do k=1,N_int2
det_8(k) = psi_det_read(k,2,i)
enddo
do k=1,Nint
det(k,2,i) = det_bk(k)
enddo
enddo
deallocate(psi_det_read)
end
subroutine save_wavefunction
implicit none
use bitmasks
@ -475,3 +849,6 @@ subroutine save_wavefunction_general(ndet,nstates,psidet,psicoef)
call stop_progress
deallocate (psi_coef_save)
end

View File

@ -98,19 +98,79 @@ subroutine filter_connected(key1,key2,Nint,sze,idx)
end
subroutine filter_connected_sorted_ab(key1,key2,next,Nint,sze,idx)
use bitmasks
implicit none
BEGIN_DOC
! Filters out the determinants that are not connected by H
! returns the array idx which contains the index of the
! determinants in the array key1 that interact
! via the H operator with key2.
! idx(0) is the number of determinants that interact with key1
!
! Determinants are taken from the psi_det_sorted_ab array
END_DOC
integer, intent(in) :: Nint, sze
integer, intent(in) :: next(2,N_det)
integer(bit_kind), intent(in) :: key1(Nint,2,sze)
integer(bit_kind), intent(in) :: key2(Nint,2)
integer, intent(out) :: idx(0:sze)
integer :: i,j,l
integer :: degree_x2
integer(bit_kind) :: det3_1(Nint,2), det3_2(Nint,2)
ASSERT (Nint > 0)
ASSERT (sze >= 0)
l=1
call filter_3_highest_electrons( key2(1,1), det3_2(1,1), Nint)
if (Nint==1) then
i = 1
do while ( i<= sze )
call filter_3_highest_electrons( key1(1,1,i), det3_1(1,1), Nint)
degree_x2 = popcnt( xor( det3_1(1,1), det3_2(1,1)))
if (degree_x2 > 4) then
i = next(1,i)
cycle
else
degree_x2 = popcnt( xor( key1(1,1,i), key2(1,1)) )
if (degree_x2 <= 4) then
degree_x2 += popcnt( xor( key1(1,2,i), key2(1,2)) )
if (degree_x2 <= 4) then
idx(l) = i
l += 1
endif
endif
i += 1
endif
enddo
else
print *, 'Not implemented', irp_here
stop 1
endif
idx(0) = l-1
end
subroutine filter_connected_davidson(key1,key2,Nint,sze,idx)
use bitmasks
implicit none
BEGIN_DOC
! Filters out the determinants that are not connected by H
!
! returns the array idx which contains the index of the
!
! determinants in the array key1 that interact
!
! via the H operator with key2.
!
! idx(0) is the number of determinants that interact with key1
! key1 should come from psi_det_sorted_ab.
END_DOC
integer, intent(in) :: Nint, sze
integer(bit_kind), intent(in) :: key1(Nint,2,sze)

View File

@ -1,3 +1,4 @@
use bitmasks
subroutine det_to_occ_pattern(d,o,Nint)
use bitmasks
implicit none
@ -138,3 +139,112 @@ recursive subroutine rec_occ_pattern_to_dets(list_todo,nt,list_a,na,d,nd,sze,am
end
BEGIN_PROVIDER [ integer(bit_kind), psi_occ_pattern, (N_int,2,psi_det_size) ]
&BEGIN_PROVIDER [ integer, N_occ_pattern ]
implicit none
BEGIN_DOC
! array of the occ_pattern present in the wf
! psi_occ_pattern(:,1,j) = jth occ_pattern of the wave function : represent all the single occupation
! psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation
END_DOC
integer :: i,j,k
! create
do i = 1, N_det
do k = 1, N_int
psi_occ_pattern(k,1,i) = ieor(psi_det(k,1,i),psi_det(k,2,i))
psi_occ_pattern(k,2,i) = iand(psi_det(k,1,i),psi_det(k,2,i))
enddo
enddo
! Sort
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8, external :: occ_pattern_search_key
integer(bit_kind), allocatable :: tmp_array(:,:,:)
logical,allocatable :: duplicate(:)
allocate ( iorder(N_det), duplicate(N_det), bit_tmp(N_det), tmp_array(N_int,2,psi_det_size) )
do i=1,N_det
iorder(i) = i
!$DIR FORCEINLINE
bit_tmp(i) = occ_pattern_search_key(psi_occ_pattern(1,1,i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det)
!DIR$ IVDEP
do i=1,N_det
do k=1,N_int
tmp_array(k,1,i) = psi_occ_pattern(k,1,iorder(i))
tmp_array(k,2,i) = psi_occ_pattern(k,2,iorder(i))
enddo
duplicate(i) = .False.
enddo
i=1
integer (bit_kind) :: occ_pattern_tmp
do i=1,N_det
duplicate(i) = .False.
enddo
do i=1,N_det-1
if (duplicate(i)) then
cycle
endif
j = i+1
do while (bit_tmp(j)==bit_tmp(i))
if (duplicate(j)) then
j+=1
cycle
endif
duplicate(j) = .True.
do k=1,N_int
if ( (tmp_array(k,1,i) /= tmp_array(k,1,j)) &
.or. (tmp_array(k,2,i) /= tmp_array(k,2,j)) ) then
duplicate(j) = .False.
exit
endif
enddo
j+=1
if (j>N_det) then
exit
endif
enddo
enddo
N_occ_pattern=0
do i=1,N_det
if (duplicate(i)) then
cycle
endif
N_occ_pattern += 1
do k=1,N_int
psi_occ_pattern(k,1,N_occ_pattern) = tmp_array(k,1,i)
psi_occ_pattern(k,2,N_occ_pattern) = tmp_array(k,2,i)
enddo
enddo
deallocate(iorder,duplicate,bit_tmp,tmp_array)
! !TODO DEBUG
! integer :: s
! do i=1,N_occ_pattern
! do j=i+1,N_occ_pattern
! s = 0
! do k=1,N_int
! if((psi_occ_pattern(k,1,j) /= psi_occ_pattern(k,1,i)).or. &
! (psi_occ_pattern(k,2,j) /= psi_occ_pattern(k,2,i))) then
! s=1
! exit
! endif
! enddo
! if ( s == 0 ) then
! print *, 'Error : occ ', j, 'already in wf'
! call debug_det(psi_occ_pattern(1,1,j),N_int)
! stop
! endif
! enddo
! enddo
! !TODO DEBUG
END_PROVIDER

View File

@ -1 +1,2 @@
AOs BiInts Bitmask Dets Electrons Ezfio_files Generators_full Hartree_Fock MonoInts MOs Nuclei Output Selectors_full Utils Perturbation
AOs BiInts Bitmask Dets Electrons Ezfio_files Generators_full Hartree_Fock MOGuess MonoInts MOs Nuclei Output Perturbation Selectors_full Utils

View File

@ -1,4 +1,6 @@
full_ci
n_det_max_fci integer
pt2_max double precision
do_pt2_end logical
n_det_max_fci integer
pt2_max double precision
do_pt2_end logical
energy double precision
energy_pt2 double precision

View File

@ -49,6 +49,7 @@ program full_ci
print *, 'E = ', CI_energy
print *, 'E+PT2 = ', CI_energy+pt2
print *, '-----'
call ezfio_set_full_ci_energy(CI_energy)
if (abort_all) then
exit
endif
@ -70,6 +71,7 @@ program full_ci
print *, 'E = ', CI_energy
print *, 'E+PT2 = ', CI_energy+pt2
print *, '-----'
call ezfio_set_full_ci_energy_pt2(CI_energy+pt2)
endif
deallocate(pt2,norm_pert)
end

View File

@ -1 +1 @@
AOs BiInts Bitmask Electrons Ezfio_files MonoInts MOs Nuclei Output Utils
AOs BiInts Bitmask Electrons Ezfio_files MonoInts MOGuess MOs Nuclei Output Utils

View File

@ -1,19 +1,40 @@
program scf
call create_guess
call orthonormalize_mos
call run
end
subroutine create_guess
implicit none
BEGIN_DOC
! Create an H_core guess if no MOs are present in the EZFIO directory
END_DOC
logical :: exists
PROVIDE ezfio_filename
call ezfio_has_mo_basis_mo_coef(exists)
if (.not.exists) then
mo_coef = ao_ortho_lowdin_coef
mo_label = 'Guess'
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral,size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),mo_label)
SOFT_TOUCH mo_coef mo_label
endif
end
subroutine run
use bitmasks
implicit none
BEGIN_DOC
! Run SCF calculation
END_DOC
double precision :: SCF_energy_before,SCF_energy_after,diag_H_mat_elem,get_mo_bielec_integral
double precision :: E0
integer :: i_it, i, j, k
E0 = HF_energy
thresh_SCF = 1.d-10
call damping_SCF
mo_label = "Canonical"

View File

@ -119,5 +119,7 @@ subroutine damping_SCF
call write_double(output_hartree_fock, HF_energy, 'Hartree-Fock energy')
call write_time(output_hartree_fock)
call ezfio_set_hartree_fock_energy(HF_energy)
deallocate(D_alpha,D_beta,F_new,D_new_alpha,D_new_beta,delta_alpha,delta_beta)
end

View File

@ -26,23 +26,33 @@
lwork = -1
liwork = -1
call dsygvd(1,'v','u',ao_num,F,size(F,1),S,size(S,1),&
diagonal_Fock_matrix_mo, work, lwork, iwork, liwork, info)
! call dsygv(1, 'v', 'u',ao_num,F,size(F,1),S,size(S,1),&
! diagonal_Fock_matrix_mo, work, lwork, info)
if (info /= 0) then
print *, irp_here//' failed'
print *, irp_here//' failed : ', info
stop 1
endif
lwork = int(work(1))
liwork = iwork(1)
deallocate(work,iwork)
allocate(work(lwork), iwork(liwork) )
! deallocate(work)
! allocate(work(lwork))
call dsygvd(1,'v','u',ao_num,F,size(F,1),S,size(S,1),&
diagonal_Fock_matrix_mo, work, lwork, iwork, liwork, info)
! call dsygv(1, 'v', 'u',ao_num,F,size(F,1),S,size(S,1),&
! diagonal_Fock_matrix_mo, work, lwork, info)
if (info /= 0) then
print *, irp_here//' failed'
print *, irp_here//' failed : ', info
stop 1
endif
do j=1,mo_tot_num

View File

@ -1,4 +1,5 @@
hartree_fock
thresh_scf double precision
n_it_scf_max integer
energy double precision

View File

@ -5,7 +5,7 @@ program H_CORE_guess
TOUCH mo_coef
label = "Guess"
call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral,size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label)
print *, 'save mos'
call save_mos
end

View File

@ -3,4 +3,5 @@ mo_basis
mo_coef double precision (ao_basis_ao_num,mo_basis_mo_tot_num)
mo_label character*(64)
mo_occ double precision (mo_basis_mo_tot_num)
ao_md5 character*(32)

View File

@ -39,14 +39,7 @@ END_PROVIDER
logical :: exists
PROVIDE ezfio_filename
!Label
call ezfio_has_mo_basis_mo_label(exists)
if (exists) then
call ezfio_get_mo_basis_mo_label(mo_label)
else
mo_label = 'no_label'
endif
! Coefs
call ezfio_has_mo_basis_mo_coef(exists)
if (exists) then
@ -62,8 +55,15 @@ END_PROVIDER
enddo
enddo
deallocate(buffer)
call ezfio_has_mo_basis_mo_label(exists)
if (exists) then
call ezfio_get_mo_basis_mo_label(mo_label)
else
mo_label = 'no_label'
endif
else
mo_coef = 0.d0
! Orthonormalized AO basis
mo_coef = 0.
endif
END_PROVIDER

View File

@ -7,6 +7,7 @@ subroutine save_mos
call ezfio_set_mo_basis_mo_tot_num(mo_tot_num)
call ezfio_set_mo_basis_mo_label(mo_label)
call ezfio_set_mo_basis_ao_md5(ao_md5)
allocate ( buffer(ao_num,mo_tot_num) )
buffer = 0.d0
do j = 1, mo_tot_num

View File

@ -1 +1,2 @@
AOs BiInts Bitmask CASSD DDCI Dets Electrons Ezfio_files Generators_CAS Hartree_Fock MonoInts MOs Nuclei Output Perturbation Selectors_full Utils Good_states Molden Primitive_basis Loc_MOs
AOs BiInts Bitmask CASSD DDCI Dets Electrons Ezfio_files Generators_CAS Hartree_Fock Loc_MOs MOGuess Molden MonoInts MOs Nuclei Output Perturbation Primitive_basis Selectors_full Utils

View File

@ -60,3 +60,101 @@ END_PROVIDER
enddo
END_PROVIDER
BEGIN_PROVIDER [ integer(bit_kind), psi_selectors_ab, (N_int,2,psi_selectors_size) ]
&BEGIN_PROVIDER [ double precision, psi_selectors_coef_ab, (psi_selectors_size,N_states) ]
&BEGIN_PROVIDER [ integer, psi_selectors_next_ab, (2,psi_selectors_size) ]
implicit none
BEGIN_DOC
! Determinants on which we apply <i|H|j>.
! They are sorted by the 3 highest electrons in the alpha part,
! then by the 3 highest electrons in the beta part to accelerate
! the research of connected determinants.
END_DOC
integer :: i,j,k
integer, allocatable :: iorder(:)
integer*8, allocatable :: bit_tmp(:)
integer*8, external :: det_search_key
allocate ( iorder(N_det_selectors), bit_tmp(N_det_selectors) )
! Sort alpha dets
! ---------------
integer(bit_kind) :: det_tmp(N_int)
do i=1,N_det_selectors
iorder(i) = i
call int_of_3_highest_electrons(psi_selectors(1,1,i),bit_tmp(i),N_int)
enddo
call i8sort(bit_tmp,iorder,N_det_selectors)
!DIR$ IVDEP
do i=1,N_det_selectors
do j=1,N_int
psi_selectors_ab(j,1,i) = psi_selectors(j,1,iorder(i))
psi_selectors_ab(j,2,i) = psi_selectors(j,2,iorder(i))
enddo
do k=1,N_states
psi_coef_sorted_ab(i,k) = psi_selectors_coef(iorder(i),k)
enddo
enddo
! Find next alpha
! ---------------
integer :: next
next = N_det_selectors+1
psi_selectors_next_ab(1,N_det_selectors) = next
do i=N_det_selectors-1,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1
endif
psi_selectors_next_ab(1,i) = next
enddo
! Sort beta dets
! --------------
integer :: istart, iend
integer(bit_kind), allocatable :: psi_selectors_ab_temp (:,:)
allocate ( psi_selectors_ab_temp (N_int,N_det_selectors) )
do i=1,N_det_selectors
do j=1,N_int
psi_selectors_ab_temp(j,i) = psi_selectors_ab(j,2,i)
enddo
iorder(i) = i
call int_of_3_highest_electrons(psi_selectors_ab_temp(1,i),bit_tmp(i),N_int)
enddo
istart=1
do while ( istart<N_det_selectors )
iend = psi_selectors_next_ab(1,istart)
call i8sort(bit_tmp(istart),iorder(istart),iend-istart)
!DIR$ IVDEP
do i=istart,iend-1
do j=1,N_int
psi_selectors_ab(j,2,i) = psi_selectors_ab_temp(j,iorder(i))
enddo
do k=1,N_states
psi_coef_sorted_ab(i,k) = psi_coef(iorder(i),k)
enddo
enddo
next = iend
psi_selectors_next_ab(2,iend-1) = next
do i=iend-2,1,-1
if (bit_tmp(i) /= bit_tmp(i+1)) then
next = i+1
endif
psi_selectors_next_ab(2,i) = next
enddo
istart = iend
enddo
deallocate(iorder, bit_tmp, psi_selectors_ab_temp)
END_PROVIDER