Date: Mon, 12 Feb 2024 22:46:25 -0600 Subject: [PATCH 04/15] feat: k point array construction Construction of k point arrays from scalar that may be iterated arbitrarily over some axis. Certain values may be forced (e.g., in 2D materials). Outline of input/output code, no real functionality there yet. --- .../create_k_points.cpython-38.pyc | Bin 0 -> 2311 bytes andrewsalij/Tests/create_k_points.py | 35 ++++++++++++++++ .../convergence_tracker.cpython-38.pyc | Bin 1399 -> 2731 bytes andrewsalij/convergence_tracker.py | 39 ++++++++++++++++++ andrewsalij/io.py | 24 +++++++++++ 5 files changed, 98 insertions(+) create mode 100644 andrewsalij/Tests/__pycache__/create_k_points.cpython-38.pyc create mode 100644 andrewsalij/Tests/create_k_points.py create mode 100644 andrewsalij/io.py diff --git a/andrewsalij/Tests/__pycache__/create_k_points.cpython-38.pyc b/andrewsalij/Tests/__pycache__/create_k_points.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..30832e810ee546c45ec8bde34e05fdf1d28b37a0 GIT binary patch literal 2311 zcma);&u<$=6vtDPA%u6zh1uxS_8~((5{K zPqD+`h;bbIh}HcG`eDsFFRp$2-5|~M<{;Zv&{kQZ9;;j{NT|c?;owaJfB8BZ#X>F_ zhUU_F$wJo#4TbcikN2J|$pBklF3B>sCAlms*aotS!E4238}vRvyt@f1*6AQiIQl&~ zC>U~JoA}E=N26JXQ?LWR&$V;tj?s1mKEbo?YEQZc&XJSf(f$jZ7zPo|2|2_Smb+1k z3ySpsjyX *i;bg;N*<42I*(mN6o_+3Om!ft*&lS*& zzXBLQ-6=$_dRs-QYeye5cne+s{b=*c))VZRx8h8KYCRYvqrS>?-g=noZ$?jB{aD|H zxCLrwpw+b3P9FEtPK&l6Z_UpwUmNZgW$dY=r*WPpJ_gB27mQc<-pvI>*Umc6!F6#= zfIkCw11~f?M2tuL0sHX_!rO7BGv P%|nrb}&iW&Mb#93Pz{6Jd_OJqp?uuP_crtU%&n}VlMqh|!vniYCn zGYd1`(?sRuAg36N*YMoCeIbj}As6##pc~5rSL?RjBO^E@g4#wV{(*bO1gQy9I`u;F zt!r;8zNIG6&b+#74!7~@&p+r08WXclBTUyof-BgsxT?0cRHD;u744|B{nJ#4lXvjt zWEIV^Z|GS}#CQhXEHK{=Ur24)P_rF~?iASyU*UVJ7b3I$=XlZ5PWAIW-n_w!^hD)J z7=DgXlqbcQj~yf^_FbbYvK;y0n<>HODZ!u#muQ*S$Xq5vQ75FUV{t|f-o*z+Z7Y4Q z 4qUQKBZz+A|49duNn{iAs1vOjNVt^LciC76<0?HWnut z?Vv;2mMI&7<;P()=Dgnf?7!H|`IrMWr>U>e`*}@Cfq6%j>ECp8l8GCqI>Jm`pd&*R z-X{(ppqWr~BN+IQuFjR4#TbT2`917?DiLuak^hf@d^GDzMG!?<+*eUll%uFWkfR=5 zSE7i%KK2ce9N{V%DhTiqnUBeQLgsAB=8DQBP(h}IF*6K!;06LuKM>{(1?|Ua7DY6H zQI=}j?a<3c{o$^y)vM;qWxq*l$=N@INJE@-71(cR@EFH!#`vkDfbc1rLXhW0lPZFB UyS{r=1ary_oEfh;mu>|7A2OyPZ~y=R literal 0 HcmV?d00001 diff --git a/andrewsalij/Tests/create_k_points.py b/andrewsalij/Tests/create_k_points.py new file mode 100644 index 00000000..5d4bf81c --- /dev/null +++ b/andrewsalij/Tests/create_k_points.py @@ -0,0 +1,35 @@ +import unittest +import numpy as np +from andrewsalij.convergence_tracker import KPointConvergenceTester + +class KPointArrayCreation(unittest.TestCase): + def test_basic(self): + k_array = KPointConvergenceTester.create_k_point_array(k_iterator=1) + assert np.array_equal(k_array,np.array([1,1,1],dtype=int)) + def test_k_indices(self): + for i in np.arange(3): + k_array = KPointConvergenceTester.create_k_point_array(k_iterator=2,k_index=i) + assert np.array_equal(k_array,np.array([2,2,2],dtype=int)) + def test_weight(self): + weight = np.array([1,2.4,3.1]) + k_array = KPointConvergenceTester.create_k_point_array(k_iterator=10,k_index = 0,effective_weight_array=weight) + assert np.array_equal(k_array,np.array([10,24,31])) + def test_k_force(self): + weight = np.array([3,2.4,2]) + k_force_array = np.array([None,None,1]) #for 2D (xy) materials + k_array = KPointConvergenceTester.create_k_point_array(k_iterator=5,k_index =1,effective_weight_array=weight, + fixed_k_points=k_force_array) + assert np.array_equal(k_array, np.array([6, 5, 1])) + def test_k_force_invalid_warn(self): + k_force= 1 #should warn--scalar does not work + self.assertWarns(Warning,KPointConvergenceTester.create_k_point_array,5, + k_index =1,effective_weight_array = np.array([3.6,3.1,6.3]),fixed_k_points = k_force) + def test_k_force_invalid_pass(self): + weight = np.array([3,2.4,2]) + k_force_array = 1 #should pass with warning + k_array = KPointConvergenceTester.create_k_point_array(k_iterator=5,k_index =1,effective_weight_array=weight, + fixed_k_points=k_force_array) + assert np.array_equal(k_array, np.array([6, 5, 4])) + +if __name__ == '__main__': + unittest.main() diff --git a/andrewsalij/__pycache__/convergence_tracker.cpython-38.pyc b/andrewsalij/__pycache__/convergence_tracker.cpython-38.pyc index 156794969a223259c6a3dd188bbc1bf1d139ddfb..e4ac631011aec7071378e564932258326ec9349c 100644 GIT binary patch literal 2731 zcmaJ@OK%%D5GMDfwQM=g14;8hx=k+?+6F {wWxWFUw3kYkVbF@L2$VXr;qFZ9$I?#fc6I9zbV$8b2$k9yi_H3>BK_dnv#HA4Qy z$zpS0@({ZE3J52hrX-~1*9xu2gj?J`BHW%@p$#*KyD)QwJ+(uJ( `$!HJ^BmI0kP RFHS) z`=_VtU@WT7MXICiIfoQ_B(wR#uJKmek}jwdo?kg?wky&Aj&iG;WSlLqorhIrlFl37 zT2R0C!!rAB+e1HQU>Rd&ld(b0M=6ds7<(~_(t4-C7|&zIB>GxH%~oMuQb*#&7zh&$ zpE}fEGixiAh{|JAKLJ^+#8;$CO*Q(VBV6tX@3_HT{Cf5Y
}m^$ zCR1`u3wlB+Kond_ciUF!s?ku$%1fA0Z)my3n7Iy|hpv%mx?#8hgDO;X9Gs!;Y2r#u z)VD}>V-!4V7!MR{a`-h2G@#0qYCw}IwaA1{h_;UH!a8;|=nCsrL9fEzb#g){PT>^f z5`jIOxrNPXe@*^1z5{1mZk^Ca @p?z zX$%&GiIU$)X8lSE7yROkvw6N(@YH7s)KR2!InVsMSYRvT;^oS^=ypY{lYPMsMACb% z7Z_G*=q(0m{Phn}1__)V20383OgO?_KQQ42?2Z5k`F6lXHyWh|wgDXxPXKKLgJY`g zmp0@^>2}jR(xsIROE;1-IxM|N>BFIbU%-K$DE)&-BAlwy!4Vv6&TT9kwNd5eWh 40-8XJ~ITPe3aIL%mBy6OS z)=4bdw#1iLUI9{G> `g3EHx&Z=kGsd}o2Gq}+w` zY6A#yeYyn>$8UV^EGK_RRE!ufYdFSke7x|2U7J_jvQO$4h8ioEjF7iL)&uA>So-`! z8qVA?a~w79Zf{8Zb0^o4pvkg@1aYd|P&$Gjz$^MZ=kqwo069KIf(n$a8Zl#$rZdzu z(22NP;pZldFolg%@uAtUEqe1}b6w(2+b!K}G#DOMcOavAhRo)I&8K)=`uD4c?*V$V Ke!YBW^V0wAJi4O* delta 440 zcmY*VOG*SW5KYp_m~N+AMHE37;zDfj2qNy>34^$4kT@jq1F;9v>Pl1?Vb+pU46eL} zc!EBKJ2x(@iocnHs^nE(B`@!J=_4zS@;oCDquW>e$)1X}tqnl?#1KOtA&0CqJx zv1FK3)bK-6ikI^TDjAT+#EbAwPpAkz_O>UWRWi?EsTTC0zOnwy*4ip#-BsV?@ptLK zuAM)
Q@jMuQ zw;3Nn%9ysPQrh*KMyY>s9tkT!itYQd<5K`0z4EhIx>%6V=0Bs_I`=ys1 Date: Wed, 14 Feb 2024 20:53:48 -0600 Subject: [PATCH 05/15] feat: PWInput running PWInputs can run with QEJob driver. Tests kept outside repository to keep file sizes manageable and to avoid reproducing pseudopotentials --- .../__pycache__/test_pwscf_io.cpython-310.pyc | Bin 0 -> 1356 bytes .../__pycache__/test_pwscf_io.cpython-38.pyc | Bin 0 -> 1203 bytes andrewsalij/Tests/test_pwscf_io.py | 26 ++++++++++++++++++ andrewsalij/__pycache__/io.cpython-310.pyc | Bin 0 -> 1980 bytes andrewsalij/__pycache__/io.cpython-38.pyc | Bin 0 -> 1981 bytes andrewsalij/io.py | 19 ++++++++++++- 6 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-310.pyc create mode 100644 andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-38.pyc create mode 100644 andrewsalij/Tests/test_pwscf_io.py create mode 100644 andrewsalij/__pycache__/io.cpython-310.pyc create mode 100644 andrewsalij/__pycache__/io.cpython-38.pyc diff --git a/andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-310.pyc b/andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d44864d4310aba5c92ec747666d93e958834e2ee GIT binary patch literal 1356 zcmZ`(OK%i85VqZqafX>>cnCsR5JG^|95NDTgm}#o&}vvRBO&@?HDd=nkM6 4t!4<2at{Q7gxHkika$Wxio6G`=A(AGnJRNyRCMMQVo?Y z?IO1N=BCa^xZ`MJFu4QWUIn2@N+n5|q>_CkfHsgJjDSbRFh;U5APIMCC4>~OM>?NZ zrO?HQ!rsG%0g;aT(CrNnF9Ga7^gS)flJ3!cO35BsvNG7CAHX&a$I-qg2tu=d5*%Q# z1B`M2Op_#b@zb7o{N$cntL8E*m6(Wmq2YY4lUb`wIjrVW)q7oKQx}z}yT~JRtx4@D zUK%YE=0dBcJB}aj|4hs(Wcaf68~PsVa;tjL1x|rQ`#-%lo9c1bbK3PZ%y;c*2T0hQ zzjJMGIgGyo!EFqJ( dI&te_si41xbDeH8+52!4C*;$Ox^^y)}vZKt}dP4HN3PdaL0&i^<{yn!0tNeChPw zj?}!=MSj_2+A0Yb&kF1KESo5)jdg)la~F=`E*u~B21D`S(Y8U<<|GIg?qquUnVJ?_ zkmy>h;abxleb?wxwP9}Ybuqd@|DZAL(8b2FOnLX;({vqTEE-s4_(*;^K9uy4 t0d?r_URPkWDx7d0(>2;uH$@Wc> 0<4v+ZR}Q?W`An$5*n3L z`v^Qha_qbC1bgL_SLlfuFD)r5j&|a)$KQPO&1^RsH3F;u?5F%;5%LS2#pQtW5 0K5M_>?4*n9SOnv*F#qBBa#5t&-KeMFDpZ0HQ#nJE{* zo!%V5=7=)4!L+^7+wAg<53ks2k%=&ue4l4&l;pZ>g<4CM_ls;Ky9Y%$D%~9SrE8e6 z`hFG2_f#a>R_SOt+GYOv`%|J;Aj8?_+S6bgfOHThLdoEDIw)cZ34-+~e_QMXahN|* zVW8wVh03d_u?|PkFzAC4Ixu= !Drg-Q{VAjbB6eF7$uyy z>!n{LQI2F-(@b17OPwe!tte$HhGrJ3FxJdXia0xD{+oC2yL_wvk-3}QjdaI!uJrqW ru@=JUVp??*OzB{j1yKw?(?$PzRn`lfDUI6sv`&E|bzms3w|x2=K%5=$ literal 0 HcmV?d00001 diff --git a/andrewsalij/Tests/test_pwscf_io.py b/andrewsalij/Tests/test_pwscf_io.py new file mode 100644 index 00000000..b5b23ca5 --- /dev/null +++ b/andrewsalij/Tests/test_pwscf_io.py @@ -0,0 +1,26 @@ +import unittest +import andrewsalij.io as io +import os +TEST_DIR = "/home/andrew/Documents/RewoteTests" +FILE_STR = "si2.in" +FILE_PATH = os.sep.join((TEST_DIR,FILE_STR)) +QE_JOB = io.QEJob(FILE_PATH) +class test_qcinput_io(unittest.TestCase): + def test_k_points(self): + k_points = [1,2,3] + QE_JOB.update_k_points(k_points) + self.assertTupleEqual(tuple(k_points),QE_JOB.input.kpoints_grid) + def test_write(self): + try: + os.makedirs(os.sep.join((TEST_DIR,"save")),exist_ok=True) + QE_JOB.save(os.sep.join((TEST_DIR,"save/si2.in"))) + except: + self.fail("Exception raised") + def test_run(self): + try: + QE_JOB.run() + except: + self.fail("Exception raised") + +if __name__ == '__main__': + unittest.main() \ No newline at end of file diff --git a/andrewsalij/__pycache__/io.cpython-310.pyc b/andrewsalij/__pycache__/io.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..026e5f4654c5c3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iW5!i!K9wCf5p{LR^D-89MD}3)_wL?{$&pH>n#6^W>E!z|sb^`S)#P=i59;H| zEY{CuJdx>nsnf-&a~0>==_D&h)qCS}o)wwqd=uS3e+X>`fN-=lj6?b=^zdL2&r;4! zpYvHM>Kx|-&fnE>zOZyT7iGe^+< K+uQsq4gN5TGuP79#|xZ<1ee;7s25v2MW22HNW4Fz7ETZfW4 zxpC(77FlM ^z@W(~1#ieLg}Bh>*-!AS3V#0O2Yfgvk5AJ?2UA(jtfEnf zA(N<%sJl26_0Y^w@Dh@Doo?&kBiMTkz10+J`mKA2FR?NM8#Z(c17Tgm+|!T wR^D+kfCwtSd>x!TxL48)W8;kwAJH5E<#;_r% U?w&G%VN&pbR^uvapP=svPiM zXv0)m8TS;FVfv~*u4I`&8XE=|h8-J-XajBniE|8C)Q2>mW*1y(Y20I|<%YpE(ePc$ z7r#Z*gSg3O0RJh54Rub~BkGfF`q*iDtpe~dsF==JehKDqLt?&3EU$8i!xj#hzGk36 zidiyC_1jWNOc;rpl3(C}ub9n6>L+QQFVo)&@)JB_^9*%_S1P<5E9#Irw9kCkXA*5; wC)%jq!~eiZT8y&NCb2~K bWJf7w?09V{RUl{BC}^*h7PKeKwqM*si- literal 0 HcmV?d00001 diff --git a/andrewsalij/io.py b/andrewsalij/io.py index f94f41d3..4b7b68e6 100644 --- a/andrewsalij/io.py +++ b/andrewsalij/io.py @@ -1,5 +1,6 @@ from pymatgen.io import pwscf - +import subprocess +import os '''Input and output handling Formats supported: Quantum Espresso (PWscf input) ''' @@ -20,5 +21,21 @@ def __init__(self,path,to_load = False): self.input = self.load(path) #PWInput object @staticmethod def load(path): + '''Loads PWInput object from filepath''' return pwscf.PWInput.from_file(path) + def update_k_points(self,k_points): + '''Updates kpoints_grid for PWInput''' + k_points_tuple = tuple(k_points) #force type + self.input.__setattr__("kpoints_grid",k_points_tuple) + def save(self,path): + '''Saves a Quantum Espresso input file for self.input at path''' + self.input.write_file(path) + def run(self,output_path = None,prefix_str = ""): + #TODO: check in Linux bash + '''Saves and runs self.input''' + base, ext = os.path.splitext(self.path) + if (output_path is None):output_path = base+".out" + qe_process_str = prefix_str+" pw.x -i "+self.path+" > "+output_path + #TODO: add parallelism + subprocess.run(qe_process_str,shell=True) From 627cd64a3fb1a998ab2219dcf263fd85e43b0826 Mon Sep 17 00:00:00 2001 From: Andrew Salij Date: Wed, 14 Feb 2024 22:06:46 -0600 Subject: [PATCH 06/15] feat: convergence test loading --- andrewsalij/Scripts/run_si2_sweep.py | 26 ++++++++++++++++++ .../createConvergenceTester.cpython-310.pyc | Bin 0 -> 1310 bytes .../__pycache__/test_params.cpython-310.pyc | Bin 0 -> 293 bytes .../__pycache__/test_pwscf_io.cpython-310.pyc | Bin 1356 -> 1891 bytes andrewsalij/Tests/createConvergenceTester.py | 6 ++++ andrewsalij/Tests/test_params.py | 4 +++ andrewsalij/Tests/test_pwscf_io.py | 24 ++++++++++------ .../convergence_tracker.cpython-310.pyc | Bin 0 -> 3514 bytes andrewsalij/__pycache__/io.cpython-310.pyc | Bin 1980 -> 2377 bytes andrewsalij/convergence_tracker.py | 22 +++++++++++---- andrewsalij/io.py | 22 ++++++++++++--- 11 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 andrewsalij/Scripts/run_si2_sweep.py create mode 100644 andrewsalij/Tests/__pycache__/createConvergenceTester.cpython-310.pyc create mode 100644 andrewsalij/Tests/__pycache__/test_params.cpython-310.pyc create mode 100644 andrewsalij/Tests/test_params.py create mode 100644 andrewsalij/__pycache__/convergence_tracker.cpython-310.pyc diff --git a/andrewsalij/Scripts/run_si2_sweep.py b/andrewsalij/Scripts/run_si2_sweep.py new file mode 100644 index 00000000..57e1458f --- /dev/null +++ b/andrewsalij/Scripts/run_si2_sweep.py @@ -0,0 +1,26 @@ +import andrewsalij.io +import os +import copy +INPUT_BASE_FOLDER = "/home/andrew/Documents/MaterialsDB/pwscf_files/" +RUN_BASE_FOLDER = "/home/andrew/Documents/QE_Runs" +os.makedirs(RUN_BASE_FOLDER,exist_ok=True) + +si2_input = "si2.in" + +filepath = os.sep.join((INPUT_BASE_FOLDER,si2_input)) + +run_sub_dir = "Si2_k_sweep" +run_directory = os.sep.join((RUN_BASE_FOLDER,run_sub_dir)) +os.makedirs(run_directory,exist_ok=True) + +job_init = andrewsalij.io.QEJob(filepath) +job = copy.deepcopy(job_init) +input = job.input + +control_dict= input.sections["control"] + +structure = input.structure + + +save_test_path = os.sep.join((run_directory,"si2_saved.in")) +job.save(save_test_path) diff --git a/andrewsalij/Tests/__pycache__/createConvergenceTester.cpython-310.pyc b/andrewsalij/Tests/__pycache__/createConvergenceTester.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3255663f7c87c32da9083293424910f8b476bc7d GIT binary patch literal 1310 zcmah}%}x|S5bo}o-JSgbVIf(AF?#Sa9GDj{2D2)NW|69kQaGRP|p~O?_WgPcb*wA~3}17kT6n@)bAL;lpMfM85_l zh@fK +%xJmxV&C1>vN|J_WR18%$p#Tjcqc@7l8l05FK)_~@DG?;mE^2_4t9d> zI0 >ENg$1oSzpWX8{56+>yo=5ssma4coppznT(QL zDET3JQVge=%#DsVQnNYTi{P*@QeWQdWSov7M5m+S-$AcUKH4sL7`~Ti$(>bN +h~S2fGh!g^c9o?1i yVdkAQkc3IHw HQ2*yI$|qkp literal 0 HcmV?d00001 diff --git a/andrewsalij/Tests/__pycache__/test_params.cpython-310.pyc b/andrewsalij/Tests/__pycache__/test_params.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8702aa1d35e2b7cb58c94210835575f5c9962d5d GIT binary patch literal 293 zcmd1j<>g`kg4Eu#sZ~JwF^Gc |km=-cdv8FHvGib8B1gd24t5VX>$j?pHPs~dxN-fuS$xklLP0cGQ)(=W8&o4<0 zNi8lZu3{_BG}6n=(`38FlwW*{Bg8d0B;Lg{=oW{Yr;lrVa7fTC=Hk?XTP#`mnR&N3 z!GZyfAs#Ckia3CFfQesjIP7uHEb%B!(g#`&w5}NHj^f0e%q)Gd<@!L;lK6teqQu-{ gy@JYH95%W6DWy57c8oxyi$UgdFt9MPFp4k&0K(T%X8-^I literal 0 HcmV?d00001 diff --git a/andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-310.pyc b/andrewsalij/Tests/__pycache__/test_pwscf_io.cpython-310.pyc index d44864d4310aba5c92ec747666d93e958834e2ee..7941d0125f1a5f1dcac0a3e2715fc835d00c3ca6 100644 GIT binary patch literal 1891 zcmZ`(OK%%D5GJ_~(|Xu$P^3l@r)mnc-5w;MD0(W2w22zWD3pf<1l47+7HOBV_F-~W z$AWvQbIql{K yttxrHl{bB3D^y>_%dY)MbBCjAi#|l8kLo;@k! M8vFb z N#7NyFwmQIwBqNTDH7^v)^^`g6z??tPY<;L yO}m zY`vl<(Mbvx{qAl*e*E;MUI8@v76|L_Cu;nT>LzONCMvOkdo|~LtW_x+ur^q8jNYU7 zX-GHd^v+T$o%zi?eg-k7z|)Lk$z0 w84K`cW;4>Jgi&1|7%!$;VoeCdm5_=Z+VpO#pOvM zmxCMUiMRq6Sf+BzQ5l1u-h>!-^~a|_b>rvX_qT5bTy+QMcO=2{BXGRHeY?W_@lxDZ z9{+=njlh+{eVANcV99_6R}5#&G >tXeL+wd(O!_V*9~wlq#})9Kx%$yb)Wh+7`VS(3^)wzW7;b1@m?yb;IPpsF4H z0R+<+RwE$&DT>cgT)iDP!&1-)9*f3cA#g~7`#j`9BXB!-UYe*Zj-w6BCz&cSKf6|S zGuN%!D%UOW)gOYe_2MK=$^)698Xtz;TD0wBXRA6>QI&4sRMq_luIlvzjD|TuU4#9j o1llmBslPy-kNGTvV)?ffA>UztGnfu14a#YQ-g1L)HmLvae-Vz(>;M1& delta 652 zcmZ8e&x_MQ6rMLTNvAc Au0wIJSl>>-L)b`n}AS+P Nb%{N~J8U zpjQtiR}bmYlYfE#fIsk_t0(^jFFF&Us2Scz-uK@7-j~dG`%BG^>-8E^&(_IT(IyLf z2S$r)ty4UpoD2*>#%5j-R2WBi2?Hi@UKLEe)eaD++<1eyA<+2DYcjAzotw|G+!ZLd zmk1CCuMDU1LoevfFT107BHUrbrI@*U@!@nLqBL>)Viu>u7fG7T%_Q8t5k`v-O}Mi7 z)TSPCSVrJ8*x5ID3f1g7KG^Rmx%qaA#-IY{B&8g*KaM$hivguZZmud+SC# $K zNzXB}mf7w$bnCW;i~kOl `u7Xtapyt&?2mb-@9Ew!5v8!aq+6-h{_8tdmI`)z d67%V?xC5#$(c%nQz}A7P(|{VBRfz@k*KcF+j!pmo diff --git a/andrewsalij/Tests/createConvergenceTester.py b/andrewsalij/Tests/createConvergenceTester.py index f58235be..5f7453c6 100644 --- a/andrewsalij/Tests/createConvergenceTester.py +++ b/andrewsalij/Tests/createConvergenceTester.py @@ -1,5 +1,7 @@ import unittest import andrewsalij.convergence_tracker as convergence_tracker +import andrewsalij.io +import andrewsalij.Tests.test_params as test_params class CreateConvergenceTester(unittest.TestCase): def test_base_creation(self): @@ -8,5 +10,9 @@ def test_base_creation(self): def test_k_pt_creation(self): k_point_convergence_tester = convergence_tracker.KPointConvergenceTester(path="") assert isinstance(k_point_convergence_tester,convergence_tracker.KPointConvergenceTester) + def test_convergence_loaded(self): + k_point_convergence_tester = convergence_tracker.KPointConvergenceTester(test_params.FILE_PATH) + assert isinstance(k_point_convergence_tester.base_job,andrewsalij.io.Job) + if __name__ == '__main__': unittest.main() diff --git a/andrewsalij/Tests/test_params.py b/andrewsalij/Tests/test_params.py new file mode 100644 index 00000000..2729dc8f --- /dev/null +++ b/andrewsalij/Tests/test_params.py @@ -0,0 +1,4 @@ +import os +TEST_DIR = "/home/andrew/Documents/RewoteTests" +FILE_STR = "si2.in" +FILE_PATH = os.sep.join((TEST_DIR,FILE_STR)) \ No newline at end of file diff --git a/andrewsalij/Tests/test_pwscf_io.py b/andrewsalij/Tests/test_pwscf_io.py index b5b23ca5..0b4b2acf 100644 --- a/andrewsalij/Tests/test_pwscf_io.py +++ b/andrewsalij/Tests/test_pwscf_io.py @@ -1,10 +1,9 @@ import unittest import andrewsalij.io as io import os -TEST_DIR = "/home/andrew/Documents/RewoteTests" -FILE_STR = "si2.in" -FILE_PATH = os.sep.join((TEST_DIR,FILE_STR)) -QE_JOB = io.QEJob(FILE_PATH) +from pymatgen.io import pwscf +import andrewsalij.Tests.test_params as test_params +QE_JOB = io.QEJob(test_params.FILE_PATH) class test_qcinput_io(unittest.TestCase): def test_k_points(self): k_points = [1,2,3] @@ -12,15 +11,22 @@ def test_k_points(self): self.assertTupleEqual(tuple(k_points),QE_JOB.input.kpoints_grid) def test_write(self): try: - os.makedirs(os.sep.join((TEST_DIR,"save")),exist_ok=True) - QE_JOB.save(os.sep.join((TEST_DIR,"save/si2.in"))) + os.makedirs(os.sep.join((test_params.TEST_DIR,"save")),exist_ok=True) + QE_JOB.save(os.sep.join((test_params.TEST_DIR,"save/si2.in"))) except: - self.fail("Exception raised") + self.fail("Exception raised in saving QEJob") def test_run(self): try: QE_JOB.run() except: - self.fail("Exception raised") - + self.fail("Exception raised in running QEJob") + def test_load_qejob(self): + try: + io.load_job(test_params.FILE_PATH,job_type="pwscf") + except: + self.fail("Exception raised in loading QEJob") + def test_output(self): + QE_JOB.run() + assert isinstance(QE_JOB.output,pwscf.PWOutput) if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/andrewsalij/__pycache__/convergence_tracker.cpython-310.pyc b/andrewsalij/__pycache__/convergence_tracker.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0442f5debee4914e81d86f7746af67ee6515dacb GIT binary patch literal 3514 zcmai0&yO3o6&}tn%}T5FCf?X}Vzg7YXe`9pMS>J4wr-l#2As60V8B6(3JnIcBDFi( z(Tu{OY_B>C1Xu&P)R+DR>)!mw^w QffV^3XC%$8>XZVXhUDWT`SHE)G4FQU z7Rv5l{~^StW&Mj9&Elf*32Jd4f?J%W)_|FRdtjS?XW*EBci?SU4=iqT=b6QwGkf5p z<#G=#PxxofpvBoEtLMLhC96Lq*(?qkpP&|ZAcR>3D==7Z8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B>=1>u9xqHi zN<*bkV8PLy!i @5HH6 o 2}_+U*_6=O3nPUy~;fcNdMZ84zH4`yU=C@rpBgi z)}r&YZ5&iev)9yUsPK(=Mpxa!wW=Dhs3t-SVFsb}u% ^Hp~c nRuS+Oly#T9DLG1uohOTfM2_NcgF>Cgi`R%l9cs{qIcxm`xW2v< diff --git a/andrewsalij/convergence_tracker.py b/andrewsalij/convergence_tracker.py index 5b93b191..05b9ee3f 100644 --- a/andrewsalij/convergence_tracker.py +++ b/andrewsalij/convergence_tracker.py @@ -1,27 +1,39 @@ import numpy as np import warnings - - +import os +import andrewsalij.io '''Convergence tracking of k points''' class ConvergenceTester: '''Base class for convergence testing some system''' - def __init__(self,path): + def __init__(self,path,output_dir = None,job_type = "pwscf"): ''' Initializes general convergence tester :param path: str + :param output_dir: str or None + :param job_type : str Path to file containing system for convergence testing ''' self.path = path self.convergence_list = [] self.converged_value = None + if (path): + self.init_directory, self.filename = os.path.split(self.path) + self.base_output_directory = self._initialize_convergence_output_dir(output_dir=output_dir) + self.base_job= andrewsalij.io.load_job(self.path,job_type=job_type) def find_convergence(self,convergence_delta): ''' Convergence parameter tolerance in units of parameter - :param convergence_delta: + :param convergence_delta: float :return: ''' - return None + return None + def _initialize_convergence_output_dir(self,output_dir = None): + '''Initializes the convergence testing by creating output directory. If output_dir = None, makes directory 'conv' in self.path''' + if output_dir is None: + output_dir = os.sep.join((self.init_directory,"conv")) + os.makedirs(output_dir,exist_ok=True) + return output_dir class KPointConvergenceTester(ConvergenceTester): '''Subclass for k-point convergence testing''' diff --git a/andrewsalij/io.py b/andrewsalij/io.py index 4b7b68e6..1fdd4f16 100644 --- a/andrewsalij/io.py +++ b/andrewsalij/io.py @@ -6,19 +6,32 @@ ''' #TODO: add additional format support +def load_job(path,job_type = "pwscf"): + ''' + General function for loading a job from an input--handles various job types (e.g., 'pwscf', ...) + :param path: str + :param job_type: str + ''' + job_type = job_type.lower() #to avoid capitalization input issues + if (job_type=="pwscf"): + job = QEJob(path) + else: + ValueError("Unsupported job_type "+job_type) + return job class Job(): ''' Base class for a file to run calculations ''' - def __init__(self,path,to_load = False): + def __init__(self,path): self.path = path class QEJob(Job): ''' Class for running Quantum Espresso calculations. Extends Job() ''' - def __init__(self,path,to_load = False): - super().__init__(path,to_load) + def __init__(self,path): + super().__init__(path) self.input = self.load(path) #PWInput object + self.output = None @staticmethod def load(path): '''Loads PWInput object from filepath''' @@ -31,11 +44,12 @@ def save(self,path): '''Saves a Quantum Espresso input file for self.input at path''' self.input.write_file(path) def run(self,output_path = None,prefix_str = ""): - #TODO: check in Linux bash '''Saves and runs self.input''' base, ext = os.path.splitext(self.path) if (output_path is None):output_path = base+".out" qe_process_str = prefix_str+" pw.x -i "+self.path+" > "+output_path #TODO: add parallelism subprocess.run(qe_process_str,shell=True) + self.output = pwscf.PWOutput(output_path) + From c797021a64acf8e6c7163ed9807a42e19d6ef0b0 Mon Sep 17 00:00:00 2001 From: Andrew Salij Date: Thu, 15 Feb 2024 13:16:04 -0600 Subject: [PATCH 07/15] feat convegence testing working K point convergence MVP working (K points [8,8,8 for -.001 Ry for Si2). Dependency added via pydantic (MIT) for deep dictionary updating --- andrewsalij/Convergence-Tracker.md | 1 + andrewsalij/Licenses/pydantic_LICENSE | 21 ++++ andrewsalij/Scripts/run_si2_sweep.py | 21 ++-- .../qe_job_updating.cpython-310.pyc | Bin 0 -> 1291 bytes andrewsalij/Tests/qe_job_updating.py | 21 ++++ andrewsalij/__pycache__/io.cpython-310.pyc | Bin 2377 -> 3256 bytes andrewsalij/convergence_tracker.py | 99 ++++++++++++++++-- andrewsalij/io.py | 14 ++- 8 files changed, 160 insertions(+), 17 deletions(-) create mode 100644 andrewsalij/Licenses/pydantic_LICENSE create mode 100644 andrewsalij/Tests/__pycache__/qe_job_updating.cpython-310.pyc create mode 100644 andrewsalij/Tests/qe_job_updating.py diff --git a/andrewsalij/Convergence-Tracker.md b/andrewsalij/Convergence-Tracker.md index 29dfaa80..e2939353 100644 --- a/andrewsalij/Convergence-Tracker.md +++ b/andrewsalij/Convergence-Tracker.md @@ -6,6 +6,7 @@ Dependencies for this project may be installed by running in the following insta pip install numpy matplotlib scipy pip install pymatgen pip install ase +pip install pydantic ``` diff --git a/andrewsalij/Licenses/pydantic_LICENSE b/andrewsalij/Licenses/pydantic_LICENSE new file mode 100644 index 00000000..488c6260 --- /dev/null +++ b/andrewsalij/Licenses/pydantic_LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 to present Pydantic Services Inc. and individual contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/andrewsalij/Scripts/run_si2_sweep.py b/andrewsalij/Scripts/run_si2_sweep.py index 57e1458f..13f8acca 100644 --- a/andrewsalij/Scripts/run_si2_sweep.py +++ b/andrewsalij/Scripts/run_si2_sweep.py @@ -1,26 +1,31 @@ import andrewsalij.io import os import copy +import andrewsalij.convergence_tracker as convergence_tracker + + +'''Script for testing that Si2 k sweeping is working''' + INPUT_BASE_FOLDER = "/home/andrew/Documents/MaterialsDB/pwscf_files/" RUN_BASE_FOLDER = "/home/andrew/Documents/QE_Runs" os.makedirs(RUN_BASE_FOLDER,exist_ok=True) si2_input = "si2.in" + filepath = os.sep.join((INPUT_BASE_FOLDER,si2_input)) run_sub_dir = "Si2_k_sweep" run_directory = os.sep.join((RUN_BASE_FOLDER,run_sub_dir)) -os.makedirs(run_directory,exist_ok=True) +convergence_tester = convergence_tracker.KPointConvergenceTester(filepath,output_dir = run_directory) -job_init = andrewsalij.io.QEJob(filepath) -job = copy.deepcopy(job_init) -input = job.input +base_job = convergence_tester.base_job +update_job = copy.deepcopy(base_job) +sections = update_job.input.sections -control_dict= input.sections["control"] -structure = input.structure +convergence_tester.find_convergence(-.001) +convergence_list = convergence_tester.convergence_parameter_list +convergence_energy_list = convergence_tester.convergence_energy_list -save_test_path = os.sep.join((run_directory,"si2_saved.in")) -job.save(save_test_path) diff --git a/andrewsalij/Tests/__pycache__/qe_job_updating.cpython-310.pyc b/andrewsalij/Tests/__pycache__/qe_job_updating.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..87ef3ecc7828182be94eeeeb852081599f53f038 GIT binary patch literal 1291 zcmZ`(OK%e~5VpPEWSef%mq024#DzmHjf6NN#49`^6sRbdy;$4Wl-(w~!QNHXD!l+d zB;m%N;RpE2seb_p!HnIaRDf3=KgKij`J3^U?RJYm` ^(+!!n#KsVPxD1s;e0hR1CNdg&24kMT08`5pqjotpB z+WP9dy=PhVyx#A@W(m>G^(Gx>c@HTuy$?#{<-Tz6vf^N8dTh547ew%gJn$6= zVvwy4ZP9D= vDpTI-{%UBRIn!$I LCMsc(Ud1j 3t5H?zW7`~+MWxHJZIpEd+fWaDRKo2d zsnir_Isy##%6VcO (H?)xuMLJPJ*p?8JQr2Uf$3kFLd5zu# z_xc73ESx2Qs5CwbM}n~bviM&<4e$$ z*iKg3)upu!i+TdYV;upPICoV8b!VIC1ST5)NS1+R=t|74Jbm%9FJ3>~d+rk!?ZLsv rDZClPs&C?Pj?k8_;%??xj_!FH?&BjhS3%&V{1?*>-K0?*Q~v8W-~V5@ literal 0 HcmV?d00001 diff --git a/andrewsalij/Tests/qe_job_updating.py b/andrewsalij/Tests/qe_job_updating.py new file mode 100644 index 00000000..df476597 --- /dev/null +++ b/andrewsalij/Tests/qe_job_updating.py @@ -0,0 +1,21 @@ +import copy +import unittest +import test_params +import andrewsalij.io +import numpy as np +import numpy.testing as np_test +QE_JOB = andrewsalij.io.QEJob(test_params.FILE_PATH) +class QEJobUpdateTester(unittest.TestCase): + def test_k_array_update(self): + new_k_points = np.array([1,7,4]) + QE_JOB.update_k_points(new_k_points) + np_test.assert_array_equal(new_k_points,np.array(QE_JOB.input.kpoints_grid)) + def test_section_update(self): + new_directory = "/home/new_directory" + section_dict_update = {'control':{'outdir':new_directory}} + QE_JOB_copy = copy.deepcopy(QE_JOB) + QE_JOB_copy.update_input_sections(section_dict_update) + new_outdir = QE_JOB_copy.input.sections['control']['outdir'] + assert new_outdir == new_directory +if __name__ == '__main__': + unittest.main() diff --git a/andrewsalij/__pycache__/io.cpython-310.pyc b/andrewsalij/__pycache__/io.cpython-310.pyc index 5360d15c42ec33e2184deeed3b77200a4373c599..5f52baf3929e7c9f6d72f436632c5d69bf86c9c2 100644 GIT binary patch delta 1143 zcmZuw&1(}u6yKTs$ZnFxH2t!))h#GxZ5#UGp(t3vs_3DpMZ_S6?arj#knS$ClS)cU z53TfE1_UqCinpG;`7ekd=t)*QdGqMelW#VSTInqNoA)*E&HU!g`_j9?LfF-nRbYH| zKhh7@eqk6@_Q%g(Aqv3_t)i#1QOQ^eK|~|^E~=Qf6=IOgu0k?9xMG235(_koT03eb z`8-74fx|>0It+g9UrKhN?oh#o9GZrsj3qM z8Suu)!-%+?#y0Ui?uUWPT6S2o?>)K`L`}Zv7>OCRh#PR {7La{1Ia zF{EH~K8Bn-%ls$hL<-> 4kQWa5Iw qj>3TW!HUg8J3WX!R`!Fj zReQx>rvaGkm^NzV$mOf743!;?O~J$rfJBd@hR@lwwCioc%w;#GKo?62ZC*O%lAe=# zRR*#-@yY1f?pdL{8aBD)u@iq4lE$)12^W!xHU`^Vo)US2DoNWPs!E`6 azI?h+?HKq;aaDSpo?%2C3@; eyp%5yEG=Q{ROk1Je zbFSUGTBK^LDbBdK6&SCLW1lN zc1^;9cx8@nkAN8W1DJ}2@+#J{$W%?uRI{pS7Ih}yk&{buQEScRD>NwkA(P$7W+cd~ zO!T0+7PZ*Cl)F0*rMx~}PM-<8AOmv}@)Bgizb`?Yvj+Pm&3VOyTaq6}S-p_&HGTsC CB`${m delta 273 zcmdlXc~XckpO=@50SK=3oK00{pU5Y}=rvJWUW=0 g&~E# znJJ1D$m2-i1oAjjS(}-o*fzGzWMt%=EXVYiQF1a9a~h-Q FGq5m3aRoDI@=yN7e1lPb@@1AqjLMVCSno2bPYz)-nOw=<$*4V dk02IOgSPoBYT#HI>l7HLnui4K4P+Jz00|BT7DgUsCKfJ6 z4rUG(A?6|$kb3r8+y#}ni6!Z&d3u@oMNA-#S|CDWaxRal5Fe1q!@$AF!N|nO#mdJc G!Uh1g0yy^o diff --git a/andrewsalij/convergence_tracker.py b/andrewsalij/convergence_tracker.py index 05b9ee3f..fd9ebfee 100644 --- a/andrewsalij/convergence_tracker.py +++ b/andrewsalij/convergence_tracker.py @@ -1,3 +1,5 @@ +import copy + import numpy as np import warnings import os @@ -14,8 +16,11 @@ def __init__(self,path,output_dir = None,job_type = "pwscf"): Path to file containing system for convergence testing ''' self.path = path - self.convergence_list = [] - self.converged_value = None + self.convergence_energy_list = [] + self.convergence_parameter_list = [] + self.output_list = [] + self.converged_energy = None + self.converged_parameter = None if (path): self.init_directory, self.filename = os.path.split(self.path) self.base_output_directory = self._initialize_convergence_output_dir(output_dir=output_dir) @@ -26,7 +31,7 @@ def find_convergence(self,convergence_delta): :param convergence_delta: float :return: ''' - + #TODO write general convergence handling return None def _initialize_convergence_output_dir(self,output_dir = None): '''Initializes the convergence testing by creating output directory. If output_dir = None, makes directory 'conv' in self.path''' @@ -37,8 +42,8 @@ def _initialize_convergence_output_dir(self,output_dir = None): class KPointConvergenceTester(ConvergenceTester): '''Subclass for k-point convergence testing''' - def __init__(self,path): - super().__init__(path) + def __init__(self,path,output_dir = None,job_type = "pwscf"): + super().__init__(path,output_dir=output_dir,job_type=job_type) @staticmethod def create_k_point_array(k_iterator,k_index = 0,effective_weight_array = np.array([1,1,1]),fixed_k_points = None): @@ -68,10 +73,88 @@ def get_effective_k_point_weight(self,weight_type = "uniform"): if weight_type=="uniform": effective_weight_array = np.array([1,1,1]) #no special weighting if weight_type=="lattice": - lattice_array = self.get_lattice_vectors() #a,b,c (in real space) + lattice_array = self.base_job.get_lattice_vectors() #a,b,c (in real space) effective_weight_array = 1/lattice_array #now in reciprocal space return effective_weight_array - def get_lattice_vectors(self): + def find_convergence(self,convergence_delta,k_iterator_init = int(1),k_step = int(1),k_index = 0, + fixed_k_points = None,weight_type = "uniform",run_prefix_str = "",max_iterations = 20,talk = True): ''' - :return: + Finds the converged energy + ''' + k_iterator_init,k_step = int(k_iterator_init),int(k_step) + if (convergence_delta > 0): + warnings.warn("convergence_delta must be negative. Negativity imposed") + convergence_delta = -1*np.abs(convergence_delta) + cur_convergence_delta = convergence_delta-1 # initial value that must be lower that converged value + cur_k_iterator = k_iterator_init #index for k array construction + effective_weight_array = self.get_effective_k_point_weight(weight_type = weight_type) + run_counter = 0 #index for convergence lists + convergence_flag = False + while (cur_convergence_delta < convergence_delta): #absolutes taken in case convergence + if run_counter >= max_iterations: + print("Max iterations "+str(max_iterations)+" reached. Terminating convergence run") + break + self._run_convergence_iteration(cur_k_iterator, + prefix_str=run_prefix_str,k_index = k_index, + effective_weight_array=effective_weight_array,fixed_k_points=fixed_k_points,talk = talk) + if (run_counter>=int(1)): + cur_convergence_delta = self.convergence_energy_list[run_counter]-self.convergence_energy_list[int(run_counter-1)] + + if cur_convergence_delta>0: + print("Energy increased in final convergence step. Terminating convergence run") + break + if (cur_convergence_delta>convergence_delta): + convergence_flag=True + break + cur_k_iterator = cur_k_iterator + k_step + run_counter = int(run_counter + 1) + if (convergence_flag): + self.converged_energy = self.convergence_energy_list[run_counter] + self.converged_parameter = self.convergence_parameter_list[run_counter] + else: + self.converged_energy,self.converged_parameter = None, None + return self.converged_parameter #returns None if run does not converge + def _run_convergence_iteration(self,k_iterator,prefix_str = "",k_index = 0,effective_weight_array=np.array([1,1,1]),fixed_k_points = None,talk = True): + '''Creates directory for convergence iteration, runs jobs, parses output + :param k_iterator : int ''' + iter_k_array = self.create_k_point_array(k_iterator,k_index = k_index,effective_weight_array=effective_weight_array,fixed_k_points=fixed_k_points) + k_array_str_init = str(iter_k_array) + k_array_str = self._clean_k_array_string(k_array_str_init) + if talk: + print("Testing K array: "+k_array_str_init) + iteration_subdir = os.sep.join((self.base_output_directory,"K_"+k_array_str)) + os.makedirs(iteration_subdir,exist_ok=True) + conv_iter_job = copy.deepcopy(self.base_job) + conv_iter_job.update_k_points(iter_k_array) + iteration_output_dir = os.sep.join((iteration_subdir,"out")) + os.makedirs(iteration_output_dir,exist_ok=True) + conv_iter_job.update_input_sections({'control':{'outdir':iteration_output_dir}}) + new_input_path = os.sep.join((iteration_subdir,self.filename)) + conv_iter_job.save(new_input_path) + conv_iter_job.path = new_input_path + output_filename = conv_iter_job.get_output_filename() + iteration_output_filepath= os.sep.join((iteration_subdir,output_filename)) + conv_iter_job.run(output_path=iteration_output_filepath,prefix_str=prefix_str) + iter_output = conv_iter_job.output + self.output_list.append(iter_output) + self.convergence_parameter_list.append(iter_k_array) + self.convergence_energy_list.append(iter_output.final_energy) + if talk: + print("Iteration Energy: "+str(iter_output.final_energy)) + @staticmethod + def _clean_k_array_string(k_array_string, + char_list_to_underscore = [","], + char_list_to_remove = [" ","(",")","[","]"]): + ''' + Prepares k_array_string for use in directory names + :param k_array_string: str + ''' + k_array_string = k_array_string.lower() + for char in char_list_to_underscore: + k_array_string = k_array_string.replace(char,"_") + for char in char_list_to_remove: + k_array_string = k_array_string.replace(char,"") + return k_array_string + + diff --git a/andrewsalij/io.py b/andrewsalij/io.py index 1fdd4f16..66723446 100644 --- a/andrewsalij/io.py +++ b/andrewsalij/io.py @@ -1,6 +1,8 @@ from pymatgen.io import pwscf import subprocess import os +import numpy as np +import pydantic.v1.utils '''Input and output handling Formats supported: Quantum Espresso (PWscf input) ''' @@ -40,6 +42,9 @@ def update_k_points(self,k_points): '''Updates kpoints_grid for PWInput''' k_points_tuple = tuple(k_points) #force type self.input.__setattr__("kpoints_grid",k_points_tuple) + def update_input_sections(self,update_dict): + '''Updates dictionary of PWInput''' + self.input.sections = pydantic.v1.utils.deep_update(self.input.sections,update_dict) def save(self,path): '''Saves a Quantum Espresso input file for self.input at path''' self.input.write_file(path) @@ -51,5 +56,12 @@ def run(self,output_path = None,prefix_str = ""): #TODO: add parallelism subprocess.run(qe_process_str,shell=True) self.output = pwscf.PWOutput(output_path) - + def get_output_filename(self): + '''Returns pwscf filename corresponding to input '.in' given in self.path''' + base_dir, input_filename = os.path.split(self.path) + input_filename_base, ext = os.path.splitext(input_filename) + return input_filename_base+".out" + def get_lattice_vectors(self): + '''Returns lattice vectors a np.ndarray from PWInput''' + return np.array(self.input.structure.lattice.abc) From b2124b771773826e2200d8278073d5ede869fb56 Mon Sep 17 00:00:00 2001 From: Andrew Salij Date: Thu, 15 Feb 2024 14:47:19 -0600 Subject: [PATCH 08/15] feat convergence figure plotting make_report_figure() works for KPointConvergenceTester --- andrewsalij/Convergence-Tracker.md | 13 ++++++++++ andrewsalij/Scripts/run_si2_sweep.py | 4 ++- andrewsalij/Scripts/si2_k_converged.png | Bin 0 -> 22852 bytes andrewsalij/convergence_tracker.py | 32 +++++++++++++++++++++++- 4 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 andrewsalij/Scripts/si2_k_converged.png diff --git a/andrewsalij/Convergence-Tracker.md b/andrewsalij/Convergence-Tracker.md index e2939353..51871fc0 100644 --- a/andrewsalij/Convergence-Tracker.md +++ b/andrewsalij/Convergence-Tracker.md @@ -9,6 +9,19 @@ pip install ase pip install pydantic ``` +Tests have been run on a variety of materials, whose provenance is below: + +Materials Project (DOI 10.17188/1190959) +(CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) +Si2 (mp-149) + +Pseudopotentials Tested: +NC SR 0.4.1 from Pseudo Dojo + Paper: 10.1016/j.cpc.2018.01.012 arxiv preprint + Method Paper: 10.1103/PhysRevB.88.085117 + License: (CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) + (see https://github.com/PseudoDojo/pseudodojo) + > Ideal candidate: scientists skilled in Density Functional Theory and proficient in python. diff --git a/andrewsalij/Scripts/run_si2_sweep.py b/andrewsalij/Scripts/run_si2_sweep.py index 13f8acca..1d9a3872 100644 --- a/andrewsalij/Scripts/run_si2_sweep.py +++ b/andrewsalij/Scripts/run_si2_sweep.py @@ -24,8 +24,10 @@ sections = update_job.input.sections -convergence_tester.find_convergence(-.001) +convergence_tester.find_convergence(-.005) convergence_list = convergence_tester.convergence_parameter_list convergence_energy_list = convergence_tester.convergence_energy_list +convergence_tester.make_report_figure("si2_k_converged.png",x_axis_type="convergence_parameter") + diff --git a/andrewsalij/Scripts/si2_k_converged.png b/andrewsalij/Scripts/si2_k_converged.png new file mode 100644 index 0000000000000000000000000000000000000000..111eb068887aeabafd779ef947dd1463e93ed825 GIT binary patch literal 22852 zcmeFZX*gDG`#!u3A@fYgl#tBxJY+~BQJLqlWX?Qfo ^)M2gHZBr?w= z={?q^o~QfyJ-`3<|L}fzKfL$0-CNPR)^)CPo#%1v`+n@l8FT*JX%a#PLIgob&Zw*C zA_#Ucf?$mk;K6UidPcs$A5tEw1|An&>^!_J-E9#qOAl8^7Z1lPR;*sO?$@rkIE(O0 z@(c5_UiR>Cy(TRn;PkHx_+8xX1z3OVH^EH~yQ&*rLl81c^na{uh38ig#Gv?$iqb`& z)WuO>lZ(^)_$%E<6!CEJA}pzJbtqg_uQgKMr9Mj(R5@a7G-Rch9Pz2vN2J_@r~hjC zre22c$0~ lXS8J9;Dr{ 5SE-o%SMfjx1 zv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zrkj9>sCsc5<(MAQrnR;p4732rF|IL(M&t=Nz5taEig-mtN(Q&94ME-j@e;tB-Of!k z;Q)SuAzjhYQn9I$#MR_D26_suhxAccH<7Tx(4+HUCpAKkh#=Tyka~DC@gQPa1K)(+ zUJkTik7gFYU?ik6; g! z4aGy~S!qw7JwuPCK!Nq#yA0D}t3znU<1;QB2Qw((AyM=+0Z{T7On-nD>V{4fNEYbj zw^CE%yvKa;;ba_F509o;f!EOh3>~4(5NI_zz_EaJE%@=>?Dh&ILXcy^fyY2&IFg;# z&IkgH{i8ryh}_Wi(u|(720xayJ8eSu7fdY3z;xi&K#e3Qqb;xb{F^QTCu>~Uiw7n1 zFr;>vY_#7aIySZu6}6#ng??#iNi9g6UDyd4281V v{Bb7w5(A;#*6|EJq5in ztsn>DJoe&V1|E&lK|yHrLQhFT!3KI9$K*DEWTq;w#T$^hWH;U`Z<@tMN7qBZjfX%> zd{mnHm|9#tWC%E=V)% $H^ISIXzLCeG_C;5i@0|WRP-u9NvI(fo#-$;l2c#? z0dwtLzj+j~q3Sl!9_ZgkbDeRSHJpqH2nRju2pSTb;an =+@4q9qA-tfG<+!6?Z9URMCZ93rW>|Ia`NZc%oI>wkW;FzYkn UY0bBRCmJ(&y85}Sb4q9e0J7U0qW}N^ literal 0 HcmV?d00001 diff --git a/andrewsalij/convergence_tracker.py b/andrewsalij/convergence_tracker.py index fd9ebfee..5a069e8d 100644 --- a/andrewsalij/convergence_tracker.py +++ b/andrewsalij/convergence_tracker.py @@ -1,5 +1,5 @@ import copy - +import matplotlib.pyplot as plt import numpy as np import warnings import os @@ -156,5 +156,35 @@ def _clean_k_array_string(k_array_string, for char in char_list_to_remove: k_array_string = k_array_string.replace(char,"") return k_array_string + def make_report_figure(self,filename,output_directory = None,x_axis_type = "iteration_number",x_label = "Convergence Iteration",y_label = "Energy (Ry)", + plot_params = {},to_show = True): + ''' + Creates basic report figure for k point convergence testing. Plot parameters may be + overridden via matplotlib.pyplot.rcParams.update() + ''' + fig, ax = plt.subplots() + if output_directory is not None: + full_filename = os.sep.join((output_directory,filename)) + else:full_filename = filename + n_its = len(self.convergence_energy_list) + iteration_array = np.linspace(1, n_its, n_its) + energy_array = np.array(self.convergence_energy_list) + ax.plot(iteration_array,energy_array,**plot_params) + ax.set_ylabel(y_label) + ax.set_xlabel(x_label) + if (x_axis_type == "iteration_number"): + #No additional functionality at present--kept for case switching + dummy_var = None + elif (x_axis_type == "convergence_parameter"): + x_ticks = ax.get_xticks()[1:-1]# removing edge indices that give left and right bounds of axis + x_labels = self.convergence_parameter_list + x_tick_indices = (x_ticks-1).astype(int) #shifting index from iteration 1 to pythonic 0 + x_labels_subset = [x_labels[idx] for idx in list(x_tick_indices)] + ax.set_xticks(x_ticks,labels = x_labels_subset) + else: + ValueError("Invalid x_axis_type: "+str(x_axis_type)) + + fig.savefig(full_filename) + if to_show: fig.show() From e28871aa3624bf27d3ffcc62aa5002e6bc1ffc5e Mon Sep 17 00:00:00 2001 From: Andrew Salij Date: Thu, 15 Feb 2024 17:19:15 -0600 Subject: [PATCH 09/15] test second suite of convergence tests calculations for Os4Ru MoS2_2D Graphene_2D Some minor bugfixes for report figure also docs for full test suite --- andrewsalij/Convergence-Tracker.md | 27 ++++++++++++++++-- .../Graphene_2D/graphene_2d_k_converged.png | Bin 0 -> 22296 bytes .../Scripts/Graphene_2D/run_sweep_graphene.py | 21 ++++++++++++++ .../Scripts/MoS2_2D/mos2_2d_k_converged.png | Bin 0 -> 23118 bytes andrewsalij/Scripts/MoS2_2D/run_sweep.py | 21 ++++++++++++++ .../Scripts/Os4Ru/os4ru_k_converged.png | Bin 0 -> 29128 bytes andrewsalij/Scripts/Os4Ru/run_sweep.py | 21 ++++++++++++++ .../Scripts/{ => Si2}/run_si2_sweep.py | 0 .../Scripts/{ => Si2}/si2_k_converged.png | Bin .../convergence_tracker.cpython-310.pyc | Bin 3514 -> 7588 bytes andrewsalij/convergence_tracker.py | 15 ++++++---- 11 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 andrewsalij/Scripts/Graphene_2D/graphene_2d_k_converged.png create mode 100644 andrewsalij/Scripts/Graphene_2D/run_sweep_graphene.py create mode 100644 andrewsalij/Scripts/MoS2_2D/mos2_2d_k_converged.png create mode 100644 andrewsalij/Scripts/MoS2_2D/run_sweep.py create mode 100644 andrewsalij/Scripts/Os4Ru/os4ru_k_converged.png create mode 100644 andrewsalij/Scripts/Os4Ru/run_sweep.py rename andrewsalij/Scripts/{ => Si2}/run_si2_sweep.py (100%) rename andrewsalij/Scripts/{ => Si2}/si2_k_converged.png (100%) diff --git a/andrewsalij/Convergence-Tracker.md b/andrewsalij/Convergence-Tracker.md index 51871fc0..51e55bb9 100644 --- a/andrewsalij/Convergence-Tracker.md +++ b/andrewsalij/Convergence-Tracker.md @@ -11,12 +11,33 @@ pip install pydantic Tests have been run on a variety of materials, whose provenance is below: -Materials Project (DOI 10.17188/1190959) +Materials Project (DOI: doi:10.1063/1.4812323) (CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) -Si2 (mp-149) +Si2 (mp-149) (DOI 10.17188/1190959) + +Materials Cloud three-dimensional crystals database (MC3D) +(CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) +DOI:10.24435/materialscloud:rw-t0 + +GaN (mc3d-3763/pbe) +BN (mc3d-13290/pbe) +O4Ru2 (mc3d-1930/pbe) +Br4Ca2 (mc3d-30836/pbe) +Cs2La2Te6Zn2 (mc3d-11071/pbe) +C2Ce2Os4P2 (mc3d-10335/pbe) + +Materials Cloud two-dimensional crystals database (MC2D) +(CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) +DOI:10.24435/materialscloud:az-b2 +DOI:10.24435/materialscloud:36-nd + +C (graphene, from graphite exfoliation) (https://www.materialscloud.org/discover/mc2d/details/C, graphite (2H) initial) +MoS2 (https://www.materialscloud.org/discover/mc2d/details/MoS2-MoS2) +AgCO2 (https://www.materialscloud.org/discover/mc2d/details/AgCO2) + Pseudopotentials Tested: -NC SR 0.4.1 from Pseudo Dojo +PBEsol (standard accuracy) NC SR ONCVPSP 0.4.1 from Pseudo Dojo Paper: 10.1016/j.cpc.2018.01.012 arxiv preprint Method Paper: 10.1103/PhysRevB.88.085117 License: (CC-BY 4.0, https://creativecommons.org/licenses/by/4.0/legalcode) diff --git a/andrewsalij/Scripts/Graphene_2D/graphene_2d_k_converged.png b/andrewsalij/Scripts/Graphene_2D/graphene_2d_k_converged.png new file mode 100644 index 0000000000000000000000000000000000000000..3aac987432ca77bdcbf6bbf27a3fd6c69b21cd4a GIT binary patch literal 22296 zcmb@u1yojD*DkyP5k(Ob6e$&vP*GZ15eWsP8x)joxG5 p}pgM+lQF!eS2$jD|>SjeMX0ewss~~mRy(lFLPdG zG`6?5wiDpsu=w`{m#u7#I2bo~zQaTITT5x!VHo9o^gmIOXrc**sXmv!d0p8lV!GGa zNqM-pV*U|x&4WlLF)HFS_x;bmytqF;CRp~_YaDxa&d=Y(64%-9vavjgd3mBmHTz>4 z@oTD0syuz~7=10$hsWMt+DHE7*{6r{jNK8depg5yGci2~=q!z%47*+b%eij7_RRZk zyQm)zPI{ez#;hI8!XJRYV$EkUVmLfW%!py0erNtq59S?lM19qUS*%=KN`r%goS}Ep zFOy-I(~)mil<(e+SzB`otz9mQmc-1NLPJAkq@=8Ir!cJCo9>$J%`~mNbVotrd*}93 zQidq6lNsb_>S$A7*c|iv`Z~JwkI%+gjQ8lKfgZk92HS&SKEG{?La*+Ff0b7r#)vS? z^&rvV|EmWLB&WPSwDZw7k$7xs7W|0+`!y$tW60psG*^C{ar<;msk_NeTjvlo^vWJF z%HV*L=cT)BUt;?(Y~lqr_F;<1dh$N%-XsR%m=`j#DF;0T-G8cRJg@!H3L_wY16#T~ zt@(_VlS#~|+Po_=bauiP#)9k&=E9QI8K-OEbnqZN$`2d+QnyU<%faS6d|}{WOjv!w z`P^fQZ`L+Ea6-w+4eQCZ2=_X8>f_I!Qao0D+Q*ph+`WJQeq^_N1iu1vptQ%<5X0$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