├── CPLAP-package.tar.gz ├── CPLAP.f90 ├── MANUAL.txt ├── Makefile ├── README ├── SAMPLE_EXTRA_PHASES ├── SAMPLE_GRID_0.1 ├── SAMPLE_INPUT ├── SAMPLE_RESTART_RESULTS └── SAMPLE_RESULTS /CPLAP-package.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jbuckeridge/cplap/561582b8c83ad855d974dd05fc2940cee9697959/CPLAP-package.tar.gz -------------------------------------------------------------------------------- /CPLAP.f90: -------------------------------------------------------------------------------- 1 | program cplap 2 | ! 3 | !********************************************************************* 4 | ! 5 | ! This program reads in the chemical formula for a solid phase 6 | ! and its energy. It then asks for the limiting phases of the 7 | ! combinations of the elements and their energies. These are 8 | ! used to calculate the stability region in the space defined 9 | ! by the chemical potentials of the constituent elements of the 10 | ! solid. 11 | ! 12 | ! The calculation is done by solving the system of linear equations 13 | ! resulting from the inequalities defined by the limiting constituent 14 | ! compound energies and the total energy expression of the solid. The 15 | ! chemical potential of the anionic species can be set as a free 16 | ! parameter. 17 | ! 18 | ! e.g. : 19 | ! 20 | ! If the system is X Y2 Z with energy E -> 21 | ! 22 | ! we have mu_Z = E - mu_X - 2 mu_Y (*) 23 | ! 24 | ! with limiting phases X2 Z (energy E1) 25 | ! Y Z (energy E2) 26 | ! 27 | ! we must have 2 mu_X + mu_Z < E1 (**) 28 | ! and mu_Y + mu_Z < E2 (**) 29 | ! 30 | ! in order that the system be grown (otherwise phases X2 Z or Y Z will 31 | ! be formed) 32 | ! 33 | ! Also E < mu_X < 0 etc 34 | ! 35 | ! We can substitute in our expression (*) for mu_Z, then giving 3 36 | ! equations with 2 unknowns. All combinations of the equations are 37 | ! solved (if a solution exists for the combination) and a number of 38 | ! intersection points are found (or not if the system has no solution). 39 | ! Those intersection points that satisfy the limiting inequalities (**) 40 | ! are the results we want, giving the corner points of the polyhedron 41 | ! defining the stability region in chemical potential space. (In the 42 | ! example the polyhedron will be 2D). 43 | ! 44 | ! The limiting inequalities are returned, which can be used to 45 | ! generate a plot in mathematica/matlab if the space is 3D or less. 46 | ! The corner points of the polyhedron defining the stability 47 | ! region are also returned. The user can request a density of points 48 | ! (in units of energy), and a grid of points of that density in the 49 | ! stability region are returned. 50 | ! 51 | ! The process can be started from a file. If this is done the user 52 | ! is asked for a value of one of the chemical potentials (not the 53 | ! chemical potential that is a free parameter). The problem is then 54 | ! solved with this value of chemical potential, reducing the space 55 | ! by one dimension. 56 | ! 57 | ! J. Buckeridge October 2011 58 | ! 59 | !********************************************************************* 60 | ! 61 | implicit none 62 | ! 63 | integer, parameter :: nmax = 300 64 | real*8, parameter :: small = 1.d-12 65 | logical, parameter :: ltrue = .true. 66 | logical, parameter :: lfalse = .false. 67 | ! 68 | integer i, j, k, l, n, nspecies, nlimits, restart, num(nmax), nadd, nspecies_dep 69 | integer limittotno(nmax), limitnum(nmax,nmax), ndepend, neqns, numtmp 70 | integer numres, numsol, values(8), fixnum, str_num, comp_array(nmax), depnum 71 | integer input, extra 72 | integer nrel, func1, func2, rel_array(nmax), z_zero, cnt_z(nmax) 73 | real*8 mu(nmax), energy, limite(nmax), eqns(nmax,nmax) 74 | real*8 intersect(nmax*nmax,nmax), results(nmax,nmax), sum1, sum2, sum3, sum4 75 | real*8 tmp1, tmp2 76 | real*8 mumax(nmax), mumin(nmax), grid, gridpt(nmax), fixe 77 | real*8 bintemp, Ebin_min, Ebin_max, enertemp 78 | real*8 avgpos(nmax,3) 79 | character*1 read_tmp 80 | character*2 name(nmax), limitname(nmax,nmax), fixname, depname, tmp_str 81 | character*3 str2, str3 82 | character*4 str4 83 | character*5 zone, ineq_name(nmax), strdep 84 | character*8 date 85 | character*9 ineq_str(nmax) 86 | character*10 time 87 | character*25 strtemp 88 | character*60 string, char 89 | character*100 str1, compounds(nmax) 90 | character*100 line 91 | character*200 eqn_str, formstr 92 | character*1000 lngstr 93 | logical check1, check2, check_eqns, check_low, check_ab, check_dep, check_lim 94 | logical check_fix, check_read 95 | ! 96 | open(unit=11, file="restart.dat", status="old", iostat=restart) 97 | open(unit=12, file="results.dat", status="replace") 98 | ! 99 | ! Write banner 100 | ! 101 | write(*,'(a)') "_____________________________________________________________" 102 | write(*,'(a)') " " 103 | write(*,'(a)') " CCCC PPPPP LL AAAA PPPPP !! " 104 | write(*,'(a)') " CC CC PP PP LL AA AA PP PP !! " 105 | write(*,'(a)') " CC PP PP LL AA AA PP PP !! " 106 | write(*,'(a)') " CC PPPPP LL AAAAAA PPPPP !! " 107 | write(*,'(a)') " CC CC PP LL AA AA PP " 108 | write(*,'(a)') " CCCC PP LLLLLL AA AA PP !! " 109 | write(*,'(a)') "_____________________________________________________________" 110 | write(*,'(a)') " " 111 | write(*,'(a)') " Chemical Potential Limits Analysis Program " 112 | write(*,'(a)') "_____________________________________________________________" 113 | write(*,'(a)') " " 114 | write(*,'(a)') " Version 1.1 2013 " 115 | write(*,'(a)') " John Buckeridge (j.buckeridge@ucl.ac.uk) " 116 | write(*,'(a)') "_____________________________________________________________" 117 | check_ab = lfalse 118 | check_fix = lfalse 119 | if(restart /= 0) then 120 | write(*,*) 121 | write(*,'(a)') "************************ New run ************************" 122 | write(*,'(a)') "_____________________________________________________________" 123 | write(*,*) 124 | ! 125 | ! Check for input file. If found read data from it 126 | ! 127 | open(unit=13, status="old", file="input.dat", iostat=input) 128 | if(input == 0) then 129 | write(*,'(a)') "Reading input from input.dat..." 130 | write(*,*) 131 | ! 132 | ! First read in the number of elements in the compound 133 | ! 134 | write(*,'(a)') "Reading in number of species in system..." 135 | do 136 | read(13,'(a100)') line 137 | if(line(1:1) /= "#") then 138 | read(line,*) nspecies 139 | exit 140 | endif 141 | enddo 142 | if(nspecies < 2) then 143 | write(*,'(a)') "SYNTAX ERROR reading in number of species (must be greater than one)" 144 | write(*,'(a)') "ERROR IS FATAL" 145 | goto 200 146 | endif 147 | write(*,'(a)') "...found ok" 148 | write(*,*) 149 | ! 150 | ! Now read in formula of compound 151 | ! 152 | write(*,'(a)') "Reading in formula of compound of interest..." 153 | do 154 | read(13,'(a100)') line 155 | if(line(1:1) /= "#") then 156 | read(line,*) (num(i),name(i),i=1,nspecies), energy 157 | exit 158 | endif 159 | enddo 160 | ! 161 | ! Check energy is negative 162 | ! 163 | if(energy > 0.d0) then 164 | write(*,'(a)') "FATAL ERROR: ENERGY OF SYSTEM IS POSITIVE!!" 165 | goto 200 166 | endif 167 | ! 168 | ! Check that element numbers in formula aren't negative 169 | ! 170 | do i=1,nspecies 171 | if(num(i) < 1) then 172 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 173 | write(*,'(a,i3)') " Error occurred for element", i 174 | goto 200 175 | endif 176 | enddo 177 | write(*,'(a)') "...found ok" 178 | 179 | write(*,*) 180 | string = '(a7, (1x,i2,1x,a2))' 181 | write(string(5:7),'(i3)') nspecies 182 | write(*,string) "System:", (num(i),name(i),i=1,nspecies) 183 | write(*,*) 184 | ! 185 | ! Read in which (if any) element is to be set as a dependent variable 186 | ! 187 | write(*,'(a)') "Reading in dependent variable..." 188 | do 189 | read(13,'(a100)') line 190 | if(line(1:1) /= "#") then 191 | read(line,*) depname 192 | exit 193 | endif 194 | enddo 195 | ! 196 | ! If none is set give a warning to the user 197 | ! 198 | if(depname(1:1) == "n") then 199 | write(*,'(a)') "WARNING: No depedent variable set. Solution may still be found -" 200 | write(*,'(a)') " however only the intersection points with the compound" 201 | write(*,'(a)') " are consistent with its formation. It is advisable to set" 202 | write(*,'(a)') " a dependent variable." 203 | write(*,*) 204 | check_dep = lfalse 205 | nspecies_dep = nspecies 206 | else 207 | ! 208 | ! Check that the element is actually in the system 209 | ! 210 | check_dep = ltrue 211 | nspecies_dep = nspecies - 1 212 | j = 0 213 | do i=1,nspecies 214 | if(depname == name(i)) then 215 | j = j+1 216 | depnum = i 217 | endif 218 | enddo 219 | if(j == 0) then 220 | write(*,'(a)') "FATAL ERROR: Dependent variable element not found in system!" 221 | goto 200 222 | endif 223 | ! 224 | ! Change order of species in system so that dependent variable element is last 225 | ! in the list (ie element nspecies) 226 | ! 227 | tmp_str = name(nspecies) 228 | name(nspecies) = depname 229 | name(depnum) = tmp_str 230 | numtmp = num(nspecies) 231 | num(nspecies) = num(depnum) 232 | num(depnum) = numtmp 233 | write(*,'(a)') "...found ok" 234 | write(*,*) 235 | endif 236 | ! 237 | ! Read in limiting phases and their energies. First read in the total number 238 | ! 239 | write(*,'(a)') "Reading in competing phases..." 240 | do 241 | read(13,'(a100)') line 242 | if(line(1:1) /= "#") then 243 | read(line,*) nlimits 244 | exit 245 | endif 246 | enddo 247 | ! 248 | ! Check that the number is not less than zero 249 | ! 250 | if(nlimits < 0) then 251 | write(*,'(a)') "FATAL ERROR: Found negative number of competing phases!" 252 | goto 200 253 | endif 254 | ! 255 | ! Check if there are no limiting compounds. If there are, read them in sequentially. 256 | ! Check that the number in the input file matches the stated total amount. If not warn 257 | ! user and reset total amount 258 | ! 259 | check_lim = ltrue 260 | if(nlimits == 0) then 261 | check_lim = lfalse 262 | else 263 | do i=1,nlimits 264 | check_read = lfalse 265 | do 266 | read(13,'(a100)',end=5001) line 267 | if(line(1:1) /= "#") then 268 | read(line,*,end=5001) limittotno(i) 269 | exit 270 | endif 271 | enddo 272 | if(limittotno(i) > nspecies) then 273 | write(*,'(a28,i3,a36)') "FATAL ERROR: Competing phase", i, "has more elements than the material!" 274 | goto 200 275 | endif 276 | if(limittotno(i) < 1 ) then 277 | write(*,'(a28,i3,a26)') "FATAL ERROR: Competing phase", i, "has less than one element!" 278 | goto 200 279 | endif 280 | do 281 | read(13,'(a100)',end=5001) line 282 | if(line(1:1) /= "#") then 283 | read(line,*,end=5001) (limitnum(i,j),limitname(i,j),j=1,limittotno(i)), limite(i) 284 | exit 285 | endif 286 | enddo 287 | check_read = ltrue 288 | enddo 289 | 5001 if(check_read .neqv. ltrue) then 290 | write(*,'(a)') "WARNING: Found less competing phases than supposed total amount" 291 | write(*,'(a29,i3)') " Actual number found:", i-1 292 | nlimits = i-1 293 | endif 294 | write(*,'(a)') "...found ok" 295 | write(*,*) 296 | ! 297 | ! Check that elements in the compounds are compatible with those in the material 298 | ! 299 | write(*,'(a)') "Checking competing phase formulae..." 300 | do i=1,nlimits 301 | l = 0 302 | do j=1,limittotno(i) 303 | do k=1,nspecies 304 | if(limitname(i,j) == name(k)) l = l+1 305 | enddo 306 | enddo 307 | if(l == 0) then 308 | write(*,'(a)') "FATAL ERROR: Competing phase found with element not contained in & 309 | &material!!" 310 | write(*,'(a44,i3)') " Error found in competing phase:", i 311 | goto 200 312 | endif 313 | enddo 314 | ! 315 | ! Check that element numbers in compounds aren't negative 316 | ! 317 | do i=1,nlimits 318 | do j=1,limittotno(i) 319 | if(limitnum(i,j) < 1) then 320 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 321 | write(*,'(a44,i3)') " Error found in competing phase", i 322 | goto 200 323 | endif 324 | enddo 325 | enddo 326 | write(*,'(a)') "...all ok" 327 | write(*,*) 328 | endif 329 | ! 330 | ! If no input.dat file found then interactive mode is activated 331 | ! 332 | else 333 | write(*,'(a)') "No input.dat file found - beginning interactive mode..." 334 | write(*,*) 335 | ! 336 | ! Read in the number of species, chemical formula and energy 337 | ! 338 | write(*,'(a)') "Enter number of elements in the material:" 339 | 70 read(*,*) nspecies 340 | if(nspecies < 2) then 341 | write(*,'(a)') "ERROR: System must consist of more than one element!!" 342 | write(*,'(a)') "Please re-enter number of elements in the material:" 343 | goto 70 344 | endif 345 | ! 346 | write(*,*) 347 | write(*,'(a)') "Enter chemical formula of material and its energy in the form" 348 | write(*,*) 349 | write(*,'(a)') "n_a A n_b B n_c C ... energy" 350 | write(*,*) 351 | write(*,'(a)') "where n_a etc. are the integer numbers for species A etc." 352 | write(*,'(a)') "(e.g. if the material is calcite then 1 Ca 1 C 3 O and then" 353 | write(*,'(a)') "the energy must be entered. Please keep the energy units" 354 | write(*,'(a)') "consistent when entering all data)" 355 | read(*,*) (num(i),name(i),i=1,nspecies), energy 356 | write(*,*) 357 | ! 358 | ! Check energy is negative 359 | ! 360 | if(energy > 0.d0) then 361 | write(*,'(a)') "FATAL ERROR: ENERGY OF SYSTEM IS POSITIVE!!" 362 | goto 200 363 | endif 364 | ! 365 | ! Check that element numbers in formula aren't negative 366 | ! 367 | do i=1,nspecies 368 | if(num(i) < 1) then 369 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 370 | write(*,'(a,i3)') " Error occurred for element", i 371 | goto 200 372 | endif 373 | enddo 374 | ! 375 | ! Ask if an element is to be set as a dependent variable 376 | ! 377 | write(*,'(a)') "Do you wish to set an element as a dependent variable (y/n)?" 378 | 5000 read(*,'(a3)') str2 379 | if(str2(1:1) == "y" .or. str2(1:1) == "Y") then 380 | check_dep = ltrue 381 | nspecies_dep = nspecies - 1 382 | write(*,*) 383 | write(*,'(a)') "Enter element whose chemical potential will be the" 384 | write(*,'(a)') "dependent variable:" 385 | 8000 read(*,*) depname 386 | j = 0 387 | do i=1,nspecies 388 | if(depname == name(i)) then 389 | j = j+1 390 | depnum = i 391 | endif 392 | enddo 393 | if(j == 0) then 394 | write(*,'(a)') "ERROR: Element not found in system. Please enter another& 395 | & element:" 396 | goto 8000 397 | endif 398 | ! 399 | ! Change order of species in system so that dependent variable element is last 400 | ! in the list (ie element nspecies) 401 | ! 402 | tmp_str = name(nspecies) 403 | name(nspecies) = depname 404 | name(depnum) = tmp_str 405 | numtmp = num(nspecies) 406 | num(nspecies) = num(depnum) 407 | num(depnum) = numtmp 408 | elseif(str2(1:1) == "n" .or. str2(1:1) == "N") then 409 | write(*,*) 410 | write(*,'(a)') "WARNING: No depedent variable set. Solution may still be found -" 411 | write(*,'(a)') " however only the intersection points with the compound" 412 | write(*,'(a)') " are consistent with its formation. It is advisable to set" 413 | write(*,'(a)') " a dependent variable." 414 | write(*,*) 415 | check_dep = lfalse 416 | nspecies_dep = nspecies 417 | else 418 | write(*,'(a)') "SYNTAX ERROR: please enter yes or no:" 419 | goto 5000 420 | endif 421 | ! 422 | ! Echo to user which chemical potential will be the dependent variable 423 | ! 424 | if(check_dep) then 425 | write(*,'(a5,1x,a)') "mu_"//trim(name(nspecies_dep + 1)), "will be the dependent & 426 | &variable" 427 | write(*,*) 428 | endif 429 | ! 430 | ! Read in limiting phases and their energies. Care will have to be taken when 431 | ! reading in each one, so the user will have to provide quite a lot of information 432 | ! 433 | write(*,'(a)') "---" 434 | write(*,'(a)') 435 | write(*,'(a)') "Now the competing phases and their energies must be entered." 436 | write(*,'(a)') "First enter the total number of competing phases:" 437 | 8001 read(*,*) nlimits 438 | ! 439 | ! Check that the number is not less than zero 440 | ! 441 | if(nlimits < 0) then 442 | write(*,'(a)') "ERROR: Number cannot be negative!" 443 | write(*,'(a)') "Enter number of competing phases again:" 444 | goto 8001 445 | endif 446 | ! 447 | ! Check if there are no limiting compounds. If so tell user that range of allowed 448 | ! chemical potentials is only limited by the allowed elemental values determined 449 | ! by the system energy 450 | ! 451 | check_lim = ltrue 452 | if(nlimits == 0) then 453 | write(*,'(a)') "No competing phases: element chemical potentials can take any" 454 | write(*,'(a)') "value in range between zero and system energy" 455 | check_lim = lfalse 456 | endif 457 | write(*,*) 458 | write(*,'(a)') "Now for each phase enter the number of elements, then the" 459 | write(*,'(a)') "formula and energy, in the same format as for the material" 460 | write(*,'(a)') "formula." 461 | write(*,*) 462 | do i=1,nlimits 463 | write(*,'(a48,i3)') "Enter number of elements in competing phase no. ", i 464 | read(*,*) limittotno(i) 465 | ! 466 | ! Check that the number of elements in the compound doesn't exceed the number 467 | ! of elements in the material, or is less than one 468 | ! 469 | if(limittotno(i) > nspecies) then 470 | write(*,'(a)') "ERROR: Competing phase has more elements than the material!!" 471 | write(*,*) 472 | write(*,'(a55,i3)') "Enter a new number of elements for competing phase no. ", i 473 | read(*,*) limittotno(i) 474 | endif 475 | if(limittotno(i) < 1 ) then 476 | write(*,'(a)') "ERROR: Competing phase cannot have less than one element!!" 477 | write(*,*) 478 | write(*,'(a55,i3)') "Enter a new number of elements for competing phase no. ", i 479 | read(*,*) limittotno(i) 480 | endif 481 | write(*,*) 482 | write(*,'(a57,i3)') "Enter chemical formula and energy of competing phase no. ", i 483 | read(*,*) (limitnum(i,j),limitname(i,j),j=1,limittotno(i)), limite(i) 484 | write(*,*) 485 | enddo 486 | ! 487 | ! Check that elements in the compounds are compatible with those in the material 488 | ! 489 | write(*,'(a)') "Checking competing phase formulae..." 490 | write(*,*) 491 | do i=1,nlimits 492 | l = 0 493 | do j=1,limittotno(i) 494 | do k=1,nspecies 495 | if(limitname(i,j) == name(k)) l = l+1 496 | enddo 497 | enddo 498 | if(l == 0) then 499 | write(*,'(a)') "FATAL ERROR: Competing phase found with element not contained in & 500 | &material!!" 501 | write(*,'(a44,i3)') " Error found in competing phase ", i 502 | goto 200 503 | endif 504 | enddo 505 | ! 506 | ! Check that element numbers in compounds aren't negative 507 | ! 508 | do i=1,nlimits 509 | do j=1,limittotno(i) 510 | if(limitnum(i,j) < 1) then 511 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 512 | write(*,'(a44,i3)') " Error found in competing phase ", i 513 | goto 200 514 | endif 515 | enddo 516 | enddo 517 | write(*,'(a)') "...all ok" 518 | write(*,*) 519 | endif 520 | ! 521 | ! Construct matrix containing all linear equations. First go through all limiting 522 | ! compound formulae and determine the resulting linear equation for each 523 | ! 524 | eqns = 0.d0 525 | if(check_lim .eqv. lfalse) goto 100 526 | check1 = lfalse 527 | do i=1,nlimits 528 | ! 529 | ! First check if the dependent variable element is present. If so fill elements of 530 | ! this line of the matrix appropriately, not yet taking into account the presence 531 | ! of other elements in the compound (skip this if no dependent variable set) 532 | ! 533 | if(check_dep) then 534 | do j=1,limittotno(i) 535 | if(limitname(i,j) == name(nspecies)) then 536 | check1 = ltrue 537 | ndepend = j 538 | endif 539 | enddo 540 | endif 541 | if(check1) then 542 | do j=1,nspecies_dep 543 | eqns(i,j) = eqns(i,j) - dble(limitnum(i,ndepend)) * (dble(num(j))/& 544 | &dble(num(nspecies_dep + 1))) 545 | enddo 546 | eqns(i,nspecies_dep + 1) = limite(i) - dble(limitnum(i,ndepend)) * (energy/& 547 | &dble(num(nspecies_dep + 1))) 548 | check1 = lfalse 549 | ! 550 | ! If the dependent variable is not present the energy must still be put in the 551 | ! last column 552 | ! 553 | else 554 | eqns(i,nspecies_dep + 1) = limite(i) 555 | endif 556 | ! 557 | ! Now fill matrix elements according to presence of other chemical elements besides 558 | ! the dependent variable element. If the dependent variable element is present 559 | ! in the compound these numbers will be added to those determined previously. If not 560 | ! they will be added to zero (with matrix elements corresponding to chemical 561 | ! elements not present in the compound remaining as zero) 562 | ! 563 | do j=1,limittotno(i) 564 | do k=1,nspecies_dep 565 | if(limitname(i,j) == name(k)) then 566 | eqns(i,k) = eqns(i,k) + dble(limitnum(i,j)) 567 | endif 568 | enddo 569 | enddo 570 | enddo 571 | ! 572 | ! Now add equations corresponding to the limits imposed by the chemical potential 573 | ! ranges of the individual elements of the material (i.e. E < mu_X < 0). If no 574 | ! limiting compounds were inputted, definition of eqns array begins here 575 | ! 576 | 100 do i=1,nspecies_dep 577 | eqns(nlimits+i,i) = dble(num(i)) 578 | eqns(nlimits+i+nspecies_dep,i) = dble(num(i)) 579 | eqns(nlimits+i+nspecies_dep,nspecies_dep + 1) = energy 580 | enddo 581 | ! 582 | ! Now shift all equations forward one row in the matrix and add linear equation 583 | ! corresponding to the dependent variable equal to zero 584 | ! 585 | do i=nlimits+2*nspecies_dep,1,-1 586 | eqns(i+1,:) = eqns(i,:) 587 | enddo 588 | do i=1,nspecies_dep 589 | eqns(1,i) = dble(num(i)) 590 | enddo 591 | eqns(1,nspecies_dep + 1) = energy 592 | neqns = nlimits + 2*nspecies_dep + 1 593 | else 594 | ! 595 | ! Restart file exists: read in data from restart file 596 | ! 597 | write(*,*) 598 | write(*,'(a)') "Found restart file..." 599 | write(*,*) 600 | do i=1,4 601 | read(11,*) 602 | enddo 603 | read(11,*) char, char, char, nspecies 604 | rewind(unit=11) 605 | read(11,*) 606 | read(11,*) 607 | read(11,*) char, char, char, (num(i),name(i),i=1,nspecies) 608 | write(*,*) 609 | string = '(a7, (1x,i2,1x,a2))' 610 | write(string(5:7),'(i3)') nspecies 611 | write(*,string) "System:", (num(i),name(i),i=1,nspecies) 612 | read(11,*) 613 | read(11,*) 614 | read(11,*) 615 | read(11,*) char, char, char, char, nlimits 616 | ! 617 | ! Set check_lim 618 | ! 619 | if(nlimits > 0) then 620 | check_lim = ltrue 621 | else 622 | check_lim = lfalse 623 | endif 624 | ! 625 | do i=1,5 626 | read(11,*) 627 | enddo 628 | read(11,*) char, energy 629 | read(11,*) 630 | read(11,*) char, char, strdep 631 | if(strdep(1:1) == "n") then 632 | check_dep = lfalse 633 | nspecies_dep = nspecies 634 | else 635 | check_dep = ltrue 636 | nspecies_dep = nspecies - 1 637 | write(*,*) 638 | write(*,'(a19,2x,a5)') "Dependent variable:", strdep 639 | endif 640 | do i=1,5 641 | read(11,*) 642 | enddo 643 | ! 644 | ! Read in inequality relations to set up matrix eqns, containing the linear equations 645 | ! solved in the original run 646 | ! 647 | eqns = 0.d0 648 | do i=1,nlimits+1 649 | read(11,*) (eqns(i,j), char, j=1,nspecies_dep), char, eqns(i,nspecies_dep + 1) 650 | enddo 651 | do i=1,nspecies_dep 652 | read(11,*) eqns(nlimits+1+i,i), char, char, eqns(nlimits+1+i,nspecies_dep + 1) 653 | enddo 654 | do i=1,nspecies_dep 655 | read(11,*) eqns(nlimits+1+nspecies_dep+i,i), char, char, eqns(nlimits+1+& 656 | &nspecies_dep+i,nspecies_dep + 1) 657 | enddo 658 | read(11,*) 659 | read(11,*) 660 | ! 661 | ! Read in limiting compounds (if any) 662 | ! 663 | if(nlimits > 0) then 664 | limittotno = 0 665 | limitnum = 0 666 | limitname = " " 667 | limite = 0.d0 668 | do 669 | read(11,'(a1)') read_tmp 670 | if(read_tmp == "*") exit 671 | enddo 672 | read(11,*) 673 | read(11,*) char, char, numtmp, char, str1, char, char, char, limite(1) 674 | ! 675 | ! Parse out compound's elements from its name (contained in str1). Do this by 676 | ! checking for lower case letters in the string, and for numbers 677 | ! 678 | ! Start with the first limiting compound 679 | ! 680 | str_num = len_trim(str1) 681 | i = 0 682 | do 683 | i = i+1 684 | check_low = lfalse 685 | if(i > str_num) exit 686 | if(i == str_num) then 687 | j = 1 688 | else 689 | j = 0 690 | do 691 | j = j+1 692 | if((iachar(str1(i+j:i+j)) >= iachar('A') .and. iachar(str1(i+j:i+j))& 693 | <= iachar('Z')) .or. (j + i > str_num)) exit 694 | enddo 695 | endif 696 | if(j == 1) then 697 | limittotno(1) = limittotno(1) + 1 698 | limitname(1,limittotno(1)) = str1(i:i) 699 | else 700 | if(iachar(str1(i+1:i+1)) >= iachar('a') .and. iachar(str1(i+1:i+1)) & 701 | <= iachar('z')) then 702 | limittotno(1) = limittotno(1) + 1 703 | limitname(1,limittotno(1)) = str1(i:i+1) 704 | check_low = ltrue 705 | else 706 | limittotno(1) = limittotno(1) + 1 707 | limitname(1,limittotno(1)) = str1(i:i) 708 | endif 709 | endif 710 | if(check_low) then 711 | if(j > 2) then 712 | do k=j,3,-1 713 | limitnum(1,limittotno(1)) = limitnum(1,limittotno(1)) + (iachar(& 714 | &str1(i+k-1:i+k-1)) - iachar('0')) * int(10.d0**(-k) * 10.d0**j) 715 | enddo 716 | else 717 | limitnum(1,limittotno(1)) = 1 718 | endif 719 | else 720 | if(j > 1) then 721 | do k=j,2,-1 722 | limitnum(1,limittotno(1)) = limitnum(1,limittotno(1)) + (iachar(& 723 | &str1(i+k-1:i+k-1)) - iachar('0')) * int(10.d0**(-k) * 10.d0**j) 724 | enddo 725 | else 726 | limitnum(1,limittotno(1)) = 1 727 | endif 728 | endif 729 | i = i + j - 1 730 | enddo 731 | ! 732 | ! Now the other limiting compounds (if any) 733 | ! 734 | if(nlimits > 1) then 735 | do 736 | do 737 | read(11,'(a1)') read_tmp 738 | if(read_tmp == "_") exit 739 | enddo 740 | str1 = " " 741 | read(11,*) 742 | read(11,*) char, char, numtmp, char, str1, char, char, char, limite& 743 | &(numtmp) 744 | str_num = len_trim(str1) 745 | i = 0 746 | do 747 | i = i+1 748 | check_low = lfalse 749 | if(i > str_num) exit 750 | if(i == str_num) then 751 | j = 1 752 | else 753 | j = 0 754 | do 755 | j = j+1 756 | if((iachar(str1(i+j:i+j)) >= iachar('A') .and. iachar(str1(i+j& 757 | &:i+j)) <= iachar('Z')) .or. (j + i > str_num)) exit 758 | enddo 759 | endif 760 | if(j == 1) then 761 | limittotno(numtmp) = limittotno(numtmp) + 1 762 | limitname(numtmp,limittotno(numtmp)) = str1(i:i) 763 | else 764 | if(iachar(str1(i+1:i+1)) >= iachar('a') .and. iachar(str1(i+1:i+1))& 765 | <= iachar('z')) then 766 | limittotno(numtmp) = limittotno(numtmp) + 1 767 | limitname(numtmp,limittotno(numtmp)) = str1(i:i+1) 768 | check_low = ltrue 769 | else 770 | limittotno(numtmp) = limittotno(numtmp) + 1 771 | limitname(numtmp,limittotno(numtmp)) = str1(i:i) 772 | endif 773 | endif 774 | if(check_low) then 775 | if(j > 2) then 776 | do k=j,3,-1 777 | limitnum(numtmp,limittotno(numtmp)) = limitnum(numtmp,& 778 | &limittotno(numtmp)) + (iachar(str1(i+k-1:i+k-1)) -& 779 | &iachar('0')) * int(10.d0**(-k) * 10.d0**j) 780 | enddo 781 | else 782 | limitnum(numtmp,limittotno(numtmp)) = 1 783 | endif 784 | else 785 | if(j > 1) then 786 | do k=j,2,-1 787 | limitnum(numtmp,limittotno(numtmp)) = limitnum(numtmp,& 788 | &limittotno(numtmp)) + (iachar(str1(i+k-1:i+k-1)) -& 789 | &iachar('0')) * int(10.d0**(-k) * 10.d0**j) 790 | enddo 791 | else 792 | limitnum(numtmp,limittotno(numtmp)) = 1 793 | endif 794 | endif 795 | i = i + j - 1 796 | enddo 797 | if(numtmp == nlimits) exit 798 | enddo 799 | endif 800 | endif 801 | ! 802 | ! Three restart options are available. Ask the user which is appropriate 803 | ! 804 | write(*,*) 805 | write(*,*) 806 | write(*,'(a)') "From restart file can:" 807 | write(*,*) 808 | write(*,'(a)') " (a) Change which element's chemical potential is the" 809 | write(*,'(a)') " dependent variable (or set a dependent variable if" 810 | write(*,'(a)') " not done previously)" 811 | write(*,'(a)') " (b) Enter additional competing phases (can be read from" 812 | write(*,'(a)') " a file extra_phases.dat)" 813 | write(*,'(a)') " (c) Set the value of chemical potential for a particular" 814 | write(*,'(a)') " element to a constant" 815 | write(*,*) 816 | write(*,'(a)') "Enter appropriate choice (a/b/c):" 817 | 90 read(*,'(a1)') read_tmp 818 | ! 819 | if(read_tmp(1:1) == 'a' .or. read_tmp(1:1) == 'A') then 820 | ! 821 | ! Dependent variable must be changed. Ask user which element's chemical potential 822 | ! will be the new dependent variable. Also output file will be slightly different 823 | ! to the (b) option case, so need to set a check here 824 | ! 825 | check_ab = ltrue 826 | check_dep = ltrue 827 | nspecies_dep = nspecies - 1 828 | write(*,*) 829 | write(*,'(a)') "Enter element whose chemical potential will be the (new)" 830 | write(*,'(a)') "dependent variable:" 831 | 80 read(*,*) fixname 832 | j = 0 833 | do i=1,nspecies 834 | if(fixname == name(i)) then 835 | j = j+1 836 | fixnum = i 837 | endif 838 | enddo 839 | if(j == 0) then 840 | write(*,'(a)') "ERROR: Element not found in system. Please enter another& 841 | & element:" 842 | goto 80 843 | endif 844 | ! 845 | ! Change order of species in system so that new dependent variable element is last 846 | ! in the list (ie element nspecies) 847 | ! 848 | tmp_str = name(nspecies) 849 | name(nspecies) = fixname 850 | name(fixnum) = tmp_str 851 | numtmp = num(nspecies) 852 | num(nspecies) = num(fixnum) 853 | num(fixnum) = numtmp 854 | ! 855 | ! Now create eqns array from the limiting compounds and system, as was done for the 856 | ! original calculation 857 | ! 858 | eqns = 0.d0 859 | if(check_lim .eqv. lfalse) goto 110 860 | check1 = lfalse 861 | do i=1,nlimits 862 | ! 863 | ! First check if the dependent variable element is present. If so fill elements of 864 | ! this line of the matrix appropriately, not yet taking into account the presence 865 | ! of other elements in the compound 866 | ! 867 | do j=1,limittotno(i) 868 | if(limitname(i,j) == name(nspecies_dep + 1)) then 869 | check1 = ltrue 870 | ndepend = j 871 | endif 872 | enddo 873 | if(check1) then 874 | do j=1,nspecies_dep 875 | eqns(i,j) = eqns(i,j) - dble(limitnum(i,ndepend)) * (dble(num(j))/& 876 | &dble(num(nspecies_dep + 1))) 877 | enddo 878 | eqns(i,nspecies_dep + 1) = limite(i) - dble(limitnum(i,ndepend)) * (energy/& 879 | &dble(num(nspecies_dep + 1))) 880 | check1 = lfalse 881 | ! 882 | ! If the dependent variable is not present the energy must still be put in the 883 | ! last column 884 | ! 885 | else 886 | eqns(i,nspecies_dep + 1) = limite(i) 887 | endif 888 | ! 889 | ! Now fill matrix elements according to presence of other chemical elements besides 890 | ! the dependent variable element. If the dependent variable element is present 891 | ! in the compound these numbers will be added to those determined previously. If not 892 | ! they will be added to zero (with matrix elements corresponding to chemical 893 | ! elements not present in the compound remaining as zero) 894 | ! 895 | do j=1,limittotno(i) 896 | do k=1,nspecies_dep 897 | if(limitname(i,j) == name(k)) then 898 | eqns(i,k) = eqns(i,k) + dble(limitnum(i,j)) 899 | endif 900 | enddo 901 | enddo 902 | enddo 903 | ! 904 | ! Now add equations corresponding to the limits imposed by the chemical potential 905 | ! ranges of the individual elements of the material (i.e. E < mu_X < 0). If no 906 | ! limiting compounds were inputted, definition of eqns array begins here 907 | ! 908 | 110 do i=1,nspecies_dep 909 | eqns(nlimits+i,i) = dble(num(i)) 910 | eqns(nlimits+i+nspecies_dep,i) = dble(num(i)) 911 | eqns(nlimits+i+nspecies_dep,nspecies_dep + 1) = energy 912 | enddo 913 | ! 914 | ! Now shift all equations forward one row in the matrix and add linear equation 915 | ! corresponding to the dependent variable equal to zero 916 | ! 917 | do i=nlimits+2*nspecies_dep,1,-1 918 | eqns(i+1,:) = eqns(i,:) 919 | enddo 920 | do i=1,nspecies_dep 921 | eqns(1,i) = dble(num(i)) 922 | enddo 923 | eqns(1,nspecies_dep + 1) = energy 924 | neqns = nlimits + 2*nspecies_dep + 1 925 | ! 926 | ! If option b is selected, new limiting compounds must be read in 927 | ! 928 | elseif(read_tmp(1:1) == 'b' .or. read_tmp(1:1) == 'B') then 929 | ! 930 | check_ab = ltrue 931 | ! 932 | ! Check for file containing additional phases. If it exists read data from it 933 | ! 934 | open(unit=14, status="old", file="extra_phases.dat", iostat=extra) 935 | if(extra == 0) then 936 | write(*,'(a)') "Reading additional competing phases from extra_phases.dat..." 937 | write(*,*) 938 | write(*,'(a)') "Reading total number of additional phases..." 939 | do 940 | read(14,'(a100)') line 941 | if(line(1:1) /= "#") then 942 | read(line,*) nadd 943 | exit 944 | endif 945 | enddo 946 | ! 947 | ! Check that the number is not less than zero 948 | ! 949 | if(nadd < 0) then 950 | write(*,'(a)') "FATAL ERROR: Found negative number of additional competing phases!" 951 | goto 200 952 | endif 953 | write(*,'(a)') "...found ok" 954 | write(*,*) 955 | ! 956 | ! Check if there are no limiting compounds. If there are, read them in sequentially. 957 | ! Check that the number in the input file matches the stated total amount. If not warn 958 | ! user and reset total amount 959 | ! 960 | if(nadd == 0) then 961 | write(*,'(a)') "Zero additional competing phases found" 962 | goto 130 963 | else 964 | write(*,'(a)') "Reading in formulae of each addtional competing phase..." 965 | write(*,*) 966 | do i=nlimits+1,nlimits+nadd 967 | check_read = lfalse 968 | do 969 | read(14,'(a100)',end=5002) line 970 | if(line(1:1) /= "#") then 971 | read(line,*,end=5002) limittotno(i) 972 | exit 973 | endif 974 | enddo 975 | if(limittotno(i) > nspecies) then 976 | write(*,'(a28,i3,a36)') "FATAL ERROR: Competing phase", i, "has more elements than the material!" 977 | goto 200 978 | endif 979 | if(limittotno(i) < 1 ) then 980 | write(*,'(a28,i3,a26)') "FATAL ERROR: Competing phase", i, "has less than one element!" 981 | goto 200 982 | endif 983 | do 984 | read(14,'(a100)',end=5002) line 985 | if(line(1:1) /= "#") then 986 | read(line,*,end=5002) (limitnum(i,j),limitname(i,j),j=1,limittotno(i)), limite(i) 987 | exit 988 | endif 989 | enddo 990 | check_read = ltrue 991 | enddo 992 | 5002 if(check_read .neqv. ltrue) then 993 | write(*,'(a)') "WARNING: Found less additional competing phases than supposed total amount" 994 | write(*,'(a29,i3)') " Actual number found:", i-1 995 | nadd = i-1 996 | endif 997 | write(*,'(a)') "...found ok" 998 | write(*,*) 999 | ! 1000 | ! Check that elements in the compounds are compatible with those in the material 1001 | ! 1002 | write(*,'(a)') "Checking additional competing phase formulae..." 1003 | do i=nlimits+1,nlimits+nadd 1004 | l = 0 1005 | do j=1,limittotno(i) 1006 | do k=1,nspecies 1007 | if(limitname(i,j) == name(k)) l = l+1 1008 | enddo 1009 | enddo 1010 | if(l == 0) then 1011 | write(*,'(a)') "FATAL ERROR: Competing phase found with element not contained in & 1012 | &material!!" 1013 | write(*,'(a44,i3)') " Error found in competing phase:", i 1014 | goto 200 1015 | endif 1016 | enddo 1017 | ! 1018 | ! Check that element numbers in compounds aren't negative 1019 | ! 1020 | do i=nlimits+1,nlimits+nadd 1021 | do j=1,limittotno(i) 1022 | if(limitnum(i,j) < 1) then 1023 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 1024 | write(*,'(a44,i3)') " Error found in competing phase", i 1025 | goto 200 1026 | endif 1027 | enddo 1028 | enddo 1029 | write(*,'(a)') "...all ok" 1030 | write(*,*) 1031 | endif 1032 | else 1033 | ! 1034 | ! File not found. Enter values interactively 1035 | ! 1036 | write(*,'(a)') "extra_phases.dat file not found - entering interactive mode..." 1037 | write(*,*) 1038 | write(*,'(a)') "Enter number of additional competing phases:" 1039 | 120 read(*,*) nadd 1040 | if(nadd < 0 .or. nadd > 1000) then 1041 | write(*,*) 1042 | write(*,'(a)') "ERROR: number cannot be negative!!" 1043 | write(*,'(a)') "Please re-enter number:" 1044 | goto 120 1045 | endif 1046 | ! 1047 | if(nadd == 0) then 1048 | write(*,'(a)') "No additional competing phases" 1049 | goto 130 1050 | endif 1051 | write(*,*) 1052 | write(*,'(a)') "For each competing phase enter the number of elements, then the" 1053 | write(*,'(a)') "formula and energy, in the same format as for the material" 1054 | write(*,'(a)') "formula." 1055 | write(*,*) 1056 | do i=1,nadd 1057 | write(*,'(a59,i3)') "Enter number of elements in additional competing phase no. ", i 1058 | read(*,*) limittotno(nlimits+i) 1059 | ! 1060 | ! Check that the number of elements in the compound doesn't exceed the number 1061 | ! of elements in the material, or is less than 1 1062 | ! 1063 | if(limittotno(nlimits+i) > nspecies) then 1064 | write(*,'(a)') "ERROR: Competing phase has more elements than the material!!" 1065 | write(*,*) 1066 | write(*,'(a66,i3)') "Enter a new number of elements for additional & 1067 | &competing phase no. ", i 1068 | read(*,*) limittotno(nlimits+i) 1069 | endif 1070 | if(limittotno(nlimits+i) < 1 ) then 1071 | write(*,'(a)') "ERROR: Competing phase cannot have less than one element!!" 1072 | write(*,*) 1073 | write(*,'(a55,i3)') "Enter a new number of elements for competing phase no. ", i 1074 | read(*,*) limittotno(nlimits+i) 1075 | endif 1076 | write(*,*) 1077 | write(*,'(a67,i3)') "Enter chemical formula and energy of additional & 1078 | &competing phase no. ", i 1079 | read(*,*) (limitnum(nlimits+i,j),limitname(nlimits+i,j),j=1,limittotno& 1080 | &(nlimits+i)), limite(nlimits+i) 1081 | write(*,*) 1082 | enddo 1083 | ! 1084 | ! Check that elements in the compounds are compatible with those in the material 1085 | ! 1086 | write(*,'(a)') "Checking competing phase formulae..." 1087 | write(*,*) 1088 | do i=1,nadd 1089 | l = 0 1090 | do j=1,limittotno(nlimits+i) 1091 | do k=1,nspecies 1092 | if(limitname(nlimits+i,j) == name(k)) l = l+1 1093 | enddo 1094 | enddo 1095 | if(l == 0) then 1096 | write(*,'(a)') "FATAL ERROR: Competing phase found with element not contained in & 1097 | &material!!" 1098 | write(*,'(a44,i3)') " Error found in competing phase ", i 1099 | goto 200 1100 | endif 1101 | enddo 1102 | ! 1103 | ! Check that element numbers in compounds aren't negative 1104 | ! 1105 | do i=1,nadd 1106 | do j=1,limittotno(nlimits+i) 1107 | if(limitnum(nlimits+i,j) < 1) then 1108 | write(*,'(a)') "FATAL ERROR: Incorrect syntax when entering numbers in chemical formula" 1109 | write(*,'(a44,i3)') " Error found in competing phase ", i 1110 | goto 200 1111 | endif 1112 | enddo 1113 | enddo 1114 | write(*,'(a)') "...all ok" 1115 | write(*,*) 1116 | ! 1117 | ! Close if testing if extra_phases.dat exists 1118 | ! 1119 | endif 1120 | ! 1121 | ! Reset nlimits value and check_lim 1122 | ! 1123 | nlimits = nlimits + nadd 1124 | check_lim = ltrue 1125 | ! 1126 | ! Now create eqns array from the limiting compounds and system, as was done for the 1127 | ! original calculation 1128 | ! 1129 | 130 eqns = 0.d0 1130 | if(check_lim .eqv. lfalse) goto 140 1131 | check1 = lfalse 1132 | do i=1,nlimits 1133 | ! 1134 | ! First check if the dependent variable element is present. If so fill elements of 1135 | ! this line of the matrix appropriately, not yet taking into account the presence 1136 | ! of other elements in the compound (skip this if no dependent variable set) 1137 | ! 1138 | if(check_dep) then 1139 | do j=1,limittotno(i) 1140 | if(limitname(i,j) == name(nspecies)) then 1141 | check1 = ltrue 1142 | ndepend = j 1143 | endif 1144 | enddo 1145 | endif 1146 | if(check1) then 1147 | do j=1,nspecies_dep 1148 | eqns(i,j) = eqns(i,j) - dble(limitnum(i,ndepend)) * (dble(num(j))/& 1149 | &dble(num(nspecies_dep + 1))) 1150 | enddo 1151 | eqns(i,nspecies_dep + 1) = limite(i) - dble(limitnum(i,ndepend)) * (energy/& 1152 | &dble(num(nspecies_dep + 1))) 1153 | check1 = lfalse 1154 | ! 1155 | ! If the dependent variable is not present the energy must still be put in the 1156 | ! last column 1157 | ! 1158 | else 1159 | eqns(i,nspecies_dep + 1) = limite(i) 1160 | endif 1161 | ! 1162 | ! Now fill matrix elements according to presence of other chemical elements besides 1163 | ! the dependent variable element. If the dependent variable element is present 1164 | ! in the compound these numbers will be added to those determined previously. If not 1165 | ! they will be added to zero (with matrix elements corresponding to chemical 1166 | ! elements not present in the compound remaining as zero) 1167 | ! 1168 | do j=1,limittotno(i) 1169 | do k=1,nspecies_dep 1170 | if(limitname(i,j) == name(k)) then 1171 | eqns(i,k) = eqns(i,k) + dble(limitnum(i,j)) 1172 | endif 1173 | enddo 1174 | enddo 1175 | enddo 1176 | ! 1177 | ! Now add equations corresponding to the limits imposed by the chemical potential 1178 | ! ranges of the individual elements of the material (i.e. E < mu_X < 0). If no 1179 | ! limiting compounds were inputted, definition of eqns array begins here 1180 | ! 1181 | 140 do i=1,nspecies_dep 1182 | eqns(nlimits+i,i) = dble(num(i)) 1183 | eqns(nlimits+i+nspecies_dep,i) = dble(num(i)) 1184 | eqns(nlimits+i+nspecies_dep,nspecies_dep + 1) = energy 1185 | enddo 1186 | ! 1187 | ! Now shift all equations forward one row in the matrix and add linear equation 1188 | ! corresponding to the dependent variable equal to zero 1189 | ! 1190 | do i=nlimits+2*nspecies_dep,1,-1 1191 | eqns(i+1,:) = eqns(i,:) 1192 | enddo 1193 | do i=1,nspecies_dep 1194 | eqns(1,i) = dble(num(i)) 1195 | enddo 1196 | eqns(1,nspecies_dep + 1) = energy 1197 | neqns = nlimits + 2*nspecies_dep + 1 1198 | ! 1199 | ! Otherwise option c is requested 1200 | ! 1201 | elseif(read_tmp(1:1) == 'c' .or. read_tmp(1:1) == 'C') then 1202 | ! 1203 | ! If the system is binary this option is not available 1204 | ! 1205 | if(nspecies <= 2) then 1206 | write(*,*) 1207 | write(*,'(a)') "ERROR: binary system found - option (c) not available!!" 1208 | write(*,'(a)') " (solution is trivial)" 1209 | write(*,*) 1210 | write(*,'(a)') "Please select option a or b:" 1211 | goto 90 1212 | endif 1213 | ! 1214 | ! Request from user element for which chemical potential will be fixed 1215 | ! 1216 | write(*,*) 1217 | write(*,'(a)') "Enter element for which chemical potential will be fixed:" 1218 | 60 read(*,*) fixname 1219 | j = 0 1220 | do i=1,nspecies 1221 | if(fixname == name(i)) then 1222 | j = j+1 1223 | if(check_dep .and. i == nspecies) then 1224 | write(*,'(a)') "ERROR: The dependent variable cannot be held fixed.& 1225 | &Please" 1226 | write(*,'(a)') "enter another element:" 1227 | goto 60 1228 | else 1229 | fixnum = i 1230 | endif 1231 | endif 1232 | enddo 1233 | if(j == 0) then 1234 | write(*,'(a)') "ERROR: Element not found in system. Please enter another & 1235 | &element:" 1236 | goto 60 1237 | endif 1238 | check_fix = ltrue 1239 | ! 1240 | ! Request value at which this element's chemical potential should be set 1241 | ! 1242 | write(*,*) 1243 | write(*,'(a)') "Enter fixed value of chemical potential for this element:" 1244 | read(*,*) fixe 1245 | ! 1246 | ! Re-stack eqns matrix as now one of the chemical potentials has a fixed value 1247 | ! 1248 | neqns = nlimits + 2*nspecies_dep 1249 | do i=1,neqns 1250 | eqns(i,nspecies_dep+1) = eqns(i,nspecies_dep+1) - eqns(i,fixnum) * fixe 1251 | enddo 1252 | do i=fixnum,nspecies_dep 1253 | eqns(:,i) = eqns(:,i+1) 1254 | enddo 1255 | do i=nlimits+1+fixnum,neqns 1256 | eqns(i,:) = eqns(i+1,:) 1257 | enddo 1258 | do i=nlimits+nspecies_dep+fixnum,neqns 1259 | eqns(i,:) = eqns(i+1,:) 1260 | enddo 1261 | ! 1262 | ! Arrays 'name' and 'num' must also be changed 1263 | ! 1264 | do i=fixnum,nspecies_dep 1265 | num(i) = num(i+1) 1266 | name(i) = name(i+1) 1267 | enddo 1268 | nspecies = nspecies - 1 1269 | nspecies_dep = nspecies_dep - 1 1270 | neqns = neqns - 2 1271 | ! 1272 | ! Else incorrect input from user. Ask for correct input 1273 | ! 1274 | else 1275 | write(*,'(a)') "SYNTAX ERROR: please enter a, b or c:" 1276 | goto 90 1277 | endif 1278 | ! 1279 | ! Close if-else checking for restart file 1280 | ! 1281 | endif 1282 | ! 1283 | ! Write to file the limiting relations, including a header with system and date and 1284 | ! time, energy and dependent variable 1285 | ! 1286 | call date_and_time(date,time,zone,values) 1287 | call date_and_time(DATE=date,ZONE=zone) 1288 | call date_and_time(TIME=time) 1289 | call date_and_time(VALUES=values) 1290 | write(12,'(a)') "**************************************************************& 1291 | &********************" 1292 | write(12,*) 1293 | if(restart /= 0 .or. check_ab) then 1294 | string = '(a19, (1x,i2,1x,a2))' 1295 | write(string(6:8),'(i3)') nspecies 1296 | write(12,string) "Results for system:", (num(i),name(i),i=1,nspecies) 1297 | else 1298 | string = '(a24, (1x,i2,1x,a2),3x,a1,1x,a5,2x,a1,2x,f9.4,1x,a1)' 1299 | write(string(6:8),'(i3)') nspecies 1300 | write(12,string) "Results- reduced system:", (num(i),name(i),i=1,nspecies)& 1301 | &,"(", "mu_"//fixname, "=", fixe, ")" 1302 | endif 1303 | write(12,*) 1304 | write(12,'(a18,i3)') "Number of species:", nspecies 1305 | write(12,*) 1306 | write(12,'(a27,i3)') "Number of competing phases:", nlimits 1307 | write(12,*) 1308 | write(12,'(a5,2x,I2,a1,I2,a1,I4,3x,I2,a1,I2,a1,I2)') 'DATE:', & 1309 | &values(3), '/', values(2), '/', values(1), values(5), ':', values(6), ':',& 1310 | &values(7) 1311 | write(12,*) 1312 | write(12,'(a)') "**************************************************************& 1313 | &********************" 1314 | write(12,*) 1315 | write(12,'(a7,e21.13,1x,a2)') "Energy:", energy, "eV" 1316 | write(12,*) 1317 | if(check_dep) then 1318 | write(12,'(a19,2x,a5)') "Dependent variable:", "mu_"//name(nspecies) 1319 | else 1320 | write(12,'(a19,2x,a5)') "Dependent variable:", "none" 1321 | endif 1322 | write(12,*) 1323 | write(12,'(a)') "**************************************************************& 1324 | &********************" 1325 | write(12,*) 1326 | write(12,'(a)') "Limiting inequalities:" 1327 | write(12,*) 1328 | do i=1,nlimits+1 1329 | do j=1,nspecies_dep 1330 | ineq_name(j) = "mu_"//name(j) 1331 | write(ineq_str(j)(1:9),'(f9.4)') eqns(i,j) 1332 | enddo 1333 | if(i == 1) then 1334 | string = '( (a8,1x,a5,2x),a1,2x,f9.4)' 1335 | write(string(2:4),'(i3)') nspecies_dep 1336 | if(check_dep) then 1337 | write(12,string) (ineq_str(j),ineq_name(j),j=1,nspecies_dep), ">", & 1338 | & eqns(i,nspecies_dep + 1) 1339 | else 1340 | write(12,string) (ineq_str(j),ineq_name(j),j=1,nspecies_dep), "=", & 1341 | & eqns(i,nspecies_dep + 1) 1342 | endif 1343 | else 1344 | string = '( (a8,1x,a5,2x),a1,2x,f9.4)' 1345 | write(string(2:4),'(i3)') nspecies_dep 1346 | write(12,string) (ineq_str(j),ineq_name(j),j=1,nspecies_dep), "<", & 1347 | &eqns(i,nspecies_dep + 1) 1348 | endif 1349 | enddo 1350 | do i=nlimits+2,neqns 1351 | do j=1,nspecies_dep 1352 | if(eqns(i,j) /= 0.d0) then 1353 | ineq_name(j) = "mu_"//name(j) 1354 | write(ineq_str(j)(1:9),'(f9.4)') eqns(i,j) 1355 | else 1356 | ineq_name(j) = " " 1357 | ineq_str(j) = " " 1358 | endif 1359 | enddo 1360 | if(i > nlimits + nspecies_dep + 1) then 1361 | string = '( (a8,1x,a5,2x),a1,2x,f9.4)' 1362 | write(string(2:4),'(i3)') nspecies_dep 1363 | write(12,string) (ineq_str(j),ineq_name(j),j=1,nspecies_dep), ">", & 1364 | & eqns(i,nspecies_dep + 1) 1365 | else 1366 | string = '( (a8,1x,a5,2x),a1,2x,f9.4)' 1367 | write(string(2:4),'(i3)') nspecies_dep 1368 | write(12,string) (ineq_str(j),ineq_name(j),j=1,nspecies_dep), "<", & 1369 | &eqns(i,nspecies_dep + 1) 1370 | endif 1371 | enddo 1372 | write(12,*) 1373 | write(12,'(a)') "**************************************************************& 1374 | &********************" 1375 | ! 1376 | ! If system is binary there is only one independent variable, and results will 1377 | ! have to be determined in a different way to the more general case (there will 1378 | ! be no systems of equations to solve). If no limiting compounds were supplied 1379 | ! the solution is trivial 1380 | ! 1381 | if(nspecies_dep == 1) then 1382 | ! 1383 | write(*,*) 1384 | write(*,'(a)') "Determining solution for binary system..." 1385 | write(*,*) 1386 | ! 1387 | if(nlimits == 0) then 1388 | Ebin_min = energy / dble(num(1)) 1389 | Ebin_max = 0.d0 1390 | else 1391 | ! 1392 | ! There is a solution if the limits on the independent variable are consistent. 1393 | ! Redefine the limits on the independent variable according to the limiting 1394 | ! compounds, and check if there is a solution 1395 | ! 1396 | Ebin_min = energy / dble(num(1)) 1397 | Ebin_max = 0.d0 1398 | do i=2,nlimits+1 1399 | bintemp = eqns(i,nspecies) / eqns(i,nspecies-1) 1400 | if(eqns(i,nspecies-1) < 0.d0) then 1401 | if(bintemp > Ebin_min) Ebin_min = bintemp 1402 | else 1403 | if(bintemp < Ebin_max) Ebin_max = bintemp 1404 | endif 1405 | enddo 1406 | endif 1407 | if(Ebin_min > Ebin_max) then 1408 | ! 1409 | ! No solution exists 1410 | ! 1411 | write(*,*) 1412 | write(*,'(a)') "******************************************************" 1413 | write(*,'(a)') "** **" 1414 | write(*,'(a)') "** NO SOLUTIONS FOUND FOR MATERIAL!!! **" 1415 | write(*,'(a)') "** **" 1416 | write(*,'(a)') "** MATERIAL IS UNSTABLE!!! **" 1417 | write(*,'(a)') "** **" 1418 | write(*,'(a)') "******************************************************" 1419 | write(*,*) 1420 | write(12,*) 1421 | write(12,'(a)') "System is unstable - no solutions exist" 1422 | write(12,*) 1423 | write(12,'(a)') "**************************************************************& 1424 | &********************" 1425 | else 1426 | numsol = 2 1427 | results(1,1) = Ebin_min 1428 | results(2,1) = Ebin_max 1429 | ! 1430 | ! Write solution to file 1431 | ! 1432 | write(12,*) 1433 | write(*,'(a)') "Solution found - material is thermodynamically stable!" 1434 | write(*,*) 1435 | write(12,'(a)') "Solution for binary system:" 1436 | write(12,*) 1437 | write(12,'(2x,f9.4,2x,a1,2x,a5,2x,a1,2x,f9.4)') Ebin_min, "<", "mu_"//name(1), "<"& 1438 | &, Ebin_max 1439 | write(12,*) 1440 | write(12,*) 1441 | write(12,'(2x,a5,2x,a1,2x,f9.4,4x,a2,4x,a5,2x,a2,2x,f9.4)') "mu_"//name(1), "=", & 1442 | &Ebin_min, "->", "mu_"//name(2), "=", (energy - dble(num(1)) * Ebin_min) / & 1443 | &dble(num(2)) 1444 | write(12,*) 1445 | write(12,'(2x,a5,2x,a1,2x,f9.4,4x,a2,4x,a5,2x,a2,2x,f9.4)') "mu_"//name(1), "=", & 1446 | &Ebin_max, "->", "mu_"//name(2), "=", (energy - dble(num(1)) * Ebin_max) / & 1447 | &dble(num(2)) 1448 | write(12,*) 1449 | write(12,*) 1450 | write(12,'(a)') "Equation for system:" 1451 | write(12,*) 1452 | write(12,'(2x,f9.4,2x,a5,2x,a1,2x,f9.4,2x,a5,2x,a1,2x,f9.4)') dble(num(1)), "mu_"& 1453 | &//name(1), "+", dble(num(2)), "mu_"//name(2), "=", energy 1454 | write(12,*) 1455 | write(12,'(a)') "**************************************************************& 1456 | &********************" 1457 | write(*,'(a)') "...done" 1458 | endif 1459 | if(nlimits > 0) then 1460 | goto 160 1461 | else 1462 | goto 170 1463 | endif 1464 | endif 1465 | ! 1466 | ! Call routine to solve all combinations of linear equations for systems with more 1467 | ! than two elements 1468 | ! 1469 | numres = 0 1470 | call all_eqns_solve(eqns(1:neqns,1:nspecies_dep + 1),neqns,nspecies_dep + 1,intersect& 1471 | &(:,1:nspecies_dep),numres) 1472 | ! 1473 | ! There are now numres solutions stored in the rows of intersect. If no solutions 1474 | ! are found tell the user, and abort the calculation 1475 | ! 1476 | if(numres == 0) then 1477 | write(*,*) 1478 | write(*,'(a)') "ERROR: no solutions found for any system of linear equations" 1479 | write(*,'(a)') "formed from the data input!!" 1480 | write(*,*) 1481 | write(*,'(a)') "-> No intersection points between any hypersurfaces in chemical" 1482 | write(*,'(a)') " potential space" 1483 | write(*,*) 1484 | goto 200 1485 | endif 1486 | ! 1487 | ! Check which solutions are compatible with the limiting inequalities. These will 1488 | ! be the corners of the polyhedron formed by the region of stability 1489 | ! 1490 | numsol = 0 1491 | do i=1,numres 1492 | check2 = ltrue 1493 | do j=1,neqns 1494 | sum1 = 0.d0 1495 | do k=1,nspecies_dep 1496 | sum1 = sum1 + intersect(i,k) * eqns(j,k) 1497 | enddo 1498 | if(j == 1 .or. j > nlimits + nspecies_dep + 1) then 1499 | if(sum1 - eqns(j,nspecies_dep + 1) < -small) then 1500 | check2 = lfalse 1501 | endif 1502 | else 1503 | if(sum1 - eqns(j,nspecies_dep + 1) > small) then 1504 | check2 = lfalse 1505 | endif 1506 | endif 1507 | enddo 1508 | ! 1509 | ! Put compatible solutions in an array 1510 | ! 1511 | if(check2) then 1512 | numsol = numsol + 1 1513 | results(numsol,1:nspecies_dep) = intersect(i,1:nspecies_dep) 1514 | endif 1515 | enddo 1516 | ! 1517 | ! If no solutions are found tell the user 1518 | ! 1519 | if(numsol == 0) then 1520 | write(*,*) 1521 | write(*,'(a)') "******************************************************" 1522 | write(*,'(a)') "** **" 1523 | write(*,'(a)') "** NO SOLUTIONS FOUND FOR MATERIAL!!! **" 1524 | write(*,'(a)') "** **" 1525 | write(*,'(a)') "** MATERIAL IS UNSTABLE!!! **" 1526 | write(*,'(a)') "** **" 1527 | write(*,'(a)') "******************************************************" 1528 | write(*,*) 1529 | write(12,*) 1530 | write(12,'(a)') "System is unstable - no solutions exist" 1531 | write(12,*) 1532 | write(12,'(a)') "**************************************************************& 1533 | &********************" 1534 | goto 200 1535 | ! 1536 | ! Otherwise write the solutions to file 1537 | ! 1538 | else 1539 | write(*,'(a)') "Solution found - material is thermodynamically stable!" 1540 | write(*,*) 1541 | ! 1542 | ! First check for redundant solutions and remove from list before writing to file 1543 | ! 1544 | do i=1,numsol 1545 | j = i 1546 | do 1547 | j = j+1 1548 | if(j > numsol) exit 1549 | l = 0 1550 | do k=1,nspecies_dep 1551 | if(results(i,k) == results(j,k)) l = l+1 1552 | enddo 1553 | if(l == nspecies_dep) then 1554 | do n=j,numsol-1 1555 | results(n,:) = results(n+1,:) 1556 | enddo 1557 | numsol = numsol - 1 1558 | j = j-1 1559 | endif 1560 | enddo 1561 | enddo 1562 | ! 1563 | ! Now write solutions 1564 | ! 1565 | write(12,*) 1566 | write(12,'(a)') "Intersection points in chemical potential space:" 1567 | write(12,*) 1568 | string = '( (3x,a5,3x),a1,3x,a5,1x,a1)' 1569 | write(string(2:4),'(i3)') nspecies-1 1570 | write(12,string) ("mu_"//name(i),i=1,nspecies-1), "|", "mu_"//name(nspecies), "=" 1571 | str1 = "-----------" 1572 | str1 = trim(str1) 1573 | do i=1,nspecies-2 1574 | str1 = "-----------"//str1 1575 | enddo 1576 | write(str1((nspecies-1)*11+1:(nspecies-1)*11+14),'(a13)') "|------------" 1577 | string = '(a )' 1578 | write(str2(1:3),'(i3)') (nspecies * 11) + 1 1579 | str3 = adjustl(str2) 1580 | write(string(3:5),'(a3)') str3 1581 | write(12,string) str1 1582 | do i=1,numsol 1583 | string = '( (1x,f9.4,1x),a1,1x,f9.4)' 1584 | write(string(2:4),'(i3)') nspecies-1 1585 | sum1 = 0.d0 1586 | do j=1,nspecies-1 1587 | sum1 = sum1 + dble(num(j)) * results(i,j) 1588 | enddo 1589 | enertemp = (energy - sum1) / dble(num(nspecies)) 1590 | write(12,string) (results(i,j),j=1,nspecies-1), "|", enertemp 1591 | enddo 1592 | write(12,*) 1593 | write(12,'(a)') "**************************************************************& 1594 | &********************" 1595 | endif 1596 | if(nlimits > 0) then 1597 | goto 160 1598 | else 1599 | goto 170 1600 | endif 1601 | ! 1602 | ! Now write equations to file corresponding to each limiting compound, including 1603 | ! the corresponding intersection points if any (do this even if there is no solution 1604 | ! for the system) 1605 | ! 1606 | if(nlimits == 0) goto 150 1607 | 160 do i=1,nlimits 1608 | write(12,*) 1609 | ! 1610 | ! Create string with correct chemical name for limiting compound 1611 | ! 1612 | str_num = 0 1613 | str1 = " " 1614 | do j=1,limittotno(i) 1615 | if(len_trim(limitname(i,j)) > 1) then 1616 | write(str1(str_num+1:str_num+2),'(a2)') limitname(i,j) 1617 | else 1618 | write(str1(str_num+1:str_num+1),'(a1)') limitname(i,j)(1:1) 1619 | endif 1620 | str_num = len_trim(str1) 1621 | if(limitnum(i,j) > 1) then 1622 | if(limitnum(i,j) < 10) then 1623 | write(str1(str_num+1:str_num+1),'(i1)') limitnum(i,j) 1624 | elseif(limitnum(i,j) > 9 .and. limitnum(i,j) < 100) then 1625 | write(str1(str_num+1:str_num+2),'(i2)') limitnum(i,j) 1626 | else 1627 | write(str1(str_num+1:str_num+3),'(i3)') limitnum(i,j) 1628 | endif 1629 | endif 1630 | str_num = len_trim(str1) 1631 | enddo 1632 | compounds(i+1) = str1 1633 | ! 1634 | ! Write compound name as a header, with its energy 1635 | ! 1636 | string = "(a15,1x,i3,1x,a1,3x,a ,3x,a10,1x,f9.4,1x,a1)" 1637 | write(str2,'(i3)') str_num 1638 | str2 = adjustl(str2) 1639 | write(string(22:24),'(a3)') str2 1640 | write(12,string) "Competing phase", i, ":", str1, "( energy =", limite(i), ")" 1641 | write(12,'(a23)') "-----------------------" 1642 | write(12,*) 1643 | ! 1644 | ! Create string consisting of relevant equation for compound 1645 | ! 1646 | eqn_str = " " 1647 | check_eqns = ltrue 1648 | if(eqns(i+1,1) /= 0.d0) then 1649 | write(eqn_str(1:17),'(f9.4,1x,a5,2x)') eqns(i+1,1), "mu_"//name(1) 1650 | check_eqns = lfalse 1651 | endif 1652 | do j=2,nspecies_dep 1653 | if(check_eqns) then 1654 | if(eqns(i+1,j) /= 0.d0) then 1655 | write(eqn_str(1:17),'(f9.4,1x,a5,2x)') eqns(i+1,j), "mu_"//name(j) 1656 | check_eqns = lfalse 1657 | endif 1658 | else 1659 | if(eqns(i+1,j) /= 0.d0) then 1660 | str_num = len_trim(eqn_str) 1661 | if(eqns(i+1,j) < 0.d0) then 1662 | write(eqn_str(str_num+3:str_num+23),'(a1,2x,f9.4,1x,a5,2x)') "-", & 1663 | &-eqns(i+1,j), "mu_"//name(j) 1664 | else 1665 | write(eqn_str(str_num+3:str_num+23),'(a1,2x,f9.4,1x,a5,2x)') "+", & 1666 | &eqns(i+1,j), "mu_"//name(j) 1667 | endif 1668 | check_eqns = lfalse 1669 | endif 1670 | endif 1671 | enddo 1672 | str_num = len_trim(eqn_str) 1673 | write(eqn_str(str_num+3:str_num+14),'(a1,2x,f9.4)') "=", eqns(i+1,nspecies_dep + 1) 1674 | ! 1675 | ! Write the equation to file 1676 | ! 1677 | write(12,'(a)') "Equation:" 1678 | write(12,*) 1679 | str_num = len_trim(eqn_str) 1680 | string = "(2x,a )" 1681 | write(str2,'(i3)') str_num 1682 | str2 = adjustl(str2) 1683 | write(string(6:8),'(a3)') str2 1684 | write(12,string) eqn_str 1685 | write(12,*) 1686 | ! 1687 | ! Determine which intersection points are relevant for each compound and write them 1688 | ! to file 1689 | ! 1690 | write(12,'(a)') "Relevant intersection points:" 1691 | write(12,*) 1692 | comp_array = 0 1693 | l = 0 1694 | if(numsol > 0) then 1695 | do j=1,numsol 1696 | check2 = lfalse 1697 | sum1 = 0.d0 1698 | do k=1,nspecies_dep 1699 | sum1 = sum1 + results(j,k) * eqns(i+1,k) 1700 | enddo 1701 | if(abs(sum1 - eqns(i+1,nspecies_dep + 1)) < small) then 1702 | check2 = ltrue 1703 | endif 1704 | ! 1705 | ! Count how many there are and put their order in an array 1706 | ! 1707 | if(check2) then 1708 | l = l+1 1709 | comp_array(l) = j 1710 | endif 1711 | enddo 1712 | endif 1713 | ! 1714 | ! Now write to file. If there are none then say so 1715 | ! 1716 | if(l == 0 .or. numsol == 0) then 1717 | write(12,'(a)') "None" 1718 | else 1719 | string = '( (3x,a5,3x),a1,3x,a5,1x,a2)' 1720 | write(string(2:4),'(i3)') nspecies-1 1721 | write(12,string) ("mu_"//name(j),j=1,nspecies-1), "|", "mu_"//name(nspecies)& 1722 | &, ">=" 1723 | str1 = "-----------" 1724 | str1 = trim(str1) 1725 | do j=1,nspecies-2 1726 | str1 = "-----------"//str1 1727 | enddo 1728 | write(str1((nspecies-1)*11+1:(nspecies-1)*11+14),'(a13)') "|------------" 1729 | string = '(a )' 1730 | write(str2(1:3),'(i3)') (nspecies * 11) + 1 1731 | str3 = adjustl(str2) 1732 | write(string(3:5),'(a3)') str3 1733 | write(12,string) str1 1734 | do j=1,l 1735 | string = '( (1x,f9.4,1x),a1,1x,f9.4)' 1736 | write(string(2:4),'(i3)') nspecies-1 1737 | sum1 = 0.d0 1738 | do k=1,nspecies-1 1739 | sum1 = sum1 + dble(num(k)) * results(comp_array(j),k) 1740 | enddo 1741 | enertemp = (energy - sum1) / dble(num(nspecies)) 1742 | write(12,string) (results(comp_array(j),k),k=1,nspecies-1), "|", enertemp 1743 | enddo 1744 | endif 1745 | write(12,'(a)') "______________________________________________________________& 1746 | &____________________" 1747 | enddo 1748 | 1749 | ! 1750 | ! Repeat for the limits imposed by the system itself 1751 | ! 1752 | 170 write(12,*) 1753 | ! 1754 | ! Create string with correct chemical name for limiting compound 1755 | ! 1756 | str1 = " " 1757 | str_num = 0 1758 | do j=1,nspecies 1759 | if(len_trim(name(j)) > 1) then 1760 | write(str1(str_num+1:str_num+2),'(a2)') name(j) 1761 | else 1762 | write(str1(str_num+1:str_num+1),'(a1)') name(j)(1:1) 1763 | endif 1764 | str_num = len_trim(str1) 1765 | if(num(j) > 1) then 1766 | if(num(j) < 10) then 1767 | write(str1(str_num+1:str_num+1),'(i1)') num(j) 1768 | elseif(num(j) > 9 .and. num(j) < 100) then 1769 | write(str1(str_num+1:str_num+2),'(i2)') num(j) 1770 | else 1771 | write(str1(str_num+1:str_num+3),'(i3)') num(j) 1772 | endif 1773 | endif 1774 | str_num = len_trim(str1) 1775 | enddo 1776 | compounds(1) = str1 1777 | ! 1778 | ! Write compound name as a header, with its energy 1779 | ! 1780 | string = "(a23,3x,a ,3x,a10,1x,f9.4,1x,a1)" 1781 | write(str2,'(i3)') str_num 1782 | str2 = adjustl(str2) 1783 | write(string(10:12),'(a3)') str2 1784 | write(12,string) "Limits from system :", str1, "( energy =", energy, ")" 1785 | write(12,'(a23)') "-----------------------" 1786 | write(12,*) 1787 | ! 1788 | ! Create string consisting of relevant equation for compound 1789 | ! 1790 | eqn_str = " " 1791 | check_eqns = ltrue 1792 | if(eqns(1,1) /= 0.d0) then 1793 | write(eqn_str(1:17),'(f9.4,1x,a5,2x)') eqns(1,1), "mu_"//name(1) 1794 | check_eqns = lfalse 1795 | endif 1796 | do j=2,nspecies_dep 1797 | if(check_eqns) then 1798 | if(eqns(1,j) /= 0.d0) then 1799 | write(eqn_str(1:17),'(f9.4,1x,a5,2x)') eqns(1,1), "mu_"//name(j) 1800 | check_eqns = lfalse 1801 | endif 1802 | else 1803 | if(eqns(1,j) /= 0.d0) then 1804 | str_num = len_trim(eqn_str) 1805 | if(eqns(1,j) < 0.d0) then 1806 | write(eqn_str(str_num+3:str_num+23),'(a1,2x,f9.4,1x,a5,2x)') "-", & 1807 | &-eqns(1,j), "mu_"//name(j) 1808 | else 1809 | write(eqn_str(str_num+3:str_num+23),'(a1,2x,f9.4,1x,a5,2x)') "+", & 1810 | &eqns(1,j), "mu_"//name(j) 1811 | endif 1812 | check_eqns = lfalse 1813 | endif 1814 | endif 1815 | enddo 1816 | str_num = len_trim(eqn_str) 1817 | write(eqn_str(str_num+3:str_num+14),'(a1,2x,f9.4)') "=", eqns(1,nspecies_dep + 1) 1818 | ! 1819 | ! Write the equation to file 1820 | ! 1821 | write(12,'(a)') "Equation:" 1822 | write(12,*) 1823 | str_num = len_trim(eqn_str) 1824 | string = "(2x,a )" 1825 | write(str2,'(i3)') str_num 1826 | str2 = adjustl(str2) 1827 | write(string(6:8),'(a3)') str2 1828 | write(12,string) eqn_str 1829 | write(12,*) 1830 | ! 1831 | ! Determine which intersection points are relevant for the system and write them 1832 | ! to file 1833 | ! 1834 | write(12,'(a)') "Relevant intersection points:" 1835 | write(12,*) 1836 | comp_array = 0 1837 | l = 0 1838 | if(numsol > 0) then 1839 | do j=1,numsol 1840 | check2 = lfalse 1841 | sum1 = 0.d0 1842 | do k=1,nspecies_dep 1843 | sum1 = sum1 + results(j,k) * eqns(1,k) 1844 | enddo 1845 | if(abs(sum1 - eqns(1,nspecies_dep + 1)) < small) then 1846 | check2 = ltrue 1847 | endif 1848 | ! 1849 | ! Count how many there are and put their order in an array 1850 | ! 1851 | if(check2) then 1852 | l = l+1 1853 | comp_array(l) = j 1854 | endif 1855 | enddo 1856 | endif 1857 | ! 1858 | ! Now write to file. If there are none then say so 1859 | ! 1860 | if(l == 0 .or. numsol == 0) then 1861 | write(12,'(a)') "None" 1862 | else 1863 | string = '( (3x,a5,3x),a1,3x,a5,1x,a2)' 1864 | write(string(2:4),'(i3)') nspecies-1 1865 | write(12,string) ("mu_"//name(j),j=1,nspecies-1), "|", "mu_"//name(nspecies)& 1866 | &, ">=" 1867 | str1 = "-----------" 1868 | str1 = trim(str1) 1869 | do j=1,nspecies-2 1870 | str1 = "-----------"//str1 1871 | enddo 1872 | write(str1((nspecies-1)*11+1:(nspecies-1)*11+14),'(a13)') "|------------" 1873 | string = '(a )' 1874 | write(str2(1:3),'(i3)') (nspecies * 11) + 1 1875 | str3 = adjustl(str2) 1876 | write(string(3:5),'(a3)') str3 1877 | write(12,string) str1 1878 | do j=1,l 1879 | string = '( (1x,f9.4,1x),a1,1x,f9.4)' 1880 | write(string(2:4),'(i3)') nspecies-1 1881 | sum1 = 0.d0 1882 | do k=1,nspecies-1 1883 | sum1 = sum1 + dble(num(k)) * results(comp_array(j),k) 1884 | enddo 1885 | enertemp = (energy - sum1) / dble(num(nspecies)) 1886 | write(12,string) (results(comp_array(j),k),k=1,nspecies-1), "|", enertemp 1887 | enddo 1888 | endif 1889 | write(12,*) 1890 | write(12,'(a)') "**************************************************************& 1891 | &********************" 1892 | 150 continue 1893 | ! 1894 | ! Ask user if grid of points in polyhedron is required. Skip this if the system is 1895 | ! binary 1896 | ! 1897 | if(nspecies <= 2 .or. numsol == 0) goto 180 1898 | write(*,*) 1899 | write(*,'(a)') "Print grid of points enclosed within stability polyhedron (y/n)?" 1900 | 50 read(*,'(a3)') str2 1901 | if(str2(1:1) == "y" .or. str2(1:1) == "Y") then 1902 | open(unit=15, file="grid.dat", status="replace") 1903 | write(*,*) 1904 | write(*,'(a)') "Enter grid dimension in units of energy (e.g. 0.1, & 1905 | &0.01 etc.):" 1906 | read(*,*) grid 1907 | ! 1908 | ! Check that grid dimension is not too small 1909 | ! 1910 | 10 continue 1911 | if(grid < small*1.d5) then 1912 | write(*,'(a)') "ERROR: Grid dimension is too small. Please enter a larger & 1913 | &value:" 1914 | read(*,*) grid 1915 | goto 10 1916 | endif 1917 | ! 1918 | ! Create grid. First create regular grid (rectangular or cubic or higher dimensional 1919 | ! depending on nspecies-1) using the max and min values of each mu_X. Then check each 1920 | ! point in this grid to see if it is compatible with the limiting inequalities. If it 1921 | ! is write it to file 1922 | ! 1923 | write(*,*) 1924 | write(*,'(a)') "Determining grid and writing to file..." 1925 | write(*,*) 1926 | mumax = -1.d8 1927 | mumin = 1.d8 1928 | do i=1,nspecies-1 1929 | do j=1,numsol 1930 | if(results(j,i) > mumax(i)) then 1931 | mumax(i) = results(j,i) 1932 | endif 1933 | if(results(j,i) < mumin(i)) then 1934 | mumin(i) = results(j,i) 1935 | endif 1936 | enddo 1937 | enddo 1938 | ! 1939 | ! Write to file the header and the polyhedron corner points 1940 | ! 1941 | call date_and_time(date,time,zone,values) 1942 | call date_and_time(DATE=date,ZONE=zone) 1943 | call date_and_time(TIME=time) 1944 | call date_and_time(VALUES=values) 1945 | write(15,'(a)') "**************************************************************& 1946 | &********************" 1947 | write(15,*) 1948 | if(restart /= 0) then 1949 | string = '(a19, (1x,i2,1x,a2))' 1950 | write(string(6:8),'(i3)') nspecies 1951 | write(15,string) "Results for system:", (num(i),name(i),i=1,nspecies) 1952 | else 1953 | string = '(a24, (1x,i2,1x,a2),3x,a1,1x,a5,2x,a1,2x,f9.4,1x,a1)' 1954 | write(string(6:8),'(i3)') nspecies 1955 | write(15,string) "Results- reduced system:", (num(i),name(i),i=1,nspecies),& 1956 | &"(", "mu_"//fixname, "=", fixe, ")" 1957 | endif 1958 | write(15,*) 1959 | write(15,'(a5,2x,I2,a1,I2,a1,I4,3x,I2,a1,I2,a1,I2)') 'DATE:', & 1960 | values(3), '/', values(2), '/', values(1), values(5), ':', values(6), ':',& 1961 | &values(7) 1962 | write(15,*) 1963 | write(15,'(a9,i3,1x,a39)') "The first", numsol, "points are the polyhedron corner& 1964 | & points" 1965 | write(15,*) 1966 | write(15,'(a)') "**************************************************************& 1967 | &********************" 1968 | write(15,*) 1969 | string = '( (3x,a5,3x),a1,3x,a5,1x,a2)' 1970 | write(string(2:4),'(i3)') nspecies-1 1971 | write(15,string) ("mu_"//name(i),i=1,nspecies-1), "|", "mu_"//name(nspecies), ">=" 1972 | str1 = "-----------" 1973 | str1 = trim(str1) 1974 | do i=1,nspecies-2 1975 | str1 = "-----------"//str1 1976 | enddo 1977 | write(str1((nspecies-1)*11+1:(nspecies-1)*11+14),'(a13)') "|------------" 1978 | string = '(a )' 1979 | write(str2(1:3),'(i3)') (nspecies * 11) + 1 1980 | str3 = adjustl(str2) 1981 | write(string(3:5),'(a3)') str3 1982 | write(15,string) str1 1983 | do i=1,numsol 1984 | string = '( (1x,f9.4,1x),a1,1x,f9.4)' 1985 | write(string(2:4),'(i3)') nspecies-1 1986 | sum1 = 0.d0 1987 | do j=1,nspecies-1 1988 | sum1 = sum1 + dble(num(j)) * results(i,j) 1989 | enddo 1990 | enertemp = (energy - sum1) / dble(num(nspecies)) 1991 | write(15,string) (results(i,j),j=1,nspecies-1), "|", enertemp 1992 | enddo 1993 | ! 1994 | ! Start at the min value for each mu_X, increment by grid, and test if the resulting 1995 | ! point is within the polyhedron 1996 | ! 1997 | do i=1,nspecies-1 1998 | gridpt(i) = mumin(i) 1999 | enddo 2000 | 20 continue 2001 | check2 = ltrue 2002 | do i=1,neqns 2003 | sum1 = 0.d0 2004 | do j=1,nspecies-1 2005 | sum1 = sum1 + gridpt(j) * eqns(i,j) 2006 | enddo 2007 | if(i == 1 .or. i > nlimits + nspecies) then 2008 | if(sum1 - eqns(i,nspecies) < -small) then 2009 | check2 = lfalse 2010 | endif 2011 | else 2012 | if(sum1 - eqns(i,nspecies) > small) then 2013 | check2 = lfalse 2014 | endif 2015 | endif 2016 | enddo 2017 | ! 2018 | ! Write compatible grid points to file 2019 | ! 2020 | if(check2) then 2021 | string = '( (1x,f9.4,1x),a1,1x,f9.4)' 2022 | write(string(2:4),'(i3)') nspecies-1 2023 | sum1 = 0.d0 2024 | do j=1,nspecies-1 2025 | sum1 = sum1 + dble(num(j)) * gridpt(j) 2026 | enddo 2027 | enertemp = (energy - sum1) / dble(num(nspecies)) 2028 | write(15,string) (gridpt(j),j=1,nspecies-1), "|", enertemp 2029 | endif 2030 | i = nspecies-1 2031 | 30 gridpt(i) = gridpt(i) + grid 2032 | if(gridpt(i) < mumax(i)) then 2033 | goto 20 2034 | else 2035 | gridpt(i) = mumin(i) 2036 | i = i-1 2037 | if(i < 1) then 2038 | goto 40 2039 | else 2040 | goto 30 2041 | endif 2042 | endif 2043 | 40 write(*,'(a)') "...done" 2044 | close(unit=15) 2045 | ! 2046 | elseif(str2(1:1) == "n" .or. str2(1:1) == "N") then 2047 | write(*,*) 2048 | write(*,'(a)') "No grid printed" 2049 | write(*,*) 2050 | else 2051 | write(*,'(a)') "SYNTAX ERROR: please enter yes or no:" 2052 | goto 50 2053 | endif 2054 | ! 2055 | ! If System of independent variables is 2D or 3D a plot file can be generated 2056 | ! for mathematica. For the 3D case a plot file is generated only if there is a 2057 | ! solution 2058 | ! A plotting file for gnuplot is also produced in both cases 2059 | ! 2060 | 180 if(nspecies_dep == 3) then 2061 | open(unit=16,status='replace',file="3Dplot.dat") 2062 | write(*,*) 2063 | write(*,'(a)') "Chemical potential space is 3D. Writing plotting files..." 2064 | write(16,'(a20,f7.3,a2,2(a1,f7.3,a2),a1,f7.3,a2)') "plot1:=RegionPlot3D[", & 2065 | &eqns(1,1), name(1), ("+", eqns(1,i), name(i), i=2,3), ">", eqns(1,nspecies_dep + 1),& 2066 | "&&" 2067 | do i=2,nlimits 2068 | write(16,'(20x,f7.3,a2,2(a1,f7.3,a2),a1,f7.3,a2)') eqns(i,1), name(1), ("+", & 2069 | &eqns(i,j), name(j), j=2,3), "<", eqns(i,nspecies_dep + 1),"&&" 2070 | enddo 2071 | write(16,'(20x,f7.3,a2,2(a1,f7.3,a2),a1,f7.3,a1)') eqns(nlimits+1,1), name(1), & 2072 | &("+", eqns(nlimits+1,j), name(j), j=2,3), "<", eqns(nlimits+1,nspecies_dep + 1),"," 2073 | write(16,'(20x,3(a1,a2,a1,f7.3,a4))') ("{", name(i), ",", energy/dble(num(i)), ",0},"& 2074 | &,i=1,3) 2075 | write(16,'(20x,a62,a11)') "PlotRange->Full,PlotPoints->100,PlotStyle->Directive[Yellow],"& 2076 | &, "Mesh->None," 2077 | write(16,'(20x,a12,2(a2,a1),a2,a47)') "AxesLabel->{", (name(i),",",i=1,2), name(3), & 2078 | "},Ticks->Automatic,ViewPoint->{Pi,3*Pi/2,Pi/3}]" 2079 | write(16,'(a20,f7.3,a9,f7.3,a9,f7.3,a14)') "plot2:=ListPlot3D[{{", energy/dble(num(1))& 2080 | &, ",0,0},{0,", energy/dble(num(2)), ",0},{0,0,", energy/dble(num(3)), & 2081 | &"}},Mesh->None," 2082 | write(16,'(18x,a35)') "PlotStyle->Directive[Opacity[0.1]]]" 2083 | write(16,'(a17)') "Show[plot1,plot2]" 2084 | close(unit=16) 2085 | ! 2086 | ! Now write gnuplot file 2087 | ! 2088 | open(unit=16,status='replace',file="3Dplot.plt") 2089 | write(16,'(a)') "set view equal xyz" 2090 | write(16,'(a)') "set view 60, 220" 2091 | write(16,'(a)') "set border 4095" 2092 | write(16,'(a)') "set xyplane 0" 2093 | write(16,*) 2094 | ! 2095 | ! Go through each relevant compound, including the main compound. Check if any solution points 2096 | ! correspond to that compound. If so, it must be included in the plot. Find the intersection 2097 | ! lines with all other relevant compounds, and convert to conditional expressions on x and y. 2098 | ! Surfaces are defined with reference to z. The midpoints of the surfaces are used to work out 2099 | ! the conditional expressions. Surfaces parallel to z cannot be plotted - instead their 2100 | ! midpoint is plotted 2101 | ! 2102 | ! Define numerical values for the functions so that they can be plotted. Also need to keep track 2103 | ! of number of relevant compounds and their order (in an array) 2104 | ! 2105 | func1 = 1000 2106 | func2 = 100 2107 | nrel = 0 2108 | rel_array = 0 2109 | ! 2110 | ! Go through each compound 2111 | ! 2112 | do i=1,nlimits+1 2113 | ! 2114 | ! Check if any solutions correspond to that compound, and put their order in an array if they 2115 | ! do. Also find the mid-point of the solution points and store that 2116 | ! 2117 | comp_array = 0 2118 | l = 0 2119 | sum2 = 0.d0 2120 | sum3 = 0.d0 2121 | sum4 = 0.d0 2122 | do j=1,numsol 2123 | check2 = lfalse 2124 | sum1 = 0.d0 2125 | do k=1,nspecies_dep 2126 | sum1 = sum1 + results(j,k) * eqns(i,k) 2127 | enddo 2128 | if(abs(sum1 - eqns(i,nspecies_dep + 1)) < small) then 2129 | check2 = ltrue 2130 | endif 2131 | if(check2) then 2132 | l = l+1 2133 | comp_array(l) = j 2134 | sum2 = sum2 + results(j,1) 2135 | sum3 = sum3 + results(j,2) 2136 | sum4 = sum4 + results(j,3) 2137 | endif 2138 | enddo 2139 | ! 2140 | ! If there are solutions for this compound, count it and put its order in an array, and 2141 | ! work out the midpoint 2142 | ! 2143 | if(l > 0) then 2144 | nrel = nrel + 1 2145 | rel_array(nrel) = i 2146 | avgpos(nrel,1) = sum2/real(l) 2147 | avgpos(nrel,2) = sum3/real(l) 2148 | avgpos(nrel,3) = sum4/real(l) 2149 | endif 2150 | enddo 2151 | ! 2152 | ! Go through each compound that has relevant intersection points. For each case, write 2153 | ! the formula of the corresponding plane in terms of z, and go through all other relevant 2154 | ! compounds and find the intersection lines. Put these in a conditional function on x and 2155 | ! y. The less than or greater than sign is determined from the position of the mid-point. 2156 | ! Planes parallel to z (i.e. with zero z coefficient) must be treated differently - 2157 | ! for these, count how many there are and find their order. They will be added to the splot 2158 | ! command differently so that their midpoint only will be plotted 2159 | ! 2160 | z_zero = 0 2161 | cnt_z = 0 2162 | do i=1,nrel 2163 | func1 = func1 + 1 2164 | func2 = func2 + 1 2165 | lngstr = "" 2166 | ! 2167 | ! Skip planes parallel to z, but count them and store their order 2168 | ! 2169 | if(eqns(rel_array(i),3) == 0.d0) then 2170 | z_zero = z_zero+1 2171 | cnt_z(z_zero) = i 2172 | cycle 2173 | endif 2174 | ! 2175 | ! First write the equation of the surface for the compound 2176 | ! 2177 | write(16,'(a1,i4,a7,f9.4,a3,f9.4,a6,f9.4,a4)') "f", func1, "(x,y)=(", & 2178 | &eqns(rel_array(i),nspecies_dep+1)/eqns(rel_array(i),3), " + ", & 2179 | &-eqns(rel_array(i),1)/eqns(rel_array(i),3), "* x + ", & 2180 | &-eqns(rel_array(i),2)/eqns(rel_array(i),3), "* y)" 2181 | ! 2182 | ! Now create string to write the conditional expressions 2183 | ! 2184 | write(lngstr,'(a1,i3,a7)') "f", func2, "(x,y)=(" 2185 | ! 2186 | ! Write the first condition separately to the rest as it has a slightly different format 2187 | ! 2188 | k = 0 2189 | do 2190 | k = k+1 2191 | if(k /= i) then 2192 | if(eqns(rel_array(k),3) == 0.d0) then 2193 | sum1 = 0.d0 2194 | sum2 = 0.d0 2195 | do j=1,2 2196 | sum1 = sum1 + eqns(rel_array(k),j) * avgpos(i,j) 2197 | enddo 2198 | sum2 = eqns(rel_array(k),nspecies_dep+1) 2199 | if(sum1 <= sum2) then 2200 | str4 = "*y<=" 2201 | else 2202 | str4 = "*y>=" 2203 | endif 2204 | write(string,'(f9.4,a5,f9.4,a4,f9.4)') eqns(rel_array(k),1),& 2205 | &"*x + ", eqns(rel_array(k),2), str4, sum2 2206 | lngstr = trim(lngstr)//trim(string) 2207 | exit 2208 | else 2209 | sum1 = 0.d0 2210 | sum2 = 0.d0 2211 | do j=1,2 2212 | sum1 = sum1 + ((eqns(rel_array(k),j)/eqns(rel_array(k)& 2213 | &,3))-(eqns(rel_array(i),j)/eqns(rel_array(i),3))) * avgpos(i,j) 2214 | enddo 2215 | sum2 = (eqns(rel_array(k),nspecies_dep+1)/eqns(rel_array(k),3))-(eqns(& 2216 | &rel_array(i),nspecies_dep+1)/eqns(rel_array(i),3)) 2217 | if(sum1 <= sum2) then 2218 | str4 = "*y<=" 2219 | else 2220 | str4 = "*y>=" 2221 | endif 2222 | write(string,'(f9.4,a5,f9.4,a4,f9.4)') (eqns(rel_array(k),1)/eqns(rel_array(k)& 2223 | &,3))-(eqns(rel_array(i),1)/eqns(rel_array(i),3)), "*x + ", (eqns(rel_array& 2224 | &(k),2)/eqns(rel_array(k),3))-(eqns(rel_array(i),2)/eqns(rel_array(i),3)),& 2225 | &str4, sum2 2226 | lngstr = trim(lngstr)//trim(string) 2227 | exit 2228 | endif 2229 | endif 2230 | ! 2231 | ! If this conditional loop goes wrong, give an escape and report an error 2232 | ! 2233 | if(k > nrel) then 2234 | write(*,'(a)') "ERROR: problem writing 3D gnuplot plotting file" 2235 | close(unit=16) 2236 | goto 200 2237 | endif 2238 | enddo 2239 | ! 2240 | ! Now write the rest of the conditional expressions to the string, with "&&" in front of each one 2241 | ! 2242 | if(k < nrel) then 2243 | do j=k+1,nrel 2244 | if(j == i) cycle 2245 | if(eqns(rel_array(j),3) == 0.d0) then 2246 | sum1 = 0.d0 2247 | sum2 = 0.d0 2248 | do l=1,2 2249 | sum1 = sum1 + eqns(rel_array(j),l) * avgpos(i,l) 2250 | enddo 2251 | sum2 = eqns(rel_array(j),nspecies_dep+1) 2252 | if(sum1 <= sum2) then 2253 | str4 = "*y<=" 2254 | else 2255 | str4 = "*y>=" 2256 | endif 2257 | write(string,'(a2,f9.4,a5,f9.4,a4,f9.4)') "&&", eqns(rel_array(j),1),& 2258 | &"*x + ", eqns(rel_array(j),2), str4, sum2 2259 | lngstr = trim(lngstr)//trim(string) 2260 | else 2261 | sum1 = 0.d0 2262 | sum2 = 0.d0 2263 | do l=1,2 2264 | sum1 = sum1 + ((eqns(rel_array(j),l)/eqns(rel_array(j)& 2265 | &,3))-(eqns(rel_array(i),l)/eqns(rel_array(i),3))) * avgpos(i,l) 2266 | enddo 2267 | sum2 = (eqns(rel_array(j),nspecies_dep+1)/eqns(rel_array(j),3))-(eqns(& 2268 | &rel_array(i),nspecies_dep+1)/eqns(rel_array(i),3)) 2269 | if(sum1 <= sum2) then 2270 | str4 = "*y<=" 2271 | else 2272 | str4 = "*y>=" 2273 | endif 2274 | write(string,'(a2,f9.4,a5,f9.4,a4,f9.4)') "&&", (eqns(rel_array(j),1)/eqns(rel_array& 2275 | &(j),3))-(eqns(rel_array(i),1)/eqns(rel_array(i),3)), "*x + ", (eqns(rel_array& 2276 | &(j),2)/eqns(rel_array(j),3))-(eqns(rel_array(i),2)/eqns(rel_array(i),3)), & 2277 | &str4, sum2 2278 | lngstr = trim(lngstr)//trim(string) 2279 | endif 2280 | enddo 2281 | endif 2282 | ! 2283 | ! Complete the string and write it to file 2284 | ! 2285 | write(string,'(a3,i4,a9)') ")?f", func1, "(x,y):1/0" 2286 | lngstr = trim(lngstr)//trim(string) 2287 | write(16,'(a)') trim(lngstr) 2288 | enddo 2289 | ! 2290 | ! More settings for the plot 2291 | ! 2292 | write(16,*) 2293 | write(16,'(a)') "set isosample 300, 300" 2294 | write(16,'(a)') "set hidden3d offset 0" 2295 | write(16,'(a)') "set key outside left center" 2296 | write(16,'(a12,f9.4,a3)') "set xrange [", eqns(1,nspecies_dep + 1), ":0]" 2297 | write(16,'(a12,f9.4,a3)') "set yrange [", eqns(1,nspecies_dep + 1), ":0]" 2298 | write(16,'(a12,f9.4,a3)') "set zrange [", eqns(1,nspecies_dep + 1), ":0]" 2299 | write(16,'(a12,a2,a1)') "set xlabel '", name(1), "'" 2300 | write(16,'(a12,a2,a1)') "set ylabel '", name(2), "'" 2301 | write(16,'(a12,a2,a1)') "set zlabel '", name(3), "'" 2302 | write(16,*) 2303 | ! 2304 | ! Set arrows to mark the limits imposed by the system 2305 | ! 2306 | write(16,'(a26,f9.4,a6,f9.4,a12)') "set arrow nohead from 0,0,", eqns(1,nspecies_dep+1)& 2307 | &/eqns(1,3), " to 0,", eqns(1,nspecies_dep+1)/eqns(1,2), ",0 lt 3 lw 2" 2308 | write(16,'(a26,f9.4,a4,f9.4,a14)') "set arrow nohead from 0,0,", eqns(1,nspecies_dep+1)& 2309 | &/eqns(1,3), " to ", eqns(1,nspecies_dep+1)/eqns(1,1), ",0,0 lt 3 lw 2" 2310 | write(16,'(a24,f9.4,a6,f9.4,a14)') "set arrow nohead from 0,", eqns(1,nspecies_dep+1)/& 2311 | &eqns(1,2), ",0 to ", eqns(1,nspecies_dep+1)/eqns(1,1), ",0,0 lt 3 lw 2" 2312 | write(16,*) 2313 | ! 2314 | ! Now write splot command, making sure formatting is correct. Write it as a string first, as this 2315 | ! allows each case to be looped over more easily. For cases with zero z coefficient, 2316 | ! a point will be plotted instead of a surface 2317 | ! 2318 | 2319 | lngstr = "" 2320 | write(lngstr,'(a19,a,a2)') "splot f101(x,y) t '", trim(compounds(rel_array(1))), "' " 2321 | do i=2,nrel 2322 | if(z_zero /= 0) then 2323 | check2 = lfalse 2324 | do j=1,z_zero 2325 | if(i == cnt_z(j)) check2 = ltrue 2326 | enddo 2327 | if(check2) cycle 2328 | endif 2329 | write(string,'(a3,i3,a9,a,a1)') ", f", 100+i, "(x,y) t '", trim(compounds(rel_array(i))), "'" 2330 | lngstr = trim(lngstr)//trim(string) 2331 | enddo 2332 | if(z_zero /= 0) then 2333 | do i=1,z_zero 2334 | write(string,'(a13,a,a1)') ", '-' w p t '", trim(compounds(rel_array(cnt_z(i)))), "'" 2335 | lngstr = trim(lngstr)//trim(string) 2336 | enddo 2337 | endif 2338 | ! 2339 | ! Write splot string to file 2340 | ! 2341 | write(16,'(a)') trim(lngstr) 2342 | ! 2343 | ! If there any planes parallel to z, write their midpoints to be plotted 2344 | ! 2345 | if(z_zero /= 0) then 2346 | do i=1,z_zero 2347 | write(16,'(3(f9.4,1x))') (avgpos(cnt_z(i),j),j=1,3) 2348 | write(16,'(a1)') "e" 2349 | enddo 2350 | endif 2351 | ! 2352 | ! Finish 2353 | ! 2354 | close(unit=16) 2355 | write(*,*) 2356 | write(*,'(a)') "...done -> 3Dplot.plt can be loaded in gnuplot" 2357 | write(*,'(a)') " -> 3Dplot.dat can be pasted into Mathematica" 2358 | ! 2359 | ! If system is 2D prepare plotting files 2360 | ! 2361 | elseif(nspecies_dep == 2) then 2362 | open(unit=17,status='replace',file="2Dplot.dat") 2363 | write(*,*) 2364 | write(*,'(a)') "Chemical potential space is 2D. Writing files for plotting..." 2365 | write(17,'(a18,f7.3,a2,a1,f7.3,a2,a1,f7.3,a2)') "plot1:=RegionPlot[", & 2366 | &eqns(1,1), name(1), "+", eqns(1,2), name(2), ">", eqns(1,nspecies_dep + 1),& 2367 | "&&" 2368 | do i=2,nlimits 2369 | write(17,'(18x,f7.3,a2,a1,f7.3,a2,a1,f7.3,a2)') eqns(i,1), name(1), "+", & 2370 | &eqns(i,2), name(2), "<", eqns(i,nspecies_dep + 1),"&&" 2371 | enddo 2372 | write(17,'(18x,f7.3,a2,a1,f7.3,a2,a1,f7.3,a1)') eqns(nlimits+1,1), name(1), & 2373 | &"+", eqns(nlimits+1,2), name(2), "<", eqns(nlimits+1,nspecies_dep + 1),"," 2374 | write(17,'(18x,2(a1,a2,a1,f7.3,a4))') ("{", name(i), ",", energy/dble(num(i)), ",0},"& 2375 | &,i=1,2) 2376 | write(17,'(18x,a32,a11)') "PlotRange->Full,PlotPoints->100," 2377 | write(17,'(18x,a12,a2,a1,a2,a2)') "AxesLabel->{", name(1),",", name(2), "}]" 2378 | write(17,'(a14,f7.3,a1,f7.3,a2,a2)') "plot2:=Plot[{{", eqns(1,nspecies_dep + 1)/eqns(1,2), "-", & 2379 | &eqns(1,1)/eqns(1,2), name(1), "}," 2380 | do i=1,nlimits-1 2381 | write(17,'(14x,a2,f7.3,a1,f7.3,a2,a2)') "{", eqns(i+1,nspecies_dep + 1)/eqns(i+1,2), & 2382 | &"-", eqns(i+1,1)/eqns(i+1,2), name(1), "}," 2383 | enddo 2384 | write(17,'(14x,a2,f7.3,a1,f7.3,a2,a3)') "{", eqns(nlimits+1,nspecies_dep + 1)/eqns(nlimits+1& 2385 | &,2), "-", eqns(nlimits+1,1)/eqns(nlimits+1,2), name(1), "}}," 2386 | write(17,'(14x,a1,a2,a1,f7.3,a4)') "{", name(1), ",", eqns(1,nspecies_dep + 1)/eqns(1,1), & 2387 | &",0}]" 2388 | write(17,'(a17)') "Show[plot1,plot2]" 2389 | close(unit=17) 2390 | ! 2391 | ! Now write gnuplot file 2392 | ! 2393 | open(unit=17,status='replace',file="2Dplot.plt") 2394 | write(17,'(a)') "set multiplot" 2395 | write(17,*) 2396 | write(17,'(a)') "set lmargin at screen 0.225" 2397 | write(17,'(a)') "set rmargin at screen 0.775" 2398 | write(17,'(a)') "set tmargin at screen 0.875" 2399 | write(17,'(a)') "set bmargin at screen 0.125" 2400 | write(17,*) 2401 | write(17,'(a)') "unset xtics" 2402 | write(17,'(a)') "unset ytics" 2403 | write(17,'(a)') "set border" 2404 | ! 2405 | ! Put in functions for inequalities 2406 | ! 2407 | write(17,'(a11,f9.4,1x,a3,a3,f9.4,1x,a5,f9.4,a13)') "f1(x,y) = (", eqns(1,1),& 2408 | &"* x", " + ", eqns(1,2), "* y >", eqns(1,nspecies_dep + 1), ")?f2(x,y):1/0" 2409 | i=1 2410 | if(nlimits > 0) then 2411 | do i=2,nlimits+1 2412 | if(i < 10 .and. i+1 < 10) then 2413 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a5,f9.4,a3,i1,a9)') "f", i, "(x,y) = & 2414 | &(", eqns(i,1), "* x", " + ", eqns(i,2), "* y <", eqns(i,nspecies_dep & 2415 | &+ 1), ")?f", i+1, "(x,y):1/0" 2416 | elseif(i < 10 .and. i+1 == 10) then 2417 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a5,f9.4,a3,i2,a9)') "f", i, "(x,y) = & 2418 | &(", eqns(i,1), "* x", "+", eqns(i,2), "* y <", eqns(i,nspecies_dep & 2419 | &+ 1), ")?f", i+1, "(x,y):1/0" 2420 | else 2421 | write(17,'(a1,i2,a9,f9.4,a3,a3,f9.4,a5,f9.4,a3,i2,a9)') "f", i, "(x,y) = & 2422 | &(", eqns(i,1), "* x", "+", eqns(i,2), "* y <", eqns(i,nspecies_dep & 2423 | &+ 1), ")?f", i+1, "(x,y):1/0" 2424 | endif 2425 | enddo 2426 | endif 2427 | i = i-1 2428 | if(i+1 < 10 .and. i+2 < 10) then 2429 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i1,a9)') "f", i+1, "(x,y) = (", eqns(i+1,1)& 2430 | &, "* x", " < ", eqns(i+1,nspecies_dep + 1), ")?f", i+2, "(x,y):1/0" 2431 | elseif(i+1 < 10 .and. i+2 == 10) then 2432 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+1, "(x,y) = (", eqns(i+1,1)& 2433 | &, "* x", " < ", eqns(i+1,nspecies_dep + 1), ")?f", i+2, "(x,y):1/0" 2434 | else 2435 | write(17,'(a1,i2,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+1, "(x,y) = (", eqns(i+1,1)& 2436 | &, "* x", " < ", eqns(i+1,nspecies_dep + 1), ")?f", i+2, "(x,y):1/0" 2437 | endif 2438 | if(i+2 < 10 .and. i+3 < 10) then 2439 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i1,a9)') "f", i+2, "(x,y) = (", eqns(i+2,2)& 2440 | &, "* y", " < ", eqns(i+2,nspecies_dep + 1), ")?f", i+3, "(x,y):1/0" 2441 | elseif(i+2 < 10 .and. i+3 == 10) then 2442 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+2, "(x,y) = (", eqns(i+2,2)& 2443 | &, "* y", " < ", eqns(i+2,nspecies_dep + 1), ")?f", i+3, "(x,y):1/0" 2444 | else 2445 | write(17,'(a1,i2,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+2, "(x,y) = (", eqns(i+2,2)& 2446 | &, "* y", " < ", eqns(i+2,nspecies_dep + 1), ")?f", i+3, "(x,y):1/0" 2447 | endif 2448 | if(i+3 < 10 .and. i+4 < 10) then 2449 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i1,a9)') "f", i+3, "(x,y) = (", eqns(i+3,1)& 2450 | &, "* x", " > ", eqns(i+3,nspecies_dep + 1), ")?f", i+4, "(x,y):1/0" 2451 | elseif(i+3 < 10 .and. i+4 == 10) then 2452 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+3, "(x,y) = (", eqns(i+3,1)& 2453 | &, "* x", " > ", eqns(i+3,nspecies_dep + 1), ")?f", i+4, "(x,y):1/0" 2454 | else 2455 | write(17,'(a1,i2,a9,f9.4,a3,a3,f9.4,a3,i2,a9)') "f", i+3, "(x,y) = (", eqns(i+3,1)& 2456 | &, "* x", " > ", eqns(i+3,nspecies_dep + 1), ")?f", i+4, "(x,y):1/0" 2457 | endif 2458 | if(i+4 < 10) then 2459 | write(17,'(a1,i1,a9,f9.4,a3,a3,f9.4,a7)') "f", i+4, "(x,y) = (", eqns(i+4,2), "* y"& 2460 | &, " > ", eqns(i+4,nspecies_dep + 1), ")?1:1/0" 2461 | else 2462 | write(17,'(a1,i2,a9,f9.4,a3,a3,f9.4,a7)') "f", i+4, "(x,y) = (", eqns(i+4,2), "* y"& 2463 | &, " > ", eqns(i+4,nspecies_dep + 1), ")?1:1/0" 2464 | endif 2465 | write(17,'(a)') "unset colorbox" 2466 | write(17,'(a)') "set isosample 300, 300" 2467 | write(17,'(a)') "set palette gray" 2468 | write(17,'(a)') "unset xlabel" 2469 | write(17,'(a)') "unset ylabel" 2470 | write(17,'(a)') "set sample 500" 2471 | write(17,'(a)') "set pm3d map" 2472 | write(17,'(a7,f9.4,a5,f9.4,a19)') "splot [", eqns(1,nspecies_dep + 1), ":0] [", eqns(1,& 2473 | &nspecies_dep + 1), ":0] f1(x,y) notitle" 2474 | write(17,'(a)') "unset pm3d" 2475 | write(17,'(a)') "set border 12" 2476 | write(17,'(a)') "set key r c" 2477 | write(17,'(a)') "set style fill transparent" 2478 | write(17,'(a)') "set x2tics nomirror" 2479 | write(17,'(a)') "set y2tics nomirror" 2480 | write(17,'(a12,f9.4,a3)') "set xrange [", eqns(1,nspecies_dep + 1), ":0]" 2481 | write(17,'(a12,f9.4,a3)') "set yrange [", eqns(1,nspecies_dep + 1), ":0]" 2482 | write(17,'(a13,a2,a1)') "set x2label '", name(1), "'" 2483 | write(17,'(a13,a2,a1)') "set y2label '", name(2), "'" 2484 | ! 2485 | ! Now write plot string - some competing phases may be left out if they have no definition 2486 | ! in the 2D space. This can be the case when a large number of original elements is reduced 2487 | ! by setting some chemical potentials to particular values. Effectively the coefficient can 2488 | ! become zero, and as some lines are defined by dividing by this coefficient, they must be 2489 | ! excluded 2490 | ! 2491 | lngstr = "" 2492 | ! 2493 | ! First write compound of interest formula 2494 | ! 2495 | write(lngstr,'(a4,f9.4,a3,f9.4,a8,a,a6)') "plot", eqns(1,nspecies_dep+1)/eqns(1,2), & 2496 | &" - ", eqns(1,1)/eqns(1,2), " * x t '", trim(compounds(1)), "' lw 2" 2497 | ! 2498 | ! Now go through the competing phases and write for each one, skipping those that are undefined 2499 | ! 2500 | if(nlimits > 0) then 2501 | do i=2,nlimits+1 2502 | if(eqns(i,2) /= 0.d0) then 2503 | write(string,'(a1,f9.4,a3,f9.4,a8,a,a6)') ",", eqns(i,nspecies_dep+1)/eqns(i,2), & 2504 | &" - ", eqns(i,1)/eqns(i,2), " * x t '", trim(compounds(i)), "' lw 2" 2505 | lngstr = trim(lngstr)//trim(string) 2506 | endif 2507 | enddo 2508 | endif 2509 | ! 2510 | ! Write plot string to file 2511 | ! 2512 | write(17,'(a)') trim(lngstr) 2513 | ! 2514 | ! Finish 2515 | ! 2516 | write(17,*) 2517 | write(17,'(a)') "unset multiplot" 2518 | close(unit=17) 2519 | write(*,*) 2520 | write(*,'(a)') "...done -> 2Dplot.plt can be loaded in gnuplot" 2521 | write(*,'(a)') " -> 2Dplot.dat can be pasted into Mathematica" 2522 | ! 2523 | ! Now write data to plot individual lines associated with the compounds to a .txt file, giving 2524 | ! each compound separately, with two points defining the line. If a compound's line is parallel 2525 | ! to the x or y axis, the line is defined according to the endpoints on the axes for the 2526 | ! compound of interest 2527 | ! 2528 | open(unit=17,status='replace',file="2Dplot.txt") 2529 | write(17,'(a)') "#"//trim(compounds(1)) 2530 | write(17,'(2(f9.4,2x))') 0.d0, eqns(1,nspecies_dep+1)/eqns(1,2) 2531 | write(17,'(2(f9.4,2x))') eqns(1,nspecies_dep+1)/eqns(1,1), 0.d0 2532 | do i=2,nlimits+1 2533 | write(17,*) 2534 | write(17,'(a)') "#"//trim(compounds(i)) 2535 | if(eqns(i,1) == 0.d0) then 2536 | write(17,'(2(f9.4,2x))') 0.d0, eqns(i,nspecies_dep+1)/eqns(i,2) 2537 | write(17,'(2(f9.4,2x))') eqns(1,nspecies_dep+1)/eqns(1,1), & 2538 | &eqns(i,nspecies_dep+1)/eqns(i,2) 2539 | elseif(eqns(i,2) == 0.d0) then 2540 | write(17,'(2(f9.4,2x))') eqns(i,nspecies_dep+1)/eqns(i,1), & 2541 | &eqns(1,nspecies_dep+1)/eqns(1,2) 2542 | write(17,'(2(f9.4,2x))') eqns(i,nspecies_dep+1)/eqns(i,1), 0.d0 2543 | else 2544 | if(eqns(i,nspecies_dep+1)/eqns(i,2) > 0.d0) then 2545 | write(17,'(2(f9.4,2x))') eqns(1,nspecies_dep+1)/eqns(1,1), & 2546 | &eqns(i,nspecies_dep+1)/eqns(i,2) + -eqns(1,nspecies_dep+1)/eqns(1,1)& 2547 | &* eqns(i,1)/eqns(i,2) 2548 | else 2549 | write(17,'(2(f9.4,2x))') 0.d0, eqns(i,nspecies_dep+1)/eqns(i,2) 2550 | endif 2551 | if(eqns(i,nspecies_dep+1)/eqns(i,1) > 0.d0) then 2552 | write(17,'(2(f9.4,2x))') (-eqns(1,nspecies_dep+1)/eqns(1,2) + & 2553 | &eqns(i,nspecies_dep+1)/eqns(i,2)) * eqns(i,2)/eqns(i,1), & 2554 | &eqns(1,nspecies_dep+1)/eqns(1,2) 2555 | else 2556 | write(17,'(2(f9.4,2x))') eqns(i,nspecies_dep+1)/eqns(i,1), 0.d0 2557 | endif 2558 | endif 2559 | enddo 2560 | ! 2561 | ! Finish 2562 | ! 2563 | close(unit=17) 2564 | write(*,*) 2565 | write(*,'(a)') "...done -> 2Dplot.plt can be loaded in gnuplot" 2566 | write(*,'(a)') " -> 2Dplot.dat can be pasted into Mathematica" 2567 | write(*,'(a)') " -> 2Dplot.txt contains points to plot lines" 2568 | ! 2569 | else 2570 | continue 2571 | endif 2572 | ! 2573 | ! Tell user how to do a restart and fix one of the chemical potentials 2574 | ! 2575 | if(nspecies >= 3) then 2576 | write(*,*) 2577 | write(*,'(a)') "Copy 'results.dat' to 'restart.dat' in order to run the" 2578 | write(*,'(a)') "calculation again with a different dependent variable, with" 2579 | write(*,'(a)') "additional competing phases, or with one of the chemical" 2580 | write(*,'(a)') "potentials set at a fixed value." 2581 | write(*,*) 2582 | else 2583 | write(*,*) 2584 | write(*,'(a)') "Copy 'results.dat' to 'restart.dat' in order to run the" 2585 | write(*,'(a)') "calculation again with a different dependent variable, or" 2586 | write(*,'(a)') "with additional competing phases." 2587 | write(*,*) 2588 | endif 2589 | ! 2590 | 200 continue 2591 | ! 2592 | close(unit=11) 2593 | close(unit=12) 2594 | ! 2595 | end program cplap 2596 | ! 2597 | ! 2598 | ! 2599 | ! 2600 | subroutine all_eqns_solve(eqns,dim1,dim2,results,numres) 2601 | ! 2602 | ! This subroutine reads in an array 'eqns' containing a number dim1 2603 | ! of linear equations, with dim2-1 unknowns in each equation. The 2604 | ! routine forms all possible combinations of the linear equations 2605 | ! and solves each system (if a solution exists), using LU decomposition 2606 | ! and back substitution (using modified versions of the numerical 2607 | ! recipes routines ludcmp and lubksb (Numerical Recipes in Fortran 77. 2608 | ! The Art of Scientific Computing, 2nd Edition, 1992 W. H. Press et al.) 2609 | ! The solutions are returned in the array 'results' 2610 | ! 2611 | ! J. Buckeridge October 2011 2612 | ! 2613 | implicit none 2614 | ! 2615 | integer, parameter :: nmax = 300 2616 | real*8, parameter :: small = 1.d-12 2617 | ! 2618 | integer i, j, dim1, dim2, num, indx(nmax), ival(nmax) 2619 | integer, intent(inout) :: numres 2620 | ! real*8, intent(inout) :: eqns(:,:) 2621 | ! real*8, intent(inout) :: results(:,:) 2622 | real*8 eqns(dim1,dim2), results(nmax*nmax,dim2) 2623 | real*8 system(size(eqns,2),size(eqns,2)), vector(size(eqns,2)), d 2624 | logical check1 2625 | ! 2626 | ! Set num equal to the dimensions of the linear system to be solved (i.e. 2627 | ! equal to dim2 - 1) 2628 | ! 2629 | num = dim2 - 1 2630 | ! 2631 | ! Initialize numres as zero 2632 | ! 2633 | numres = 0 2634 | ! 2635 | ! There will be dim1 C num systems to be solved (if solutions for each 2636 | ! particular system exist). Go through each system and attempt to solve. 2637 | ! This is done using an array of length num, each entry of which is 2638 | ! increased in the correct order so that all combinations of length num 2639 | ! from the array of length dim1 are taken 2640 | ! 2641 | do i=1,num 2642 | ival(i) = i 2643 | enddo 2644 | 100 continue 2645 | ! 2646 | ! Set the num x num array to be solved, and the vector in which the 2647 | ! solutions are returned from the numerical recipes routines. Re-zero 2648 | ! both first 2649 | ! 2650 | system = 0.d0 2651 | vector = 0.d0 2652 | do i=1,num 2653 | do j=1,num 2654 | system(i,j) = eqns(ival(i),j) 2655 | enddo 2656 | vector(i) = eqns(ival(i),dim2) 2657 | enddo 2658 | ! 2659 | ! Call numerical recipes routine to get LU decomposition. If this fails 2660 | ! then there is no solution for this system of equations 2661 | ! 2662 | check1 = .true. 2663 | call ludcmp(system(1:num,1:num),indx(1:num),d,num,check1) 2664 | if(check1) then 2665 | call lubksb(system(1:num,1:num),indx(1:num),vector(1:num),num) 2666 | if(any(vector >= (1.d0/small))) then 2667 | goto 102 2668 | else 2669 | numres = numres + 1 2670 | results(numres,1:num) = vector(1:num) 2671 | endif 2672 | endif 2673 | 102 continue 2674 | ! 2675 | i = 0 2676 | do 2677 | ival(num-i) = ival(num-i)+1 2678 | if(ival(num-i) <= dim1-i) then 2679 | goto 100 2680 | else 2681 | i = i+1 2682 | if(i >= num) goto 101 2683 | do j=1,i 2684 | if(j == 1) then 2685 | ival(num-i+j) = ival(num-i+j-1)+2 2686 | else 2687 | ival(num-i+j) = ival(num-i+j-1)+1 2688 | endif 2689 | enddo 2690 | endif 2691 | enddo 2692 | 101 continue 2693 | ! 2694 | end subroutine all_eqns_solve 2695 | ! 2696 | ! 2697 | ! 2698 | ! 2699 | SUBROUTINE ludcmp(a,indx,d,nn,check) 2700 | ! 2701 | ! HACK: replace all references to modules with own code. This includes replacing 2702 | ! function calls with code blocks for the actual function. Done to avoid SP/DP etc 2703 | ! confusion 2704 | ! HACK: change precision of variables to maximum 2705 | ! HACK: input nn to declare array sizes 2706 | ! HACK: change declarations to F77 style 2707 | ! 2708 | ! 2709 | ! HACK (oct 2011) : Added check, to check if matrix is singular (if so no solution 2710 | ! will be found) 2711 | ! 2712 | ! 2713 | !USE nrtype; USE nrutil, ONLY : assert_eq,imaxloc,nrerror,outerprod,swap 2714 | IMPLICIT NONE 2715 | integer nn, indx(nn), j, n, imax 2716 | real*8 a(nn,nn), d, vv(nn) 2717 | logical, intent(inout) :: check 2718 | !REAL*8, DIMENSION(:,:), INTENT(INOUT) :: a 2719 | !REAL(SP), DIMENSION(:,:), INTENT(INOUT) :: a 2720 | !integer indx(2*nn) 2721 | !INTEGER, DIMENSION(:), INTENT(OUT) :: indx 2722 | !INTEGER(I4B), DIMENSION(:), INTENT(OUT) :: indx 2723 | !REAL*8, INTENT(OUT) :: d 2724 | !REAL(SP), INTENT(OUT) :: d 2725 | !Given an N × N input matrix a, this routine replaces it by the LU decomposition of a 2726 | !rowwise permutation of itself. On output, a is arranged as in equation (2.3.14); indx is an 2727 | !output vector of length N that records the row permutation effected by the partial pivoting; 2728 | !d is output as ±1 depending on whether the number of row interchanges was even or odd, 2729 | !respectively. This routine is used in combination with lubksb to solve linear equations or 2730 | !invert a matrix. 2731 | !real*8 vv(2*nn) 2732 | !REAL*8, DIMENSION(size(a,1)) :: vv 2733 | !REAL(SP), DIMENSION(size(a,1)) :: vv 2734 | !vv stores the implicit scaling of each row. 2735 | REAL*8, PARAMETER :: TINY=1.0d-20 2736 | !REAL(SP), PARAMETER :: TINY=1.0e-20_sp 2737 | !A small number. 2738 | !INTEGER :: j,n,imax 2739 | !INTEGER(I4B) :: j,n,imax 2740 | ! 2741 | ! HACK: dummy array for imaxloc function 2742 | ! 2743 | integer, dimension(1) :: imaxloc_r 2744 | ! 2745 | ! HACK: dummy array for swap function 2746 | ! 2747 | real*8, dimension(size(a,1)) :: dum 2748 | ! 2749 | ! HACK: dummy array for outerprod function 2750 | ! 2751 | REAL*8, DIMENSION(size(a),size(a)) :: outerprod_r 2752 | ! 2753 | ! HACK: replace assert_eq with code block 2754 | ! 2755 | !n=assert_eq(size(a,1),size(a,2),size(indx),'ludcmp') 2756 | if (size(a,1) == size(a,2) .and. size(a,2) == size(indx)) then 2757 | n=size(a,1) 2758 | else 2759 | write (*,*) 'nrerror: an assert_eq failed with this tag: ludcmp' 2760 | STOP 'program terminated by assert_eq3' 2761 | end if 2762 | d=1.d0 2763 | !d=1.0 2764 | !No row interchanges yet. 2765 | vv=maxval(abs(a),dim=2) 2766 | !Loop over rows to get the implicit scaling 2767 | ! 2768 | ! HACK: replace call to nrerror 2769 | ! 2770 | ! 2771 | ! ****HACK (oct 2011) : if matrix is singular return check=true 2772 | ! (also change test to vv <= TINY) 2773 | ! 2774 | ! if (any(vv == 0.0)) then 2775 | if (any(vv <= TINY)) then 2776 | check = .false. 2777 | return 2778 | endif 2779 | !write(*,*) "nrerror: singular matrix in ludcmp" 2780 | !if (any(vv == 0.0)) call nrerror('singular matrix in ludcmp') 2781 | !information. 2782 | !There is a row of zeros. 2783 | ! 2784 | ! HACK: change to double precision 2785 | ! 2786 | vv=1.d0/vv 2787 | !vv=1.0_sp/vv 2788 | !Save the scaling. 2789 | do j=1,n 2790 | ! 2791 | ! HACK: replace imacloc with code block 2792 | ! 2793 | imaxloc_r = maxloc(vv(j:n)*abs(a(j:n,j))) 2794 | imax=(j-1)+imaxloc_r(1) 2795 | !imax=(j-1)+imaxloc(vv(j:n)*abs(a(j:n,j))) 2796 | !Find the pivot row. 2797 | if (j /= imax) then 2798 | !Do we need to interchange rows? 2799 | !Yes, do so... 2800 | ! 2801 | ! HACK: replace swap with code block 2802 | ! 2803 | dum=a(imax,:) 2804 | a(imax,:)=a(j,:) 2805 | a(j,:)=dum 2806 | d=-d 2807 | !call swap(a(imax,:),a(j,:)) 2808 | !...and change the parity of d. 2809 | vv(imax)=vv(j) 2810 | !Also interchange the scale factor. 2811 | end if 2812 | indx(j)=imax 2813 | if (a(j,j) == 0.0) a(j,j)=TINY 2814 | !If the pivot element is zero the matrix is singular (at least to the precision of the al- 2815 | !gorithm). For some applications on singular matrices, it is desirable to substitute TINY 2816 | !for zero. 2817 | a(j+1:n,j)=a(j+1:n,j)/a(j,j) 2818 | !Divide by the pivot element. 2819 | ! 2820 | ! HACK: replace outerprod with code block 2821 | ! 2822 | outerprod_r = 0.d0 2823 | outerprod_r(1:size(a(j+1:n,j)),1:size(a(j,j+1:n))) = spread(a(j+1:n,j),& 2824 | &dim=2,ncopies=size(a(j,j+1:n))) * spread(a(j,j+1:n),dim=1,ncopies=size(a(j+1:n,j))) 2825 | a(j+1:n,j+1:n)=a(j+1:n,j+1:n)-outerprod_r(1:size(a(j+1:n,j)),1:size(a(j,j+1:n))) 2826 | !a(j+1:n,j+1:n)=a(j+1:n,j+1:n)-outerprod(a(j+1:n,j),a(j,j+1:n)) 2827 | !Reduce remaining submatrix. 2828 | end do 2829 | END SUBROUTINE ludcmp 2830 | ! 2831 | ! 2832 | ! 2833 | ! 2834 | SUBROUTINE lubksb(a,indx,b,nn) 2835 | ! 2836 | ! HACK: replace all references to modules with own code. This includes replacing 2837 | ! function calls with code blocks for the actual function. Done to avoid SP/DP etc 2838 | ! confusion 2839 | ! HACK: change precision of variables to maximum 2840 | ! HACK: input nn to declare array sizes 2841 | ! HACK: change declarations to F77 style 2842 | ! 2843 | !USE nrtype; USE nrutil, ONLY : assert_eq 2844 | IMPLICIT NONE 2845 | integer nn, indx(nn), i, n, ii, ll 2846 | real*8 a(nn,nn), b(nn), summ 2847 | !REAL*8, DIMENSION(:,:), INTENT(IN) :: a 2848 | !REAL(SP), DIMENSION(:,:), INTENT(IN) :: a 2849 | !integer indx(2*nn) 2850 | !INTEGER, DIMENSION(:), INTENT(IN) :: indx 2851 | !INTEGER(I4B), DIMENSION(:), INTENT(IN) :: indx 2852 | !REAL, DIMENSION(:), INTENT(INOUT) :: b 2853 | !REAL(SP), DIMENSION(:), INTENT(INOUT) :: b 2854 | !Solves the set of N linear equations A · X = B. Here the N × N matrix a is input, not 2855 | !as the original matrix A, but rather as its LU decomposition, determined by the routine 2856 | !ludcmp. indx is input as the permutation vector of length N returned by ludcmp. b is 2857 | !input as the right-hand-side vector B, also of length N , and returns with the solution vector 2858 | !X. a and indx are not modified by this routine and can be left in place for successive calls 2859 | !with different right-hand sides b. This routine takes into account the possibility that b will 2860 | !begin with many zero elements, so it is efficient for use in matrix inversion. 2861 | !INTEGER :: i,n,ii,ll 2862 | !INTEGER(I4B) :: i,n,ii,ll 2863 | !REAL*8 :: summ 2864 | !REAL(SP) :: summ 2865 | ! 2866 | ! HACK: replace assert_eq with code block 2867 | ! 2868 | !n=assert_eq(size(a,1),size(a,2),size(indx),'lubksb') 2869 | if (size(a,1) == size(a,2) .and. size(a,2) == size(indx)) then 2870 | n=size(a,1) 2871 | else 2872 | write (*,*) 'nrerror: an assert_eq failed with this tag: lubksb' 2873 | STOP 'program terminated by assert_eq3' 2874 | end if 2875 | ii=0 2876 | !When ii is set to a positive value, it will become the in- 2877 | !dex of the first nonvanishing element of b. We now do 2878 | do i=1,n 2879 | !the forward substitution, equation (2.3.6). The only new 2880 | ll=indx(i) 2881 | !wrinkle is to unscramble the permutation as we go. 2882 | summ=b(ll) 2883 | b(ll)=b(i) 2884 | if (ii /= 0) then 2885 | summ=summ-dot_product(a(i,ii:i-1),b(ii:i-1)) 2886 | else if (summ /= 0.0) then 2887 | ii=i 2888 | !A nonzero element was encountered, so from now on we will 2889 | end if 2890 | !have to do the dot product above. 2891 | b(i)=summ 2892 | end do 2893 | do i=n,1,-1 2894 | !Now we do the backsubstitution, equation (2.3.7). 2895 | b(i) = (b(i)-dot_product(a(i,i+1:n),b(i+1:n)))/a(i,i) 2896 | end do 2897 | END SUBROUTINE lubksb 2898 | ! 2899 | -------------------------------------------------------------------------------- /MANUAL.txt: -------------------------------------------------------------------------------- 1 | _____________________________________________________________ 2 | 3 | CCCC PPPPP LL AAAA PPPPP !! 4 | CC CC PP PP LL AA AA PP PP !! 5 | CC PP PP LL AA AA PP PP !! 6 | CC PPPPP LL AAAAAA PPPPP !! 7 | CC CC PP LL AA AA PP 8 | CCCC PP LLLLLL AA AA PP !! 9 | _____________________________________________________________ 10 | 11 | Chemical Potential Limits Analysis Program 12 | _____________________________________________________________ 13 | 14 | Version 1.1 2013 15 | John Buckeridge (j.buckeridge@ucl.ac.uk) 16 | _____________________________________________________________ 17 | 18 | CPLAP is a program designed to determine the thermodynamical 19 | stability of a material, and, if it is stable, to determine 20 | the ranges of the constituent elements' chemical potentials 21 | within which it is stable, in comparison with competing phases 22 | and the elemental forms. 23 | 24 | Before running CPLAP, the energies of the material and all its 25 | competing phases (search the chemical database extensively for 26 | this) must be calculated. Use the same level theory for every 27 | calculation, and use the same units when inputting to CPLAP. 28 | 29 | The chemical potentials are defined with respect to the 30 | energy of the species in their elemental form. So the zero of 31 | chemical potential for a species is the energy per atom of 32 | that species in its elemental form. 33 | 34 | ************************************************************** 35 | 36 | COMPILATION 37 | 38 | Just type 'make'. 39 | 40 | You can set your preferred fortran compiler by changing the 41 | 'FC' variable in the Makefile. 42 | 43 | ************************************************************** 44 | INPUT 45 | 46 | Input consists of the number of elements, their names and sto- 47 | ichiometry, and the energy of the compound of interest, and 48 | all the competing phases. Input can be read from an input file 49 | (called input.dat - there is an example file provided, copy 50 | SAMPLE_INPUT to input.dat to try it out) or can 51 | be entered interactively. The name of the element whose chemi- 52 | cal potential is to be set as the dependent variable must be 53 | inputted also. 54 | 55 | The format for entering a compound is - 56 | N 57 | n_a A n_b B n_c C ... E1 58 | 59 | where N is the total number of elements, n_a is the number of 60 | type A elements etc., and E1 is the energy. 61 | 62 | Beware - it is possible to not set a dependent variable. If 63 | this is the case, the code will still run. However, only the 64 | intersection points with the compound of interest itself are 65 | actual solutions. It is advisable to always set a dependent 66 | variable. 67 | 68 | ************************************************************** 69 | 70 | OUTPUT 71 | 72 | Output is found in the file results.dat. The limiting inequal- 73 | ities that apply to the system are given first. Then (if the 74 | system is stable) the intersection points (including the value 75 | of the dependent variable at each point) are given. These con- 76 | sist of the corner points of the stability region in the che- 77 | mical potential space. Next is given a list of each competing 78 | phase, giving its corresponding equation in terms of the inde- 79 | pendent variables, and the intersection points relevant to 80 | that phase. The compound of interest itself is given last. 81 | 82 | The user will be asked whether they want a grid of points in 83 | the stability region printed. If so, they must enter the dens- 84 | ity of the grid (in terms of the chemical potential values). 85 | 86 | If the system is 2D or 3D, a file 2Dplot.dat (or 3Dplot.dat) 87 | will be created. The contents of this file may be pasted in- 88 | to a Mathematica notebook, where the stability region in the 89 | chemical potential space can be visualised. A file 2Dplot.plt 90 | (or 3Dplot.plt) will also be produced, which can be loaded 91 | directly into gnuplot. Finally, for 2D systems, a file 92 | 2Dplot.txt is created which contains line points so that the 93 | lines corresponding to compounds can be plotted using 94 | whichever plotting software is preferred. 95 | 96 | For binary systems, the line segment that corresponds to the 97 | stability region in the 1D chemical potential space is given. 98 | The equation governing the constraint on the two chemical po- 99 | tentials is also given, so that the value of the dependent 100 | variable can be worked out easily. 101 | 102 | ************************************************************** 103 | 104 | RESTART 105 | 106 | It is possible to restart from a previous run. To do this, 107 | copy result.dat to restart.dat and re-run. There are 3 options 108 | available on restart - 109 | 110 | (a) Change the dependent variable 111 | (b) Add more competing phases 112 | (c) Set a chemical potential to a particular value 113 | 114 | Option (a) is self-explanatory. For option (b), the additional 115 | competing phases can be inputted via a file extra_phases.dat, 116 | which uses the same format for data input as input.dat (there 117 | is an example provided - just copy SAMPLE_EXTRA_PHASES to 118 | extra_phases.dat), or interactively (if extra_phases.dat 119 | does not exist). Option (c) is not available if the system is 120 | binary - this is because the solution is trivial. Just use the 121 | equation governing the constraint in the results.dat file. 122 | 123 | ************************************************************** 124 | 125 | Any bugs or problems - please email j.buckeridge@ucl.ac.uk 126 | 127 | ************************************************************** 128 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Set fortran compiler here 2 | FC=ifort 3 | 4 | 5 | %.o : %.f90; $(FC) -c $(FFLAGS) $< -o $@ 6 | 7 | OBJECTS= CPLAP.o 8 | 9 | CPLAP: $(OBJECTS) 10 | rm -f CPLAP 11 | $(FC) -o CPLAP $(OBJECTS) 12 | rm -f CPLAP.o 13 | 14 | clean: 15 | -rm -f *.o; touch *.f90 16 | 17 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ******************************************************************************** 2 | 3 | Files contained in the package: 4 | 5 | 1. Makefile - file to compile the program 6 | 2. CPLAP.f90 - CPLAP source code 7 | 3. MANUAL.txt - user manual 8 | 4. SAMPLE_INPUT - example of input file 9 | 5. SAMPLE_RESULTS - matching output file to SAMPLE_INPUT 10 | 6. SAMPLE_GRID_0.1 - grid output when a density of 0.1 is chosen 11 | 7. SAMPLE_EXTRA_PHASES - example of input file for option 'b' on restart 12 | 8. SAMPLE_RESTART_RESULTS - matching output file to option 'b' restart run using 13 | SAMPLE_EXTRA_PHASES as input 14 | 15 | ******************************************************************************** 16 | 17 | Installation: 18 | 19 | 1. Edit Makefile to change variable 'FC' to your preferred fortran compiler. 20 | 2. Type 'make'. 21 | 22 | ******************************************************************************** 23 | 24 | Running CPLAP: 25 | 26 | Run the executable (type './CPLAP'). There is a sample input: 27 | 28 | 1. cp SAMPLE_INPUT input.dat 29 | 2. ./CPLAP 30 | 31 | See MANUAL.txt for the input format. 32 | (If CPLAP does not find the file 'input.dat', it begins the interactive mode). 33 | 34 | There is an option to print a grid of points contained within the stability 35 | region with a user-specified density - see MANUAL.txt for details. 36 | 37 | The output 'results.dat' should match 'SAMPLE_RESULTS'. There will also be plot 38 | files produced on output (see MANUAL.txt). 39 | 40 | There is an option to print a grid of points in the stability region, given a 41 | grid density (see MANUAL.txt). If a grid density of 0.1 is chosen, the file 42 | 'grid.dat' should match 'SAMPLE_GRID_0.1'. 43 | 44 | ******************************************************************************** 45 | 46 | Restarting CPLAP: 47 | 48 | CPLAP can be restarted from a previous run - see MANUAL.txt for details. To 49 | restart CPLAP: 50 | 51 | 1. cp results.dat restart.dat 52 | 2. ./CPLAP 53 | 54 | There are 3 options on restarting - for option (b), additional data can be 55 | supplied via an input file called 'extra_phases.dat' - there is a sample file 56 | 'SAMPLE_EXTRA_PHASES' 57 | 58 | To test this: 59 | 1. cp results.dat restart.dat 60 | 2. cp SAMPLE_EXTRA_PHASES extra_phases.dat 61 | 3. ./CPLAP 62 | 4. select option 'b' 63 | 64 | The output is modified appropriately (there will be a 2D plot produced that 65 | differs from the one produced on the initial run). The output 'results.dat' 66 | should match the file 'SAMPLE_RESTART_RESULTS'. 67 | 68 | ******************************************************************************** 69 | 70 | Note (31/01/19): 71 | 72 | Anyone looking for a nicer 2D plot than that generated by gnuplot? 73 | 74 | Adam Jackson has written an excellent python script to do so. See: 75 | 76 | https://github.com/ajjackson/mctools/ 77 | 78 | -------------------------------------------------------------------------------- /SAMPLE_EXTRA_PHASES: -------------------------------------------------------------------------------- 1 | # 2 | # cp SAMPLE_EXTRA_PHASES extra_phases.dat 3 | # then run a restart, selecting option (b) 4 | # 5 | # Give the number of additional competing phases to be considered: 6 | # 7 | 1 8 | # 9 | # For each competing phase first give the number of species, then 10 | # the formula of the compound 11 | # 12 | 3 13 | 2 Ba 1 Sn 4 O -17.1252705 14 | -------------------------------------------------------------------------------- /SAMPLE_GRID_0.1: -------------------------------------------------------------------------------- 1 | ********************************************************************************** 2 | 3 | Results for system: 1 Ba 1 Sn 3 O 4 | 5 | DATE: 20/ 6/2013 11:41:25 6 | 7 | The first 4 points are the polyhedron corner points 8 | 9 | ********************************************************************************** 10 | 11 | mu_Ba mu_Sn | mu_O >= 12 | ----------------------|----------- 13 | -5.1387 -6.3256 | 0.0000 14 | -6.1766 -5.2876 | 0.0000 15 | -1.9759 0.0000 | -3.1628 16 | -3.5328 0.0000 | -2.6438 17 | -6.0766 -5.3256 | -0.0207 18 | -6.0766 -5.2256 | -0.0540 19 | -6.0766 -5.1256 | -0.0873 20 | -5.9766 -5.4256 | -0.0207 21 | -5.9766 -5.3256 | -0.0540 22 | -5.9766 -5.2256 | -0.0873 23 | -5.9766 -5.1256 | -0.1207 24 | -5.9766 -5.0256 | -0.1540 25 | -5.9766 -4.9256 | -0.1873 26 | -5.8766 -5.5256 | -0.0207 27 | -5.8766 -5.4256 | -0.0540 28 | -5.8766 -5.3256 | -0.0873 29 | -5.8766 -5.2256 | -0.1207 30 | -5.8766 -5.1256 | -0.1540 31 | -5.8766 -5.0256 | -0.1873 32 | -5.8766 -4.9256 | -0.2207 33 | -5.8766 -4.8256 | -0.2540 34 | -5.8766 -4.7256 | -0.2873 35 | -5.7766 -5.6256 | -0.0207 36 | -5.7766 -5.5256 | -0.0540 37 | -5.7766 -5.4256 | -0.0873 38 | -5.7766 -5.3256 | -0.1207 39 | -5.7766 -5.2256 | -0.1540 40 | -5.7766 -5.1256 | -0.1873 41 | -5.7766 -5.0256 | -0.2207 42 | -5.7766 -4.9256 | -0.2540 43 | -5.7766 -4.8256 | -0.2873 44 | -5.7766 -4.7256 | -0.3207 45 | -5.7766 -4.6256 | -0.3540 46 | -5.7766 -4.5256 | -0.3873 47 | -5.6766 -5.7256 | -0.0207 48 | -5.6766 -5.6256 | -0.0540 49 | -5.6766 -5.5256 | -0.0873 50 | -5.6766 -5.4256 | -0.1207 51 | -5.6766 -5.3256 | -0.1540 52 | -5.6766 -5.2256 | -0.1873 53 | -5.6766 -5.1256 | -0.2207 54 | -5.6766 -5.0256 | -0.2540 55 | -5.6766 -4.9256 | -0.2873 56 | -5.6766 -4.8256 | -0.3207 57 | -5.6766 -4.7256 | -0.3540 58 | -5.6766 -4.6256 | -0.3873 59 | -5.6766 -4.5256 | -0.4207 60 | -5.6766 -4.4256 | -0.4540 61 | -5.6766 -4.3256 | -0.4873 62 | -5.5766 -5.8256 | -0.0207 63 | -5.5766 -5.7256 | -0.0540 64 | -5.5766 -5.6256 | -0.0873 65 | -5.5766 -5.5256 | -0.1207 66 | -5.5766 -5.4256 | -0.1540 67 | -5.5766 -5.3256 | -0.1873 68 | -5.5766 -5.2256 | -0.2207 69 | -5.5766 -5.1256 | -0.2540 70 | -5.5766 -5.0256 | -0.2873 71 | -5.5766 -4.9256 | -0.3207 72 | -5.5766 -4.8256 | -0.3540 73 | -5.5766 -4.7256 | -0.3873 74 | -5.5766 -4.6256 | -0.4207 75 | -5.5766 -4.5256 | -0.4540 76 | -5.5766 -4.4256 | -0.4873 77 | -5.5766 -4.3256 | -0.5207 78 | -5.5766 -4.2256 | -0.5540 79 | -5.5766 -4.1256 | -0.5873 80 | -5.4766 -5.9256 | -0.0207 81 | -5.4766 -5.8256 | -0.0540 82 | -5.4766 -5.7256 | -0.0873 83 | -5.4766 -5.6256 | -0.1207 84 | -5.4766 -5.5256 | -0.1540 85 | -5.4766 -5.4256 | -0.1873 86 | -5.4766 -5.3256 | -0.2207 87 | -5.4766 -5.2256 | -0.2540 88 | -5.4766 -5.1256 | -0.2873 89 | -5.4766 -5.0256 | -0.3207 90 | -5.4766 -4.9256 | -0.3540 91 | -5.4766 -4.8256 | -0.3873 92 | -5.4766 -4.7256 | -0.4207 93 | -5.4766 -4.6256 | -0.4540 94 | -5.4766 -4.5256 | -0.4873 95 | -5.4766 -4.4256 | -0.5207 96 | -5.4766 -4.3256 | -0.5540 97 | -5.4766 -4.2256 | -0.5873 98 | -5.4766 -4.1256 | -0.6207 99 | -5.4766 -4.0256 | -0.6540 100 | -5.4766 -3.9256 | -0.6873 101 | -5.3766 -6.0256 | -0.0207 102 | -5.3766 -5.9256 | -0.0540 103 | -5.3766 -5.8256 | -0.0873 104 | -5.3766 -5.7256 | -0.1207 105 | -5.3766 -5.6256 | -0.1540 106 | -5.3766 -5.5256 | -0.1873 107 | -5.3766 -5.4256 | -0.2207 108 | -5.3766 -5.3256 | -0.2540 109 | -5.3766 -5.2256 | -0.2873 110 | -5.3766 -5.1256 | -0.3207 111 | -5.3766 -5.0256 | -0.3540 112 | -5.3766 -4.9256 | -0.3873 113 | -5.3766 -4.8256 | -0.4207 114 | -5.3766 -4.7256 | -0.4540 115 | -5.3766 -4.6256 | -0.4873 116 | -5.3766 -4.5256 | -0.5207 117 | -5.3766 -4.4256 | -0.5540 118 | -5.3766 -4.3256 | -0.5873 119 | -5.3766 -4.2256 | -0.6207 120 | -5.3766 -4.1256 | -0.6540 121 | -5.3766 -4.0256 | -0.6873 122 | -5.3766 -3.9256 | -0.7207 123 | -5.3766 -3.8256 | -0.7540 124 | -5.3766 -3.7256 | -0.7873 125 | -5.2766 -6.1256 | -0.0207 126 | -5.2766 -6.0256 | -0.0540 127 | -5.2766 -5.9256 | -0.0873 128 | -5.2766 -5.8256 | -0.1207 129 | -5.2766 -5.7256 | -0.1540 130 | -5.2766 -5.6256 | -0.1873 131 | -5.2766 -5.5256 | -0.2207 132 | -5.2766 -5.4256 | -0.2540 133 | -5.2766 -5.3256 | -0.2873 134 | -5.2766 -5.2256 | -0.3207 135 | -5.2766 -5.1256 | -0.3540 136 | -5.2766 -5.0256 | -0.3873 137 | -5.2766 -4.9256 | -0.4207 138 | -5.2766 -4.8256 | -0.4540 139 | -5.2766 -4.7256 | -0.4873 140 | -5.2766 -4.6256 | -0.5207 141 | -5.2766 -4.5256 | -0.5540 142 | -5.2766 -4.4256 | -0.5873 143 | -5.2766 -4.3256 | -0.6207 144 | -5.2766 -4.2256 | -0.6540 145 | -5.2766 -4.1256 | -0.6873 146 | -5.2766 -4.0256 | -0.7207 147 | -5.2766 -3.9256 | -0.7540 148 | -5.2766 -3.8256 | -0.7873 149 | -5.2766 -3.7256 | -0.8207 150 | -5.2766 -3.6256 | -0.8540 151 | -5.2766 -3.5256 | -0.8873 152 | -5.1766 -6.2256 | -0.0207 153 | -5.1766 -6.1256 | -0.0540 154 | -5.1766 -6.0256 | -0.0873 155 | -5.1766 -5.9256 | -0.1207 156 | -5.1766 -5.8256 | -0.1540 157 | -5.1766 -5.7256 | -0.1873 158 | -5.1766 -5.6256 | -0.2207 159 | -5.1766 -5.5256 | -0.2540 160 | -5.1766 -5.4256 | -0.2873 161 | -5.1766 -5.3256 | -0.3207 162 | -5.1766 -5.2256 | -0.3540 163 | -5.1766 -5.1256 | -0.3873 164 | -5.1766 -5.0256 | -0.4207 165 | -5.1766 -4.9256 | -0.4540 166 | -5.1766 -4.8256 | -0.4873 167 | -5.1766 -4.7256 | -0.5207 168 | -5.1766 -4.6256 | -0.5540 169 | -5.1766 -4.5256 | -0.5873 170 | -5.1766 -4.4256 | -0.6207 171 | -5.1766 -4.3256 | -0.6540 172 | -5.1766 -4.2256 | -0.6873 173 | -5.1766 -4.1256 | -0.7207 174 | -5.1766 -4.0256 | -0.7540 175 | -5.1766 -3.9256 | -0.7873 176 | -5.1766 -3.8256 | -0.8207 177 | -5.1766 -3.7256 | -0.8540 178 | -5.1766 -3.6256 | -0.8873 179 | -5.1766 -3.5256 | -0.9207 180 | -5.1766 -3.4256 | -0.9540 181 | -5.1766 -3.3256 | -0.9873 182 | -5.0766 -6.1256 | -0.0873 183 | -5.0766 -6.0256 | -0.1207 184 | -5.0766 -5.9256 | -0.1540 185 | -5.0766 -5.8256 | -0.1873 186 | -5.0766 -5.7256 | -0.2207 187 | -5.0766 -5.6256 | -0.2540 188 | -5.0766 -5.5256 | -0.2873 189 | -5.0766 -5.4256 | -0.3207 190 | -5.0766 -5.3256 | -0.3540 191 | -5.0766 -5.2256 | -0.3873 192 | -5.0766 -5.1256 | -0.4207 193 | -5.0766 -5.0256 | -0.4540 194 | -5.0766 -4.9256 | -0.4873 195 | -5.0766 -4.8256 | -0.5207 196 | -5.0766 -4.7256 | -0.5540 197 | -5.0766 -4.6256 | -0.5873 198 | -5.0766 -4.5256 | -0.6207 199 | -5.0766 -4.4256 | -0.6540 200 | -5.0766 -4.3256 | -0.6873 201 | -5.0766 -4.2256 | -0.7207 202 | -5.0766 -4.1256 | -0.7540 203 | -5.0766 -4.0256 | -0.7873 204 | -5.0766 -3.9256 | -0.8207 205 | -5.0766 -3.8256 | -0.8540 206 | -5.0766 -3.7256 | -0.8873 207 | -5.0766 -3.6256 | -0.9207 208 | -5.0766 -3.5256 | -0.9540 209 | -5.0766 -3.4256 | -0.9873 210 | -5.0766 -3.3256 | -1.0207 211 | -5.0766 -3.2256 | -1.0540 212 | -5.0766 -3.1256 | -1.0873 213 | -4.9766 -5.9256 | -0.1873 214 | -4.9766 -5.8256 | -0.2207 215 | -4.9766 -5.7256 | -0.2540 216 | -4.9766 -5.6256 | -0.2873 217 | -4.9766 -5.5256 | -0.3207 218 | -4.9766 -5.4256 | -0.3540 219 | -4.9766 -5.3256 | -0.3873 220 | -4.9766 -5.2256 | -0.4207 221 | -4.9766 -5.1256 | -0.4540 222 | -4.9766 -5.0256 | -0.4873 223 | -4.9766 -4.9256 | -0.5207 224 | -4.9766 -4.8256 | -0.5540 225 | -4.9766 -4.7256 | -0.5873 226 | -4.9766 -4.6256 | -0.6207 227 | -4.9766 -4.5256 | -0.6540 228 | -4.9766 -4.4256 | -0.6873 229 | -4.9766 -4.3256 | -0.7207 230 | -4.9766 -4.2256 | -0.7540 231 | -4.9766 -4.1256 | -0.7873 232 | -4.9766 -4.0256 | -0.8207 233 | -4.9766 -3.9256 | -0.8540 234 | -4.9766 -3.8256 | -0.8873 235 | -4.9766 -3.7256 | -0.9207 236 | -4.9766 -3.6256 | -0.9540 237 | -4.9766 -3.5256 | -0.9873 238 | -4.9766 -3.4256 | -1.0207 239 | -4.9766 -3.3256 | -1.0540 240 | -4.9766 -3.2256 | -1.0873 241 | -4.9766 -3.1256 | -1.1207 242 | -4.9766 -3.0256 | -1.1540 243 | -4.9766 -2.9256 | -1.1873 244 | -4.8766 -5.7256 | -0.2873 245 | -4.8766 -5.6256 | -0.3207 246 | -4.8766 -5.5256 | -0.3540 247 | -4.8766 -5.4256 | -0.3873 248 | -4.8766 -5.3256 | -0.4207 249 | -4.8766 -5.2256 | -0.4540 250 | -4.8766 -5.1256 | -0.4873 251 | -4.8766 -5.0256 | -0.5207 252 | -4.8766 -4.9256 | -0.5540 253 | -4.8766 -4.8256 | -0.5873 254 | -4.8766 -4.7256 | -0.6207 255 | -4.8766 -4.6256 | -0.6540 256 | -4.8766 -4.5256 | -0.6873 257 | -4.8766 -4.4256 | -0.7207 258 | -4.8766 -4.3256 | -0.7540 259 | -4.8766 -4.2256 | -0.7873 260 | -4.8766 -4.1256 | -0.8207 261 | -4.8766 -4.0256 | -0.8540 262 | -4.8766 -3.9256 | -0.8873 263 | -4.8766 -3.8256 | -0.9207 264 | -4.8766 -3.7256 | -0.9540 265 | -4.8766 -3.6256 | -0.9873 266 | -4.8766 -3.5256 | -1.0207 267 | -4.8766 -3.4256 | -1.0540 268 | -4.8766 -3.3256 | -1.0873 269 | -4.8766 -3.2256 | -1.1207 270 | -4.8766 -3.1256 | -1.1540 271 | -4.8766 -3.0256 | -1.1873 272 | -4.8766 -2.9256 | -1.2207 273 | -4.8766 -2.8256 | -1.2540 274 | -4.8766 -2.7256 | -1.2873 275 | -4.7766 -5.5256 | -0.3873 276 | -4.7766 -5.4256 | -0.4207 277 | -4.7766 -5.3256 | -0.4540 278 | -4.7766 -5.2256 | -0.4873 279 | -4.7766 -5.1256 | -0.5207 280 | -4.7766 -5.0256 | -0.5540 281 | -4.7766 -4.9256 | -0.5873 282 | -4.7766 -4.8256 | -0.6207 283 | -4.7766 -4.7256 | -0.6540 284 | -4.7766 -4.6256 | -0.6873 285 | -4.7766 -4.5256 | -0.7207 286 | -4.7766 -4.4256 | -0.7540 287 | -4.7766 -4.3256 | -0.7873 288 | -4.7766 -4.2256 | -0.8207 289 | -4.7766 -4.1256 | -0.8540 290 | -4.7766 -4.0256 | -0.8873 291 | -4.7766 -3.9256 | -0.9207 292 | -4.7766 -3.8256 | -0.9540 293 | -4.7766 -3.7256 | -0.9873 294 | -4.7766 -3.6256 | -1.0207 295 | -4.7766 -3.5256 | -1.0540 296 | -4.7766 -3.4256 | -1.0873 297 | -4.7766 -3.3256 | -1.1207 298 | -4.7766 -3.2256 | -1.1540 299 | -4.7766 -3.1256 | -1.1873 300 | -4.7766 -3.0256 | -1.2207 301 | -4.7766 -2.9256 | -1.2540 302 | -4.7766 -2.8256 | -1.2873 303 | -4.7766 -2.7256 | -1.3207 304 | -4.7766 -2.6256 | -1.3540 305 | -4.7766 -2.5256 | -1.3873 306 | -4.6766 -5.3256 | -0.4873 307 | -4.6766 -5.2256 | -0.5207 308 | -4.6766 -5.1256 | -0.5540 309 | -4.6766 -5.0256 | -0.5873 310 | -4.6766 -4.9256 | -0.6207 311 | -4.6766 -4.8256 | -0.6540 312 | -4.6766 -4.7256 | -0.6873 313 | -4.6766 -4.6256 | -0.7207 314 | -4.6766 -4.5256 | -0.7540 315 | -4.6766 -4.4256 | -0.7873 316 | -4.6766 -4.3256 | -0.8207 317 | -4.6766 -4.2256 | -0.8540 318 | -4.6766 -4.1256 | -0.8873 319 | -4.6766 -4.0256 | -0.9207 320 | -4.6766 -3.9256 | -0.9540 321 | -4.6766 -3.8256 | -0.9873 322 | -4.6766 -3.7256 | -1.0207 323 | -4.6766 -3.6256 | -1.0540 324 | -4.6766 -3.5256 | -1.0873 325 | -4.6766 -3.4256 | -1.1207 326 | -4.6766 -3.3256 | -1.1540 327 | -4.6766 -3.2256 | -1.1873 328 | -4.6766 -3.1256 | -1.2207 329 | -4.6766 -3.0256 | -1.2540 330 | -4.6766 -2.9256 | -1.2873 331 | -4.6766 -2.8256 | -1.3207 332 | -4.6766 -2.7256 | -1.3540 333 | -4.6766 -2.6256 | -1.3873 334 | -4.6766 -2.5256 | -1.4207 335 | -4.6766 -2.4256 | -1.4540 336 | -4.6766 -2.3256 | -1.4873 337 | -4.5766 -5.1256 | -0.5873 338 | -4.5766 -5.0256 | -0.6207 339 | -4.5766 -4.9256 | -0.6540 340 | -4.5766 -4.8256 | -0.6873 341 | -4.5766 -4.7256 | -0.7207 342 | -4.5766 -4.6256 | -0.7540 343 | -4.5766 -4.5256 | -0.7873 344 | -4.5766 -4.4256 | -0.8207 345 | -4.5766 -4.3256 | -0.8540 346 | -4.5766 -4.2256 | -0.8873 347 | -4.5766 -4.1256 | -0.9207 348 | -4.5766 -4.0256 | -0.9540 349 | -4.5766 -3.9256 | -0.9873 350 | -4.5766 -3.8256 | -1.0207 351 | -4.5766 -3.7256 | -1.0540 352 | -4.5766 -3.6256 | -1.0873 353 | -4.5766 -3.5256 | -1.1207 354 | -4.5766 -3.4256 | -1.1540 355 | -4.5766 -3.3256 | -1.1873 356 | -4.5766 -3.2256 | -1.2207 357 | -4.5766 -3.1256 | -1.2540 358 | -4.5766 -3.0256 | -1.2873 359 | -4.5766 -2.9256 | -1.3207 360 | -4.5766 -2.8256 | -1.3540 361 | -4.5766 -2.7256 | -1.3873 362 | -4.5766 -2.6256 | -1.4207 363 | -4.5766 -2.5256 | -1.4540 364 | -4.5766 -2.4256 | -1.4873 365 | -4.5766 -2.3256 | -1.5207 366 | -4.5766 -2.2256 | -1.5540 367 | -4.5766 -2.1256 | -1.5873 368 | -4.4766 -4.9256 | -0.6873 369 | -4.4766 -4.8256 | -0.7207 370 | -4.4766 -4.7256 | -0.7540 371 | -4.4766 -4.6256 | -0.7873 372 | -4.4766 -4.5256 | -0.8207 373 | -4.4766 -4.4256 | -0.8540 374 | -4.4766 -4.3256 | -0.8873 375 | -4.4766 -4.2256 | -0.9207 376 | -4.4766 -4.1256 | -0.9540 377 | -4.4766 -4.0256 | -0.9873 378 | -4.4766 -3.9256 | -1.0207 379 | -4.4766 -3.8256 | -1.0540 380 | -4.4766 -3.7256 | -1.0873 381 | -4.4766 -3.6256 | -1.1207 382 | -4.4766 -3.5256 | -1.1540 383 | -4.4766 -3.4256 | -1.1873 384 | -4.4766 -3.3256 | -1.2207 385 | -4.4766 -3.2256 | -1.2540 386 | -4.4766 -3.1256 | -1.2873 387 | -4.4766 -3.0256 | -1.3207 388 | -4.4766 -2.9256 | -1.3540 389 | -4.4766 -2.8256 | -1.3873 390 | -4.4766 -2.7256 | -1.4207 391 | -4.4766 -2.6256 | -1.4540 392 | -4.4766 -2.5256 | -1.4873 393 | -4.4766 -2.4256 | -1.5207 394 | -4.4766 -2.3256 | -1.5540 395 | -4.4766 -2.2256 | -1.5873 396 | -4.4766 -2.1256 | -1.6207 397 | -4.4766 -2.0256 | -1.6540 398 | -4.4766 -1.9256 | -1.6873 399 | -4.3766 -4.7256 | -0.7873 400 | -4.3766 -4.6256 | -0.8207 401 | -4.3766 -4.5256 | -0.8540 402 | -4.3766 -4.4256 | -0.8873 403 | -4.3766 -4.3256 | -0.9207 404 | -4.3766 -4.2256 | -0.9540 405 | -4.3766 -4.1256 | -0.9873 406 | -4.3766 -4.0256 | -1.0207 407 | -4.3766 -3.9256 | -1.0540 408 | -4.3766 -3.8256 | -1.0873 409 | -4.3766 -3.7256 | -1.1207 410 | -4.3766 -3.6256 | -1.1540 411 | -4.3766 -3.5256 | -1.1873 412 | -4.3766 -3.4256 | -1.2207 413 | -4.3766 -3.3256 | -1.2540 414 | -4.3766 -3.2256 | -1.2873 415 | -4.3766 -3.1256 | -1.3207 416 | -4.3766 -3.0256 | -1.3540 417 | -4.3766 -2.9256 | -1.3873 418 | -4.3766 -2.8256 | -1.4207 419 | -4.3766 -2.7256 | -1.4540 420 | -4.3766 -2.6256 | -1.4873 421 | -4.3766 -2.5256 | -1.5207 422 | -4.3766 -2.4256 | -1.5540 423 | -4.3766 -2.3256 | -1.5873 424 | -4.3766 -2.2256 | -1.6207 425 | -4.3766 -2.1256 | -1.6540 426 | -4.3766 -2.0256 | -1.6873 427 | -4.3766 -1.9256 | -1.7207 428 | -4.3766 -1.8256 | -1.7540 429 | -4.3766 -1.7256 | -1.7873 430 | -4.2766 -4.5256 | -0.8873 431 | -4.2766 -4.4256 | -0.9207 432 | -4.2766 -4.3256 | -0.9540 433 | -4.2766 -4.2256 | -0.9873 434 | -4.2766 -4.1256 | -1.0207 435 | -4.2766 -4.0256 | -1.0540 436 | -4.2766 -3.9256 | -1.0873 437 | -4.2766 -3.8256 | -1.1207 438 | -4.2766 -3.7256 | -1.1540 439 | -4.2766 -3.6256 | -1.1873 440 | -4.2766 -3.5256 | -1.2207 441 | -4.2766 -3.4256 | -1.2540 442 | -4.2766 -3.3256 | -1.2873 443 | -4.2766 -3.2256 | -1.3207 444 | -4.2766 -3.1256 | -1.3540 445 | -4.2766 -3.0256 | -1.3873 446 | -4.2766 -2.9256 | -1.4207 447 | -4.2766 -2.8256 | -1.4540 448 | -4.2766 -2.7256 | -1.4873 449 | -4.2766 -2.6256 | -1.5207 450 | -4.2766 -2.5256 | -1.5540 451 | -4.2766 -2.4256 | -1.5873 452 | -4.2766 -2.3256 | -1.6207 453 | -4.2766 -2.2256 | -1.6540 454 | -4.2766 -2.1256 | -1.6873 455 | -4.2766 -2.0256 | -1.7207 456 | -4.2766 -1.9256 | -1.7540 457 | -4.2766 -1.8256 | -1.7873 458 | -4.2766 -1.7256 | -1.8207 459 | -4.2766 -1.6256 | -1.8540 460 | -4.2766 -1.5256 | -1.8873 461 | -4.1766 -4.3256 | -0.9873 462 | -4.1766 -4.2256 | -1.0207 463 | -4.1766 -4.1256 | -1.0540 464 | -4.1766 -4.0256 | -1.0873 465 | -4.1766 -3.9256 | -1.1207 466 | -4.1766 -3.8256 | -1.1540 467 | -4.1766 -3.7256 | -1.1873 468 | -4.1766 -3.6256 | -1.2207 469 | -4.1766 -3.5256 | -1.2540 470 | -4.1766 -3.4256 | -1.2873 471 | -4.1766 -3.3256 | -1.3207 472 | -4.1766 -3.2256 | -1.3540 473 | -4.1766 -3.1256 | -1.3873 474 | -4.1766 -3.0256 | -1.4207 475 | -4.1766 -2.9256 | -1.4540 476 | -4.1766 -2.8256 | -1.4873 477 | -4.1766 -2.7256 | -1.5207 478 | -4.1766 -2.6256 | -1.5540 479 | -4.1766 -2.5256 | -1.5873 480 | -4.1766 -2.4256 | -1.6207 481 | -4.1766 -2.3256 | -1.6540 482 | -4.1766 -2.2256 | -1.6873 483 | -4.1766 -2.1256 | -1.7207 484 | -4.1766 -2.0256 | -1.7540 485 | -4.1766 -1.9256 | -1.7873 486 | -4.1766 -1.8256 | -1.8207 487 | -4.1766 -1.7256 | -1.8540 488 | -4.1766 -1.6256 | -1.8873 489 | -4.1766 -1.5256 | -1.9207 490 | -4.1766 -1.4256 | -1.9540 491 | -4.1766 -1.3256 | -1.9873 492 | -4.0766 -4.1256 | -1.0873 493 | -4.0766 -4.0256 | -1.1207 494 | -4.0766 -3.9256 | -1.1540 495 | -4.0766 -3.8256 | -1.1873 496 | -4.0766 -3.7256 | -1.2207 497 | -4.0766 -3.6256 | -1.2540 498 | -4.0766 -3.5256 | -1.2873 499 | -4.0766 -3.4256 | -1.3207 500 | -4.0766 -3.3256 | -1.3540 501 | -4.0766 -3.2256 | -1.3873 502 | -4.0766 -3.1256 | -1.4207 503 | -4.0766 -3.0256 | -1.4540 504 | -4.0766 -2.9256 | -1.4873 505 | -4.0766 -2.8256 | -1.5207 506 | -4.0766 -2.7256 | -1.5540 507 | -4.0766 -2.6256 | -1.5873 508 | -4.0766 -2.5256 | -1.6207 509 | -4.0766 -2.4256 | -1.6540 510 | -4.0766 -2.3256 | -1.6873 511 | -4.0766 -2.2256 | -1.7207 512 | -4.0766 -2.1256 | -1.7540 513 | -4.0766 -2.0256 | -1.7873 514 | -4.0766 -1.9256 | -1.8207 515 | -4.0766 -1.8256 | -1.8540 516 | -4.0766 -1.7256 | -1.8873 517 | -4.0766 -1.6256 | -1.9207 518 | -4.0766 -1.5256 | -1.9540 519 | -4.0766 -1.4256 | -1.9873 520 | -4.0766 -1.3256 | -2.0207 521 | -4.0766 -1.2256 | -2.0540 522 | -4.0766 -1.1256 | -2.0873 523 | -3.9766 -3.9256 | -1.1873 524 | -3.9766 -3.8256 | -1.2207 525 | -3.9766 -3.7256 | -1.2540 526 | -3.9766 -3.6256 | -1.2873 527 | -3.9766 -3.5256 | -1.3207 528 | -3.9766 -3.4256 | -1.3540 529 | -3.9766 -3.3256 | -1.3873 530 | -3.9766 -3.2256 | -1.4207 531 | -3.9766 -3.1256 | -1.4540 532 | -3.9766 -3.0256 | -1.4873 533 | -3.9766 -2.9256 | -1.5207 534 | -3.9766 -2.8256 | -1.5540 535 | -3.9766 -2.7256 | -1.5873 536 | -3.9766 -2.6256 | -1.6207 537 | -3.9766 -2.5256 | -1.6540 538 | -3.9766 -2.4256 | -1.6873 539 | -3.9766 -2.3256 | -1.7207 540 | -3.9766 -2.2256 | -1.7540 541 | -3.9766 -2.1256 | -1.7873 542 | -3.9766 -2.0256 | -1.8207 543 | -3.9766 -1.9256 | -1.8540 544 | -3.9766 -1.8256 | -1.8873 545 | -3.9766 -1.7256 | -1.9207 546 | -3.9766 -1.6256 | -1.9540 547 | -3.9766 -1.5256 | -1.9873 548 | -3.9766 -1.4256 | -2.0207 549 | -3.9766 -1.3256 | -2.0540 550 | -3.9766 -1.2256 | -2.0873 551 | -3.9766 -1.1256 | -2.1207 552 | -3.9766 -1.0256 | -2.1540 553 | -3.9766 -0.9256 | -2.1873 554 | -3.8766 -3.7256 | -1.2873 555 | -3.8766 -3.6256 | -1.3207 556 | -3.8766 -3.5256 | -1.3540 557 | -3.8766 -3.4256 | -1.3873 558 | -3.8766 -3.3256 | -1.4207 559 | -3.8766 -3.2256 | -1.4540 560 | -3.8766 -3.1256 | -1.4873 561 | -3.8766 -3.0256 | -1.5207 562 | -3.8766 -2.9256 | -1.5540 563 | -3.8766 -2.8256 | -1.5873 564 | -3.8766 -2.7256 | -1.6207 565 | -3.8766 -2.6256 | -1.6540 566 | -3.8766 -2.5256 | -1.6873 567 | -3.8766 -2.4256 | -1.7207 568 | -3.8766 -2.3256 | -1.7540 569 | -3.8766 -2.2256 | -1.7873 570 | -3.8766 -2.1256 | -1.8207 571 | -3.8766 -2.0256 | -1.8540 572 | -3.8766 -1.9256 | -1.8873 573 | -3.8766 -1.8256 | -1.9207 574 | -3.8766 -1.7256 | -1.9540 575 | -3.8766 -1.6256 | -1.9873 576 | -3.8766 -1.5256 | -2.0207 577 | -3.8766 -1.4256 | -2.0540 578 | -3.8766 -1.3256 | -2.0873 579 | -3.8766 -1.2256 | -2.1207 580 | -3.8766 -1.1256 | -2.1540 581 | -3.8766 -1.0256 | -2.1873 582 | -3.8766 -0.9256 | -2.2207 583 | -3.8766 -0.8256 | -2.2540 584 | -3.8766 -0.7256 | -2.2873 585 | -3.7766 -3.5256 | -1.3873 586 | -3.7766 -3.4256 | -1.4207 587 | -3.7766 -3.3256 | -1.4540 588 | -3.7766 -3.2256 | -1.4873 589 | -3.7766 -3.1256 | -1.5207 590 | -3.7766 -3.0256 | -1.5540 591 | -3.7766 -2.9256 | -1.5873 592 | -3.7766 -2.8256 | -1.6207 593 | -3.7766 -2.7256 | -1.6540 594 | -3.7766 -2.6256 | -1.6873 595 | -3.7766 -2.5256 | -1.7207 596 | -3.7766 -2.4256 | -1.7540 597 | -3.7766 -2.3256 | -1.7873 598 | -3.7766 -2.2256 | -1.8207 599 | -3.7766 -2.1256 | -1.8540 600 | -3.7766 -2.0256 | -1.8873 601 | -3.7766 -1.9256 | -1.9207 602 | -3.7766 -1.8256 | -1.9540 603 | -3.7766 -1.7256 | -1.9873 604 | -3.7766 -1.6256 | -2.0207 605 | -3.7766 -1.5256 | -2.0540 606 | -3.7766 -1.4256 | -2.0873 607 | -3.7766 -1.3256 | -2.1207 608 | -3.7766 -1.2256 | -2.1540 609 | -3.7766 -1.1256 | -2.1873 610 | -3.7766 -1.0256 | -2.2207 611 | -3.7766 -0.9256 | -2.2540 612 | -3.7766 -0.8256 | -2.2873 613 | -3.7766 -0.7256 | -2.3207 614 | -3.7766 -0.6256 | -2.3540 615 | -3.7766 -0.5256 | -2.3873 616 | -3.6766 -3.3256 | -1.4873 617 | -3.6766 -3.2256 | -1.5207 618 | -3.6766 -3.1256 | -1.5540 619 | -3.6766 -3.0256 | -1.5873 620 | -3.6766 -2.9256 | -1.6207 621 | -3.6766 -2.8256 | -1.6540 622 | -3.6766 -2.7256 | -1.6873 623 | -3.6766 -2.6256 | -1.7207 624 | -3.6766 -2.5256 | -1.7540 625 | -3.6766 -2.4256 | -1.7873 626 | -3.6766 -2.3256 | -1.8207 627 | -3.6766 -2.2256 | -1.8540 628 | -3.6766 -2.1256 | -1.8873 629 | -3.6766 -2.0256 | -1.9207 630 | -3.6766 -1.9256 | -1.9540 631 | -3.6766 -1.8256 | -1.9873 632 | -3.6766 -1.7256 | -2.0207 633 | -3.6766 -1.6256 | -2.0540 634 | -3.6766 -1.5256 | -2.0873 635 | -3.6766 -1.4256 | -2.1207 636 | -3.6766 -1.3256 | -2.1540 637 | -3.6766 -1.2256 | -2.1873 638 | -3.6766 -1.1256 | -2.2207 639 | -3.6766 -1.0256 | -2.2540 640 | -3.6766 -0.9256 | -2.2873 641 | -3.6766 -0.8256 | -2.3207 642 | -3.6766 -0.7256 | -2.3540 643 | -3.6766 -0.6256 | -2.3873 644 | -3.6766 -0.5256 | -2.4207 645 | -3.6766 -0.4256 | -2.4540 646 | -3.6766 -0.3256 | -2.4873 647 | -3.5766 -3.1256 | -1.5873 648 | -3.5766 -3.0256 | -1.6207 649 | -3.5766 -2.9256 | -1.6540 650 | -3.5766 -2.8256 | -1.6873 651 | -3.5766 -2.7256 | -1.7207 652 | -3.5766 -2.6256 | -1.7540 653 | -3.5766 -2.5256 | -1.7873 654 | -3.5766 -2.4256 | -1.8207 655 | -3.5766 -2.3256 | -1.8540 656 | -3.5766 -2.2256 | -1.8873 657 | -3.5766 -2.1256 | -1.9207 658 | -3.5766 -2.0256 | -1.9540 659 | -3.5766 -1.9256 | -1.9873 660 | -3.5766 -1.8256 | -2.0207 661 | -3.5766 -1.7256 | -2.0540 662 | -3.5766 -1.6256 | -2.0873 663 | -3.5766 -1.5256 | -2.1207 664 | -3.5766 -1.4256 | -2.1540 665 | -3.5766 -1.3256 | -2.1873 666 | -3.5766 -1.2256 | -2.2207 667 | -3.5766 -1.1256 | -2.2540 668 | -3.5766 -1.0256 | -2.2873 669 | -3.5766 -0.9256 | -2.3207 670 | -3.5766 -0.8256 | -2.3540 671 | -3.5766 -0.7256 | -2.3873 672 | -3.5766 -0.6256 | -2.4207 673 | -3.5766 -0.5256 | -2.4540 674 | -3.5766 -0.4256 | -2.4873 675 | -3.5766 -0.3256 | -2.5207 676 | -3.5766 -0.2256 | -2.5540 677 | -3.5766 -0.1256 | -2.5873 678 | -3.4766 -2.9256 | -1.6873 679 | -3.4766 -2.8256 | -1.7207 680 | -3.4766 -2.7256 | -1.7540 681 | -3.4766 -2.6256 | -1.7873 682 | -3.4766 -2.5256 | -1.8207 683 | -3.4766 -2.4256 | -1.8540 684 | -3.4766 -2.3256 | -1.8873 685 | -3.4766 -2.2256 | -1.9207 686 | -3.4766 -2.1256 | -1.9540 687 | -3.4766 -2.0256 | -1.9873 688 | -3.4766 -1.9256 | -2.0207 689 | -3.4766 -1.8256 | -2.0540 690 | -3.4766 -1.7256 | -2.0873 691 | -3.4766 -1.6256 | -2.1207 692 | -3.4766 -1.5256 | -2.1540 693 | -3.4766 -1.4256 | -2.1873 694 | -3.4766 -1.3256 | -2.2207 695 | -3.4766 -1.2256 | -2.2540 696 | -3.4766 -1.1256 | -2.2873 697 | -3.4766 -1.0256 | -2.3207 698 | -3.4766 -0.9256 | -2.3540 699 | -3.4766 -0.8256 | -2.3873 700 | -3.4766 -0.7256 | -2.4207 701 | -3.4766 -0.6256 | -2.4540 702 | -3.4766 -0.5256 | -2.4873 703 | -3.4766 -0.4256 | -2.5207 704 | -3.4766 -0.3256 | -2.5540 705 | -3.4766 -0.2256 | -2.5873 706 | -3.4766 -0.1256 | -2.6207 707 | -3.4766 -0.0256 | -2.6540 708 | -3.3766 -2.7256 | -1.7873 709 | -3.3766 -2.6256 | -1.8207 710 | -3.3766 -2.5256 | -1.8540 711 | -3.3766 -2.4256 | -1.8873 712 | -3.3766 -2.3256 | -1.9207 713 | -3.3766 -2.2256 | -1.9540 714 | -3.3766 -2.1256 | -1.9873 715 | -3.3766 -2.0256 | -2.0207 716 | -3.3766 -1.9256 | -2.0540 717 | -3.3766 -1.8256 | -2.0873 718 | -3.3766 -1.7256 | -2.1207 719 | -3.3766 -1.6256 | -2.1540 720 | -3.3766 -1.5256 | -2.1873 721 | -3.3766 -1.4256 | -2.2207 722 | -3.3766 -1.3256 | -2.2540 723 | -3.3766 -1.2256 | -2.2873 724 | -3.3766 -1.1256 | -2.3207 725 | -3.3766 -1.0256 | -2.3540 726 | -3.3766 -0.9256 | -2.3873 727 | -3.3766 -0.8256 | -2.4207 728 | -3.3766 -0.7256 | -2.4540 729 | -3.3766 -0.6256 | -2.4873 730 | -3.3766 -0.5256 | -2.5207 731 | -3.3766 -0.4256 | -2.5540 732 | -3.3766 -0.3256 | -2.5873 733 | -3.3766 -0.2256 | -2.6207 734 | -3.3766 -0.1256 | -2.6540 735 | -3.3766 -0.0256 | -2.6873 736 | -3.2766 -2.5256 | -1.8873 737 | -3.2766 -2.4256 | -1.9207 738 | -3.2766 -2.3256 | -1.9540 739 | -3.2766 -2.2256 | -1.9873 740 | -3.2766 -2.1256 | -2.0207 741 | -3.2766 -2.0256 | -2.0540 742 | -3.2766 -1.9256 | -2.0873 743 | -3.2766 -1.8256 | -2.1207 744 | -3.2766 -1.7256 | -2.1540 745 | -3.2766 -1.6256 | -2.1873 746 | -3.2766 -1.5256 | -2.2207 747 | -3.2766 -1.4256 | -2.2540 748 | -3.2766 -1.3256 | -2.2873 749 | -3.2766 -1.2256 | -2.3207 750 | -3.2766 -1.1256 | -2.3540 751 | -3.2766 -1.0256 | -2.3873 752 | -3.2766 -0.9256 | -2.4207 753 | -3.2766 -0.8256 | -2.4540 754 | -3.2766 -0.7256 | -2.4873 755 | -3.2766 -0.6256 | -2.5207 756 | -3.2766 -0.5256 | -2.5540 757 | -3.2766 -0.4256 | -2.5873 758 | -3.2766 -0.3256 | -2.6207 759 | -3.2766 -0.2256 | -2.6540 760 | -3.2766 -0.1256 | -2.6873 761 | -3.2766 -0.0256 | -2.7207 762 | -3.1766 -2.3256 | -1.9873 763 | -3.1766 -2.2256 | -2.0207 764 | -3.1766 -2.1256 | -2.0540 765 | -3.1766 -2.0256 | -2.0873 766 | -3.1766 -1.9256 | -2.1207 767 | -3.1766 -1.8256 | -2.1540 768 | -3.1766 -1.7256 | -2.1873 769 | -3.1766 -1.6256 | -2.2207 770 | -3.1766 -1.5256 | -2.2540 771 | -3.1766 -1.4256 | -2.2873 772 | -3.1766 -1.3256 | -2.3207 773 | -3.1766 -1.2256 | -2.3540 774 | -3.1766 -1.1256 | -2.3873 775 | -3.1766 -1.0256 | -2.4207 776 | -3.1766 -0.9256 | -2.4540 777 | -3.1766 -0.8256 | -2.4873 778 | -3.1766 -0.7256 | -2.5207 779 | -3.1766 -0.6256 | -2.5540 780 | -3.1766 -0.5256 | -2.5873 781 | -3.1766 -0.4256 | -2.6207 782 | -3.1766 -0.3256 | -2.6540 783 | -3.1766 -0.2256 | -2.6873 784 | -3.1766 -0.1256 | -2.7207 785 | -3.1766 -0.0256 | -2.7540 786 | -3.0766 -2.1256 | -2.0873 787 | -3.0766 -2.0256 | -2.1207 788 | -3.0766 -1.9256 | -2.1540 789 | -3.0766 -1.8256 | -2.1873 790 | -3.0766 -1.7256 | -2.2207 791 | -3.0766 -1.6256 | -2.2540 792 | -3.0766 -1.5256 | -2.2873 793 | -3.0766 -1.4256 | -2.3207 794 | -3.0766 -1.3256 | -2.3540 795 | -3.0766 -1.2256 | -2.3873 796 | -3.0766 -1.1256 | -2.4207 797 | -3.0766 -1.0256 | -2.4540 798 | -3.0766 -0.9256 | -2.4873 799 | -3.0766 -0.8256 | -2.5207 800 | -3.0766 -0.7256 | -2.5540 801 | -3.0766 -0.6256 | -2.5873 802 | -3.0766 -0.5256 | -2.6207 803 | -3.0766 -0.4256 | -2.6540 804 | -3.0766 -0.3256 | -2.6873 805 | -3.0766 -0.2256 | -2.7207 806 | -3.0766 -0.1256 | -2.7540 807 | -3.0766 -0.0256 | -2.7873 808 | -2.9766 -1.9256 | -2.1873 809 | -2.9766 -1.8256 | -2.2207 810 | -2.9766 -1.7256 | -2.2540 811 | -2.9766 -1.6256 | -2.2873 812 | -2.9766 -1.5256 | -2.3207 813 | -2.9766 -1.4256 | -2.3540 814 | -2.9766 -1.3256 | -2.3873 815 | -2.9766 -1.2256 | -2.4207 816 | -2.9766 -1.1256 | -2.4540 817 | -2.9766 -1.0256 | -2.4873 818 | -2.9766 -0.9256 | -2.5207 819 | -2.9766 -0.8256 | -2.5540 820 | -2.9766 -0.7256 | -2.5873 821 | -2.9766 -0.6256 | -2.6207 822 | -2.9766 -0.5256 | -2.6540 823 | -2.9766 -0.4256 | -2.6873 824 | -2.9766 -0.3256 | -2.7207 825 | -2.9766 -0.2256 | -2.7540 826 | -2.9766 -0.1256 | -2.7873 827 | -2.9766 -0.0256 | -2.8207 828 | -2.8766 -1.7256 | -2.2873 829 | -2.8766 -1.6256 | -2.3207 830 | -2.8766 -1.5256 | -2.3540 831 | -2.8766 -1.4256 | -2.3873 832 | -2.8766 -1.3256 | -2.4207 833 | -2.8766 -1.2256 | -2.4540 834 | -2.8766 -1.1256 | -2.4873 835 | -2.8766 -1.0256 | -2.5207 836 | -2.8766 -0.9256 | -2.5540 837 | -2.8766 -0.8256 | -2.5873 838 | -2.8766 -0.7256 | -2.6207 839 | -2.8766 -0.6256 | -2.6540 840 | -2.8766 -0.5256 | -2.6873 841 | -2.8766 -0.4256 | -2.7207 842 | -2.8766 -0.3256 | -2.7540 843 | -2.8766 -0.2256 | -2.7873 844 | -2.8766 -0.1256 | -2.8207 845 | -2.8766 -0.0256 | -2.8540 846 | -2.7766 -1.5256 | -2.3873 847 | -2.7766 -1.4256 | -2.4207 848 | -2.7766 -1.3256 | -2.4540 849 | -2.7766 -1.2256 | -2.4873 850 | -2.7766 -1.1256 | -2.5207 851 | -2.7766 -1.0256 | -2.5540 852 | -2.7766 -0.9256 | -2.5873 853 | -2.7766 -0.8256 | -2.6207 854 | -2.7766 -0.7256 | -2.6540 855 | -2.7766 -0.6256 | -2.6873 856 | -2.7766 -0.5256 | -2.7207 857 | -2.7766 -0.4256 | -2.7540 858 | -2.7766 -0.3256 | -2.7873 859 | -2.7766 -0.2256 | -2.8207 860 | -2.7766 -0.1256 | -2.8540 861 | -2.7766 -0.0256 | -2.8873 862 | -2.6766 -1.3256 | -2.4873 863 | -2.6766 -1.2256 | -2.5207 864 | -2.6766 -1.1256 | -2.5540 865 | -2.6766 -1.0256 | -2.5873 866 | -2.6766 -0.9256 | -2.6207 867 | -2.6766 -0.8256 | -2.6540 868 | -2.6766 -0.7256 | -2.6873 869 | -2.6766 -0.6256 | -2.7207 870 | -2.6766 -0.5256 | -2.7540 871 | -2.6766 -0.4256 | -2.7873 872 | -2.6766 -0.3256 | -2.8207 873 | -2.6766 -0.2256 | -2.8540 874 | -2.6766 -0.1256 | -2.8873 875 | -2.6766 -0.0256 | -2.9207 876 | -2.5766 -1.1256 | -2.5873 877 | -2.5766 -1.0256 | -2.6207 878 | -2.5766 -0.9256 | -2.6540 879 | -2.5766 -0.8256 | -2.6873 880 | -2.5766 -0.7256 | -2.7207 881 | -2.5766 -0.6256 | -2.7540 882 | -2.5766 -0.5256 | -2.7873 883 | -2.5766 -0.4256 | -2.8207 884 | -2.5766 -0.3256 | -2.8540 885 | -2.5766 -0.2256 | -2.8873 886 | -2.5766 -0.1256 | -2.9207 887 | -2.5766 -0.0256 | -2.9540 888 | -2.4766 -0.9256 | -2.6873 889 | -2.4766 -0.8256 | -2.7207 890 | -2.4766 -0.7256 | -2.7540 891 | -2.4766 -0.6256 | -2.7873 892 | -2.4766 -0.5256 | -2.8207 893 | -2.4766 -0.4256 | -2.8540 894 | -2.4766 -0.3256 | -2.8873 895 | -2.4766 -0.2256 | -2.9207 896 | -2.4766 -0.1256 | -2.9540 897 | -2.4766 -0.0256 | -2.9873 898 | -2.3766 -0.7256 | -2.7873 899 | -2.3766 -0.6256 | -2.8207 900 | -2.3766 -0.5256 | -2.8540 901 | -2.3766 -0.4256 | -2.8873 902 | -2.3766 -0.3256 | -2.9207 903 | -2.3766 -0.2256 | -2.9540 904 | -2.3766 -0.1256 | -2.9873 905 | -2.3766 -0.0256 | -3.0207 906 | -2.2766 -0.5256 | -2.8873 907 | -2.2766 -0.4256 | -2.9207 908 | -2.2766 -0.3256 | -2.9540 909 | -2.2766 -0.2256 | -2.9873 910 | -2.2766 -0.1256 | -3.0207 911 | -2.2766 -0.0256 | -3.0540 912 | -2.1766 -0.3256 | -2.9873 913 | -2.1766 -0.2256 | -3.0207 914 | -2.1766 -0.1256 | -3.0540 915 | -2.1766 -0.0256 | -3.0873 916 | -2.0766 -0.1256 | -3.0873 917 | -2.0766 -0.0256 | -3.1207 918 | -------------------------------------------------------------------------------- /SAMPLE_INPUT: -------------------------------------------------------------------------------- 1 | # To run this calculation (for the system BaSnO3) do: 2 | # 3 | # cp SAMPLE_INPUT input.dat 4 | # ./CPLAP 5 | # 6 | # One competing phase has been left out - to add it in: 7 | # 8 | # cp results.dat restart.dat 9 | # ./CPLAP 10 | # 11 | # and select option (b) (cp SAMPLE_EXTRA_PHASES extra_phases.dat first) 12 | # 13 | # 14 | # First give number of species in the compound of interest 15 | # 16 | 3 17 | # 18 | # Next give the formula and enthalpy of formation (E1) of the compound 19 | # in the format: 20 | # 21 | # n_A A n_B B n_C C ... E1 22 | # 23 | # where n_A is the number of species A in the formula unit etc (E1 24 | # is a negative number) 25 | # (e.g. if the material is calcite then 1 Ca 1 C 3 O and then the 26 | # energy must be entered. Please keep the energy units consistent 27 | # when entering all data) 28 | # 29 | 1 Ba 1 Sn 3 O -11.464253 30 | # 31 | # Now enter which element is to be set as the dependent variable (i.e. 32 | # given in terms of the other chemical potentials). If none is to be set, 33 | # then write "none" (case sensitive) - note if no dependent variable is 34 | # set then only the intersection points with the compound of interest 35 | # are relevant 36 | # 37 | O 38 | # 39 | # Next give the number of competing phases to be considered: 40 | # 41 | 3 42 | # 43 | # For each competing phase first give the number of species, then 44 | # the formula of the compound 45 | # 46 | 2 47 | 1 Ba 1 O -5.1386635 48 | 2 49 | 1 Sn 1 O -2.539629 50 | 2 51 | 1 Sn 2 O -5.2876295 52 | -------------------------------------------------------------------------------- /SAMPLE_RESTART_RESULTS: -------------------------------------------------------------------------------- 1 | ********************************************************************************** 2 | 3 | Results for system: 1 Ba 1 Sn 3 O 4 | 5 | Number of species: 3 6 | 7 | Number of competing phases: 4 8 | 9 | DATE: 20/ 6/2013 11:16:43 10 | 11 | ********************************************************************************** 12 | 13 | Energy: -0.1146425300000E+02 eV 14 | 15 | Dependent variable: mu_O 16 | 17 | ********************************************************************************** 18 | 19 | Limiting inequalities: 20 | 21 | 1.000 mu_Ba 1.000 mu_Sn > -11.4643 22 | 0.666 mu_Ba -0.333 mu_Sn < -1.3173 23 | -0.333 mu_Ba 0.666 mu_Sn < 1.2818 24 | -0.666 mu_Ba 0.333 mu_Sn < 2.3552 25 | 0.666 mu_Ba -0.333 mu_Sn < -1.8396 26 | 1.000 mu_Ba < 0.0000 27 | 1.000 mu_Sn < 0.0000 28 | 1.000 mu_Ba > -11.4643 29 | 1.000 mu_Sn > -11.4643 30 | 31 | ********************************************************************************** 32 | 33 | Intersection points in chemical potential space: 34 | 35 | mu_Ba mu_Sn | mu_O = 36 | ----------------------|----------- 37 | -6.1767 -5.2876 | 0.0000 38 | -5.6610 -5.8032 | 0.0000 39 | -3.5329 0.0000 | -2.6438 40 | -2.7594 0.0000 | -2.9016 41 | 42 | ********************************************************************************** 43 | 44 | Competing phase 1 : BaO ( energy = -5.1387 ) 45 | ----------------------- 46 | 47 | Equation: 48 | 49 | 0.6667 mu_Ba - 0.3333 mu_Sn = -1.3173 50 | 51 | Relevant intersection points: 52 | 53 | None 54 | __________________________________________________________________________________ 55 | 56 | Competing phase 2 : SnO ( energy = -2.5396 ) 57 | ----------------------- 58 | 59 | Equation: 60 | 61 | -0.3333 mu_Ba + 0.6667 mu_Sn = 1.2818 62 | 63 | Relevant intersection points: 64 | 65 | None 66 | __________________________________________________________________________________ 67 | 68 | Competing phase 3 : SnO2 ( energy = -5.2876 ) 69 | ----------------------- 70 | 71 | Equation: 72 | 73 | -0.6667 mu_Ba + 0.3333 mu_Sn = 2.3552 74 | 75 | Relevant intersection points: 76 | 77 | mu_Ba mu_Sn | mu_O >= 78 | ----------------------|----------- 79 | -6.1767 -5.2876 | 0.0000 80 | -3.5329 0.0000 | -2.6438 81 | __________________________________________________________________________________ 82 | 83 | Competing phase 4 : Ba2SnO4 ( energy = -17.1253 ) 84 | ----------------------- 85 | 86 | Equation: 87 | 88 | 0.6667 mu_Ba - 0.3333 mu_Sn = -1.8396 89 | 90 | Relevant intersection points: 91 | 92 | mu_Ba mu_Sn | mu_O >= 93 | ----------------------|----------- 94 | -5.6610 -5.8032 | 0.0000 95 | -2.7594 0.0000 | -2.9016 96 | __________________________________________________________________________________ 97 | 98 | Limits from system : BaSnO3 ( energy = -11.4643 ) 99 | ----------------------- 100 | 101 | Equation: 102 | 103 | 1.0000 mu_Ba + 1.0000 mu_Sn = -11.4643 104 | 105 | Relevant intersection points: 106 | 107 | mu_Ba mu_Sn | mu_O >= 108 | ----------------------|----------- 109 | -6.1767 -5.2876 | 0.0000 110 | -5.6610 -5.8032 | 0.0000 111 | 112 | ********************************************************************************** 113 | -------------------------------------------------------------------------------- /SAMPLE_RESULTS: -------------------------------------------------------------------------------- 1 | ********************************************************************************** 2 | 3 | Results for system: 1 Ba 1 Sn 3 O 4 | 5 | Number of species: 3 6 | 7 | Number of competing phases: 3 8 | 9 | DATE: 24/ 4/2013 11:54: 5 10 | 11 | ********************************************************************************** 12 | 13 | Energy: -0.1146425300000E+02 eV 14 | 15 | Dependent variable: mu_O 16 | 17 | ********************************************************************************** 18 | 19 | Limiting inequalities: 20 | 21 | 1.000 mu_Ba 1.000 mu_Sn > -11.4643 22 | 0.666 mu_Ba -0.333 mu_Sn < -1.3172 23 | -0.333 mu_Ba 0.666 mu_Sn < 1.2818 24 | -0.666 mu_Ba 0.333 mu_Sn < 2.3552 25 | 1.000 mu_Ba < 0.0000 26 | 1.000 mu_Sn < 0.0000 27 | 1.000 mu_Ba > -11.4643 28 | 1.000 mu_Sn > -11.4643 29 | 30 | ********************************************************************************** 31 | 32 | Intersection points in chemical potential space: 33 | 34 | mu_Ba mu_Sn | mu_O = 35 | ----------------------|----------- 36 | -5.1387 -6.3256 | 0.0000 37 | -6.1766 -5.2876 | 0.0000 38 | -1.9759 0.0000 | -3.1628 39 | -3.5328 0.0000 | -2.6438 40 | 41 | ********************************************************************************** 42 | 43 | Competing phase 1 : BaO ( energy = -5.1387 ) 44 | ----------------------- 45 | 46 | Equation: 47 | 48 | 0.6667 mu_Ba - 0.3333 mu_Sn = -1.3172 49 | 50 | Relevant intersection points: 51 | 52 | mu_Ba mu_Sn | mu_O >= 53 | ----------------------|----------- 54 | -5.1387 -6.3256 | 0.0000 55 | -1.9759 0.0000 | -3.1628 56 | __________________________________________________________________________________ 57 | 58 | Competing phase 2 : SnO ( energy = -2.5396 ) 59 | ----------------------- 60 | 61 | Equation: 62 | 63 | -0.3333 mu_Ba + 0.6667 mu_Sn = 1.2818 64 | 65 | Relevant intersection points: 66 | 67 | None 68 | __________________________________________________________________________________ 69 | 70 | Competing phase 3 : SnO2 ( energy = -5.2876 ) 71 | ----------------------- 72 | 73 | Equation: 74 | 75 | -0.6667 mu_Ba + 0.3333 mu_Sn = 2.3552 76 | 77 | Relevant intersection points: 78 | 79 | mu_Ba mu_Sn | mu_O >= 80 | ----------------------|----------- 81 | -6.1766 -5.2876 | 0.0000 82 | -3.5328 0.0000 | -2.6438 83 | __________________________________________________________________________________ 84 | 85 | Limits from system : BaSnO3 ( energy = -11.4643 ) 86 | ----------------------- 87 | 88 | Equation: 89 | 90 | 1.0000 mu_Ba + 1.0000 mu_Sn = -11.4643 91 | 92 | Relevant intersection points: 93 | 94 | mu_Ba mu_Sn | mu_O >= 95 | ----------------------|----------- 96 | -5.1387 -6.3256 | 0.0000 97 | -6.1766 -5.2876 | 0.0000 98 | 99 | ********************************************************************************** 100 | --------------------------------------------------------------------------------