diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..67ad4ac722d3f224345520f672e97f19949be954 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,36 @@ +image: ubuntu:latest + +test: + + before_script: + + # Install Linux Packages: + - apt-get update + - hostname + - export HOME=/builds/exaalt/ + - env + - apt-get --yes --force-yes install gfortran libblas-dev liblapack-dev + - apt-get --yes --force-yes install cmake python gcc cmake-data g++ git wget + - apt-get --yes --force-yes install pkg-config python-numpy python3-numpy libopenmpi-dev + + # Build LATTE: + - cd /builds/exaalt/ + - git clone https://github.com/lanl/LATTE.git + - cd LATTE + - cp ./makefiles/makefile.CHOICES.gfort.lapack.lmp makefile.CHOICES + - make + + # Build LAMMPS: + - cd /builds/exaalt/lammps/lib/latte/ + - cp Makefile.lammps.gfortran Makefile.lammps + - cd /builds/exaalt/lammps/src/ + - make yes-latte + - make yes-molecule + - make serial + + script: + + # Test LAMMPS-LATTE Example: + - cd /builds/exaalt/lammps/examples/latte/ + - ../../src/lmp_serial -in in.latte.water + diff --git a/examples/latte/TBparam/bondints.nonortho b/examples/latte/TBparam/bondints.nonortho new file mode 100644 index 0000000000000000000000000000000000000000..8c1eee76b5a0c7be8fead53d775d988f7709c38c --- /dev/null +++ b/examples/latte/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 +N O sss -11.430028 -2.257346 -1.152844 0.000000 0.000000 1.200000 3.500000 4.000000 0.340064 -1.703613 -0.622348 0.036738 -0.040158 1.200000 3.500000 4.000000 +N O sps 11.597479 -1.382001 -0.765170 0.000000 0.000000 1.200000 3.500000 4.000000 -0.370946 -1.040947 -0.931097 0.252441 -0.115450 1.200000 3.500000 4.000000 +O N sps 12.143744 -0.822913 -0.676127 0.000000 0.000000 1.200000 3.500000 4.000000 -0.420014 -1.107918 -0.905594 0.188424 -0.088365 1.200000 3.500000 4.000000 +N O pps 9.465191 -1.082032 -0.769214 0.000000 0.000000 1.200000 3.500000 4.000000 -0.314073 0.499050 -2.914288 2.067657 -0.738439 1.200000 3.500000 4.000000 +N O ppp -4.676789 -2.171480 -0.288002 0.000000 0.000000 1.200000 3.500000 4.000000 0.223937 -1.991867 -0.537630 -0.081270 -0.004130 1.200000 3.500000 4.000000 +C O sss -14.369472 -2.077439 -0.875471 0.000000 0.000000 1.200000 3.500000 4.000000 0.375339 -1.547372 -0.642492 0.020614 -0.026699 1.200000 3.500000 4.000000 +C O sps 9.576296 -1.156217 -0.494803 0.000000 0.000000 1.200000 3.500000 4.000000 -0.373027 -0.776043 -1.019920 0.257539 -0.102838 1.200000 3.500000 4.000000 +O C sps 14.037374 -1.192632 -0.654572 0.000000 0.000000 1.200000 3.500000 4.000000 -0.458068 -1.035067 -0.937868 0.190562 -0.077841 1.200000 3.500000 4.000000 +C O pps 9.331152 -0.718120 -0.822100 0.000000 0.000000 1.200000 3.500000 4.000000 -0.322293 0.795473 -3.476601 2.589965 -0.897800 1.200000 3.500000 4.000000 +C O ppp -5.334367 -2.263939 -0.204910 0.000000 0.000000 1.200000 3.500000 4.000000 0.244570 -1.922717 -0.573671 -0.057280 -0.004108 1.200000 3.500000 4.000000 +C N sss -7.010061 -1.730597 -0.575559 0.000000 0.000000 1.500000 3.500000 4.000000 0.263438 -1.754525 -0.584215 -0.007801 -0.021729 1.500000 3.500000 4.000000 +C N sps 7.543283 -1.293768 -0.624363 0.000000 0.000000 1.500000 3.500000 4.000000 -0.326609 -1.197485 -0.807786 0.134891 -0.084373 1.500000 3.500000 4.000000 +N C sps 9.090970 -1.494255 -0.616711 0.000000 0.000000 1.500000 3.500000 4.000000 -0.337943 -1.335442 -0.769693 0.119373 -0.079493 1.500000 3.500000 4.000000 +C N pps 6.892240 -0.931920 -0.769164 0.000000 0.000000 1.500000 3.500000 4.000000 -0.350240 -0.467439 -1.849316 1.854403 -0.988471 1.500000 3.500000 4.000000 +C N ppp -2.903346 -2.149349 -0.253006 0.000000 0.000000 1.500000 3.500000 4.000000 0.158424 -2.114409 -0.582346 -0.051076 -0.006183 1.500000 3.500000 4.000000 +C C sss -9.404207 -1.363297 -0.507128 0.000000 0.000000 1.400000 3.500000 4.000000 0.346977 -1.519820 -0.570812 -0.013518 -0.015829 1.400000 3.500000 4.000000 +C C sps 8.662429 -1.047410 -0.661999 0.000000 0.000000 1.400000 3.500000 4.000000 -0.400467 -0.984048 -0.853949 0.157178 -0.073381 1.400000 3.500000 4.000000 +C C pps 6.811512 -0.552299 -0.776890 0.000000 0.000000 1.400000 3.500000 4.000000 -0.382417 0.102889 -2.786680 2.646356 -1.134320 1.400000 3.500000 4.000000 +C C ppp -3.550127 -1.925572 -0.132715 0.000000 0.000000 1.400000 3.500000 4.000000 0.214357 -1.948923 -0.578323 -0.034356 -0.007257 1.400000 3.500000 4.000000 +H C sss -9.072577 -1.393093 -0.430611 0.000000 0.000000 1.100000 3.500000 4.000000 0.416003 -1.459596 -0.654874 0.009140 -0.012658 1.100000 3.500000 4.000000 +H C sps 8.176008 -0.985177 -0.427403 0.000000 0.000000 1.100000 3.500000 4.000000 -0.495695 -0.901626 -1.007214 0.189808 -0.057087 1.100000 3.500000 4.000000 +H H sss -9.340000 -1.145903 -0.391777 0.000000 0.000000 0.750000 3.500000 4.000000 0.575007 -1.391261 -0.778831 0.080209 -0.017759 0.750000 3.500000 4.000000 +O O sss -12.737687 -1.851608 -0.666621 0.000000 0.000000 1.200000 3.500000 4.000000 0.296445 -1.911896 -0.663451 0.038054 -0.046608 1.200000 3.500000 4.000000 +O O sps 13.683050 -1.684554 -0.468349 0.000000 0.000000 1.200000 3.500000 4.000000 -0.362143 -1.285274 -0.939591 0.204641 -0.106438 1.200000 3.500000 4.000000 +O O pps 9.460772 -1.211748 -0.581016 0.000000 0.000000 1.200000 3.500000 4.000000 -0.312044 0.121814 -2.519352 1.681266 -0.644566 1.200000 3.500000 4.000000 +O O ppp -4.494595 -2.709223 -0.284124 0.000000 0.000000 1.200000 3.500000 4.000000 0.193010 -2.168462 -0.580629 -0.105104 0.004891 1.200000 3.500000 4.000000 +H O sss -12.230931 -1.808632 -0.421164 0.000000 0.000000 1.000000 3.500000 4.000000 0.404725 -1.702546 -0.707938 0.074904 -0.039922 1.000000 3.500000 4.000000 +H O sps 9.466088 -1.321262 -0.386336 0.000000 0.000000 1.000000 3.500000 4.000000 -0.447660 -0.952979 -1.163537 0.400616 -0.156965 1.000000 3.500000 4.000000 +N N sss -7.710330 -2.365312 -0.525527 0.000000 0.000000 1.500000 3.500000 4.000000 0.231654 -1.879002 -0.572765 -0.004579 -0.031106 1.500000 3.500000 4.000000 +N N sps 8.222314 -1.612118 -0.690081 0.000000 0.000000 1.500000 3.500000 4.000000 -0.305271 -1.385158 -0.751032 0.114531 -0.090839 1.500000 3.500000 4.000000 +N N pps 7.178570 -1.176467 -0.571049 0.000000 0.000000 1.500000 3.500000 4.000000 -0.324668 -0.547805 -1.638658 1.495168 -0.827868 1.500000 3.500000 4.000000 +N N ppp -2.829344 -2.408049 -0.387709 0.000000 0.000000 1.500000 3.500000 4.000000 0.142909 -2.162036 -0.571942 -0.071640 -0.004682 1.500000 3.500000 4.000000 +H N sss -12.095890 -1.519057 -0.277247 0.000000 0.000000 1.000000 3.500000 4.000000 0.446693 -1.500463 -0.657448 0.065741 -0.037004 1.000000 3.500000 4.000000 +H N sps 9.851338 -1.231616 -0.370836 0.000000 0.000000 1.000000 3.500000 4.000000 -0.501530 -0.785734 -1.123232 0.394878 -0.148501 1.000000 3.500000 4.000000 diff --git a/examples/latte/TBparam/electrons.dat b/examples/latte/TBparam/electrons.dat new file mode 100644 index 0000000000000000000000000000000000000000..c38fd23ce2f14714266e8deb6a10603b7b2e063a --- /dev/null +++ b/examples/latte/TBparam/electrons.dat @@ -0,0 +1,7 @@ +Noelem= 5 +Element basis Numel Es Ep Ed Ef Mass HubbardU Wss Wpp Wdd Wff +N sp 5.0 -18.58 -7.09 0.0 0.0 14.0067 15.93 0.0 -0.6950 0.0 0.0 +O sp 6.0 -23.96 -9.02 0.0 0.0 15.9994 12.15 0.0 -0.7577 0.0 0.0 +H s 1.0 -6.35 0.0 0.0 0.0 1.0079 12.85 -1.7937 0.0 0.0 0.0 +C sp 4.0 -13.75 -5.28 0.0 0.0 12.01 10.0 0.0 -0.621 0.0 0.0 +Ti sd 4.0 -5.5 0.0 -3.0 0.0 47.867 10.0 0.0 0.0 0.0 0.0 \ No newline at end of file diff --git a/examples/latte/TBparam/ppots.nonortho b/examples/latte/TBparam/ppots.nonortho new file mode 100644 index 0000000000000000000000000000000000000000..1b9b66c0a1a1f28fac9c310ee2011b06406f0b9c --- /dev/null +++ b/examples/latte/TBparam/ppots.nonortho @@ -0,0 +1,12 @@ +Nopps= 10 +Ele1 Ele2 A0 A1 A2 A3 A4 A5 A6 C R1 Rcut +N O 13.182426 20.050322 -46.806321 38.206953 -12.319656 0.000000 0.000000 0.000000 1.600000 1.700000 +C N 88.953762 10.294988 -27.706877 22.101434 -6.836438 0.000000 0.000000 0.000000 1.600000 1.700000 +C O 0.944093 30.116337 -59.608215 45.107654 -13.178839 0.000000 0.000000 0.000000 1.600000 1.700000 +C H 104.889589 3.971095 -23.823043 26.408093 -11.317522 0.000000 0.000000 0.000000 1.200000 1.300000 +C C 3.962931 24.467772 -51.156024 39.031644 -11.342979 0.000000 0.000000 0.000000 1.600000 1.700000 +H H 38.512100 3.887860 -37.769100 57.083500 -34.512200 0.000000 0.000000 0.000000 0.900000 1.000000 +N N 43.228899 15.004605 -36.621777 29.234888 -8.912743 0.000000 0.000000 0.000000 1.600000 1.700000 +N H 0.625470 28.081241 -63.414297 53.286361 -17.352234 0.000000 0.000000 0.000000 1.300000 1.400000 +O O 10.999870 19.303033 -45.747853 37.946431 -11.935755 0.000000 0.000000 0.000000 1.500000 1.600000 +O H 0.481176 33.175383 -81.158683 74.935408 -26.792315 0.000000 0.000000 0.000000 1.200000 1.300000 diff --git a/examples/latte/data.sucrose_non_opt.lmp b/examples/latte/data.sucrose_non_opt.lmp new file mode 100644 index 0000000000000000000000000000000000000000..a96a19eddbcef875a453a568d6d0deea485f4809 --- /dev/null +++ b/examples/latte/data.sucrose_non_opt.lmp @@ -0,0 +1,63 @@ + LAMMPS Description + + 45 atoms + + 3 atom types + + 0.0000000000000000 18.917000000000002 xlo xhi + 0.0000000000000000 17.350999999999999 ylo yhi + 0.0000000000000000 15.472000000000000 zlo zhi + + Masses + + 1 15.994915008544922 + 2 12.000000000000000 + 3 1.0078250169754028 + + Atoms + + 1 1 1 0.0 11.47359 7.39174 7.26456 + 2 1 2 0.0 12.66159 8.24474 7.53356 + 3 1 3 0.0 13.49759 7.72474 7.00656 + 4 1 2 0.0 12.92859 8.18374 9.02956 + 5 1 1 0.0 13.69659 9.10274 10.46556 + 6 1 2 0.0 12.83959 10.10474 6.64056 + 7 1 3 0.0 13.24359 10.33074 7.58456 + 8 1 1 0.0 13.17359 9.67874 5.60956 + 9 1 2 0.0 11.20559 10.26374 6.86456 + 10 1 3 0.0 11.22159 11.15674 6.18156 + 11 1 1 0.0 10.78559 10.69674 8.19156 + 12 1 2 0.0 10.23459 9.20474 6.34356 + 13 1 3 0.0 9.23359 9.62574 6.11656 + 14 1 1 0.0 10.73959 8.65074 5.08856 + 15 1 2 0.0 10.18759 8.08774 7.38056 + 16 1 3 0.0 10.03259 8.49174 8.42656 + 17 1 1 0.0 9.22959 7.03374 7.08156 + 18 1 2 0.0 7.79359 7.27874 7.34356 + 19 1 1 0.0 7.44259 8.64274 6.96956 + 20 1 2 0.0 7.01059 9.43674 8.13856 + 21 1 3 0.0 5.95059 9.74974 7.96256 + 22 1 2 0.0 7.08359 8.51474 9.35656 + 23 1 3 0.0 8.19359 8.08474 9.80956 + 24 1 1 0.0 5.86059 8.56174 10.14056 + 25 1 2 0.0 7.34259 7.10674 8.80356 + 26 1 3 0.0 6.37259 6.54074 8.80556 + 27 1 1 0.0 8.32159 6.38474 9.58156 + 28 1 2 0.0 7.89859 10.67174 8.17156 + 29 1 1 0.0 6.06859 12.11474 7.59256 + 30 1 2 0.0 7.47359 7.05174 5.99256 + 31 1 1 0.0 5.66359 6.54374 6.50656 + 32 1 3 0.0 12.00659 8.11374 9.61556 + 33 1 3 0.0 13.35859 7.21774 9.30856 + 34 1 3 0.0 13.67759 8.46774 11.22956 + 35 1 3 0.0 12.44459 9.34474 5.00556 + 36 1 3 0.0 11.54859 11.18274 8.59756 + 37 1 3 0.0 11.00959 7.71574 5.30056 + 38 1 3 0.0 5.09459 8.45474 9.52056 + 39 1 3 0.0 7.92859 6.23074 10.47756 + 40 1 3 0.0 8.53259 10.62974 7.23156 + 41 1 3 0.0 8.58159 10.63874 9.05856 + 42 1 3 0.0 6.42359 13.37374 7.86056 + 43 1 3 0.0 7.58559 6.90074 4.62256 + 44 1 3 0.0 7.35159 5.27974 6.61456 + 45 1 3 0.0 5.22759 6.18974 5.69256 diff --git a/examples/latte/data.water b/examples/latte/data.water new file mode 100644 index 0000000000000000000000000000000000000000..1a1e4d9e0bea7eb415212a7944f8e872e77508e7 --- /dev/null +++ b/examples/latte/data.water @@ -0,0 +1,41 @@ + LAMMPS Description + + 24 atoms + + 2 atom types + + 0.0000000000000000 6.2670000000000003 xlo xhi + 0.0000000000000000 6.2670000000000003 ylo yhi + 0.0000000000000000 6.2670000000000003 zlo zhi + + Masses + + 1 15.994915008544922 + 2 1.0078250169754028 + + Atoms + + 1 1 1 0.0 3.08800 3.70000 3.12400 + 2 1 2 0.0 4.05800 3.70000 3.12400 + 3 1 2 0.0 2.76400 3.13200 3.84100 + 4 1 1 0.0 2.47000 0.39000 1.36000 + 5 1 2 0.0 1.54000 0.37000 1.73000 + 6 1 2 0.0 2.48000 0.00000 0.44000 + 7 1 1 0.0 1.99300 0.41700 5.25000 + 8 1 2 0.0 2.39300 1.32700 5.16000 + 9 1 2 0.0 0.99300 0.49700 5.31000 + 10 1 1 0.0 2.05300 6.09700 3.48000 + 11 1 2 0.0 2.12300 5.20700 3.02000 + 12 1 2 0.0 1.11300 0.17000 3.40000 + 13 1 1 0.0 4.90000 5.37700 2.14000 + 14 1 2 0.0 5.51000 6.17700 2.18000 + 15 1 2 0.0 3.95000 5.68700 2.21000 + 16 1 1 0.0 0.92000 3.82700 0.56000 + 17 1 2 0.0 0.00000 3.54700 0.27000 + 18 1 2 0.0 1.23000 4.59700 0.00000 + 19 1 1 0.0 0.89000 2.03700 3.41000 + 20 1 2 0.0 0.72000 2.86700 2.87000 + 21 1 2 0.0 1.79000 1.66700 3.19000 + 22 1 1 0.0 4.45000 4.61700 5.43000 + 23 1 2 0.0 4.75000 3.89700 4.81000 + 24 1 2 0.0 4.06000 4.21700 6.26000 diff --git a/examples/latte/in.latte.sucrose.min b/examples/latte/in.latte.sucrose.min new file mode 100644 index 0000000000000000000000000000000000000000..9513af9ac64e5c0461b9c87f8824aa4508dd2ba3 --- /dev/null +++ b/examples/latte/in.latte.sucrose.min @@ -0,0 +1,43 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +read_data data.sucrose_non_opt.lmp + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# minimization + +thermo 1 +min_style cg +min_modify dmax 0.1 +min_modify line quadratic +minimize 1.0e-6 1.0e-6 10000 10000 diff --git a/examples/latte/in.latte.water b/examples/latte/in.latte.water new file mode 100644 index 0000000000000000000000000000000000000000..1ab9fcaafe18f739332d29fd338095bef5aaa8d3 --- /dev/null +++ b/examples/latte/in.latte.water @@ -0,0 +1,40 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +read_data data.water + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# dynamics + +thermo 10 +run 100 diff --git a/examples/latte/in.latte.water.min b/examples/latte/in.latte.water.min new file mode 100644 index 0000000000000000000000000000000000000000..5bf261547a9db5b7408e33c7d3316b2b12dad4f2 --- /dev/null +++ b/examples/latte/in.latte.water.min @@ -0,0 +1,41 @@ +# simple water model with LATTE + +units metal +atom_style full +atom_modify sort 0 0.0 # turn off sorting of the coordinates + +read_data data.water + +# replicate system if requested + +variable x index 1 +variable y index 1 +variable z index 1 + +variable nrep equal v_x*v_y*v_z +if "${nrep} > 1" then "replicate $x $y $z" + +# initialize system + +velocity all create 0.0 87287 loop geom + +pair_style zero 1.0 +pair_coeff * * + +neighbor 1.0 bin +neigh_modify every 1 delay 0 check yes + +timestep 0.00025 + +fix 1 all nve + +fix 2 all latte NULL +fix_modify 2 energy yes + +thermo_style custom step temp pe etotal + +# minimization + +thermo 1 +min_style fire +minimize 1.0e-9 1.0e-9 1000 1000 diff --git a/examples/latte/latte.in b/examples/latte/latte.in new file mode 100644 index 0000000000000000000000000000000000000000..0790317a5d8ca152981032cf8d067d16013a6a4a --- /dev/null +++ b/examples/latte/latte.in @@ -0,0 +1,39 @@ +LATTE INPUT FILE +================ +#This input file resumes the content of MDcontroller and TBparam/control.in +#The parser will only read it if it's present inside the running folder. +#In case this file is not present Latte will read the two files as original. +#The order of the kewords is not important in this file. +#To get a full description of these keywords please see: +## https://github.com/lanl/LATTE/blob/master/Manual/LATTE_manual.pdf + +#General controls +CONTROL{ + xControl= 1 + BASISTYPE= NONORTHO + COORDSFILE= "./coords.dat" + KBT= 0.0 + ENTROPYKIND= 1 + PPOTON= 1 + SPINON= 0 SPINTOL= 1.0e-4 + ELECTRO= 1 ELECMETH= 0 ELEC_QTOL= 1.0e-8 + MAXSCF= 450 + BREAKTOL= 1.0E-6 MINSP2ITER= 22 SP2CONV= REL + FULLQCONV= 1 QITER= 3 + QMIX= 0.25 SPINMIX= 0.25 MDMIX= 0.25 + SPARSEON= 1 THRESHOLDON= 1 NUMTHRESH= 1.0e-6 FILLINSTOP= 100 BLKSZ= 4 + MSPARSE= 1500 + RELAX= 0 RELAXTYPE= SD MAXITER= 100000 RLXFTOL= 0.0000001 + SKIN= 1.0 + CHARGE= 0 + XBO= 1 + XBODISON= 1 + XBODISORDER= 5 + KON= 0 +} + +#Controls for QMD (if using lammps MAXITER must be set to -1) +MDCONTROL{ + MAXITER= -1 +} + diff --git a/lib/latte/Makefile.lammps.gfortran b/lib/latte/Makefile.lammps.gfortran new file mode 100644 index 0000000000000000000000000000000000000000..fa6a44869f85e92baa03d3138b1d8761d80e993f --- /dev/null +++ b/lib/latte/Makefile.lammps.gfortran @@ -0,0 +1,27 @@ +# Settings that the LAMMPS build will import when this package is installed +# Change all the flags and paths accordingly +# If using PROGRESS/BML set PROGRESS to ON +# For more information about these libraries see: +# BML: https://github.com/qmmd/bml +# PROGRESS: https://github.com/losalamos/qmd-progress +# METIS: http://glaros.dtc.umn.edu/gkhome/metis/metis/download + +latte_PATH = ${HOME}/LATTE +progress_PATH = ${HOME}/qmd-progress +bml_PATH = ${HOME}/bml +metis_PATH = ${HOME}/Programs/metis-5.1.0 + +latte_SYSINC = -I${latte_PATH}/src -I${bml_PATH}/install/include -I${progress_PATH}/install/include + +#latte_SYSLIB = -fopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran \ +# -lm -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_lapack95_lp64 -lmkl_gf_lp64 \ +# -lmkl_gnu_thread -lmkl_core -lmkl_gnu_thread -lmkl_core -ldl -lpthread -lm + +latte_SYSLIB = -fopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran \ + -llapack -lblas + +# Uncomment the following line to use PROGRESS/BML and metis. +#latte_SYSLIB += -L${progress_PATH}/install/lib -lprogress -L${bml_PATH}/install/lib -lbml +#latte_SYSLIB += -L${metis_PATH}/install -lmetis + + diff --git a/lib/latte/Makefile.lammps.gfortran.dev b/lib/latte/Makefile.lammps.gfortran.dev new file mode 100644 index 0000000000000000000000000000000000000000..b2876f9777d6b6528b5b702873aa79b78ef193ff --- /dev/null +++ b/lib/latte/Makefile.lammps.gfortran.dev @@ -0,0 +1,27 @@ +# Settings that the LAMMPS build will import when this package is installed +# Change all the flags and paths accordingly +# If using PROGRESS/BML set PROGRESS to ON +# For more information about these libraries see: +# BML: https://github.com/qmmd/bml +# PROGRESS: https://github.com/losalamos/qmd-progress +# METIS: http://glaros.dtc.umn.edu/gkhome/metis/metis/download + +latte_PATH = ${HOME}/LATTE_dev +progress_PATH = ${HOME}/qmd-progress +bml_PATH = ${HOME}/bml +metis_PATH = ${HOME}/Programs/metis-5.1.0 + +latte_SYSINC = -I${latte_PATH}/src -I${bml_PATH}/install/include -I${progress_PATH}/install/include + +#latte_SYSLIB = -fopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran \ +# -lm -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_lapack95_lp64 -lmkl_gf_lp64 \ +# -lmkl_gnu_thread -lmkl_core -lmkl_gnu_thread -lmkl_core -ldl -lpthread -lm + +latte_SYSLIB = -fopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a -lgfortran \ + -llapack -lblas + +# Uncomment the following line to use PROGRESS/BML and metis. +latte_SYSLIB += -L${progress_PATH}/install/lib -lprogress -L${bml_PATH}/install/lib -lbml +#latte_SYSLIB += -L${metis_PATH}/install -lmetis + + diff --git a/lib/latte/Makefile.lammps.ifort b/lib/latte/Makefile.lammps.ifort new file mode 100644 index 0000000000000000000000000000000000000000..af622dfbd21e5bcec28c5420644e25ed96918bbb --- /dev/null +++ b/lib/latte/Makefile.lammps.ifort @@ -0,0 +1,29 @@ +# Settings that the LAMMPS build will import when this package is installed +# Change all the flags and paths accordingly +# If using PROGRESS/BML set PROGRESS to ON +# For more information about these libraries see: +# BML: https://github.com/qmmd/bml +# PROGRESS: https://github.com/losalamos/qmd-progress +# METIS: http://glaros.dtc.umn.edu/gkhome/metis/metis/download + +latte_PATH = ${HOME}/LATTE +progress_PATH = ${HOME}/qmd-progress +bml_PATH = ${HOME}/bml +metis_PATH = ${HOME}/Programs/metis-5.1.0 + +latte_SYSINC = -I${latte_PATH}/src -I${bml_PATH}/install/include -I${progress_PATH}/install/include +latte_SYSLIB = -openmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a \ + -lifcore -lsvml -lompstub -limf -L${MKLROOT}/lib/intel64 -lmkl_lapack95_lp64 -lmkl_intel_lp64 \ + -lmkl_intel_thread -lmkl_core -lmkl_intel_thread -lpthread -openmp -O0 \ + +# Alternative linking line +#latte_SYSLIB = -qopenmp ${latte_PATH}/src/latte_c_bind.o ${latte_PATH}/liblatte.a \ +# -L${MKLROOT}/lib/intel64 -lifcore -lsvml -lifport -mkl=parallel -lpthread -qopenmp -O0 \ + +# Uncomment the following line to use PROGRESS/BML +#latte_SYSLIB += -L${progress_PATH}/install/lib -lprogress -L${bml_PATH}/install/lib -lbml -L${metis_PATH}/install -lmetis +# Uncomment the following line to use PROGRESS/BML +latte_SYSLIB += -L${progress_PATH}/install/lib -lprogress -L${bml_PATH}/install/lib -lbml -L${metis_PATH}/install -lmetis + + +latte_SYSPATH = -L/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 diff --git a/lib/latte/README b/lib/latte/README new file mode 100644 index 0000000000000000000000000000000000000000..4166d03166dd8c91e729d1622d666e596c9d8dce --- /dev/null +++ b/lib/latte/README @@ -0,0 +1,43 @@ +This directory contains build settings for the LATTE library which +is required to use the LATTE package and its fix latte command in a +LAMMPS input script. + +Information about the LATTE DFTB code can be found at: +https://github.com/losalamos/LATTE + +The LATTE development effort is led by Marc Cawkwell and +Anders Niklasson at Los Alamos National Laboratory. + +To download, build, and install LATTE as a library on your system, +follow these steps: + +- Download or clone the LATTE source code from: + https://github.com/losalamos/LATTE. + +- Modify the makefile.CHOICES according to your system architecture + and compilers. + +- Set the MAKELIB flag to ON in makefile.CHOICES and finally, build the + code with the make command. + +Note that if you unpack and build LATTE in this directory and you +download a new LAMMPS tarball, the files you have added here will be +lost. So you likely want to build it somewhere else. The recommended +place is the home directory. + +To build LAMMPS with the LATTE library you should follow the following +instructions: + +- copy makefile.lammps.* to makefile.lammps in the /lammps/lib/latte directory. + +- Change the path, flags and compilers on the makefile.lammps according + to your compilers, architecture and the LATTE location. + +- Finally, you should execute the following commands: + $ cd lammps/src + $ make yes-latte + $ make g++ (or whatever target you wish) + +Note that the Makefile.lammps file in this directory is required to +allow the LAMMPS build to find the necessary LATTE files. You should +not normally need to edit this file. diff --git a/src/LATTE/Install.sh b/src/LATTE/Install.sh new file mode 100644 index 0000000000000000000000000000000000000000..2fb34096c8ff2790ba782e196251e8f07cbaf678 --- /dev/null +++ b/src/LATTE/Install.sh @@ -0,0 +1,67 @@ +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +mode=$1 + +# enforce using portable C locale +LC_ALL=C +export LC_ALL + +# arg1 = file, arg2 = file it depends on + +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} + +# all package files with no dependencies + +for file in *.cpp *.h; do + action $file +done + +# edit 2 Makefile.package files to include/exclude package info + +if (test $1 = 1) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*latte[^ \t]* //' ../Makefile.package + sed -i -e 's|^PKG_INC =[ \t]*|&-I../../lib/latte |' ../Makefile.package + sed -i -e 's|^PKG_PATH =[ \t]*|&-L../../lib/latte |' ../Makefile.package + #sed -i -e 's|^PKG_LIB =[ \t]*|&-llatte |' ../Makefile.package + sed -i -e 's|^PKG_SYSINC =[ \t]*|&$(latte_SYSINC) |' ../Makefile.package + sed -i -e 's|^PKG_SYSLIB =[ \t]*|&$(latte_SYSLIB) |' ../Makefile.package + sed -i -e 's|^PKG_SYSPATH =[ \t]*|&$(latte_SYSPATH) |' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*latte.*$/d' ../Makefile.package.settings + # multiline form needed for BSD sed on Macs + sed -i -e '4 i \ +include ..\/..\/lib\/latte\/Makefile.lammps +' ../Makefile.package.settings + fi + +elif (test $1 = 0) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*latte[^ \t]* //' ../Makefile.package + fi + + if (test -e ../Makefile.package.settings) then + sed -i -e '/^include.*latte.*$/d' ../Makefile.package.settings + fi + +fi diff --git a/src/LATTE/README b/src/LATTE/README new file mode 100644 index 0000000000000000000000000000000000000000..e82480c865d350322f9095ed5be7893bcef8e981 --- /dev/null +++ b/src/LATTE/README @@ -0,0 +1,28 @@ +This package provides a fix latte command which is a wrapper on the +LATTE DFTB code, so that molecular dynamics can be run with LAMMPS +using density-functional tight-binding quantum forces calculated by +LATTE. More information on LATTE can be found at "web site". Its +authors are Anders Niklasson, etc at LANL. + +Using this package requires the LATTE code to be downloaded and built +as a library on your system. The library can be downloaded and built +in lib/latte or elsewhere on your system, which must be done before +building LAMMPS with this package. Details of the download, build, and +install process for LATTE are given in the lib/latte/README file, and +scripts are provided to help automate the process. + +Also see the LAMMPS manual for general information on building LAMMPS +with external libraries. The settings in the Makefile.lammps file in +lib/latte must be correct for LAMMPS to build correctly with this +package installed. However, the default settings should be correct in +most cases and the Makefile.lammps file usually will not need to be +changed. + +Once you have successfully built LAMMPS with this package and the +LATTE library you can test it using an input file from the examples +dir: + +./lmp_serial < lammps/examples/latte/in.latte + +This pair style was written in collaboration with the LATTE +developers. diff --git a/src/LATTE/fix_latte.cpp b/src/LATTE/fix_latte.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a35318bc3a0ce89d9c590cf88741586575672d1a --- /dev/null +++ b/src/LATTE/fix_latte.cpp @@ -0,0 +1,343 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +// NOTES on possible future issues: +// LATTE compute and return 6-value virial tensor +// can LATTE compute per-atom energy and per-atom virial +// for minimize, what about charge DOFs +// implement charge DOF integration +// pass neighbor list to LATTE: half or full +// will we ever auto-adjust the timestep in reset_dt() +// could pass an input file to LATTE, specified in LAMMPS input script +// what units options can LAMMPS be using +// should LATTE take triclinic box from LAMMPS +// does Coulomb potential = pe[i]/q[i], is it 0 when q = 0 +// how will this work for serial/parallel LAMMPS with serial/parallel LATTE +// INPORTANT NOTE: ADD checks for metal units !!!!!!!!!!!!! + +#include <stdio.h> +#include <string.h> +#include "fix_latte.h" +#include "atom.h" +#include "comm.h" +#include "update.h" +#include "neighbor.h" +#include "domain.h" +#include "force.h" +#include "neigh_request.h" +#include "neigh_list.h" +#include "modify.h" +#include "compute.h" +#include "memory.h" +#include "error.h" + +using namespace LAMMPS_NS; +using namespace FixConst; + +extern "C" { + void latte(int *, int *, double *, int *, int *, + double *, double *, double *, double *, + double *, double *, double *, int*, + double *, double *, double *, double * ); +} + +#define INVOKED_PERATOM 8 + +/* ---------------------------------------------------------------------- */ + +FixLatte::FixLatte(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg) +{ + if (narg != 4) error->all(FLERR,"Illegal fix latte command"); + + if (comm->nprocs != 1) + error->all(FLERR,"Fix latte currently runs only in serial"); + + scalar_flag = 1; + global_freq = 1; + extscalar = 1; + virial_flag = 1; + + // store ID of compute pe/atom used to generate Coulomb potential for LATTE + // NULL means LATTE will compute Coulombic potential + + coulomb = 0; + id_pe = NULL; + + if (strcmp(arg[3],"NULL") != 0) { + coulomb = 1; + + int n = strlen(arg[3]) + 1; + id_pe = new char[n]; + strcpy(id_pe,arg[3]); + + int ipe = modify->find_compute(id_pe); + if (ipe < 0) error->all(FLERR,"Could not find fix latte compute ID"); + if (modify->compute[ipe]->peatomflag == 0) + error->all(FLERR,"Fix latte compute ID does not compute pe/atom"); + } + + // initializations + + nmax = 0; + qpotential = NULL; + flatte = NULL; + + latte_energy = 0.0; +} + +/* ---------------------------------------------------------------------- */ + +FixLatte::~FixLatte() +{ + delete [] id_pe; + memory->destroy(qpotential); + memory->destroy(flatte); +} + +/* ---------------------------------------------------------------------- */ + +int FixLatte::setmask() +{ + int mask = 0; + //mask |= INITIAL_INTEGRATE; + //mask |= FINAL_INTEGRATE; + mask |= PRE_REVERSE; + mask |= POST_FORCE; + mask |= MIN_POST_FORCE; + mask |= THERMO_ENERGY; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::init() +{ + // error checks + + if (domain->dimension == 2) + error->all(FLERR,"Fix latte requires 3d problem"); + + if (coulomb) { + if (atom->q_flag == 0 || force->pair == NULL || force->kspace == NULL) + error->all(FLERR,"Fix latte cannot compute Coulombic potential"); + + int ipe = modify->find_compute(id_pe); + if (ipe < 0) error->all(FLERR,"Could not find fix latte compute ID"); + c_pe = modify->compute[ipe]; + } + + // must be fully periodic or fully non-periodic + + if (domain->nonperiodic == 0) pbcflag = 1; + else if (!domain->xperiodic && !domain->yperiodic && !domain->zperiodic) + pbcflag = 0; + else error->all(FLERR,"Fix latte requires 3d simulation"); + + // create qpotential & flatte if needed + // for now, assume nlocal will never change + + if (coulomb && qpotential == NULL) { + memory->create(qpotential,atom->nlocal,"latte:qpotential"); + memory->create(flatte,atom->nlocal,3,"latte:flatte"); + } + + /* + // warn if any integrate fix comes after this one + // is it actually necessary for q(n) update to come after x,v update ?? + + int after = 0; + int flag = 0; + for (int i = 0; i < modify->nfix; i++) { + if (strcmp(id,modify->fix[i]->id) == 0) after = 1; + else if ((modify->fmask[i] & INITIAL_INTEGRATE) && after) flag = 1; + } + if (flag && comm->me == 0) + error->warning(FLERR,"Fix latte should come after all other " + "integration fixes"); + */ + + /* + // need a full neighbor list + // could we use a half list? + // perpetual list, built whenever re-neighboring occurs + + int irequest = neighbor->request(this,instance_me); + neighbor->requests[irequest]->pair = 0; + neighbor->requests[irequest]->fix = 1; + neighbor->requests[irequest]->half = 0; + neighbor->requests[irequest]->full = 1; + */ +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::init_list(int id, NeighList *ptr) +{ + // list = ptr; +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::setup(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::min_setup(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- + integrate electronic degrees of freedom +------------------------------------------------------------------------- */ + +void FixLatte::initial_integrate(int vflag) {} + +/* ---------------------------------------------------------------------- + store eflag, so can use it in post_force to tally per-atom energies +------------------------------------------------------------------------- */ + +void FixLatte::pre_reverse(int eflag, int vflag) +{ + eflag_caller = eflag; +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::post_force(int vflag) +{ + int eflag = eflag_caller; + if (eflag || vflag) ev_setup(eflag,vflag); + // else evflag = 0; + else evflag = eflag_global = vflag_global = eflag_atom = vflag_atom = 0; + + // compute Coulombic potential = pe[i]/q[i] + // invoke compute pe/atom + // wrap with clear/add and trigger pe/atom calculation every step + + if (coulomb) { + modify->clearstep_compute(); + + if (!(c_pe->invoked_flag & INVOKED_PERATOM)) { + c_pe->compute_peratom(); + c_pe->invoked_flag |= INVOKED_PERATOM; + } + + modify->addstep_compute(update->ntimestep+1); + + double *pe = c_pe->vector_atom; + double *q = atom->q; + int nlocal = atom->nlocal; + + for (int i = 0; i < nlocal; i++) + if (q[i]) qpotential[i] = pe[i]/q[i]; + else qpotential[i] = 0.0; + } + + // hardwire these unsupported flags for now + + int coulombflag = 0; + // pe_peratom = 0; + // virial_global = 1; // set via vflag_global at some point + // virial_peratom = 0; + neighflag = 0; + + // set flags used by LATTE + + int flags[6]; + + flags[0] = pbcflag; // 1 for fully periodic, 0 for fully non-periodic + flags[1] = coulombflag; // 1 for LAMMPS computes Coulombics, 0 for LATTE + flags[2] = eflag_atom; // 1 to return per-atom energies, 0 for no + flags[3] = vflag_global; // 1 to return global virial 0 for no + flags[4] = vflag_atom; // 1 to return per-atom virial, 0 for no + flags[5] = neighflag; // 1 to pass neighbor list to LATTE, 0 for no + + // setup LATTE arguments + + int natoms = atom->nlocal; + double *coords = &atom->x[0][0]; + int *type = atom->type; + int ntypes = atom->ntypes; + double *mass = &atom->mass[1]; + double *boxlo = domain->boxlo; + double *boxhi = domain->boxhi; + + double *forces; + if (coulomb) forces = &flatte[0][0]; + else forces = &atom->f[0][0]; + + int maxiter = -1; + + latte(flags,&natoms,coords,type,&ntypes,mass,boxlo,boxhi,&domain->xy, + &domain->xz,&domain->yz, + forces,&maxiter,&latte_energy,&atom->v[0][0],&update->dt,virial); + + // sum LATTE forces to LAMMPS (Coulombic) forces + + if (coulomb) { + double **f = atom->f; + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + f[i][0] += flatte[i][0]; + f[i][1] += flatte[i][1]; + f[i][2] += flatte[i][2]; + } + } +} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::min_post_force(int vflag) +{ + post_force(vflag); +} + +/* ---------------------------------------------------------------------- + integrate electronic degrees of freedom +------------------------------------------------------------------------- */ + +void FixLatte::final_integrate() {} + +/* ---------------------------------------------------------------------- */ + +void FixLatte::reset_dt() +{ + //dtv = update->dt; + //dtf = 0.5 * update->dt * force->ftm2v; +} + +/* ---------------------------------------------------------------------- + DFTB energy from LATTE +------------------------------------------------------------------------- */ + +double FixLatte::compute_scalar() +{ + return latte_energy; +} + +/* ---------------------------------------------------------------------- + memory usage of local arrays +------------------------------------------------------------------------- */ + +double FixLatte::memory_usage() +{ + double bytes = 0.0; + if (coulomb) bytes += nmax * sizeof(double); + if (coulomb) bytes += nmax*3 * sizeof(double); + return bytes; +} diff --git a/src/LATTE/fix_latte.h b/src/LATTE/fix_latte.h new file mode 100644 index 0000000000000000000000000000000000000000..d6b75d52f40a895b37c5cbec2da5756ae1d644af --- /dev/null +++ b/src/LATTE/fix_latte.h @@ -0,0 +1,72 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS + +FixStyle(latte,FixLatte) + +#else + +#ifndef LMP_FIX_LATTE_H +#define LMP_FIX_LATTE_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixLatte : public Fix { + public: + FixLatte(class LAMMPS *, int, char **); + virtual ~FixLatte(); + int setmask(); + void init(); + void init_list(int, class NeighList *); + void setup(int); + void min_setup(int); + void initial_integrate(int); + void pre_reverse(int, int); + void post_force(int); + void min_post_force(int); + void final_integrate(); + void reset_dt(); + double compute_scalar(); + double memory_usage(); + + protected: + char *id_pe; + int coulomb,pbcflag,pe_peratom,virial_global,virial_peratom,neighflag; + int eflag_caller; + + int nmax; + double *qpotential; + double **flatte; + double latte_energy; + + class NeighList *list; + class Compute *c_pe; +}; + +} + +#endif +#endif + +/* ERROR/WARNING messages: + +E: Illegal ... command + +Self-explanatory. Check the input script syntax and compare to the +documentation for the command. You can use -echo screen as a +command-line option when running LAMMPS to see the offending line. + +*/ diff --git a/src/Makefile b/src/Makefile index 3b67d2284fb8b968a513280d7a93fd3c9a6ecae1..3b14248b9a77663cd5e2927cfc0dafabb67949c6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -53,8 +53,8 @@ endif # PACKEXT = subset that require an external (downloaded) library PACKAGE = asphere body class2 colloid compress coreshell dipole gpu \ - granular kim kokkos kspace manybody mc meam misc molecule \ - mpiio mscg opt peri poems \ + granular kim kokkos kspace latte manybody mc meam misc \ + molecule mpiio mscg opt peri poems \ python qeq reax replica rigid shock snap srd voronoi PACKUSER = user-atc user-awpmd user-cgdna user-cgsdk user-colvars \ @@ -64,7 +64,7 @@ PACKUSER = user-atc user-awpmd user-cgdna user-cgsdk user-colvars \ user-quip user-reaxc user-smd user-smtbq user-sph user-tally \ user-vtk -PACKLIB = compress gpu kim kokkos meam mpiio mscg poems \ +PACKLIB = compress gpu kim kokkos latte meam mpiio mscg poems \ python reax voronoi \ user-atc user-awpmd user-colvars user-h5md user-lb user-molfile \ user-netcdf user-qmmm user-quip user-smd user-vtk diff --git a/test.txt b/test.txt new file mode 100644 index 0000000000000000000000000000000000000000..b08910052722041150089dfcb707b50ad2bc1e16 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +The creation of this file is for testing purposes only.