diff --git a/pyxtal/interface/LATTE_templates/LATTE_DOUBLE b/pyxtal/interface/LATTE_templates/LATTE_DOUBLE new file mode 100755 index 00000000..2f599a8a Binary files /dev/null and b/pyxtal/interface/LATTE_templates/LATTE_DOUBLE differ diff --git a/pyxtal/interface/LATTE_templates/MDcontroller b/pyxtal/interface/LATTE_templates/MDcontroller new file mode 100644 index 00000000..1806fc3b --- /dev/null +++ b/pyxtal/interface/LATTE_templates/MDcontroller @@ -0,0 +1,18 @@ +MAXITER= 1000 +UDNEIGH= 25 +DT= 0.25 +TEMPERATURE= 300.0 RNDIST= GAUSSIAN SEEDINIT= UNIFORM +DUMPFREQ= 250 +RSFREQ= 5000 +WRTFREQ= 20 +TOINITTEMP5= 1 +THERMPER= 500 +THERMRUN= 100000 +NVTON= 5 NPTON= 0 AVEPER= 1000 FRICTION= 1000.0 SEED= 54 +PTARGET= 1.0 NPTTYPE= ISO +SHOCKON= 0 +SHOCKSTART= 100000 +SHOCKDIR= 1 +UPARTICLE= 500.0 USHOCK= -4590.0 C0= 1300.0 +MDADAPT= 0 +GETHUG= 0 E0= -1439.76 V0= 2959.6056192814552 P0= 0.128777 diff --git a/pyxtal/interface/LATTE_templates/TBparam/bondints.nonortho b/pyxtal/interface/LATTE_templates/TBparam/bondints.nonortho new file mode 100644 index 00000000..3ba9307d --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/bondints.nonortho @@ -0,0 +1,36 @@ +Noints= 34 +Element1 Element2 Kind H0 B1 B2 B3 B4 B5 R1 Rcut H0 B1 B2 B3 B4 B5 R1 Rcut +C C sss -8.934050 -1.604058 -0.520371 0.000000 -0.000000 1.400000 5.000000 5.500000 0.343720 -1.488604 -0.487281 0.055159 -0.006759 1.400000 5.000000 5.500000 +C C sps 8.391509 -0.864267 -0.747101 0.000000 -0.000000 1.400000 5.000000 5.500000 -0.390127 -0.988150 -0.742529 0.192232 -0.038713 1.400000 5.000000 5.500000 +C C pps 6.395707 -0.707833 -0.504416 0.000000 -0.000000 1.400000 5.000000 5.500000 -0.333411 0.070281 -1.873111 1.001934 -0.248703 1.400000 5.000000 5.500000 +C C ppp -3.517340 -1.883201 -0.077008 0.000000 -0.000000 1.400000 5.000000 5.500000 0.209485 -1.849528 -0.382195 0.041854 -0.007993 1.400000 5.000000 5.500000 +N N sss -5.707074 -2.306020 -0.273939 0.000000 -0.000000 1.500000 5.000000 5.500000 0.214793 -1.922919 -0.484915 0.079605 -0.016140 1.500000 5.000000 5.500000 +N N sps 7.549866 -1.456625 -0.462899 0.000000 -0.000000 1.500000 5.000000 5.500000 -0.280782 -1.461806 -0.658868 0.184148 -0.045965 1.500000 5.000000 5.500000 +N N pps 6.497746 -1.294480 -0.324354 0.000000 -0.000000 1.500000 5.000000 5.500000 -0.284850 -0.696498 -1.300096 0.709604 -0.206469 1.500000 5.000000 5.500000 +N N ppp -2.740779 -2.249729 -0.096116 0.000000 -0.000000 1.500000 5.000000 5.500000 0.127020 -2.153332 -0.355743 0.037623 -0.008967 1.500000 5.000000 5.500000 +O O sss -14.937277 -1.614961 -0.339180 0.000000 -0.000000 1.200000 5.000000 5.500000 0.282381 -1.963517 -0.596227 0.127360 -0.025179 1.200000 5.000000 5.500000 +O O sps 13.700053 -1.854109 -0.332985 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.344630 -1.366777 -0.834614 0.247931 -0.052705 1.200000 5.000000 5.500000 +O O pps 9.001815 -1.460299 -0.268820 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.290473 -0.248901 -1.733179 0.798610 -0.182073 1.200000 5.000000 5.500000 +O O ppp -5.107343 -2.099762 -0.046522 0.000000 -0.000000 1.200000 5.000000 5.500000 0.178501 -2.194056 -0.388997 0.045256 -0.009246 1.200000 5.000000 5.500000 +C O sss -11.005303 -1.978634 -0.454607 0.000000 -0.000000 1.200000 5.000000 5.500000 0.363767 -1.567417 -0.578872 0.096984 -0.015546 1.200000 5.000000 5.500000 +C O sps 9.800910 -1.179193 -0.394262 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.359462 -0.857862 -0.926813 0.267938 -0.050923 1.200000 5.000000 5.500000 +O C sps 13.727062 -1.387462 -0.346539 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.442630 -1.081792 -0.815689 0.217586 -0.042192 1.200000 5.000000 5.500000 +C O pps 8.337188 -0.888428 -0.493834 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.298197 0.340651 -2.095903 0.981487 -0.212677 1.200000 5.000000 5.500000 +C O ppp -5.023209 -2.142009 -0.109942 0.000000 -0.000000 1.200000 5.000000 5.500000 0.230948 -1.917887 -0.404058 0.047634 -0.008733 1.200000 5.000000 5.500000 +C N sss -7.016284 -2.145166 -0.493367 0.000000 -0.000000 1.500000 5.000000 5.500000 0.253524 -1.742054 -0.483621 0.066958 -0.011254 1.500000 5.000000 5.500000 +C N sps 7.729578 -1.402928 -0.674396 0.000000 -0.000000 1.500000 5.000000 5.500000 -0.302838 -1.236485 -0.697479 0.192271 -0.044565 1.500000 5.000000 5.500000 +N C sps 8.383196 -1.502518 -0.426192 0.000000 -0.000000 1.500000 5.000000 5.500000 -0.327300 -1.337970 -0.658645 0.172226 -0.040512 1.500000 5.000000 5.500000 +C N pps 6.152442 -0.943910 -0.495091 0.000000 -0.000000 1.500000 5.000000 5.500000 -0.306999 -0.484299 -1.437805 0.801708 -0.226829 1.500000 5.000000 5.500000 +C N ppp -2.854177 -2.054023 -0.102927 0.000000 -0.000000 1.500000 5.000000 5.500000 0.148675 -2.034035 -0.364707 0.038393 -0.008457 1.500000 5.000000 5.500000 +N O sss -9.800110 -2.389434 -0.427942 0.000000 -0.000000 1.200000 5.000000 5.500000 0.322615 -1.772266 -0.584180 0.113994 -0.020655 1.200000 5.000000 5.500000 +N O sps 10.697957 -1.408732 -0.530055 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.357853 -1.133974 -0.870166 0.257093 -0.051703 1.200000 5.000000 5.500000 +O N sps 11.422880 -1.038934 -0.320181 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.393584 -1.223014 -0.820414 0.233193 -0.047389 1.200000 5.000000 5.500000 +N O pps 8.884051 -1.188542 -0.400780 0.000000 -0.000000 1.200000 5.000000 5.500000 -0.298451 0.023080 -1.883157 0.874215 -0.193692 1.200000 5.000000 5.500000 +N O ppp -4.735483 -2.221835 -0.071803 0.000000 -0.000000 1.200000 5.000000 5.500000 0.204625 -2.055114 -0.392109 0.047073 -0.009193 1.200000 5.000000 5.500000 +H C sss -9.355801 -1.312466 -0.697473 0.000000 -0.000000 1.100000 5.000000 5.500000 0.402044 -1.504587 -0.627071 0.078410 -0.009699 1.100000 5.000000 5.500000 +H C sps 7.623792 -0.970945 -0.448309 0.000000 -0.000000 1.100000 5.000000 5.500000 -0.483327 -0.960315 -0.992701 0.385761 -0.110502 1.100000 5.000000 5.500000 +H N sss -11.722444 -1.503544 -0.624941 0.000000 -0.000000 1.000000 5.000000 5.500000 0.428682 -1.583978 -0.681399 0.106288 -0.016236 1.000000 5.000000 5.500000 +H N sps 9.348231 -1.216607 -0.426100 0.000000 -0.000000 1.000000 5.000000 5.500000 -0.481404 -0.890317 -1.126260 0.448262 -0.119891 1.000000 5.000000 5.500000 +H O sss -11.247450 -1.784903 -0.510711 0.000000 -0.000000 1.000000 5.000000 5.500000 0.389257 -1.773934 -0.716854 0.121158 -0.021296 1.000000 5.000000 5.500000 +H O sps 9.307728 -1.303985 -0.383430 0.000000 -0.000000 1.000000 5.000000 5.500000 -0.433289 -1.029012 -1.143228 0.460892 -0.129739 1.000000 5.000000 5.500000 +H H sss -9.160773 -1.160165 -0.468804 0.000000 -0.000000 0.750000 5.000000 5.500000 0.561801 -1.452310 -0.815589 0.090827 -0.015928 0.750000 5.000000 5.500000 diff --git a/pyxtal/interface/LATTE_templates/TBparam/control.in b/pyxtal/interface/LATTE_templates/TBparam/control.in new file mode 100644 index 00000000..ce29625d --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/control.in @@ -0,0 +1,42 @@ +Control= 1 +BASISTYPE= NONORTHO +SCLTYPE= EXP +DEBUGON= 0 +FERMIM= 6 +CGORLIB= 1 CGTOL= 1.0e-6 +KBT= 0.2 +NORECS= 1 +ENTROPYKIND= 1 +PPOTON= 1 PLUSDON= 1 +SPINON= 0 SPINTOL= 1.0e-6 +ELECTRO= 1 ELECMETH= 0 ELEC_ETOL= 0.001 ELEC_QTOL= 1.0e-6 +COULACC= 1.0e-6 COULCUT= 12.0 COULR1= 50.0 +MAXSCF= 100 +BREAKTOL= 1.0E-6 MINSP2ITER= 22 SP2CONV= REL +FULLQCONV= 1 QITER= 2 +QMIX= 0.05 SPINMIX= 0.1 MDMIX= 0.125 +ORDERNMOL= 0 +SPARSEON= 0 THRESHOLDON= 1 NUMTHRESH= 1.0e-6 FILLINSTOP= 100 BLKSZ= 4 +MSPARSE= 3000 +LCNON= 0 LCNITER= 4 CHTOL= 0.01 +SKIN= 1.0 +RELAX= 1 RELAXTYPE= SD MAXITER= 30 RLXFTOL= 0.100 +MDON= 0 +PBCON= 1 +RESTART= 0 +CHARGE= 0 +XBO= 1 +XBODISON= 1 +XBODISORDER= 5 +NGPU= 1 +KON= 0 +COMPFORCE= 1 +DOSFIT= 0 INTS2FIT= 1 BETA= 1000.0 NFITSTEP= 5000 QFIT= 0 MCSIGMA= 0.2 +PPFITON= 0 +ALLFITON= 0 +PPSTEP= 500 BISTEP= 500 PP2FIT= 2 BINT2FIT= 6 +PPBETA= 1000.0 PPSIGMA= 0.01 PPNMOL= 10 PPNGEOM= 200 +PARREP= 0 +ER= 1.0 +NVTON=5 +RSFREQ= 1000 diff --git a/pyxtal/interface/LATTE_templates/TBparam/control.in.bak b/pyxtal/interface/LATTE_templates/TBparam/control.in.bak new file mode 100644 index 00000000..bbe508ef --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/control.in.bak @@ -0,0 +1,45 @@ +Control= 1 +BASISTYPE= NONORTHO +SCLTYPE= EXP +DEBUGON= 0 +FERMIM= 6 +CGORLIB= 1 CGTOL= 1.0e-6 +KBT= 0.2 +NORECS= 1 +ENTROPYKIND= 1 +PPOTON= 1 PLUSDON= 1 +SPINON= 0 SPINTOL= 1.0e-6 +ELECTRO= 1 ELECMETH= 0 ELEC_ETOL= 0.001 ELEC_QTOL= 1.0e-6 +COULACC= 1.0e-6 COULCUT= 12.0 COULR1= 50.0 +MAXSCF= 100 +BREAKTOL= 1.0E-6 MINSP2ITER= 22 SP2CONV= REL +FULLQCONV= 1 QITER= 2 +QMIX= 0.05 SPINMIX= 0.1 MDMIX= 0.125 +ORDERNMOL= 0 +SPARSEON= 0 THRESHOLDON= 1 NUMTHRESH= 1.0e-6 FILLINSTOP= 100 BLKSZ= 4 +MSPARSE= 3000 +LCNON= 0 LCNITER= 4 CHTOL= 0.01 +SKIN= 1.0 +RELAX=1 +MDON= 0 +PBCON= 1 +RESTART=1 +CHARGE= 0 +XBO= 1 +XBODISON= 1 +XBODISORDER= 5 +NGPU= 1 +KON= 0 +COMPFORCE= 1 +DOSFIT= 0 INTS2FIT= 1 BETA= 1000.0 NFITSTEP= 5000 QFIT= 0 MCSIGMA= 0.2 +PPFITON= 0 +ALLFITON= 0 +PPSTEP= 500 BISTEP= 500 PP2FIT= 2 BINT2FIT= 6 +PPBETA= 1000.0 PPSIGMA= 0.01 PPNMOL= 10 PPNGEOM= 200 +PARREP= 0 +ER= 1.0 +NVTON=5 + +# --- Appended by LATTECalc --- +MAXITER=300 +RLXFTOL=1.0E-03 diff --git a/pyxtal/interface/LATTE_templates/TBparam/electrons.dat b/pyxtal/interface/LATTE_templates/TBparam/electrons.dat new file mode 100644 index 00000000..bedd4f2b --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/electrons.dat @@ -0,0 +1,6 @@ +Noelem= 4 +Element basis Numel Es Ep Ed Ef Mass HubbardU Wss Wpp Wdd Wff +N sp 5.000000 -18.543798 -7.862407 0.000000 0.000000 14.006700 17.053958 0.000000 -0.6934 0.000000 0.000000 +H s 1.000000 -6.237968 0.000000 0.000000 0.000000 1.007900 13.684855 -2.23400 0.000000 0.000000 0.000000 +C sp 4.000000 -13.736556 -4.748938 0.000000 0.000000 12.010000 10.522540 0.000000 -0.618100 0.000000 0.000000 +O sp 6.000000 -23.833752 -9.645001 0.000000 0.000000 15.999400 14.443874 0.000000 -0.757650 0.000000 0.000000 diff --git a/pyxtal/interface/LATTE_templates/TBparam/ppots.nonortho b/pyxtal/interface/LATTE_templates/TBparam/ppots.nonortho new file mode 100644 index 00000000..5bdd251e --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/ppots.nonortho @@ -0,0 +1,12 @@ +Nopps= 10 +Ele1 Ele2 A0 A1 A2 A3 A4 A5 A6 C R1 Rcut +N O 0.585174 -13.630616 -16.729136 -16.589565 0.000000 1.200000 0.000000 0.000000 2.000000 2.500000 +C N 0.148562 -13.512681 -14.280038 -9.118015 0.000000 1.500000 0.000000 0.000000 2.000000 2.500000 +N N 0.032636 -18.399587 -19.546888 -10.810899 0.000000 1.500000 0.000000 0.000000 2.000000 2.500000 +C O 1.670258 -9.549889 -10.137473 -12.295289 0.000000 1.200000 0.000000 0.000000 2.000000 2.500000 +C C 0.309908 -13.092197 -15.134245 -10.913844 0.000000 1.400000 0.000000 0.000000 2.000000 2.500000 +O O 2.572927 -7.103864 -6.904440 -12.090310 0.000000 1.200000 0.000000 0.000000 2.000000 2.500000 +N H 0.968008 -8.760215 -8.873476 -11.230357 0.000000 1.000000 0.000000 0.000000 1.600000 2.000000 +O H 0.508863 -11.440143 -16.239463 -23.819501 0.000000 1.000000 0.000000 0.000000 1.600000 2.000000 +C H 0.206824 -14.019158 -21.991607 -25.118148 0.000000 1.100000 0.000000 0.000000 1.600000 2.000000 +H H 0.204732 -16.086792 -24.718534 0.000000 0.000000 0.750000 0.000000 0.000000 1.200000 1.400000 diff --git a/pyxtal/interface/LATTE_templates/TBparam/ppotsplusD.nonortho b/pyxtal/interface/LATTE_templates/TBparam/ppotsplusD.nonortho new file mode 100644 index 00000000..54a6d4f1 --- /dev/null +++ b/pyxtal/interface/LATTE_templates/TBparam/ppotsplusD.nonortho @@ -0,0 +1,10 @@ +noppd= 4 +s6= 1.0384807055937466 +ganna= 23.000000000000000 +rcut= 12.0 +ppele r0 c6 +C 1.981760173 17.100000000 +H 1.282315406 1.660000000 +N 1.806898982 11.500000000 +O 1.771926743 7.200000000 + diff --git a/pyxtal/interface/LATTE_templates/alpha_match.cif b/pyxtal/interface/LATTE_templates/alpha_match.cif new file mode 100644 index 00000000..095b913d --- /dev/null +++ b/pyxtal/interface/LATTE_templates/alpha_match.cif @@ -0,0 +1,89 @@ +############################################################# +# ______ _ _ _ # +# (_____ \ \ \ / / | | # +# _____) ) _ \ \/ / |_ ____| | # +# | ____/ | | | ) (| _)/ _ | | # +# | | | |_| |/ /\ \ |_( (_| | |___ # +# |_| \__ /_/ \_\___)__|_|_____) # +# (____/ # +#---------------------(version 1.1.0)--------------------# +# A Python package for random crystal generation # +# url: https://github.com/qzhu2017/pyxtal # +# @Zhu's group at University of Nevada Las Vegas # +############################################################# +data_1-d0.770-spg77-e24.076 + +_symmetry_space_group_name_H-M 'P42' +_symmetry_Int_Tables_number 77 +_symmetry_cell_setting tetragonal +_cell_length_a 22.272039 +_cell_length_b 22.272039 +_cell_length_c 7.349282 +_cell_angle_alpha 90.000000 +_cell_angle_beta 90.000000 +_cell_angle_gamma 90.000000 +_cell_volume 3645.565192 + +loop_ + _symmetry_equiv_pos_site_id + _symmetry_equiv_pos_as_xyz +1 'x, y, z' +2 '-x, -y, z' +3 '-y, x, z+1/2' +4 'y, -x, z+1/2' + +loop_ + _atom_site_label + _atom_site_type_symbol + _atom_site_symmetry_multiplicity + _atom_site_fract_x + _atom_site_fract_y + _atom_site_fract_z + _atom_site_occupancy +O O 4 0.961000 0.637000 0.187000 1 +C C 4 0.909000 0.654000 0.187000 1 +N N 4 0.874000 0.666000 0.039000 1 +C C 4 0.817000 0.686000 0.093000 1 +C C 4 0.768000 0.706000 -0.009000 1 +C C 4 0.718000 0.727000 0.090000 1 +C C 4 0.718000 0.727000 0.284000 1 +C C 4 0.768000 0.706000 0.383000 1 +C C 4 0.817000 0.687000 0.282000 1 +N N 4 0.874000 0.666000 0.336000 1 +C C 4 0.660000 0.751000 0.369000 1 +C C 4 0.610000 0.712000 0.284000 1 +C C 4 0.569000 0.677000 0.383000 1 +C C 4 0.529000 0.643000 0.281000 1 +N N 4 0.487000 0.599000 0.335000 1 +C C 4 0.463000 0.570000 0.187000 1 +O O 4 0.431000 0.526000 0.187000 1 +N N 4 0.487000 0.599000 0.039000 1 +C C 4 0.529000 0.643000 0.093000 1 +C C 4 0.569000 0.677000 -0.009000 1 +C C 4 0.610000 0.712000 0.090000 1 +C C 4 0.660000 0.751000 0.006000 1 +C C 4 0.652000 0.813000 0.091000 1 +C C 4 0.647000 0.867000 -0.009000 1 +C C 4 0.642000 0.920000 0.093000 1 +N N 4 0.640000 0.981000 0.039000 1 +C C 4 0.640000 1.018000 0.187000 1 +O O 4 0.641000 1.073000 0.187000 1 +N N 4 0.640000 0.981000 0.336000 1 +C C 4 0.642000 0.920000 0.282000 1 +C C 4 0.647000 0.867000 0.383000 1 +C C 4 0.652000 0.813000 0.284000 1 +H H 4 0.887000 0.659000 -0.092000 1 +H H 4 0.769000 0.706000 -0.156000 1 +H H 4 0.769000 0.706000 0.531000 1 +H H 4 0.887000 0.659000 0.466000 1 +H H 4 0.660000 0.751000 0.518000 1 +H H 4 0.569000 0.676000 0.530000 1 +H H 4 0.481000 0.585000 0.466000 1 +H H 4 0.481000 0.585000 -0.092000 1 +H H 4 0.569000 0.676000 -0.156000 1 +H H 4 0.660000 0.751000 -0.143000 1 +H H 4 0.648000 0.868000 -0.156000 1 +H H 4 0.639000 0.995000 -0.092000 1 +H H 4 0.639000 0.995000 0.466000 1 +H H 4 0.648000 0.868000 0.531000 1 +#END diff --git a/pyxtal/interface/LATTE_templates/bl/inputblock.dat b/pyxtal/interface/LATTE_templates/bl/inputblock.dat new file mode 100644 index 00000000..755a8229 --- /dev/null +++ b/pyxtal/interface/LATTE_templates/bl/inputblock.dat @@ -0,0 +1,188 @@ +184 + 22.2720390000 0.0000000000 0.0000000000 + 0.0000000000 22.2720390000 0.0000000000 + 0.0000000000 0.0000000000 7.3492820000 +O 21.4034294790 14.1872888430 1.3743157340 +O 0.8686095210 8.0847501570 1.3743157340 +O 8.0847501570 21.4034294790 5.0489567340 +O 14.1872888430 0.8686095210 5.0489567340 +C 20.2452834510 14.5659135060 1.3743157340 +C 2.0267555490 7.7061254940 1.3743157340 +C 7.7061254940 20.2452834510 5.0489567340 +C 14.5659135060 2.0267555490 5.0489567340 +N 19.4657620860 14.8331779740 0.2866219980 +N 2.8062769140 7.4388610260 0.2866219980 +N 7.4388610260 19.4657620860 3.9612629980 +N 14.8331779740 2.8062769140 3.9612629980 +C 18.1962558630 15.2786187540 0.6834832260 +C 4.0757831370 6.9934202460 0.6834832260 +C 6.9934202460 18.1962558630 4.3581242260 +C 15.2786187540 4.0757831370 4.3581242260 +C 17.1049259520 15.7240595340 7.2831384620 +C 5.1671130480 6.5479794660 7.2831384620 +C 6.5479794660 17.1049259520 3.6084974620 +C 15.7240595340 5.1671130480 3.6084974620 +C 15.9913240020 16.1917723530 0.6614353800 +C 6.2807149980 6.0802666470 0.6614353800 +C 6.0802666470 15.9913240020 4.3360763800 +C 16.1917723530 6.2807149980 4.3360763800 +C 15.9913240020 16.1917723530 2.0871960880 +C 6.2807149980 6.0802666470 2.0871960880 +C 6.0802666470 15.9913240020 5.7618370880 +C 16.1917723530 6.2807149980 5.7618370880 +C 17.1049259520 15.7240595340 2.8147750060 +C 5.1671130480 6.5479794660 2.8147750060 +C 6.5479794660 17.1049259520 6.4894160060 +C 15.7240595340 5.1671130480 6.4894160060 +C 18.1962558630 15.3008907930 2.0724975240 +C 4.0757831370 6.9711482070 2.0724975240 +C 6.9711482070 18.1962558630 5.7471385240 +C 15.3008907930 4.0757831370 5.7471385240 +N 19.4657620860 14.8331779740 2.4693587520 +N 2.8062769140 7.4388610260 2.4693587520 +N 7.4388610260 19.4657620860 6.1439997520 +N 14.8331779740 2.8062769140 6.1439997520 +C 14.6995457400 16.7263012890 2.7118850580 +C 7.5724932600 5.5457377110 2.7118850580 +C 5.5457377110 14.6995457400 6.3865260580 +C 16.7263012890 7.5724932600 6.3865260580 +C 13.5859437900 15.8576917680 2.0871960880 +C 8.6860952100 6.4143472320 2.0871960880 +C 6.4143472320 13.5859437900 5.7618370880 +C 15.8576917680 8.6860952100 5.7618370880 +C 12.6727901910 15.0781704030 2.8147750060 +C 9.5992488090 7.1938685970 2.8147750060 +C 7.1938685970 12.6727901910 6.4894160060 +C 15.0781704030 9.5992488090 6.4894160060 +C 11.7819086310 14.3209210770 2.0651482420 +C 10.4901303690 7.9511179230 2.0651482420 +C 7.9511179230 11.7819086310 5.7397892420 +C 14.3209210770 10.4901303690 5.7397892420 +N 10.8464829930 13.3409513610 2.4620094700 +N 11.4255560070 8.9310876390 2.4620094700 +N 8.9310876390 10.8464829930 6.1366504700 +N 13.3409513610 11.4255560070 6.1366504700 +C 10.3119540570 12.6950622300 1.3743157340 +C 11.9600849430 9.5769767700 1.3743157340 +C 9.5769767700 10.3119540570 5.0489567340 +C 12.6950622300 11.9600849430 5.0489567340 +O 9.5992488090 11.7150925140 1.3743157340 +O 12.6727901910 10.5569464860 1.3743157340 +O 10.5569464860 9.5992488090 5.0489567340 +O 11.7150925140 12.6727901910 5.0489567340 +N 10.8464829930 13.3409513610 0.2866219980 +N 11.4255560070 8.9310876390 0.2866219980 +N 8.9310876390 10.8464829930 3.9612629980 +N 13.3409513610 11.4255560070 3.9612629980 +C 11.7819086310 14.3209210770 0.6834832260 +C 10.4901303690 7.9511179230 0.6834832260 +C 7.9511179230 11.7819086310 4.3581242260 +C 14.3209210770 10.4901303690 4.3581242260 +C 12.6727901910 15.0781704030 7.2831384620 +C 9.5992488090 7.1938685970 7.2831384620 +C 7.1938685970 12.6727901910 3.6084974620 +C 15.0781704030 9.5992488090 3.6084974620 +C 13.5859437900 15.8576917680 0.6614353800 +C 8.6860952100 6.4143472320 0.6614353800 +C 6.4143472320 13.5859437900 4.3360763800 +C 15.8576917680 8.6860952100 4.3360763800 +C 14.6995457400 16.7263012890 0.0440956920 +C 7.5724932600 5.5457377110 0.0440956920 +C 5.5457377110 14.6995457400 3.7187366920 +C 16.7263012890 7.5724932600 3.7187366920 +C 14.5213694280 18.1071677070 0.6687846620 +C 7.7506695720 4.1648712930 0.6687846620 +C 4.1648712930 14.5213694280 4.3434256620 +C 18.1071677070 7.7506695720 4.3434256620 +C 14.4100092330 19.3098578130 7.2831384620 +C 7.8620297670 2.9621811870 7.2831384620 +C 2.9621811870 14.4100092330 3.6084974620 +C 19.3098578130 7.8620297670 3.6084974620 +C 14.2986490380 20.4902758800 0.6834832260 +C 7.9733899620 1.7817631200 0.6834832260 +C 1.7817631200 14.2986490380 4.3581242260 +C 20.4902758800 7.9733899620 4.3581242260 +N 14.2541049600 21.8488702590 0.2866219980 +N 8.0179340400 0.4231687410 0.2866219980 +N 0.4231687410 14.2541049600 3.9612629980 +N 21.8488702590 8.0179340400 3.9612629980 +C 14.2541049600 0.4008967020 1.3743157340 +C 8.0179340400 21.8711422980 1.3743157340 +C 21.8711422980 14.2541049600 5.0489567340 +C 0.4008967020 8.0179340400 5.0489567340 +O 14.2763769990 1.6258588470 1.3743157340 +O 7.9956620010 20.6461801530 1.3743157340 +O 20.6461801530 14.2763769990 5.0489567340 +O 1.6258588470 7.9956620010 5.0489567340 +N 14.2541049600 21.8488702590 2.4693587520 +N 8.0179340400 0.4231687410 2.4693587520 +N 0.4231687410 14.2541049600 6.1439997520 +N 21.8488702590 8.0179340400 6.1439997520 +C 14.2986490380 20.4902758800 2.0724975240 +C 7.9733899620 1.7817631200 2.0724975240 +C 1.7817631200 14.2986490380 5.7471385240 +C 20.4902758800 7.9733899620 5.7471385240 +C 14.4100092330 19.3098578130 2.8147750060 +C 7.8620297670 2.9621811870 2.8147750060 +C 2.9621811870 14.4100092330 6.4894160060 +C 19.3098578130 7.8620297670 6.4894160060 +C 14.5213694280 18.1071677070 2.0871960880 +C 7.7506695720 4.1648712930 2.0871960880 +C 4.1648712930 14.5213694280 5.7618370880 +C 18.1071677070 7.7506695720 5.7618370880 +H 19.7552985930 14.6772737010 6.6731480560 +H 2.5167404070 7.5947652990 6.6731480560 +H 7.5947652990 19.7552985930 2.9985070560 +H 14.6772737010 2.5167404070 2.9985070560 +H 17.1271979910 15.7240595340 6.2027940080 +H 5.1448410090 6.5479794660 6.2027940080 +H 6.5479794660 17.1271979910 2.5281530080 +H 15.7240595340 5.1448410090 2.5281530080 +H 17.1271979910 15.7240595340 3.9024687420 +H 5.1448410090 6.5479794660 3.9024687420 +H 6.5479794660 17.1271979910 0.2278277420 +H 15.7240595340 5.1448410090 0.2278277420 +H 19.7552985930 14.6772737010 3.4247654120 +H 2.5167404070 7.5947652990 3.4247654120 +H 7.5947652990 19.7552985930 7.0994064120 +H 14.6772737010 2.5167404070 7.0994064120 +H 14.6995457400 16.7263012890 3.8069280760 +H 7.5724932600 5.5457377110 3.8069280760 +H 5.5457377110 14.6995457400 0.1322870760 +H 16.7263012890 7.5724932600 0.1322870760 +H 12.6727901910 15.0558983640 3.8951194600 +H 9.5992488090 7.2161406360 3.8951194600 +H 7.2161406360 12.6727901910 0.2204784600 +H 15.0558983640 9.5992488090 0.2204784600 +H 10.7128507590 13.0291428150 3.4247654120 +H 11.5591882410 9.2428961850 3.4247654120 +H 9.2428961850 10.7128507590 7.0994064120 +H 13.0291428150 11.5591882410 7.0994064120 +H 10.7128507590 13.0291428150 6.6731480560 +H 11.5591882410 9.2428961850 6.6731480560 +H 9.2428961850 10.7128507590 2.9985070560 +H 13.0291428150 11.5591882410 2.9985070560 +H 12.6727901910 15.0558983640 6.2027940080 +H 9.5992488090 7.2161406360 6.2027940080 +H 7.2161406360 12.6727901910 2.5281530080 +H 15.0558983640 9.5992488090 2.5281530080 +H 14.6995457400 16.7263012890 6.2983346740 +H 7.5724932600 5.5457377110 6.2983346740 +H 5.5457377110 14.6995457400 2.6236936740 +H 16.7263012890 7.5724932600 2.6236936740 +H 14.4322812720 19.3321298520 6.2027940080 +H 7.8397577280 2.9399091480 6.2027940080 +H 2.9399091480 14.4322812720 2.5281530080 +H 19.3321298520 7.8397577280 2.5281530080 +H 14.2318329210 22.1606788050 6.6731480560 +H 8.0402060790 0.1113601950 6.6731480560 +H 0.1113601950 14.2318329210 2.9985070560 +H 22.1606788050 8.0402060790 2.9985070560 +H 14.2318329210 22.1606788050 3.4247654120 +H 8.0402060790 0.1113601950 3.4247654120 +H 0.1113601950 14.2318329210 7.0994064120 +H 22.1606788050 8.0402060790 7.0994064120 +H 14.4322812720 19.3321298520 3.9024687420 +H 7.8397577280 2.9399091480 3.9024687420 +H 2.9399091480 14.4322812720 0.2278277420 +H 19.3321298520 7.8397577280 0.2278277420 diff --git a/pyxtal/interface/LATTE_templates/latte_calc.py b/pyxtal/interface/LATTE_templates/latte_calc.py new file mode 100644 index 00000000..0aa65735 --- /dev/null +++ b/pyxtal/interface/LATTE_templates/latte_calc.py @@ -0,0 +1,329 @@ +import os +import subprocess +import re + +import numpy as np +from ase import Atoms +from pyxtal import pyxtal +from pyxtal.lattice import Lattice + + +class LATTECalc: + """ + Minimal LATTE calculator for PyXtal / ASE. + + Assumes the current working directory (workdir) contains: + - LATTE executable (exe, e.g. './LATTE_DOUBLE') + - TBparam/ directory with control.in etc. + - MDcontroller + - bl/ directory (will be created if missing) + + It does NOT change directories or create extra folders. + """ + + def __init__( + self, + struc, + exe="./LATTE_DOUBLE", + workdir=".", + log_name="latte.log", + relax=None, # currently only used as a flag, not editing control.in + timeout=3600, + control_relax=None, # int 0/1, if None => don’t touch RELAX + control_maxiter=None, # int, if None => don’t touch MAXITER + control_rlxftol=None, # float, if None => don’t touch RLXFTOL + control_restart=None, # int 0/1, if None => don’t touch RESTART + ): + # keep paths absolute to be safe + self.workdir = os.path.abspath(workdir) + self.exe = os.path.abspath(os.path.join(self.workdir, exe)) + self.log_name = log_name + self.log_path = os.path.join(self.workdir, self.log_name) + self.relax = relax if relax is not None else self._read_relax_from_control() + self.timeout = timeout + self.control_relax = control_relax + self.control_maxiter = control_maxiter + self.control_rlxftol = control_rlxftol + self.control_restart = control_restart + + # --- handle structure (pyxtal or ASE Atoms) --- + if isinstance(struc, pyxtal): + self.pyxtal = struc + self.species = struc.species + struc = struc.to_ase(resort=False) + else: + self.pyxtal = None + + if isinstance(struc, Atoms): + self.lattice = Lattice.from_matrix(struc.cell) + self.cart_coords = struc.get_positions() # Å + self.sites = struc.get_chemical_symbols() + else: + raise NotImplementedError("LATTECalc only supports pyxtal or ASE Atoms objects") + + self.structure = struc + + # results + self.energy = None + self.energy_per_atom = None + self.forces = None + self.stress = None + self.optimized = False + self.cputime = 0.0 + self.error = False + + def run(self): + """ + Run LATTE once: + 1) write bl/inputblock.dat + 2) run LATTE executable + 3) parse log for total energy + """ + self._write_inputblock() + self._apply_control_overrides() + self._execute() + self._read_output() + # optional later: self._read_restart_geometry() + + def to_ase(self): + #Return ASE Atoms for the (possibly) relaxed structure. + #Right now we just keep the original positions; deal later + + cell = self.lattice.matrix + positions = self.cart_coords + return Atoms(self.sites, positions=positions, cell=cell, pbc=True) + + def to_pyxtal(self): + """ + Convert final structure back to pyxtal. + """ + ase_atoms = self.to_ase() + for tol in [1e-2, 1e-3, 1e-4, 1e-5]: + try: + s = pyxtal() + s.from_seed(ase_atoms, tol=tol) + return s + except Exception: + pass + return None + + def _write_inputblock(self): + """ + Write bl/inputblock.dat in the format LATTE expects: + Natoms + 3 lines: lattice vectors + Natoms lines: element x y z (Å) + """ + bl_dir = os.path.join(self.workdir, "bl") + if not os.path.exists(bl_dir): + os.makedirs(bl_dir) + + natoms = len(self.sites) + cell = self.lattice.matrix + + inputblock_path = os.path.join(bl_dir, "inputblock.dat") + with open(inputblock_path, "w") as f: + f.write(f"{natoms:d}\n") + for i in range(3): + f.write(f"{cell[i,0]: .10f} {cell[i,1]: .10f} {cell[i,2]: .10f}\n") + for elem, pos in zip(self.sites, self.cart_coords): + f.write(f"{elem:s} {pos[0]: .10f} {pos[1]: .10f} {pos[2]: .10f}\n") + def _apply_control_overrides(self): + """ + Update the RELAX line in TBparam/control.in with: + RELAX= RELAXTYPE= SD MAXITER= RLXFTOL= + + If any of these parameters are missing (None), keep the old values. + """ + control_path = os.path.join(self.workdir, "TBparam", "control.in") + if not os.path.exists(control_path): + print(f"Warning: {control_path} not found; cannot apply overrides.") + return + + # Read existing file + with open(control_path, "r") as f: + lines = f.readlines() + + new_lines = [] + relax_found = False + restart_found = False + # Defaults (will be replaced if line already has them) + relax_val = self.control_relax + relax_type = "SD" + maxiter_val = self.control_maxiter + rlxftol_val = self.control_rlxftol + restart_val = self.control_restart + + for line in lines: + if re.match(r"^\s*RELAX\s*=", line): + relax_found = True + + # Extract old values if not provided + old_relax = re.search(r"RELAX\s*=\s*([0-9]+)", line) + old_maxit = re.search(r"MAXITER\s*=\s*([0-9]+)", line) + old_ftol = re.search(r"RLXFTOL\s*=\s*([-0-9.Ee]+)", line) + old_type = re.search(r"RELAXTYPE\s*=\s*(\w+)", line) + + if relax_val is None and old_relax: relax_val = int(old_relax.group(1)) + if maxiter_val is None and old_maxit: maxiter_val = int(old_maxit.group(1)) + if rlxftol_val is None and old_ftol: rlxftol_val = float(old_ftol.group(1)) + if old_type: relax_type = old_type.group(1) + + # Construct new formatted line + relax_val = 1 if relax_val is None else int(relax_val) + maxiter_val = 300 if maxiter_val is None else int(maxiter_val) + rlxftol_val = 1e-3 if rlxftol_val is None else float(rlxftol_val) + + new_line = f"RELAX= {relax_val:d} RELAXTYPE= {relax_type} MAXITER= {maxiter_val:d} RLXFTOL= {rlxftol_val:.3f}\n" + new_lines.append(new_line) + # ---- RESTART block ---- + elif re.match(r"^\s*RESTART\s*=", line): + restart_found = True + old_restart = re.search(r"RESTART\s*=\s*([0-9]+)", line) + if restart_val is None and old_restart: + restart_val = int(old_restart.group(1)) + restart_val = 1 if restart_val is None else int(restart_val) + new_lines.append(f"RESTART= {restart_val:d}\n") + else: + new_lines.append(line) + + if not relax_found: + # Append it at the end if missing + relax_val = 1 if relax_val is None else int(relax_val) + maxiter_val = 300 if maxiter_val is None else int(maxiter_val) + rlxftol_val = 1e-3 if rlxftol_val is None else float(rlxftol_val) + new_lines.append(f"\nRELAX= {relax_val:d} RELAXTYPE= {relax_type} MAXITER= {maxiter_val:d} RLXFTOL= {rlxftol_val:.3f}\n") + + # Append RESTART if missing + if not restart_found: + restart_val = 1 if restart_val is None else int(restart_val) + new_lines.append(f"RESTART= {restart_val:d}\n") + + with open(control_path, "w") as f: + f.writelines(new_lines) + + def _read_relax_from_control(self): + """ + Read RELAX flag from TBparam/control.in and return True/False. + Default to True if file not found or unreadable. + """ + control_path = os.path.join(self.workdir, "TBparam", "control.in") + if not os.path.exists(control_path): + return True + with open(control_path, "r") as f: + for line in f: + if re.match(r"^\s*RELAX\s*=", line): + try: + val = int(line.split("=")[1].strip().split()[0]) + return bool(val) + except Exception: + return True + return True + + + def _execute(self): + """ + Run LATTE in self.workdir, logging stdout+stderr to self.log_path. + """ + if not os.path.exists(self.exe): + print(f"LATTE executable not found at {self.exe}") + self.error = True + return + + try: + with open(self.log_path, "w") as fout: + subprocess.run( + [self.exe], + stdout=fout, + stderr=subprocess.STDOUT, + timeout=self.timeout, + check=True, + cwd=self.workdir, + ) + except subprocess.TimeoutExpired: + print(f"LATTE timed out after {self.timeout} s") + self.error = True + except subprocess.CalledProcessError as e: + print(f"LATTE failed with return code {e.returncode}") + self.error = True + + def _read_output(self): + """ + Parse total energy from the log file. + """ + if self.error: + return + + if not os.path.exists(self.log_path): + print("LATTE log file not found") + self.error = True + return + + Tot_energy = re.compile(r"FREE ENERGY\s*=\s*([-0-9.Ee]+)") + + last_e = None + with open(self.log_path, "r") as f: + for line in f: + m = Tot_energy.search(line) + if m: + last_e = float(m.group(1)) + + if last_e is None: + print("Could not find total energy in LATTE log") + self.error = True + return + + self.energy = last_e + self.energy_per_atom = self.energy / len(self.sites) + self.optimized = self.relax + + # optional stub for later + def _read_restart_geometry(self): + """ + Stub: implement later if you want to read relaxed coords from bl/restart.dat. + """ + restart_path = os.path.join(self.workdir, "bl", "restart.dat") + if not os.path.exists(restart_path): + return + # parse restart.dat here and update self.lattice & self.cart_coords + # once you know the exact format + pass + + +def latte_single_optimize( + struc, + exe="./LATTE_DOUBLE", + workdir=".", + log_name="latte.log", + relax=None, # if None: auto-read RELAX from control.in + timeout=3600, + control_relax=None, # int 0/1 -> sets RELAX= + control_maxiter=None, # int -> sets MAXITER= + control_rlxftol=None, # float -> sets RLXFTOL= + control_restart=None, # int 0/1 -> sets RESTART= +): + """ + Returns: (pyxtal_struct, energy_per_atom, cputime, error_flag) + Currently cputime is always 0.0 (LATTE doesn't give us an easy CPU time). + """ + calc = LATTECalc( + struc, + exe=exe, + workdir=workdir, + log_name=log_name, + relax=relax, + timeout=timeout, + control_relax=control_relax, + control_maxiter=control_maxiter, + control_rlxftol=control_rlxftol, + control_restart=control_restart, + ) + calc.run() + + if calc.error: + print("LATTE error in latte_single_optimize") + return None, None, 0.0, True + else: + final_pyxtal = calc.to_pyxtal() if calc.pyxtal is None else calc.to_pyxtal() + return final_pyxtal, calc.energy_per_atom, calc.cputime, False + diff --git a/pyxtal/interface/LATTE_templates/test.py b/pyxtal/interface/LATTE_templates/test.py new file mode 100644 index 00000000..4411bea3 --- /dev/null +++ b/pyxtal/interface/LATTE_templates/test.py @@ -0,0 +1,48 @@ +from pyxtal import pyxtal +from ase.io import read +from latte_calc import latte_single_optimize + +#s = pyxtal() +#s.from_random(3, 19, ["C"], [4]) +# Load CIF file into ASE Atoms +s = read("alpha_match.cif") + +s_opt, epa, t, err = latte_single_optimize( + s, + exe="./LATTE_DOUBLE", + workdir=".", + log_name="latte.log", + control_relax=1, # RELAX=1 + control_maxiter=30, # MAXITER=300 + control_rlxftol=0.1, # RLXFTOL=1.0E-03 + control_restart=0, # RESTART=1 +) + +print("Error:", err) +print("Energy per atom:", epa) +print("Optimized structure (pyxtal):", s_opt is not None) + + +''' +from pyxtal import pyxtal +from latte_calc import LATTECalc + +s = pyxtal() +s.from_random(3, 19, ["C"], [4]) + +calc = LATTECalc( + s, + exe="./LATTE_DOUBLE", + workdir=".", + log_name="latte.log", + control_relax=1, + control_maxiter=300, + control_rlxftol=1.0e-3, + control_restart=1, +) +calc.run() + +print("Error:", calc.error) +print("Energy per atom:", calc.energy_per_atom) +print("Optimized structure:", calc.optimized) +''' \ No newline at end of file