├── LICENSE.md ├── README.md ├── version_1.1_vasp.5.3.5 ├── Occupation matrix control in VASP.pdf ├── mods_LDApU.F_vasp_5.3.5.diff └── mods_main.F_vasp.5.3.5.diff ├── version_1.2_vasp.5.4.4 ├── Occupation matrix control in VASP.pdf ├── mods_LDApU.F_vasp.5.4.4.diff └── mods_main.F_vasp.5.4.4.diff └── version_1.4_vasp.5.4.4_spin_orbit ├── Occupation matrix control in VASP - V1.4.pdf └── Occupation_matrix_vasp.5.4.4_spin_oribit.patch /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019 Prof. Graeme Watson, Trinity College Dublin, watsong@tcd.ie 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Occupation-matrix-control-in-VASP 2 | 3 | Occupation matrix control sets the occupations used when calculating the DFT+U corrections. It does not directly change the electron distribution. In this way it will effectively encourage the occupations entered. This has two direct uses 4 | 5 | 1) To set a specific electronic occupation. 6 | 7 | 2) To obtain localisation at a specific site (atom and location) and look for the minimum energy occupation. 8 | 9 | More details can be found in the pdf in each directory. 10 | 11 | 26/06/2019 Version 1.2 - added support for vasp.5.4.4 12 | 13 | 05/09/2019 Version 1.4 - includes all previous functions with the the addition of of spin orbit. 14 | 15 | ## Installation 16 | 17 | for the latest versino place the patch files `Occupation_matrix_vasp.5.4.4_spin_oribit.patch` in the VASP root directory 18 | 19 | ``` 20 | $ patch -p0 < Occupation_matrix_vasp.5.4.4_spin_oribit.patch 21 | ``` 22 | 23 | You can then compile vasp in the usual way. 24 | 25 | 26 | Note - For older versions separate patch files are provided for main.F and LDAu.F which must be patched from the src directory - see the instructions in the associated pdf for further details. 27 | 28 | ## Usage 29 | 30 | Occupation matrix control sets the occupations used when calculating the DFT+U corrections. It does not directly change the electron distribution. In this way it will effectively encourage the occupations entered. This has two direct uses 31 | 32 | 1) To set a specific occupation. 33 | In this case the electron occupations are set and the structure relaxed. It is usually best in the first step to ensure localisation on the site of choice as the initial localisation will direct the associated polaronic distortion at the site during relaxation. Once the relaxation is complete (to some degree) the occupation control should be switched off and the calculation restarted. The occupation can be picked up from the WAVECAR and the system is allowed to relax. The system may or may not retain the occupation originally intended and this will need to be checked. LDAUPRINT=2 is useful for this. 34 | The reason for this is that using the occupation matrix causes shifts in the energy as you are setting occupations - which even for the specific electron configuration you are looking at is never absolutely correct (there is always some mixing / distortion / rotation of orbitals). Hence the need to restart with the occupation matrix switched off. 35 | 36 | 2) To obtain localisation at a specific site and look for the minimum energy occupation. 37 | This is slightly easier as essentially you are attempting to create a polaronic distortion. In simple systems like TiO2 and CeO2 this can be done by setting a single electron occupation (usually use one of the low energy orbitals for the crystal field) and relaxing the system. Again it is usually best in the first step to ensure localisation on the site of choice as the initial localisation will direct the associated polaronic distortion at the site during relaxation. Once it has relaxed and created the distortion (do not usually need it that well converged) you can switch the occupation matrix control off. Generally we have found (especially for f orbitals) that the occupation becomes trapped in a specific orbital while in some d electron systems the electron can sometimes switch orbitals. 38 | 39 | For d orbitals, if you want the lowest energy it is usually best to delete the WAVECAR and allow VASP to search for the lowest electronic structure for the given distortion . It is also advised to perform a single SCF initially and ensure reasonable localisation before relaxing the structure. 40 | 41 | For f orbitals we have sometimes found that the distortions for different orbitals can be sufficiently different that it can direct the occupation even with the WAVECAR deleted. Hence, you have to search (or at least guess) which orbital should be occupied in the initial optimisation (i.e. choose a low energy orbital for the crystal field splitting). 42 | 43 | 44 | ### Specifiying Occupations 45 | 46 | Occupation matrix control can be used for any orbital - s, p, d or f - although VASP only allows U to be applied to a single set of orbitals (s, p, d or f) for a given atom. Each atom essentially has a matrix of orbital occupations - VASP defines this with respect to the Cartesian coordinates. This can make getting specific occupation (or orbitals) difficult if the local structure of the atom does not correspond to the x, y and z axes. 47 | 48 | There are two different methods for specifiying occupations 49 | 50 | #### OCCDIRX 51 | 52 | This allows specific orbital occupations to be specified in the INCAR files using the keyword OCCDIRX - where X is a number between 1 and 999. 53 | 54 | ``` 55 | OCCDIRX No of atoms, No * (ATOM, LDAUL, No of elements, No of E *( i, j, spin, occ)) 56 | ``` 57 | 58 | No of atoms - number of atoms specified on this line 59 | Atom - atom number in POSCAR 60 | LDAUL - orbital type (0-s, 1-p, 2-d, 3-f) 61 | No of elements - Number of occupation matrix elements set for this atom 62 | i,j - matrix element (1-16,1-16) 63 | spin - which spin the occupation is for (1-up, 2-down) 64 | occ - the occupation (up to 1.0) 65 | 66 | NOTE - Anything not set by the OCCDIRX lines will automatically be set to zero. 67 | 68 | E.g. 69 | ``` 70 | OCCDIR1 = 2 1 3 1 13 13 1 1.0 2 3 1 13 13 1 1.0 71 | ``` 72 | 73 | Occupations are set on two atoms: 74 | Atom 1 in POSCAR - f orbital, 1 element to set: 13-13 (f-3) up spin occupation set to 1.0 75 | Atom 2 in POSCAR - f orbital, 1 element to set: 13-13 (f-3) up spin occupation set to 1.0 76 | 77 | 78 | NOTE - Non-colinnear input does not include the imaginary component of the matrix elements and is therefore not recommended. 79 | 80 | #### OCCEXT 81 | 82 | We have implemented a direct occupation matrix input for atoms through an external file. This greatly helps when 83 | 1) the crystal field is not aligned with the axis of the structure (in which case a number of off diagonal elements are required) 84 | 2) dealing with atoms with large numbers of d and f electrons 85 | 3) there is a specific orbital distortion (e.g. due to vacancies or at surfaces) 86 | 4) there is significant co-valent interactions resulting in more d occupation than simply the filling of specific orbitals. 87 | To use this you need a good guess of the occupation matrix appropriate for the environment. This can often be achieve by using OCCDIR on a simple unit cell or taken from another crystal structure (e.g. for a particular oxidation state) 88 | 89 | Reading in from an external file (OCCMATRIX) is specified in the INCAR by the tag OCCEXT = 1. 90 | 91 | The format of the file is similar to the output when LDAUPRINT = 2 is specified (see example below). The top line has the number of atoms which have their occupations set in the external file. There are then this number of blocks on input with the following format. The first line of each block has the atom number (in the POSCAR), the angular momentum of the orbitals in question and whether there is spin(2) or not(1). Following this is a line which I usually just use to label the spin component (which is not actually taken notice of). Following this is the spin up occupation matrix (size appropriate for the angular momentum). If spin polarization was requested this is followed by another line for comment and a second occupation matrix. There is a blank line between the end of one block and the start of the next. 92 | 93 | For example the occupations of Fe3+ (d5) taken from a FM calculation can be used to specific an AFM arrangement with the matrices for the spin up and spin down reversed for the second atom (I left the spin label to remind me a reversed them). 94 | 95 | ``` 96 | 2 No of atoms to be specified 97 | 3 2 2 Atom No (in POSCAR), L, spin(2) or not (1) 98 | spin component 1 Not really important what is here ! 99 | 0.7997 0.3554 -0.0000 -0.0000 -0.0000 100 | 0.3554 0.5269 -0.0000 -0.0000 -0.0000 101 | -0.0000 -0.0000 1.0225 0.0653 0.0575 102 | -0.0000 -0.0000 0.0653 0.7468 -0.3435 103 | -0.0000 -0.0000 0.0575 -0.3435 0.6179 104 | spin component 2 105 | 0.9057 -0.3651 0.0000 -0.0000 0.0000 106 | -0.3651 0.3291 0.0000 -0.0000 0.0000 107 | 0.0000 0.0000 0.5578 0.4221 0.0993 108 | -0.0000 -0.0000 0.4221 0.5288 0.2056 109 | 0.0000 0.0000 0.0993 0.2056 0.2269 110 | Blank line between atoms 111 | 4 2 2 Atom No (in POSCAR), L, spin(2) or not (1) 112 | spin component 2 Spins switched to give the AFM arrangmnet 113 | 0.9057 -0.3651 0.0000 -0.0000 0.0000 114 | -0.3651 0.3291 0.0000 -0.0000 0.0000 115 | 0.0000 0.0000 0.5578 0.4221 0.0993 116 | -0.0000 -0.0000 0.4221 0.5288 0.2056 117 | 0.0000 0.0000 0.0993 0.2056 0.2269 118 | spin component 1 119 | 0.7997 0.3554 -0.0000 -0.0000 -0.0000 120 | 0.3554 0.5269 -0.0000 -0.0000 -0.0000 121 | -0.0000 -0.0000 1.0225 0.0653 0.0575 122 | -0.0000 -0.0000 0.0653 0.7468 -0.3435 123 | -0.0000 -0.0000 0.0575 -0.3435 0.6179 124 | Blank line 125 | ``` 126 | 127 | #### Non-colinear / spin orbit calculations 128 | 129 | in the case of non-collinear / spin orbit the occupation matrix is now twice as large as the number of atomic orbital involved. In addition, the matrix is complex. VASP handles this by having 4 complex n x n matrices, where n is the number of atomic orbital relevant for the given L. e.g. a four 5x5 matrices for d orbitals or four 7x7 matrices for f orbitals. 130 | The matrix input follows the same format as for spin polarised calculation except instead of two spins the spin tag is used to select the four matrices input. In addition there are two matrices side by side which are the real and complex parts of the occupation matrix. 131 | 132 | The example below shows the occupation matrix for the 3K magnetic structure of UO2. There are four atoms in the cubic unit cell with each with 4 “spin components” which represent the different parts of the single occupation matrix 133 | 134 | ``` 135 | 4 136 | 1 3 4 137 | spin component 1 138 | 0.2942 0.0147 0.0789 0.0078 0.0297 -0.0015 -0.0876 -0.0000 0.0006 0.0021 0.0039 0.0215 -0.2219 -0.0922 139 | 0.0147 0.1290 0.0137 0.0186 0.0035 0.0020 -0.0045 -0.0006 0.0000 0.0188 -0.0116 -0.0147 -0.0165 -0.0121 140 | 0.0789 0.0137 0.3010 0.0060 -0.0652 0.0030 -0.0285 -0.0021 -0.0188 -0.0000 -0.2886 -0.0733 -0.0890 -0.0242 141 | 0.0078 0.0186 0.0060 0.3732 0.0933 0.0226 -0.0062 -0.0039 0.0116 0.2886 0.0000 -0.0864 -0.0013 -0.0048 142 | 0.0297 0.0035 -0.0652 0.0933 0.0832 -0.0134 -0.0212 -0.0215 0.0147 0.0733 0.0864 0.0000 -0.0168 -0.0044 143 | -0.0015 0.0020 0.0030 0.0226 -0.0134 0.2214 0.0798 0.2219 0.0165 0.0890 0.0013 0.0168 -0.0000 -0.0738 144 | -0.0876 -0.0045 -0.0285 -0.0062 -0.0212 0.0798 0.0945 0.0922 0.0121 0.0242 0.0048 0.0044 0.0738 -0.0000 145 | spin component 2 146 | 0.1042 0.0116 0.0345 0.0033 0.0022 0.0827 -0.0006 0.0966 0.0055 0.0302 -0.0023 0.0168 -0.0904 -0.0713 147 | 0.0049 0.0041 0.0264 0.0051 -0.0025 -0.0068 -0.0065 -0.0083 -0.0040 0.0020 -0.0210 -0.0073 -0.0166 -0.0005 148 | 0.0015 0.0017 0.0585 0.0809 0.0042 0.0178 0.0030 0.0130 0.0001 0.0717 -0.0663 -0.0359 -0.0047 -0.0048 149 | -0.0115 -0.0043 0.0799 -0.1147 -0.0596 -0.0018 0.0066 0.0060 -0.0097 -0.0976 -0.0983 0.0025 0.0007 0.0037 150 | -0.0095 0.0152 0.0134 0.2741 0.0759 -0.0437 -0.0251 -0.0758 0.0038 0.2104 -0.0165 -0.0836 0.0118 0.0259 151 | 0.0673 0.0033 -0.0087 0.0162 0.0278 -0.0635 -0.0477 -0.0757 0.0048 -0.0094 0.0316 0.0030 -0.0544 0.0013 152 | -0.0186 -0.0002 -0.0053 -0.0007 -0.0237 0.2309 0.1020 0.2714 0.0163 0.0829 0.0056 0.0266 0.0147 -0.0837 153 | spin component 3 154 | 0.1042 0.0049 0.0015 -0.0115 -0.0095 0.0673 -0.0186 -0.0966 0.0083 -0.0130 -0.0060 0.0758 0.0757 -0.2714 155 | 0.0116 0.0041 0.0017 -0.0043 0.0152 0.0033 -0.0002 -0.0055 0.0040 -0.0001 0.0097 -0.0038 -0.0048 -0.0163 156 | 0.0345 0.0264 0.0585 0.0799 0.0134 -0.0087 -0.0053 -0.0302 -0.0020 -0.0717 0.0976 -0.2104 0.0094 -0.0829 157 | 0.0033 0.0051 0.0809 -0.1147 0.2741 0.0162 -0.0007 0.0023 0.0210 0.0663 0.0983 0.0165 -0.0316 -0.0056 158 | 0.0022 -0.0025 0.0042 -0.0596 0.0759 0.0278 -0.0237 -0.0168 0.0073 0.0359 -0.0025 0.0836 -0.0030 -0.0266 159 | 0.0827 -0.0068 0.0178 -0.0018 -0.0437 -0.0635 0.2309 0.0904 0.0166 0.0047 -0.0007 -0.0118 0.0544 -0.0147 160 | -0.0006 -0.0065 0.0030 0.0066 -0.0251 -0.0477 0.1020 0.0713 0.0005 0.0048 -0.0037 -0.0259 -0.0013 0.0837 161 | spin component 4 162 | 0.1086 -0.0001 0.0115 -0.0011 -0.0299 -0.0017 0.0924 -0.0000 0.0079 -0.0058 -0.0025 0.0204 0.0545 -0.1132 163 | -0.0001 0.1230 0.0030 0.0019 0.0071 0.0021 -0.0093 -0.0079 -0.0000 -0.0026 0.0083 -0.0101 -0.0031 -0.0066 164 | 0.0115 0.0030 0.0625 -0.0078 0.0650 -0.0067 0.0148 0.0058 0.0026 -0.0000 0.0480 -0.0495 -0.0054 -0.0027 165 | -0.0011 0.0019 -0.0078 0.1029 -0.0894 -0.0185 0.0053 0.0025 -0.0083 -0.0480 -0.0000 -0.0867 0.0057 0.0087 166 | -0.0299 0.0071 0.0650 -0.0894 0.2707 0.0281 -0.0766 -0.0204 0.0101 0.0495 0.0867 0.0000 -0.0489 0.0163 167 | -0.0017 0.0021 -0.0067 -0.0185 0.0281 0.0682 -0.0829 -0.0545 0.0031 0.0054 -0.0057 0.0489 0.0000 -0.0621 168 | 0.0924 -0.0093 0.0148 0.0053 -0.0766 -0.0829 0.3109 0.1132 0.0066 0.0027 -0.0087 -0.0163 0.0621 -0.0000 169 | 170 | 2 3 4 171 | spin component 1 172 | 0.2942 -0.0147 0.0789 0.0078 -0.0297 -0.0015 0.0876 -0.0000 -0.0006 0.0021 0.0039 -0.0215 -0.2219 0.0922 173 | -0.0147 0.1290 -0.0137 -0.0186 0.0035 -0.0020 -0.0045 0.0006 0.0000 -0.0188 0.0116 -0.0147 0.0165 -0.0121 174 | 0.0789 -0.0137 0.3010 0.0060 0.0652 0.0030 0.0285 -0.0021 0.0188 0.0000 -0.2886 0.0733 -0.0890 0.0242 175 | 0.0078 -0.0186 0.0060 0.3732 -0.0933 0.0226 0.0062 -0.0039 -0.0116 0.2886 0.0000 0.0864 -0.0013 0.0048 176 | -0.0297 0.0035 0.0652 -0.0933 0.0832 0.0134 -0.0212 0.0215 0.0147 -0.0733 -0.0864 -0.0000 0.0168 -0.0044 177 | -0.0015 -0.0020 0.0030 0.0226 0.0134 0.2214 -0.0798 0.2219 -0.0165 0.0890 0.0013 -0.0168 -0.0000 0.0738 178 | 0.0876 -0.0045 0.0285 0.0062 -0.0212 -0.0798 0.0945 -0.0922 0.0121 -0.0242 -0.0048 0.0044 -0.0738 -0.0000 179 | spin component 2 180 | -0.1042 0.0116 -0.0345 -0.0033 0.0022 -0.0827 -0.0006 -0.0966 0.0055 -0.0302 0.0023 0.0168 0.0904 -0.0713 181 | 0.0049 -0.0041 0.0264 0.0051 0.0025 -0.0068 0.0065 -0.0083 0.0040 0.0020 -0.0210 0.0073 -0.0166 0.0005 182 | -0.0015 0.0017 -0.0585 -0.0809 0.0042 -0.0178 0.0030 -0.0130 0.0001 -0.0717 0.0663 -0.0359 0.0047 -0.0048 183 | 0.0115 -0.0043 -0.0799 0.1147 -0.0596 0.0018 0.0066 -0.0060 -0.0097 0.0976 0.0983 0.0025 -0.0007 0.0037 184 | -0.0095 -0.0152 0.0134 0.2741 -0.0759 -0.0437 0.0251 -0.0758 -0.0038 0.2104 -0.0165 0.0836 0.0118 -0.0259 185 | -0.0673 0.0033 0.0087 -0.0162 0.0278 0.0635 -0.0477 0.0757 0.0048 0.0094 -0.0316 0.0030 0.0544 0.0013 186 | -0.0186 0.0002 -0.0053 -0.0007 0.0237 0.2309 -0.1020 0.2714 -0.0163 0.0829 0.0056 -0.0266 0.0147 0.0837 187 | spin component 3 188 | -0.1042 0.0049 -0.0015 0.0115 -0.0095 -0.0673 -0.0186 0.0966 0.0083 0.0130 0.0060 0.0758 -0.0757 -0.2714 189 | 0.0116 -0.0041 0.0017 -0.0043 -0.0152 0.0033 0.0002 -0.0055 -0.0040 -0.0001 0.0097 0.0038 -0.0048 0.0163 190 | -0.0345 0.0264 -0.0585 -0.0799 0.0134 0.0087 -0.0053 0.0302 -0.0020 0.0717 -0.0976 -0.2104 -0.0094 -0.0829 191 | -0.0033 0.0051 -0.0809 0.1147 0.2741 -0.0162 -0.0007 -0.0023 0.0210 -0.0663 -0.0983 0.0165 0.0316 -0.0056 192 | 0.0022 0.0025 0.0042 -0.0596 -0.0759 0.0278 0.0237 -0.0168 -0.0073 0.0359 -0.0025 -0.0836 -0.0030 0.0266 193 | -0.0827 -0.0068 -0.0178 0.0018 -0.0437 0.0635 0.2309 -0.0904 0.0166 -0.0047 0.0007 -0.0118 -0.0544 -0.0147 194 | -0.0006 0.0065 0.0030 0.0066 0.0251 -0.0477 -0.1020 0.0713 -0.0005 0.0048 -0.0037 0.0259 -0.0013 -0.0837 195 | spin component 4 196 | 0.1086 0.0001 0.0115 -0.0011 0.0299 -0.0017 -0.0924 -0.0000 -0.0079 -0.0058 -0.0025 -0.0204 0.0545 0.1132 197 | 0.0001 0.1230 -0.0030 -0.0019 0.0071 -0.0021 -0.0093 0.0079 -0.0000 0.0026 -0.0083 -0.0101 0.0031 -0.0066 198 | 0.0115 -0.0030 0.0625 -0.0078 -0.0650 -0.0067 -0.0148 0.0058 -0.0026 -0.0000 0.0480 0.0495 -0.0054 0.0027 199 | -0.0011 -0.0019 -0.0078 0.1029 0.0894 -0.0185 -0.0053 0.0025 0.0083 -0.0480 -0.0000 0.0867 0.0057 -0.0087 200 | 0.0299 0.0071 -0.0650 0.0894 0.2707 -0.0281 -0.0766 0.0204 0.0101 -0.0495 -0.0867 0.0000 0.0489 0.0163 201 | -0.0017 -0.0021 -0.0067 -0.0185 -0.0281 0.0682 0.0829 -0.0545 -0.0031 0.0054 -0.0057 -0.0489 0.0000 0.0621 202 | -0.0924 -0.0093 -0.0148 -0.0053 -0.0766 0.0829 0.3109 -0.1132 0.0066 -0.0027 0.0087 -0.0163 -0.0621 -0.0000 203 | 204 | 3 3 4 205 | spin component 1 206 | 0.1086 0.0001 0.0115 0.0011 -0.0299 0.0017 0.0924 -0.0000 -0.0079 -0.0058 0.0025 0.0204 -0.0545 -0.1132 207 | 0.0001 0.1230 -0.0030 0.0019 -0.0071 0.0021 0.0093 0.0079 -0.0000 0.0026 0.0083 0.0101 -0.0031 0.0066 208 | 0.0115 -0.0030 0.0625 0.0078 0.0650 0.0067 0.0148 0.0058 -0.0026 -0.0000 -0.0480 -0.0495 0.0054 -0.0027 209 | 0.0011 0.0019 0.0078 0.1029 0.0894 -0.0185 -0.0053 -0.0025 -0.0083 0.0480 -0.0000 0.0867 0.0057 -0.0087 210 | -0.0299 -0.0071 0.0650 0.0894 0.2707 -0.0281 -0.0766 -0.0204 -0.0101 0.0495 -0.0867 0.0000 0.0489 0.0163 211 | 0.0017 0.0021 0.0067 -0.0185 -0.0281 0.0682 0.0829 0.0545 0.0031 -0.0054 -0.0057 -0.0489 0.0000 0.0621 212 | 0.0924 0.0093 0.0148 -0.0053 -0.0766 0.0829 0.3109 0.1132 -0.0066 0.0027 0.0087 -0.0163 -0.0621 -0.0000 213 | spin component 2 214 | 0.1042 -0.0049 0.0015 0.0115 -0.0095 -0.0673 -0.0186 -0.0966 -0.0083 -0.0130 0.0060 0.0758 -0.0757 -0.2714 215 | -0.0116 0.0041 -0.0017 -0.0043 -0.0152 0.0033 0.0002 0.0055 0.0040 0.0001 0.0097 0.0038 -0.0048 0.0163 216 | 0.0345 -0.0264 0.0585 -0.0799 0.0134 0.0087 -0.0053 -0.0302 0.0020 -0.0717 -0.0976 -0.2104 -0.0094 -0.0829 217 | -0.0033 0.0051 -0.0809 -0.1147 -0.2741 0.0162 0.0007 -0.0023 0.0210 -0.0663 0.0983 -0.0165 -0.0316 0.0056 218 | 0.0022 0.0025 0.0042 0.0596 0.0759 -0.0278 -0.0237 -0.0168 -0.0073 0.0359 0.0025 0.0836 0.0030 -0.0266 219 | -0.0827 -0.0068 -0.0178 -0.0018 0.0437 -0.0635 -0.2309 -0.0904 0.0166 -0.0047 -0.0007 0.0118 0.0544 0.0147 220 | -0.0006 0.0065 0.0030 -0.0066 -0.0251 0.0477 0.1020 0.0713 -0.0005 0.0048 0.0037 -0.0259 0.0013 0.0837 221 | spin component 3 222 | 0.1042 -0.0116 0.0345 -0.0033 0.0022 -0.0827 -0.0006 0.0966 -0.0055 0.0302 0.0023 0.0168 0.0904 -0.0713 223 | -0.0049 0.0041 -0.0264 0.0051 0.0025 -0.0068 0.0065 0.0083 -0.0040 -0.0020 -0.0210 0.0073 -0.0166 0.0005 224 | 0.0015 -0.0017 0.0585 -0.0809 0.0042 -0.0178 0.0030 0.0130 -0.0001 0.0717 0.0663 -0.0359 0.0047 -0.0048 225 | 0.0115 -0.0043 -0.0799 -0.1147 0.0596 -0.0018 -0.0066 -0.0060 -0.0097 0.0976 -0.0983 -0.0025 0.0007 -0.0037 226 | -0.0095 -0.0152 0.0134 -0.2741 0.0759 0.0437 -0.0251 -0.0758 -0.0038 0.2104 0.0165 -0.0836 -0.0118 0.0259 227 | -0.0673 0.0033 0.0087 0.0162 -0.0278 -0.0635 0.0477 0.0757 0.0048 0.0094 0.0316 -0.0030 -0.0544 -0.0013 228 | -0.0186 0.0002 -0.0053 0.0007 -0.0237 -0.2309 0.1020 0.2714 -0.0163 0.0829 -0.0056 0.0266 -0.0147 -0.0837 229 | spin component 4 230 | 0.2942 -0.0147 0.0789 -0.0078 0.0297 0.0015 -0.0876 -0.0000 -0.0006 0.0021 -0.0039 0.0215 0.2219 -0.0922 231 | -0.0147 0.1290 -0.0137 0.0186 -0.0035 0.0020 0.0045 0.0006 0.0000 -0.0188 -0.0116 0.0147 -0.0165 0.0121 232 | 0.0789 -0.0137 0.3010 -0.0060 -0.0652 -0.0030 -0.0285 -0.0021 0.0188 -0.0000 0.2886 -0.0733 0.0890 -0.0242 233 | -0.0078 0.0186 -0.0060 0.3732 -0.0933 0.0226 0.0062 0.0039 0.0116 -0.2886 0.0000 0.0864 -0.0013 0.0048 234 | 0.0297 -0.0035 -0.0652 -0.0933 0.0832 0.0134 -0.0212 -0.0215 -0.0147 0.0733 -0.0864 0.0000 0.0168 -0.0044 235 | 0.0015 0.0020 -0.0030 0.0226 0.0134 0.2214 -0.0798 -0.2219 0.0165 -0.0890 0.0013 -0.0168 -0.0000 0.0738 236 | -0.0876 0.0045 -0.0285 0.0062 -0.0212 -0.0798 0.0945 0.0922 -0.0121 0.0242 -0.0048 0.0044 -0.0738 -0.0000 237 | 238 | 4 3 4 239 | spin component 1 240 | 0.1086 -0.0001 0.0115 0.0011 0.0299 0.0017 -0.0924 -0.0000 0.0079 -0.0058 0.0025 -0.0204 -0.0545 0.1132 241 | -0.0001 0.1230 0.0030 -0.0019 -0.0071 -0.0021 0.0093 -0.0079 -0.0000 -0.0026 -0.0083 0.0101 0.0031 0.0066 242 | 0.0115 0.0030 0.0625 0.0078 -0.0650 0.0067 -0.0148 0.0058 0.0026 -0.0000 -0.0480 0.0495 0.0054 0.0027 243 | 0.0011 -0.0019 0.0078 0.1029 -0.0894 -0.0185 0.0053 -0.0025 0.0083 0.0480 -0.0000 -0.0867 0.0057 0.0087 244 | 0.0299 -0.0071 -0.0650 -0.0894 0.2707 0.0281 -0.0766 0.0204 -0.0101 -0.0495 0.0867 0.0000 -0.0489 0.0163 245 | 0.0017 -0.0021 0.0067 -0.0185 0.0281 0.0682 -0.0829 0.0545 -0.0031 -0.0054 -0.0057 0.0489 0.0000 -0.0621 246 | -0.0924 0.0093 -0.0148 0.0053 -0.0766 -0.0829 0.3109 -0.1132 -0.0066 -0.0027 -0.0087 -0.0163 0.0621 -0.0000 247 | spin component 2 248 | -0.1042 -0.0049 -0.0015 -0.0115 -0.0095 0.0673 -0.0186 0.0966 -0.0083 0.0130 -0.0060 0.0758 0.0757 -0.2714 249 | -0.0116 -0.0041 -0.0017 -0.0043 0.0152 0.0033 -0.0002 0.0055 -0.0040 0.0001 0.0097 -0.0038 -0.0048 -0.0163 250 | -0.0345 -0.0264 -0.0585 0.0799 0.0134 -0.0087 -0.0053 0.0302 0.0020 0.0717 0.0976 -0.2104 0.0094 -0.0829 251 | 0.0033 0.0051 0.0809 0.1147 -0.2741 -0.0162 0.0007 0.0023 0.0210 0.0663 -0.0983 -0.0165 0.0316 0.0056 252 | 0.0022 -0.0025 0.0042 0.0596 -0.0759 -0.0278 0.0237 -0.0168 0.0073 0.0359 0.0025 -0.0836 0.0030 0.0266 253 | 0.0827 -0.0068 0.0178 0.0018 0.0437 0.0635 -0.2309 0.0904 0.0166 0.0047 0.0007 0.0118 -0.0544 0.0147 254 | -0.0006 -0.0065 0.0030 -0.0066 0.0251 0.0477 -0.1020 0.0713 0.0005 0.0048 0.0037 0.0259 0.0013 -0.0837 255 | spin component 3 256 | -0.1042 -0.0116 -0.0345 0.0033 0.0022 0.0827 -0.0006 -0.0966 -0.0055 -0.0302 -0.0023 0.0168 -0.0904 -0.0713 257 | -0.0049 -0.0041 -0.0264 0.0051 -0.0025 -0.0068 -0.0065 0.0083 0.0040 -0.0020 -0.0210 -0.0073 -0.0166 -0.0005 258 | -0.0015 -0.0017 -0.0585 0.0809 0.0042 0.0178 0.0030 -0.0130 -0.0001 -0.0717 -0.0663 -0.0359 -0.0047 -0.0048 259 | -0.0115 -0.0043 0.0799 0.1147 0.0596 0.0018 -0.0066 0.0060 -0.0097 -0.0976 0.0983 -0.0025 -0.0007 -0.0037 260 | -0.0095 0.0152 0.0134 -0.2741 -0.0759 0.0437 0.0251 -0.0758 0.0038 0.2104 0.0165 0.0836 -0.0118 -0.0259 261 | 0.0673 0.0033 -0.0087 -0.0162 -0.0278 0.0635 0.0477 -0.0757 0.0048 -0.0094 -0.0316 -0.0030 0.0544 -0.0013 262 | -0.0186 -0.0002 -0.0053 0.0007 0.0237 -0.2309 -0.1020 0.2714 0.0163 0.0829 -0.0056 -0.0266 -0.0147 0.0837 263 | spin component 4 264 | 0.2942 0.0147 0.0789 -0.0078 -0.0297 0.0015 0.0876 -0.0000 0.0006 0.0021 -0.0039 -0.0215 0.2219 0.0922 265 | 0.0147 0.1290 0.0137 -0.0186 -0.0035 -0.0020 0.0045 -0.0006 0.0000 0.0188 0.0116 0.0147 0.0165 0.0121 266 | 0.0789 0.0137 0.3010 -0.0060 0.0652 -0.0030 0.0285 -0.0021 -0.0188 -0.0000 0.2886 0.0733 0.0890 0.0242 267 | -0.0078 -0.0186 -0.0060 0.3732 0.0933 0.0226 -0.0062 0.0039 -0.0116 -0.2886 0.0000 -0.0864 -0.0013 -0.0048 268 | -0.0297 -0.0035 0.0652 0.0933 0.0832 -0.0134 -0.0212 0.0215 -0.0147 -0.0733 0.0864 0.0000 -0.0168 -0.0044 269 | 0.0015 -0.0020 -0.0030 0.0226 -0.0134 0.2214 0.0798 -0.2219 -0.0165 -0.0890 0.0013 0.0168 -0.0000 -0.0738 270 | 0.0876 0.0045 0.0285 -0.0062 -0.0212 0.0798 0.0945 -0.0922 -0.0121 -0.0242 0.0048 0.0044 0.0738 -0.0000 271 | 272 | ``` 273 | 274 | ## How to cite 275 | 276 | For the method please cite the following paper in any publications arising from the use of this code: 277 | 278 | Allen J.P. and Watson G.W., 279 | Occupation matrix control of *d*- and *f*-electron localisations using DFT + *U*, [Physical Chemistry Chemical Physics 16, 21016 (2014)](https://pubs.rsc.org/en/content/articlelanding/2014/cp/c4cp01083c#!divAbstract) 280 | 281 | ## More 282 | More details can be found in the pdf in the directory for each version. 283 | 284 | ## License 285 | This project is licensed under the MIT License - see the [LICENSE.md](./LICENSE.md) for details 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | -------------------------------------------------------------------------------- /version_1.1_vasp.5.3.5/Occupation matrix control in VASP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WatsonGroupTCD/Occupation-matrix-control-in-VASP/084e1695aaf005ed38c6e24dd681e309007e473c/version_1.1_vasp.5.3.5/Occupation matrix control in VASP.pdf -------------------------------------------------------------------------------- /version_1.1_vasp.5.3.5/mods_LDApU.F_vasp_5.3.5.diff: -------------------------------------------------------------------------------- 1 | --- ../../LDApU_orig.F 2015-03-29 20:18:52.692786287 +0100 2 | +++ ../../LDApU.F 2015-03-29 18:29:40.159342664 +0100 3 | @@ -37,7 +37,14 @@ 4 | REAL(q), PRIVATE, ALLOCATABLE, SAVE :: ORBMOM(:,:,:) 5 | 6 | COMPLEX(q), PRIVATE, SAVE :: V(7,7,7,7) 7 | - 8 | + 9 | +! GWW - input occupation matrix 10 | + OVERLAP, PRIVATE, ALLOCATABLE, SAVE :: OCC_MAT_INPUT(:,:,:,:) 11 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_OCC(:) 12 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_L(:) 13 | + INTEGER, PRIVATE, SAVE :: OCC_NATOMS, OCC_PNATOMS 14 | +! END GWW 15 | + 16 | CONTAINS 17 | 18 | !********************************************************************** 19 | @@ -178,7 +185,10 @@ 20 | END SUBROUTINE LDAU_READER 21 | 22 | 23 | - SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU,IDIOT) 24 | +! GWW - change for occupation matrix 25 | + SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU5,IU6,IU,IDIOT) 26 | +! GWW 27 | + 28 | 29 | USE pseudo 30 | 31 | @@ -197,9 +207,32 @@ 32 | COMPLEX(q) CDUM 33 | LOGICAL LDUM 34 | 35 | +!GWW occupation matrix - for the I/O 36 | + INTEGER, PARAMETER :: NDIM=500 37 | + INTEGER :: IU5,IU6 38 | + INTEGER :: N, IERR, ITMP 39 | + LOGICAL :: LOPEN 40 | + CHARACTER (1) :: CHARAC 41 | + REAL(q) :: FTMP(NDIM) 42 | + 43 | +!GWW for occupation matrix 44 | + INTEGER :: NUM_ORB 45 | + INTEGER :: START 46 | + INTEGER :: occ_spin 47 | + INTEGER :: i, ii, j, jj, i1, i2, is 48 | + CHARACTER (10) :: Keyword 49 | + CHARACTER (3) :: keynum 50 | +!GWW 51 | + 52 | NCDIJ=2 53 | IF (LNONCOLLINEAR) NCDIJ=4 54 | 55 | +!GWW - occupation matrix - for reading INCAR 56 | + LOPEN=.FALSE. 57 | + OPEN(UNIT=IU5,FILE='INCAR',STATUS='OLD') 58 | +!GWW 59 | + 60 | + 61 | !======================================================================= 62 | ! Sanity check: L(S)DA+U only implemented for PAW potentials 63 | !======================================================================= 64 | @@ -231,6 +264,221 @@ 65 | ALLOCATE(ORBMOM(LMAX_,3,NIONS)) 66 | ORBMOM=0._q 67 | ENDIF 68 | + 69 | +!---------------------------------------------------------------------- 70 | +! GWW - input of occupation matrix 71 | + 72 | + ALLOCATE(OCC_MAT_INPUT(16,16,NCDIJ,NIONS)) 73 | +#ifdef realmode 74 | + OCC_MAT_INPUT=0._q 75 | +#else 76 | + OCC_MAT_INPUT=(0._q,0_q ) 77 | +#endif 78 | + ALLOCATE(ATOM_OCC(NIONS),ATOM_L(NIONS)) 79 | + 80 | +! Occupation matric input allowing specifcation of matrix elements 81 | +! up to 999 line in INCAR ! OCCDIRX X=1,999 82 | + 83 | + do jj = 1, 999 84 | + if (jj.lt.10) then 85 | + write(keynum,'(I1)')jj 86 | + else if (jj.lt.100) then 87 | + write(keynum,'(I2)')jj 88 | + else 89 | + write(keynum,'(I3)')jj 90 | + endif 91 | + keyword = 'OCCDIR'//keynum 92 | + 93 | + CALL RDATAB(LOPEN,'INCAR',IU5, keyword ,'=','#',';','F', & 94 | + & IDUM,FTMP,CDUM,LDUM,CHARAC,N,NDIM,IERR) 95 | + 96 | + IF ((IERR/=0) .AND. (IERR/=3)) THEN 97 | + WRITE(IU6,*) " " 98 | + WRITE(IU6,'("Error in ",a9," format. Format should be")') keyword 99 | + WRITE(IU6,*)"'No of atoms, No * (ATOM, LDAUL, & 100 | + & No of elements, No of E *( i, j, spin, occ))" 101 | + WRITE(IU6,*)" Everything else will be set to zero !" 102 | + STOP 103 | + ENDIF 104 | + 105 | + IF (IERR==0) then 106 | + 107 | + IF(IU6>0) then 108 | + WRITE(IU6,*) " " 109 | + WRITE(IU6,'(" ",a9," found ")') keyword 110 | +! WRITE(IU6,*)'No of atoms, No * (ATOM, LDAUL, & 111 | +! & No of elements, No of E *( i, j, spin, occ))' 112 | +! WRITE(IU6,*)' i and j vary from 1 - 16. & 113 | +! & 1:s, 2-4:p, 5-9:d, 10-16:f' 114 | +! WRITE(IU6,*)' Everything else will be set to zero !' 115 | + endif 116 | + 117 | + OCC_PNATOMS = OCC_NATOMS 118 | + OCC_NATOMS = OCC_PNATOMS + INT(FTMP(1)) 119 | + j=1 120 | + do i = OCC_PNATOMS+1, OCC_NATOMS 121 | + ATOM_OCC(i) = INT(FTMP(1+j)) 122 | + ATOM_L(i) = INT(FTMP(2+j)) 123 | + NUM_ORB = INT(FTMP(3+j)) 124 | + 125 | + do ii = 1, NUM_ORB 126 | + i1 = FTMP(4+j+(ii-1)*4) 127 | + i2 = FTMP(5+j+(ii-1)*4) 128 | + is = FTMP(6+j+(ii-1)*4) 129 | +#ifdef realmode 130 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = FTMP(7+j+(ii-1)*4) 131 | +#else 132 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = CMPLX( FTMP(7+j+(ii-1)*4), 0, q) 133 | +#endif 134 | + enddo 135 | + 136 | + j = j + 3 + NUM_ORB*4 137 | + 138 | + enddo 139 | + 140 | + ENDIF 141 | + 142 | + ENDDO 143 | + 144 | +! end of OCCDIRXXX input 145 | +!----------------------------------- 146 | +! alternative matrix input from external file OCCMATRIX 147 | + 148 | + CALL RDATAB(LOPEN,'INCAR',IU5,'OCCEXT','=','#',';','I', & 149 | + & ITMP,RDUM,CDUM,LDUM,CHARAC,N,1,IERR) 150 | + 151 | + if((IERR/=0) .AND. (IERR/=3)) THEN 152 | + write(IU6,*) " " 153 | + write(IU6,'(" Error in OCCEXT format. Format is in the occupation matrix documentation")') 154 | + write(IU6,*) " " 155 | + write(IU6,*) " " 156 | + stop 157 | + endif 158 | + 159 | + if(ITMP==1.and.IERR==0) then 160 | + If(IU6>0) then 161 | + write(IU6,*) " " 162 | + write(IU6,'(" OCCEXT found - reading occupation matrix from external file OCCMATRIX")') 163 | + write(IU6,*) " " 164 | + endif 165 | + 166 | + open(unit=999,file='OCCMATRIX',status='OLD') 167 | + 168 | + read(999,*) occ_natoms 169 | + 170 | + do i=1,occ_natoms 171 | + read(999,*) atom_occ(i), atom_l(i), occ_spin 172 | + read(999,*) 173 | + NUM_ORB = 2*ATOM_L(i)+1 174 | +! if(IU6>0) WRITE(IU6,*) "ATOM ",ATOM_OCC(i)," L = ",ATOM_L(i)," NUM = ",NUM_ORB 175 | + 176 | +! calculate start point in matrix from summing the number of orbitals for 177 | +! angular momentum less that that of interest 178 | + START = 0 179 | + do ii = ATOM_L(i)-1, 0, -1 180 | + START = START + 2*ii+1 181 | + enddo 182 | + START = START+1 183 | + do i1 = START, START + NUM_ORB-1 184 | + 185 | + read(999,*) (FTMP(i2), i2=start, start+num_orb-1 ) 186 | +! read(999,*) (OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i)), i2=start, start+num_orb-1 ) 187 | + 188 | +#ifdef realmode 189 | + 190 | + do i2 = start, start+num_orb-1 191 | + OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i))=FTMP(i2) 192 | + enddo 193 | +#else 194 | + do i2 = start, start+num_orb-1 195 | + OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i))=CMPLX (FTMP(i2), 0, q) 196 | + enddo 197 | +#endif 198 | + 199 | + enddo 200 | + 201 | + if(occ_spin==2) then 202 | + read(999,*) 203 | + do i1 = start, start+num_orb-1 204 | + 205 | + read(999,*) (FTMP(i2), i2=start, start+num_orb-1 ) 206 | +! read(999,*) (OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i)), i2=start, start+num_orb-1 ) 207 | + 208 | +#ifdef realmode 209 | + do i2 = start, start+num_orb-1 210 | + OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i))=FTMP(i2) 211 | + enddo 212 | +#else 213 | + do i2 = start, start+num_orb-1 214 | + OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i))=CMPLX (FTMP(i2), 0, q) 215 | + enddo 216 | +#endif 217 | + 218 | + enddo 219 | + endif 220 | + 221 | + read(999,*) 222 | + 223 | + enddo 224 | + 225 | + 226 | + endif 227 | + 228 | + 229 | +! end of matrix input 230 | +!----------------------------------- 231 | +! write out occupation matrices - first spin up then spin down 232 | + 233 | + IF(IU6>0) THEN 234 | + WRITE(IU6,*) " " 235 | + WRITE(IU6,*) "Occupation matrix control coded by Prof. Graeme Watson " 236 | + write(IU6,*) "at Trinity College Dublin" 237 | + WRITE(IU6,*) " " 238 | + WRITE(IU6,*) "Occupation set for the following atoms " 239 | + WRITE(IU6,*) " " 240 | + 241 | + do ii = 1,OCC_NATOMS 242 | + WRITE(IU6,*) "ATOM ",ATOM_OCC(ii)," Spin up " 243 | + WRITE(IU6,*) " " 244 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 245 | + do i = 1,16 246 | + 247 | +#ifdef realmode 248 | + WRITE(IU6,"((I2,2X, 16(F5.2,X),2X,I2))") i, & 249 | + & (OCC_MAT_INPUT(i,j,1,ATOM_OCC(ii)), j=1,16) ,i 250 | +#else 251 | + WRITE(IU6,"((I2,2X, 16(F5.2,X),2X,I2))") i, & 252 | + & ( real( OCC_MAT_INPUT(i,j,1,ATOM_OCC(ii)) ), j=1,16) ,i 253 | + 254 | +#endif 255 | + enddo 256 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 257 | + WRITE(IU6,*) " " 258 | + WRITE(IU6,*) "ATOM ",ATOM_OCC(ii)," Spin down " 259 | + WRITE(IU6,*) " " 260 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 261 | + do i = 1,16 262 | + 263 | +#ifdef realmode 264 | + WRITE(IU6,"(I2,2X, 16(F5.2,X),2X,I2)") i, & 265 | + & (OCC_MAT_INPUT(i,j,2,ATOM_OCC(ii)), j=1,16) ,i 266 | +#else 267 | + WRITE(IU6,"(I2,2X, 16(F5.2,X),2X,I2)") i, & 268 | + & ( real( OCC_MAT_INPUT(i,j,2,ATOM_OCC(ii)) ), j=1,16) ,i 269 | +#endif 270 | + enddo 271 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 272 | + enddo 273 | + ENDIF 274 | + 275 | + 276 | +! Close INCAR 277 | + 278 | + CLOSE(IU5) 279 | + 280 | +! END GWW 281 | + 282 | +!----------------------------------------------------------------------------------------------------- 283 | 284 | RETURN 285 | END SUBROUTINE INITIALIZE_LDAU 286 | @@ -376,6 +624,10 @@ 287 | INTEGER ISP,LN1,LN2,LMN1,LMN2,L1,L2,M1,M2,LM1,LM2 288 | INTEGER LNMAX,LMMAX 289 | 290 | +!GWW 291 | + INTEGER :: I, II, jj, START 292 | +!GWW END 293 | + 294 | DBLE_LDAU=0._q 295 | OCC_MAT=0._q 296 | OCC_MAT_ALL(:,:,:,IATOM)=0._q 297 | @@ -430,6 +682,28 @@ 298 | ! ENDIF 299 | ! test 300 | 301 | +! GWW Set Occupation Matrix for Atoms input 302 | + 303 | + do i = 1,OCC_NATOMS 304 | + 305 | + if(ATOM_OCC(i)/=IATOM) CYCLE 306 | + START = 0 307 | + do ii = ATOM_L(i)-1, 0, -1 308 | + START = START + 2*ii+1 309 | + enddo 310 | + START = START+1 311 | + do ii = START, START + ATOM_L(i)*2 312 | + do jj = START, START + ATOM_L(i)*2 313 | + OCC_MAT(ii,jj,1)=OCC_MAT_INPUT(ii,jj,1,ATOM_OCC(i)) 314 | + OCC_MAT(ii,jj,2)=OCC_MAT_INPUT(ii,jj,2,ATOM_OCC(i)) 315 | + enddo 316 | + enddo 317 | + 318 | + enddo 319 | + 320 | +! GWW 321 | + 322 | + 323 | OCC_MAT_ALL(:,:,:,IATOM)=OCC_MAT(:,:,:) 324 | 325 | !============================================================== 326 | -------------------------------------------------------------------------------- /version_1.1_vasp.5.3.5/mods_main.F_vasp.5.3.5.diff: -------------------------------------------------------------------------------- 1 | --- main_orig.F 2014-04-28 17:41:17.856624429 +0100 2 | +++ main.F 2014-04-28 17:42:32.263159987 +0100 3 | @@ -684,7 +684,7 @@ 4 | !----------------------------------------------------------------------- 5 | CALL LDAU_READER(T_INFO%NTYP,IO%IU5,IO%IU0) 6 | IF (USELDApU().OR.LCALC_ORBITAL_MOMENT()) & 7 | - & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU0,IO%IDIOT) 8 | + & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU5,IO%IU6,IO%IU0,IO%IDIOT) 9 | 10 | CALL SET_PAW_AUG(T_INFO%NTYP, P, IO%IU6, LMAX_CALC, LCOMPAT) 11 | !----------------------------------------------------------------------- 12 | -------------------------------------------------------------------------------- /version_1.2_vasp.5.4.4/Occupation matrix control in VASP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WatsonGroupTCD/Occupation-matrix-control-in-VASP/084e1695aaf005ed38c6e24dd681e309007e473c/version_1.2_vasp.5.4.4/Occupation matrix control in VASP.pdf -------------------------------------------------------------------------------- /version_1.2_vasp.5.4.4/mods_LDApU.F_vasp.5.4.4.diff: -------------------------------------------------------------------------------- 1 | --- LDApU.F.orig 2019-06-26 09:56:56.207538101 +0100 2 | +++ LDApU.F 2019-05-23 10:01:22.893827229 +0100 3 | @@ -37,7 +37,14 @@ 4 | REAL(q), PRIVATE, ALLOCATABLE, SAVE :: ORBMOM(:,:,:) 5 | 6 | COMPLEX(q), PRIVATE, SAVE :: V(7,7,7,7) 7 | - 8 | + 9 | +! GWW - input occupation matrix 10 | + OVERLAP, PRIVATE, ALLOCATABLE, SAVE :: OCC_MAT_INPUT(:,:,:,:) 11 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_OCC(:) 12 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_L(:) 13 | + INTEGER, PRIVATE, SAVE :: OCC_NATOMS, OCC_PNATOMS 14 | +! END GWW 15 | + 16 | CONTAINS 17 | 18 | !********************************************************************** 19 | @@ -178,7 +185,10 @@ 20 | END SUBROUTINE LDAU_READER 21 | 22 | 23 | - SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU,IDIOT) 24 | +! GWW - change for occupation matrix 25 | + SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU5,IU6,IU,IDIOT) 26 | +! GWW 27 | + 28 | 29 | USE pseudo 30 | 31 | @@ -197,9 +207,32 @@ 32 | COMPLEX(q) CDUM 33 | LOGICAL LDUM 34 | 35 | +!GWW occupation matrix - for the I/O 36 | + INTEGER, PARAMETER :: NDIM=500 37 | + INTEGER :: IU5,IU6 38 | + INTEGER :: N, IERR, ITMP 39 | + LOGICAL :: LOPEN 40 | + CHARACTER (1) :: CHARAC 41 | + REAL(q) :: FTMP(NDIM) 42 | + 43 | +!GWW for occupation matrix 44 | + INTEGER :: NUM_ORB 45 | + INTEGER :: START 46 | + INTEGER :: occ_spin 47 | + INTEGER :: i, ii, j, jj, i1, i2, is 48 | + CHARACTER (10) :: Keyword 49 | + CHARACTER (3) :: keynum 50 | +!GWW 51 | + 52 | NCDIJ=2 53 | IF (LNONCOLLINEAR) NCDIJ=4 54 | 55 | +!GWW - occupation matrix - for reading INCAR 56 | + LOPEN=.FALSE. 57 | + OPEN(UNIT=IU5,FILE='INCAR',STATUS='OLD') 58 | +!GWW 59 | + 60 | + 61 | !======================================================================= 62 | ! Sanity check: L(S)DA+U only implemented for PAW potentials 63 | !======================================================================= 64 | @@ -231,6 +264,221 @@ 65 | ALLOCATE(ORBMOM(LMAX_,3,NIONS)) 66 | ORBMOM=0._q 67 | ENDIF 68 | + 69 | +!---------------------------------------------------------------------- 70 | +! GWW - input of occupation matrix 71 | + 72 | + ALLOCATE(OCC_MAT_INPUT(16,16,NCDIJ,NIONS)) 73 | +#ifdef realmode 74 | + OCC_MAT_INPUT=0._q 75 | +#else 76 | + OCC_MAT_INPUT=(0._q,0_q ) 77 | +#endif 78 | + ALLOCATE(ATOM_OCC(NIONS),ATOM_L(NIONS)) 79 | + 80 | +! Occupation matric input allowing specifcation of matrix elements 81 | +! up to 999 line in INCAR ! OCCDIRX X=1,999 82 | + 83 | + do jj = 1, 999 84 | + if (jj.lt.10) then 85 | + write(keynum,'(I1)')jj 86 | + else if (jj.lt.100) then 87 | + write(keynum,'(I2)')jj 88 | + else 89 | + write(keynum,'(I3)')jj 90 | + endif 91 | + keyword = 'OCCDIR'//keynum 92 | + 93 | + CALL RDATAB(LOPEN,'INCAR',IU5, keyword ,'=','#',';','F', & 94 | + & IDUM,FTMP,CDUM,LDUM,CHARAC,N,NDIM,IERR) 95 | + 96 | + IF ((IERR/=0) .AND. (IERR/=3)) THEN 97 | + WRITE(IU6,*) " " 98 | + WRITE(IU6,'("Error in ",a9," format. Format should be")') keyword 99 | + WRITE(IU6,*)"'No of atoms, No * (ATOM, LDAUL, & 100 | + & No of elements, No of E *( i, j, spin, occ))" 101 | + WRITE(IU6,*)" Everything else will be set to zero !" 102 | + STOP 103 | + ENDIF 104 | + 105 | + IF (IERR==0) then 106 | + 107 | + IF(IU6>0) then 108 | + WRITE(IU6,*) " " 109 | + WRITE(IU6,'(" ",a9," found ")') keyword 110 | +! WRITE(IU6,*)'No of atoms, No * (ATOM, LDAUL, & 111 | +! & No of elements, No of E *( i, j, spin, occ))' 112 | +! WRITE(IU6,*)' i and j vary from 1 - 16. & 113 | +! & 1:s, 2-4:p, 5-9:d, 10-16:f' 114 | +! WRITE(IU6,*)' Everything else will be set to zero !' 115 | + endif 116 | + 117 | + OCC_PNATOMS = OCC_NATOMS 118 | + OCC_NATOMS = OCC_PNATOMS + INT(FTMP(1)) 119 | + j=1 120 | + do i = OCC_PNATOMS+1, OCC_NATOMS 121 | + ATOM_OCC(i) = INT(FTMP(1+j)) 122 | + ATOM_L(i) = INT(FTMP(2+j)) 123 | + NUM_ORB = INT(FTMP(3+j)) 124 | + 125 | + do ii = 1, NUM_ORB 126 | + i1 = FTMP(4+j+(ii-1)*4) 127 | + i2 = FTMP(5+j+(ii-1)*4) 128 | + is = FTMP(6+j+(ii-1)*4) 129 | +#ifdef realmode 130 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = FTMP(7+j+(ii-1)*4) 131 | +#else 132 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = CMPLX( FTMP(7+j+(ii-1)*4), 0, q) 133 | +#endif 134 | + enddo 135 | + 136 | + j = j + 3 + NUM_ORB*4 137 | + 138 | + enddo 139 | + 140 | + ENDIF 141 | + 142 | + ENDDO 143 | + 144 | +! end of OCCDIRXXX input 145 | +!----------------------------------- 146 | +! alternative matrix input from external file OCCMATRIX 147 | + 148 | + CALL RDATAB(LOPEN,'INCAR',IU5,'OCCEXT','=','#',';','I', & 149 | + & ITMP,RDUM,CDUM,LDUM,CHARAC,N,1,IERR) 150 | + 151 | + if((IERR/=0) .AND. (IERR/=3)) THEN 152 | + write(IU6,*) " " 153 | + write(IU6,'(" Error in OCCEXT format. Format is in the occupation matrix documentation")') 154 | + write(IU6,*) " " 155 | + write(IU6,*) " " 156 | + stop 157 | + endif 158 | + 159 | + if(ITMP==1.and.IERR==0) then 160 | + If(IU6>0) then 161 | + write(IU6,*) " " 162 | + write(IU6,'(" OCCEXT found - reading occupation matrix from external file OCCMATRIX")') 163 | + write(IU6,*) " " 164 | + endif 165 | + 166 | + open(unit=999,file='OCCMATRIX',status='OLD') 167 | + 168 | + read(999,*) occ_natoms 169 | + 170 | + do i=1,occ_natoms 171 | + read(999,*) atom_occ(i), atom_l(i), occ_spin 172 | + read(999,*) 173 | + NUM_ORB = 2*ATOM_L(i)+1 174 | +! if(IU6>0) WRITE(IU6,*) "ATOM ",ATOM_OCC(i)," L = ",ATOM_L(i)," NUM = ",NUM_ORB 175 | + 176 | +! calculate start point in matrix from summing the number of orbitals for 177 | +! angular momentum less that that of interest 178 | + START = 0 179 | + do ii = ATOM_L(i)-1, 0, -1 180 | + START = START + 2*ii+1 181 | + enddo 182 | + START = START+1 183 | + do i1 = START, START + NUM_ORB-1 184 | + 185 | + read(999,*) (FTMP(i2), i2=start, start+num_orb-1 ) 186 | +! read(999,*) (OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i)), i2=start, start+num_orb-1 ) 187 | + 188 | +#ifdef realmode 189 | + 190 | + do i2 = start, start+num_orb-1 191 | + OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i))=FTMP(i2) 192 | + enddo 193 | +#else 194 | + do i2 = start, start+num_orb-1 195 | + OCC_MAT_INPUT(i1,i2,1,ATOM_OCC(i))=CMPLX (FTMP(i2), 0, q) 196 | + enddo 197 | +#endif 198 | + 199 | + enddo 200 | + 201 | + if(occ_spin==2) then 202 | + read(999,*) 203 | + do i1 = start, start+num_orb-1 204 | + 205 | + read(999,*) (FTMP(i2), i2=start, start+num_orb-1 ) 206 | +! read(999,*) (OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i)), i2=start, start+num_orb-1 ) 207 | + 208 | +#ifdef realmode 209 | + do i2 = start, start+num_orb-1 210 | + OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i))=FTMP(i2) 211 | + enddo 212 | +#else 213 | + do i2 = start, start+num_orb-1 214 | + OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i))=CMPLX (FTMP(i2), 0, q) 215 | + enddo 216 | +#endif 217 | + 218 | + enddo 219 | + endif 220 | + 221 | + read(999,*) 222 | + 223 | + enddo 224 | + 225 | + 226 | + endif 227 | + 228 | + 229 | +! end of matrix input 230 | +!----------------------------------- 231 | +! write out occupation matrices - first spin up then spin down 232 | + 233 | + IF(IU6>0) THEN 234 | + WRITE(IU6,*) " " 235 | + WRITE(IU6,*) "Occupation matrix control coded by Prof. Graeme Watson " 236 | + write(IU6,*) "at Trinity College Dublin" 237 | + WRITE(IU6,*) " " 238 | + WRITE(IU6,*) "Occupation set for the following atoms " 239 | + WRITE(IU6,*) " " 240 | + 241 | + do ii = 1,OCC_NATOMS 242 | + WRITE(IU6,*) "ATOM ",ATOM_OCC(ii)," Spin up " 243 | + WRITE(IU6,*) " " 244 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 245 | + do i = 1,16 246 | + 247 | +#ifdef realmode 248 | + WRITE(IU6,"((I2,2X, 16(F5.2,X),2X,I2))") i, & 249 | + & (OCC_MAT_INPUT(i,j,1,ATOM_OCC(ii)), j=1,16) ,i 250 | +#else 251 | + WRITE(IU6,"((I2,2X, 16(F5.2,X),2X,I2))") i, & 252 | + & ( real( OCC_MAT_INPUT(i,j,1,ATOM_OCC(ii)) ), j=1,16) ,i 253 | + 254 | +#endif 255 | + enddo 256 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 257 | + WRITE(IU6,*) " " 258 | + WRITE(IU6,*) "ATOM ",ATOM_OCC(ii)," Spin down " 259 | + WRITE(IU6,*) " " 260 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 261 | + do i = 1,16 262 | + 263 | +#ifdef realmode 264 | + WRITE(IU6,"(I2,2X, 16(F5.2,X),2X,I2)") i, & 265 | + & (OCC_MAT_INPUT(i,j,2,ATOM_OCC(ii)), j=1,16) ,i 266 | +#else 267 | + WRITE(IU6,"(I2,2X, 16(F5.2,X),2X,I2)") i, & 268 | + & ( real( OCC_MAT_INPUT(i,j,2,ATOM_OCC(ii)) ), j=1,16) ,i 269 | +#endif 270 | + enddo 271 | + WRITE(IU6,"(4X,16(2X,I2,2X))") (j, j=1,16) 272 | + enddo 273 | + ENDIF 274 | + 275 | + 276 | +! Close INCAR 277 | + 278 | + CLOSE(IU5) 279 | + 280 | +! END GWW 281 | + 282 | +!----------------------------------------------------------------------------------------------------- 283 | 284 | RETURN 285 | END SUBROUTINE INITIALIZE_LDAU 286 | @@ -376,6 +624,10 @@ 287 | INTEGER ISP,LN1,LN2,LMN1,LMN2,L1,L2,M1,M2,LM1,LM2 288 | INTEGER LNMAX,LMMAX 289 | 290 | +!GWW 291 | + INTEGER :: I, II, jj, START 292 | +!GWW END 293 | + 294 | DBLE_LDAU=0._q 295 | OCC_MAT=0._q 296 | OCC_MAT_ALL(:,:,:,IATOM)=0._q 297 | @@ -430,6 +682,28 @@ 298 | ! ENDIF 299 | ! test 300 | 301 | +! GWW Set Occupation Matrix for Atoms input 302 | + 303 | + do i = 1,OCC_NATOMS 304 | + 305 | + if(ATOM_OCC(i)/=IATOM) CYCLE 306 | + START = 0 307 | + do ii = ATOM_L(i)-1, 0, -1 308 | + START = START + 2*ii+1 309 | + enddo 310 | + START = START+1 311 | + do ii = START, START + ATOM_L(i)*2 312 | + do jj = START, START + ATOM_L(i)*2 313 | + OCC_MAT(ii,jj,1)=OCC_MAT_INPUT(ii,jj,1,ATOM_OCC(i)) 314 | + OCC_MAT(ii,jj,2)=OCC_MAT_INPUT(ii,jj,2,ATOM_OCC(i)) 315 | + enddo 316 | + enddo 317 | + 318 | + enddo 319 | + 320 | +! GWW 321 | + 322 | + 323 | OCC_MAT_ALL(:,:,:,IATOM)=OCC_MAT(:,:,:) 324 | 325 | !============================================================== 326 | -------------------------------------------------------------------------------- /version_1.2_vasp.5.4.4/mods_main.F_vasp.5.4.4.diff: -------------------------------------------------------------------------------- 1 | --- main.F.orig 2017-04-20 10:03:58.000000000 +0100 2 | +++ main.F 2019-05-23 10:01:11.676862214 +0100 3 | @@ -756,7 +756,8 @@ 4 | ENDIF 5 | 6 | IF (USELDApU().OR.LCALC_ORBITAL_MOMENT()) & 7 | - & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU0,IO%IDIOT) 8 | +! GWW added I/O for LDA so can read Occupation matrix control 9 | + & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU5,IO%IU6,IO%IU0,IO%IDIOT) 10 | 11 | CALL SET_PAW_AUG(T_INFO%NTYP, P, IO%IU6, LMAX_CALC, LCOMPAT) 12 | !----------------------------------------------------------------------- 13 | -------------------------------------------------------------------------------- /version_1.4_vasp.5.4.4_spin_orbit/Occupation matrix control in VASP - V1.4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WatsonGroupTCD/Occupation-matrix-control-in-VASP/084e1695aaf005ed38c6e24dd681e309007e473c/version_1.4_vasp.5.4.4_spin_orbit/Occupation matrix control in VASP - V1.4.pdf -------------------------------------------------------------------------------- /version_1.4_vasp.5.4.4_spin_orbit/Occupation_matrix_vasp.5.4.4_spin_oribit.patch: -------------------------------------------------------------------------------- 1 | --- src/main.F.orig 2019-08-27 12:30:51.611100850 +0100 2 | +++ src/main.F 2019-08-27 12:30:51.483101008 +0100 3 | @@ -756,7 +756,8 @@ 4 | ENDIF 5 | 6 | IF (USELDApU().OR.LCALC_ORBITAL_MOMENT()) & 7 | - & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU0,IO%IDIOT) 8 | +! GWW added I/O for LDA so can read Occupation matrix control 9 | + & CALL INITIALIZE_LDAU(T_INFO%NIONS,T_INFO%NTYP,P,WDES%LNONCOLLINEAR,IO%IU5,IO%IU6,IO%IU0,IO%IDIOT) 10 | 11 | CALL SET_PAW_AUG(T_INFO%NTYP, P, IO%IU6, LMAX_CALC, LCOMPAT) 12 | !----------------------------------------------------------------------- 13 | --- src/LDApU.F.orig 2019-08-27 12:30:51.486101005 +0100 14 | +++ src/LDApU.F 2019-08-27 12:30:51.801100617 +0100 15 | @@ -37,7 +37,14 @@ 16 | REAL(q), PRIVATE, ALLOCATABLE, SAVE :: ORBMOM(:,:,:) 17 | 18 | COMPLEX(q), PRIVATE, SAVE :: V(7,7,7,7) 19 | - 20 | + 21 | +! GWW - input occupation matrix 22 | + OVERLAP, PRIVATE, ALLOCATABLE, SAVE :: OCC_MAT_INPUT(:,:,:,:) 23 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_OCC(:) 24 | + INTEGER, PRIVATE, ALLOCATABLE, SAVE :: ATOM_L(:) 25 | + INTEGER, PRIVATE, SAVE :: OCC_NATOMS, OCC_PNATOMS 26 | +! END GWW 27 | + 28 | CONTAINS 29 | 30 | !********************************************************************** 31 | @@ -178,7 +185,10 @@ 32 | END SUBROUTINE LDAU_READER 33 | 34 | 35 | - SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU,IDIOT) 36 | +! GWW - change for occupation matrix 37 | + SUBROUTINE INITIALIZE_LDAU(NIONS,NTYP,P,LNONCOLLINEAR,IU5,IU6,IU,IDIOT) 38 | +! GWW 39 | + 40 | 41 | USE pseudo 42 | 43 | @@ -197,9 +207,33 @@ 44 | COMPLEX(q) CDUM 45 | LOGICAL LDUM 46 | 47 | +!GWW occupation matrix - for the I/O 48 | + INTEGER, PARAMETER :: NDIM=500 49 | + INTEGER :: IU5,IU6 50 | + INTEGER :: N, IERR, ITMP 51 | + LOGICAL :: LOPEN 52 | + CHARACTER (1) :: CHARAC 53 | + REAL(q) :: FTMP(NDIM) 54 | + 55 | +!GWW for occupation matrix 56 | + INTEGER :: NUM_ORB 57 | + INTEGER :: START 58 | + INTEGER :: occ_spin 59 | + INTEGER :: i, ii, j, jj, i1, i2, is 60 | + CHARACTER (10) :: Keyword 61 | + CHARACTER (3) :: keynum 62 | + character (100) :: occ_format 63 | +!GWW 64 | + 65 | NCDIJ=2 66 | IF (LNONCOLLINEAR) NCDIJ=4 67 | 68 | +!GWW - occupation matrix - for reading INCAR 69 | + LOPEN=.FALSE. 70 | + OPEN(UNIT=IU5,FILE='INCAR',STATUS='OLD') 71 | +!GWW 72 | + 73 | + 74 | !======================================================================= 75 | ! Sanity check: L(S)DA+U only implemented for PAW potentials 76 | !======================================================================= 77 | @@ -231,6 +265,235 @@ 78 | ALLOCATE(ORBMOM(LMAX_,3,NIONS)) 79 | ORBMOM=0._q 80 | ENDIF 81 | + 82 | +!---------------------------------------------------------------------- 83 | +! GWW - input of occupation matrix 84 | + 85 | + ALLOCATE(OCC_MAT_INPUT(16,16,NCDIJ,NIONS)) 86 | +#ifdef realmode 87 | + OCC_MAT_INPUT=0._q 88 | +#else 89 | + OCC_MAT_INPUT=(0._q,0_q ) 90 | +#endif 91 | + ALLOCATE(ATOM_OCC(NIONS),ATOM_L(NIONS)) 92 | + 93 | +! Occupation matric input allowing specifcation of matrix elements 94 | +! up to 999 line in INCAR ! OCCDIRX X=1,999 95 | + 96 | + do jj = 1, 999 97 | + if (jj.lt.10) then 98 | + write(keynum,'(I1)')jj 99 | + else if (jj.lt.100) then 100 | + write(keynum,'(I2)')jj 101 | + else 102 | + write(keynum,'(I3)')jj 103 | + endif 104 | + keyword = 'OCCDIR'//keynum 105 | + 106 | + CALL RDATAB(LOPEN,'INCAR',IU5, keyword ,'=','#',';','F', & 107 | + & IDUM,FTMP,CDUM,LDUM,CHARAC,N,NDIM,IERR) 108 | + 109 | + IF ((IERR/=0) .AND. (IERR/=3)) THEN 110 | + WRITE(IU6,*) " " 111 | + WRITE(IU6,'("Error in ",a9," format. Format should be")') keyword 112 | + WRITE(IU6,*)"'No of atoms, No * (ATOM, LDAUL, & 113 | + & No of elements, No of E *( i, j, spin, occ))" 114 | + WRITE(IU6,*)" Everything else will be set to zero !" 115 | + STOP 116 | + ENDIF 117 | + 118 | + IF (IERR==0) then 119 | + 120 | + IF(IU6>0) then 121 | + WRITE(IU6,*) " " 122 | + WRITE(IU6,'(" ",a9," found ")') keyword 123 | +! WRITE(IU6,*)'No of atoms, No * (ATOM, LDAUL, & 124 | +! & No of elements, No of E *( i, j, spin, occ))' 125 | +! WRITE(IU6,*)' i and j vary from 1 - 16. & 126 | +! & 1:s, 2-4:p, 5-9:d, 10-16:f' 127 | +! WRITE(IU6,*)' Everything else will be set to zero !' 128 | + endif 129 | + 130 | + OCC_PNATOMS = OCC_NATOMS 131 | + OCC_NATOMS = OCC_PNATOMS + INT(FTMP(1)) 132 | + j=1 133 | + do i = OCC_PNATOMS+1, OCC_NATOMS 134 | + ATOM_OCC(i) = INT(FTMP(1+j)) 135 | + ATOM_L(i) = INT(FTMP(2+j)) 136 | + NUM_ORB = INT(FTMP(3+j)) 137 | + 138 | + do ii = 1, NUM_ORB 139 | + i1 = FTMP(4+j+(ii-1)*4) 140 | + i2 = FTMP(5+j+(ii-1)*4) 141 | + is = FTMP(6+j+(ii-1)*4) 142 | +#ifdef realmode 143 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = FTMP(7+j+(ii-1)*4) 144 | +#else 145 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i)) = CMPLX( FTMP(7+j+(ii-1)*4), 0, q) 146 | +#endif 147 | + enddo 148 | + 149 | + j = j + 3 + NUM_ORB*4 150 | + 151 | + enddo 152 | + 153 | + ENDIF 154 | + 155 | + ENDDO 156 | + 157 | +! end of OCCDIRXXX input 158 | +!----------------------------------- 159 | +! alternative matrix input from external file OCCMATRIX 160 | + 161 | + CALL RDATAB(LOPEN,'INCAR',IU5,'OCCEXT','=','#',';','I', & 162 | + & ITMP,RDUM,CDUM,LDUM,CHARAC,N,1,IERR) 163 | + 164 | + if((IERR/=0) .AND. (IERR/=3)) THEN 165 | + write(IU6,*) " " 166 | + write(IU6,'(" Error in OCCEXT format. Format is in the occupation matrix documentation")') 167 | + write(IU6,*) " " 168 | + write(IU6,*) " " 169 | + stop 170 | + endif 171 | + 172 | + if(ITMP==1.and.IERR==0) then 173 | + If(IU6>0) then 174 | + write(IU6,*) " " 175 | + write(IU6,'(" OCCEXT found - reading occupation matrix from external file OCCMATRIX")') 176 | + write(IU6,*) " " 177 | + endif 178 | + 179 | + open(unit=999,file='OCCMATRIX',status='OLD') 180 | + 181 | + read(999,*) occ_natoms 182 | + 183 | + do i=1,occ_natoms 184 | + read(999,*) atom_occ(i), atom_l(i), occ_spin 185 | + 186 | +! calculate start point in matrix from summing the number of orbitals for 187 | +! angular momentum less that that of interest 188 | + NUM_ORB = 2*ATOM_L(i)+1 189 | + START = 0 190 | + do ii = ATOM_L(i)-1, 0, -1 191 | + START = START + 2*ii+1 192 | + enddo 193 | + START = START+1 194 | + 195 | +! real occupation matrix only (occ_spin 1 or 2) 196 | + if(occ_spin<=2) then 197 | + do is = 1, occ_spin 198 | + read(999,*) 199 | + do i1 = start, start+num_orb-1 200 | + 201 | + read(999,*) (FTMP(i2), i2=start, start+num_orb-1 ) 202 | +! read(999,*) (OCC_MAT_INPUT(i1,i2,2,ATOM_OCC(i)), i2=start, start+num_orb-1 ) 203 | + 204 | +#ifdef realmode 205 | + do i2 = start, start+num_orb-1 206 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i))=FTMP(i2) 207 | + enddo 208 | +#else 209 | + do i2 = start, start+num_orb-1 210 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i))=CMPLX (FTMP(i2), 0, q) 211 | + enddo 212 | +#endif 213 | + enddo 214 | + 215 | + enddo 216 | + endif 217 | + 218 | + 219 | +! spin orbit occupation matrix (occ_spin 4) 220 | + if(occ_spin==4) then 221 | +#ifdef realmode 222 | + write(IU6,*) " " 223 | + write(IU6,'(" Non-Collinear occupation matrix - but VASP is not compiled for noncollinear calculations.")') 224 | + write(IU6,*) " " 225 | + stop 226 | +#else 227 | + do is = 1, occ_spin ! read 4 matrices for the noncollinear real and imaginary components. 228 | + read(999,*) 229 | + do i1 = start, start+num_orb-1 230 | + read(999,*) (FTMP(i2), i2=start, start+2*num_orb-1 ) 231 | + do i2 = start, start+num_orb-1 232 | + OCC_MAT_INPUT(i1,i2,is,ATOM_OCC(i))=CMPLX (FTMP(i2), FTMP(i2+num_orb), q) 233 | + enddo 234 | + enddo 235 | + enddo 236 | +#endif 237 | + endif 238 | + 239 | + read(999,*) 240 | + 241 | + enddo 242 | + 243 | + 244 | + endif 245 | + 246 | + 247 | +! end of matrix input 248 | +!----------------------------------- 249 | +! write out occupation matrices - first spin up then spin down 250 | + 251 | + IF(IU6>0) THEN 252 | + WRITE(IU6,*) " " 253 | + WRITE(IU6,*) "Occupation matrix control coded by Prof. Graeme Watson " 254 | + write(IU6,*) "at Trinity College Dublin" 255 | + WRITE(IU6,*) " " 256 | + WRITE(IU6,*) "Occupation set for the following atoms " 257 | + WRITE(IU6,*) " " 258 | + 259 | + do ii = 1,OCC_NATOMS 260 | + 261 | +! calculate start point in matrix from summing the number of orbitals for 262 | +! angular momentum less that that of interest 263 | + NUM_ORB = 2*ATOM_L(ii)+1 264 | + START = 0 265 | + do i1 = ATOM_L(ii)-1, 0, -1 266 | + START = START + 2*i1+1 267 | + enddo 268 | + START = START+1 269 | + 270 | +! Loop over spins 271 | + do i2 = 1, NCDIJ 272 | + 273 | + WRITE(IU6,*) " " 274 | + WRITE(IU6,*) "ATOM ",ATOM_OCC(ii)," Spin ", i2 275 | + 276 | +#ifdef realmode 277 | + write (occ_format, '(a,I2,a)') '(4X,',num_orb,'(3X,I2,3X))' 278 | + WRITE(IU6,occ_format) (j, j=start,start+num_orb-1) 279 | + 280 | + write (occ_format, '(a,I2,a,I2,a)') '(I2,2X,',num_orb,'(F7.4,X),2X,I2)' 281 | + do i = start, start+num_orb-1 282 | + WRITE(IU6,occ_format) i, & 283 | + & (OCC_MAT_INPUT(i,j,i2,ATOM_OCC(ii)), j=start,start+num_orb-1) ,i 284 | + enddo 285 | + 286 | +#else 287 | + write (occ_format, '(a,I2,a,I2,a)') '(4X,',num_orb,'(3X,I2,3X),6X,',num_orb,'(3X,I2,3X))' 288 | + WRITE(IU6,occ_format) (j, j=start,start+num_orb-1),(jj, jj=start,start+num_orb-1) 289 | + 290 | + write (occ_format, '(a,I2,a,I2,a)') '(I2,2X,',num_orb,'(F7.4,X),2X,I2,2X,',num_orb,'(F7.4,X),2X,I2))' 291 | + do i = start, start+num_orb-1 292 | + WRITE(IU6,occ_format) i, & 293 | + & ( real( OCC_MAT_INPUT(i,j,i2,ATOM_OCC(ii)) ), j=start,start+num_orb-1) ,i, & 294 | + & (aimag( OCC_MAT_INPUT(i,j,i2,ATOM_OCC(ii)) ), j=start,start+num_orb-1) ,i 295 | + enddo 296 | + 297 | +#endif 298 | + enddo 299 | + enddo 300 | + ENDIF 301 | + 302 | + 303 | +! Close INCAR 304 | + 305 | + CLOSE(IU5) 306 | + 307 | +! END GWW 308 | + 309 | +!----------------------------------------------------------------------------------------------------- 310 | 311 | RETURN 312 | END SUBROUTINE INITIALIZE_LDAU 313 | @@ -376,6 +639,10 @@ 314 | INTEGER ISP,LN1,LN2,LMN1,LMN2,L1,L2,M1,M2,LM1,LM2 315 | INTEGER LNMAX,LMMAX 316 | 317 | +!GWW 318 | + INTEGER :: I, I2, II, jj, START 319 | +!GWW END 320 | + 321 | DBLE_LDAU=0._q 322 | OCC_MAT=0._q 323 | OCC_MAT_ALL(:,:,:,IATOM)=0._q 324 | @@ -430,6 +697,29 @@ 325 | ! ENDIF 326 | ! test 327 | 328 | +! GWW Set Occupation Matrix for Atoms input 329 | + 330 | + do i = 1,OCC_NATOMS 331 | + 332 | + if(ATOM_OCC(i)/=IATOM) CYCLE 333 | + START = 0 334 | + do ii = ATOM_L(i)-1, 0, -1 335 | + START = START + 2*ii+1 336 | + enddo 337 | + START = START+1 338 | + do ii = START, START + ATOM_L(i)*2 339 | + do jj = START, START + ATOM_L(i)*2 340 | + do i2 = 1, NCDIJ 341 | + OCC_MAT(ii,jj,i2)=OCC_MAT_INPUT(ii,jj,i2,ATOM_OCC(i)) 342 | + enddo 343 | + enddo 344 | + enddo 345 | + 346 | + enddo 347 | + 348 | +! GWW 349 | + 350 | + 351 | OCC_MAT_ALL(:,:,:,IATOM)=OCC_MAT(:,:,:) 352 | 353 | !============================================================== 354 | --------------------------------------------------------------------------------