From 34dce5e161c5539604e437e046d50c2ff626c480 Mon Sep 17 00:00:00 2001 From: Lorenzo Tenti Date: Mon, 14 Mar 2016 17:32:20 +0100 Subject: [PATCH] Now print_mo works with the new version of Molden, loc_cele fixed. --- config/ifort.cfg | 2 +- configure | 6 + ocaml/qp_edit.ml | 36 ++-- plugins/Molden/print_mo.irp.f | 6 +- plugins/loc_cele/loc.f | 4 +- plugins/loc_cele/loc_cele.irp.f | 336 ++++++++++++++++++++++++-------- 6 files changed, 288 insertions(+), 102 deletions(-) diff --git a/config/ifort.cfg b/config/ifort.cfg index cc848cba..5653ff1c 100644 --- a/config/ifort.cfg +++ b/config/ifort.cfg @@ -31,7 +31,7 @@ OPENMP : 1 ; Append OpenMP flags # -ftz : Flushes denormal results to zero # [OPT] -FCFLAGS : -xHost -O2 -ip -ftz -g +FCFLAGS : -O2 -xHost -ip -ftz # Profiling flags ################# diff --git a/configure b/configure index b5c46269..4e5f3732 100755 --- a/configure +++ b/configure @@ -251,6 +251,12 @@ def checking(d_dependency): except (OSError,subprocess.CalledProcessError): default_path = d_info[binary].default_path + if binary == 'f77zmq': + print ' ------------------- ' + print ' ------------------- ' + print default_path + print ' ------------------- ' + print ' ------------------- ' if os.path.exists(default_path): return default_path else: diff --git a/ocaml/qp_edit.ml b/ocaml/qp_edit.ml index 53e3ea59..05a442e4 100644 --- a/ocaml/qp_edit.ml +++ b/ocaml/qp_edit.ml @@ -17,12 +17,12 @@ type keyword = | Electrons | Mo_basis | Nuclei -| Hartree_fock -| Pseudo | Integrals_bielec +| Determinants | Perturbation | Properties -| Determinants +| Hartree_fock +| Pseudo ;; @@ -32,12 +32,12 @@ let keyword_to_string = function | Electrons -> "Electrons" | Mo_basis -> "MO basis" | Nuclei -> "Molecule" -| Hartree_fock -> "Hartree_fock" -| Pseudo -> "Pseudo" | Integrals_bielec -> "Integrals_bielec" +| Determinants -> "Determinants" | Perturbation -> "Perturbation" | Properties -> "Properties" -| Determinants -> "Determinants" +| Hartree_fock -> "Hartree_fock" +| Pseudo -> "Pseudo" ;; @@ -86,18 +86,18 @@ let get s = f Ao_basis.(read, to_rst) | Determinants_by_hand -> f Determinants_by_hand.(read, to_rst) - | Hartree_fock -> - f Hartree_fock.(read, to_rst) - | Pseudo -> - f Pseudo.(read, to_rst) | Integrals_bielec -> f Integrals_bielec.(read, to_rst) + | Determinants -> + f Determinants.(read, to_rst) | Perturbation -> f Perturbation.(read, to_rst) | Properties -> f Properties.(read, to_rst) - | Determinants -> - f Determinants.(read, to_rst) + | Hartree_fock -> + f Hartree_fock.(read, to_rst) + | Pseudo -> + f Pseudo.(read, to_rst) end with | Sys_error msg -> (Printf.eprintf "Info: %s\n%!" msg ; "") @@ -135,12 +135,12 @@ let set str s = in let open Input in match s with - | Hartree_fock -> write Hartree_fock.(of_rst, write) s - | Pseudo -> write Pseudo.(of_rst, write) s | Integrals_bielec -> write Integrals_bielec.(of_rst, write) s + | Determinants -> write Determinants.(of_rst, write) s | Perturbation -> write Perturbation.(of_rst, write) s | Properties -> write Properties.(of_rst, write) s - | Determinants -> write Determinants.(of_rst, write) s + | Hartree_fock -> write Hartree_fock.(of_rst, write) s + | Pseudo -> write Pseudo.(of_rst, write) s | Electrons -> write Electrons.(of_rst, write) s | Determinants_by_hand -> write Determinants_by_hand.(of_rst, write) s | Nuclei -> write Nuclei.(of_rst, write) s @@ -188,12 +188,12 @@ let run check_only ezfio_filename = Nuclei ; Ao_basis; Electrons ; - Hartree_fock ; - Pseudo ; Integrals_bielec ; + Determinants ; Perturbation ; Properties ; - Determinants ; + Hartree_fock ; + Pseudo ; Mo_basis; Determinants_by_hand ; ] diff --git a/plugins/Molden/print_mo.irp.f b/plugins/Molden/print_mo.irp.f index b147fe50..6ac51bdb 100644 --- a/plugins/Molden/print_mo.irp.f +++ b/plugins/Molden/print_mo.irp.f @@ -104,6 +104,8 @@ subroutine write_Ao_basis(i_unit_output) write(i_unit_output,*)'' write(i_unit_output,'(A47,2X,I3)')'TOTAL NUMBER OF BASIS SET SHELLS =', i_shell write(i_unit_output,'(A47,2X,I3)')'NUMBER OF CARTESIAN GAUSSIAN BASIS FUNCTIONS =', ao_num +! this is for the new version of molden + write(i_unit_output,'(A12)')'PP =NONE' write(i_unit_output,*)'' @@ -126,7 +128,9 @@ subroutine write_Mo_basis(i_unit_output) write(i_unit_output,'(18X,F8.5)')-1.d0 write(i_unit_output,*)'' do i = 1, ao_num - write(i_unit_output,'(2X,I3, 2X A1, I3, 2X A4 , F9.6)')i,trim(element_name(int(nucl_charge(ao_nucl(i))))),ao_nucl(i),(ao_l_char_space(i)),mo_coef(i,j) +! write(i_unit_output,'(2X,I3, 2X A1, I3, 2X A4 , F9.6)')i,trim(element_name(int(nucl_charge(ao_nucl(i))))),ao_nucl(i),(ao_l_char_space(i)),mo_coef(i,j) +! F12.6 for larger coefficients... + write(i_unit_output,'(2X,I3, 2X A1, I3, 2X A4 , F12.6)')i,trim(element_name(int(nucl_charge(ao_nucl(i))))),ao_nucl(i),(ao_l_char_space(i)),mo_coef(i,j) ! write(i_unit_output,'(I3, X A1, X I3, X A4 X F16.8)')i,trim(element_name(int(nucl_charge(ao_nucl(i))))),ao_nucl(i),(ao_l_char_space(i)) enddo write(i_unit_output,*)'' diff --git a/plugins/loc_cele/loc.f b/plugins/loc_cele/loc.f index e2439b7f..edc3aa7a 100644 --- a/plugins/loc_cele/loc.f +++ b/plugins/loc_cele/loc.f @@ -17,9 +17,11 @@ C data small/1.d-6/ zprt=.true. - niter=100 + niter=1000000 conv=1.d-8 +C niter=1000000 +C conv=1.d-6 write (6,5) n,m,conv 5 format (//5x,'Unitary transformation of',i3,' vectors'/ * 5x,'following the principle of maximum overlap with a set of', diff --git a/plugins/loc_cele/loc_cele.irp.f b/plugins/loc_cele/loc_cele.irp.f index 12f90b64..3c42517a 100644 --- a/plugins/loc_cele/loc_cele.irp.f +++ b/plugins/loc_cele/loc_cele.irp.f @@ -92,21 +92,250 @@ - nrot(1) = 6 ! number of orbitals to be localized + nrot(1) = 64 ! number of orbitals to be localized integer :: index_rot(1000,1) cmoref = 0.d0 + irot = 0 + +! H2 molecule for the mixed localization + do i=1,64 + irot(i,1) = i+2 + enddo + + do i=1,17 + cmoref(i+1,i,1)=1.d0 + enddo + cmoref(19,19-1,1)=1.d0 + cmoref(20,19-1,1)=-1.d0 + cmoref(19,20-1,1)=-1.d0 + cmoref(20,20-1,1)=-1.d0 + cmoref(21,20-1,1)=2.d0 + cmoref(22,21-1,1)=1.d0 + cmoref(23,22-1,1)=1.d0 + cmoref(24,23-1,1)=1.d0 + + + cmoref(25,24-1,1)=1.d0 + cmoref(26,24-1,1)=-1.d0 + cmoref(25,25-1,1)=-1.d0 + cmoref(26,25-1,1)=-1.d0 + cmoref(27,25-1,1)=2.d0 + cmoref(28,26-1,1)=1.d0 + cmoref(29,27-1,1)=1.d0 + cmoref(30,28-1,1)=1.d0 + + cmoref(31,29-1,1)=1.d0 + cmoref(32,29-1,1)=-1.d0 + cmoref(31,30-1,1)=-1.d0 + cmoref(32,30-1,1)=-1.d0 + cmoref(33,30-1,1)=2.d0 + cmoref(34,31-1,1)=1.d0 + cmoref(35,32-1,1)=1.d0 + cmoref(36,33-1,1)=1.d0 + + do i=33,49 + cmoref(i+5,i,1)= 1.d0 + enddo + + cmoref(55,52-2,1)=1.d0 + cmoref(56,52-2,1)=-1.d0 + cmoref(55,53-2,1)=-1.d0 + cmoref(56,53-2,1)=-1.d0 + cmoref(57,53-2,1)=2.d0 + cmoref(58,54-2,1)=1.d0 + cmoref(59,55-2,1)=1.d0 + cmoref(60,56-2,1)=1.d0 + + cmoref(61,57-2,1)=1.d0 + cmoref(62,57-2,1)=-1.d0 + cmoref(61,58-2,1)=-1.d0 + cmoref(62,58-2,1)=-1.d0 + cmoref(63,58-2,1)=2.d0 + cmoref(64,59-2,1)=1.d0 + cmoref(65,60-2,1)=1.d0 + cmoref(66,61-2,1)=1.d0 + + cmoref(67,62-2,1)=1.d0 + cmoref(68,62-2,1)=-1.d0 + cmoref(67,63-2,1)=-1.d0 + cmoref(68,63-2,1)=-1.d0 + cmoref(69,63-2,1)=2.d0 + cmoref(70,64-2,1)=1.d0 + cmoref(71,65-2,1)=1.d0 + cmoref(72,66-2,1)=1.d0 +! H2 molecule +! do i=1,66 +! irot(i,1) = i +! enddo +! +! do i=1,18 +! cmoref(i,i,1)=1.d0 +! enddo +! cmoref(19,19,1)=1.d0 +! cmoref(20,19,1)=-1.d0 +! cmoref(19,20,1)=-1.d0 +! cmoref(20,20,1)=-1.d0 +! cmoref(21,20,1)=2.d0 +! cmoref(22,21,1)=1.d0 +! cmoref(23,22,1)=1.d0 +! cmoref(24,23,1)=1.d0 +! +! +! cmoref(25,24,1)=1.d0 +! cmoref(26,24,1)=-1.d0 +! cmoref(25,25,1)=-1.d0 +! cmoref(26,25,1)=-1.d0 +! cmoref(27,25,1)=2.d0 +! cmoref(28,26,1)=1.d0 +! cmoref(29,27,1)=1.d0 +! cmoref(30,28,1)=1.d0 +! +! cmoref(31,29,1)=1.d0 +! cmoref(32,29,1)=-1.d0 +! cmoref(31,30,1)=-1.d0 +! cmoref(32,30,1)=-1.d0 +! cmoref(33,30,1)=2.d0 +! cmoref(34,31,1)=1.d0 +! cmoref(35,32,1)=1.d0 +! cmoref(36,33,1)=1.d0 +! +! do i=34,51 +! cmoref(i+3,i,1)= 1.d0 +! enddo +! +! cmoref(55,52,1)=1.d0 +! cmoref(56,52,1)=-1.d0 +! cmoref(55,53,1)=-1.d0 +! cmoref(56,53,1)=-1.d0 +! cmoref(57,53,1)=2.d0 +! cmoref(58,54,1)=1.d0 +! cmoref(59,55,1)=1.d0 +! cmoref(60,56,1)=1.d0 +! +! cmoref(61,57,1)=1.d0 +! cmoref(62,57,1)=-1.d0 +! cmoref(61,58,1)=-1.d0 +! cmoref(62,58,1)=-1.d0 +! cmoref(63,58,1)=2.d0 +! cmoref(64,59,1)=1.d0 +! cmoref(65,60,1)=1.d0 +! cmoref(66,61,1)=1.d0 +! +! cmoref(67,62,1)=1.d0 +! cmoref(68,62,1)=-1.d0 +! cmoref(67,63,1)=-1.d0 +! cmoref(68,63,1)=-1.d0 +! cmoref(69,63,1)=2.d0 +! cmoref(70,64,1)=1.d0 +! cmoref(71,65,1)=1.d0 +! cmoref(72,66,1)=1.d0 +! H atom +! do i=1,33 +! irot(i,1) = i +! enddo +! +! do i=1,18 +! cmoref(i,i,1)=1.d0 +! enddo +! cmoref(19,19,1)=1.d0 +! cmoref(20,19,1)=-1.d0 +! cmoref(19,20,1)=-1.d0 +! cmoref(20,20,1)=-1.d0 +! cmoref(21,20,1)=2.d0 +! cmoref(22,21,1)=1.d0 +! cmoref(23,22,1)=1.d0 +! cmoref(24,23,1)=1.d0 + + +! cmoref(25,24,1)=1.d0 +! cmoref(26,24,1)=-1.d0 +! cmoref(25,25,1)=-1.d0 +! cmoref(26,25,1)=-1.d0 +! cmoref(27,25,1)=2.d0 +! cmoref(28,26,1)=1.d0 +! cmoref(29,27,1)=1.d0 +! cmoref(30,28,1)=1.d0 +! +! cmoref(31,29,1)=1.d0 +! cmoref(32,29,1)=-1.d0 +! cmoref(31,30,1)=-1.d0 +! cmoref(32,30,1)=-1.d0 +! cmoref(33,30,1)=2.d0 +! cmoref(34,31,1)=1.d0 +! cmoref(35,32,1)=1.d0 +! cmoref(36,33,1)=1.d0 ! Definition of the index of the MO to be rotated - irot(1,1) = 20 ! the first mo to be rotated is the 19 th MO - irot(2,1) = 21 ! the first mo to be rotated is the 20 th MO - irot(3,1) = 22 ! etc.... - irot(4,1) = 23 ! - irot(5,1) = 24 ! - irot(6,1) = 25 ! +! irot(2,1) = 21 ! the first mo to be rotated is the 21 th MO +! irot(3,1) = 22 ! etc.... +! irot(4,1) = 23 ! +! irot(5,1) = 24 ! +! irot(6,1) = 25 ! + +!N2 +! irot(1,1) = 5 +! irot(2,1) = 6 +! irot(3,1) = 7 +! irot(4,1) = 8 +! irot(5,1) = 9 +! irot(6,1) = 10 +! +! cmoref(5,1,1) = 1.d0 ! +! cmoref(6,2,1) = 1.d0 ! +! cmoref(7,3,1) = 1.d0 ! +! cmoref(40,4,1) = 1.d0 ! +! cmoref(41,5,1) = 1.d0 ! +! cmoref(42,6,1) = 1.d0 ! +!END N2 + +!HEXATRIENE +! irot(1,1) = 20 +! irot(2,1) = 21 +! irot(3,1) = 22 +! irot(4,1) = 23 +! irot(5,1) = 24 +! irot(6,1) = 25 +! +! cmoref(7,1,1) = 1.d0 ! +! cmoref(26,1,1) = 1.d0 ! +! cmoref(45,2,1) = 1.d0 ! +! cmoref(64,2,1) = 1.d0 ! +! cmoref(83,3,1) = 1.d0 ! +! cmoref(102,3,1) = 1.d0 ! +! cmoref(7,4,1) = 1.d0 ! +! cmoref(26,4,1) = -1.d0 ! +! cmoref(45,5,1) = 1.d0 ! +! cmoref(64,5,1) = -1.d0 ! +! cmoref(83,6,1) = 1.d0 ! +! cmoref(102,6,1) = -1.d0 ! +!END HEXATRIENE + +!!!!H2 H2 CAS +! irot(1,1) = 1 +! irot(2,1) = 2 +! +! cmoref(1,1,1) = 1.d0 +! cmoref(37,2,1) = 1.d0 +!END H2 +!!!! LOCALIZATION ON THE BASIS FUNCTIONS +! do i = 1, nrot(1) +! irot(i,1) = i +! cmoref(i,i,1) = 1.d0 +! enddo + +!END BASISLOC + +! do i = 1, nrot(1) +! irot(i,1) = 4+i +! enddo + do i = 1, nrot(1) + print*,'irot(i,1) = ',irot(i,1) + enddo +! pause ! you define the guess vectors that you want ! the new MO to be close to @@ -120,68 +349,22 @@ ! own guess vectors for the MOs ! The new MOs are provided in output ! in the same order than the guess MOs - cmoref(3,1,1) = 1.d0 ! - cmoref(12,1,1) = 1.d0 ! - - cmoref(21,2,1) = 1.d0 ! - cmoref(30,2,1) = 1.d0 ! - - cmoref(39,3,1) = 1.d0 ! - cmoref(48,3,1) = 1.d0 ! - - cmoref(3,4,1) = 1.d0 ! - cmoref(12,4,1) =-1.d0 ! - - cmoref(21,5,1) = 1.d0 ! - cmoref(30,5,1) =-1.d0 ! - - cmoref(39,6,1) = 1.d0 ! - cmoref(48,6,1) =-1.d0 ! +! do i = 1, nrot(1) +! j = 5+(i-1)*15 +! cmoref(j,i,1) = 0.2d0 +! cmoref(j+3,i,1) = 0.12d0 +! print*,'j = ',j +! enddo +! pause print*,'passed the definition of the referent vectors ' - !Building the S (overlap) matrix in the AO basis. - - - - do isym=1,nsym - - if (nrot(isym).eq.0) cycle - - do i=1,ao_num - - s(i,i,isym)=1.d0 - - do j=1,ao_num - - if (i.ne.j) s(i,j,isym)=0.d0 - - ddum(i,j)=0.d0 - - do k=1,nmo(isym) - - ddum(i,j)=ddum(i,j)+cmo(i,k,isym)*cmo(j,k,isym) - - enddo - + do i = 1, ao_num + do j =1, ao_num + s(i,j,1) = ao_overlap(i,j) enddo - - enddo - - call dgesv(ao_num,ao_num,ddum,id1,ipiv,s(1,1,isym),id1,info) - - if (info.ne.0) then - - write (6,*) 'Something wrong in dgsev',isym - - stop - - endif - - - enddo @@ -219,20 +402,13 @@ ! do i=1,nmo(isym) - do i=1,ao_num - do j=1,nrot(isym) - - ddum(i,j)=0.d0 - - do k=1,ao_num - - ddum(i,j)=ddum(i,j)+s(i,k,isym)*cmo(k,irot(j,isym),isym) - - enddo - - enddo - + do i=1,ao_num + ddum(i,j)=0.d0 + do k=1,ao_num + ddum(i,j)=ddum(i,j)+s(i,k,isym)*cmo(k,irot(j,isym),isym) + enddo + enddo enddo @@ -262,7 +438,7 @@ do i=1,nrot(isym) do j=1,ao_num - write (6,*) 'isym,',isym,nrot(isym),nmo(isym) +! write (6,*) 'isym,',isym,nrot(isym),nmo(isym) newcmo(j,irot(i,isym),isym)=0.d0 do k=1,nrot(isym) newcmo(j,irot(i,isym),isym)=newcmo(j,irot(i,isym),isym) + cmo(j,irot(k,isym),isym)*t(k,i) @@ -280,7 +456,7 @@ enddo !big loop over symmetry - 10 format (4E20.12) + 10 format (4E18.12) ! Now we copyt the newcmo into the mo_coef @@ -293,9 +469,7 @@ enddo enddo enddo -! if(dabs(newcmo(3,19,1) - mo_coef(3,19)) .gt.1.d-10 )then - print*,'mo_coef(3,19)',mo_coef(3,19) - pause +! pause ! we say that it hase been touched, and valid and that everything that