<html><head><meta http-equiv="content-type" content="text/html; charset=GB2312"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 10.5pt; font-family: ΢ÈíÑźÚ; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">Dear Paolo,</span><span></span></div><div><div> I am afraid the potinit.f90 initializes the potential by calling subroutine "v_of_rho" at very beginning of a calculation. However, I want to calculate the potential by new charge density <font color="#ff0000">in every SCF loop</font>, |i> changes with the iterations, but the array psi_m(r)*psi_n(r) is fixed. so I focus on the electron.f90 and modified the subroutine "sum_band". <font color="#ff0000">I am not sure the correct place to add the additional term of charge density</font>. I have some puzzle as mentioned in the previous email:</div><div><br></div><div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"> (1)The subroutine <i>symrho</i> is marked as "<span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">symmetrize rho(G)", what does the "symmetrize charge density in G space' mean? and what's its consequence? Should I add the term before this symmetrization process or after it?</span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> (2)I add the code after line 443 in subroutine "sum_band" in QE(v5.1) as follow, ( the band index of |m> and |n> are (nbnd -level_ccmg1) and (nbnd-level_ccmg2), respectively. )</span></div></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-family: '΢ÈíÑźÚ, Tahoma';">IF (loc_ccmg) THEN<br> !<br> !<br> IF ( nks > 1 ) REWIND( iunigk )<br> ik_ccmg = 1<br> !<br> IF (lsda) current_spin = isk(ik_ccmg)<br> npw = ngk(ik_ccmg)<br> w1_ccmg = 2.0 / omega<br> !<br> IF (nks > 1) THEN<br> READ( iunigk) igk<br> CALL get_buffer(evc, nwordwfc, iunwfc, ik_ccmg) ! copy evc(1:nwordwfc) from the ik-th record in file with a unit of iunwfc, i.e. wavefucntion<br> END IF<br> !<br> IF (nkb > 0) CALL init_us_2(npw, igk, xk(1, ik_ccmg), vkb)<br> !<br> IF (noncolin) THEN<br> !<br> ELSE<br> IF ( io_wave_ccmg == 'write' ) THEN<br> psic(:) = (0.D0, 0.D0)<br> psic(nls(igk(1:npw))) = evc(1:npw, nbnd-level_ccmg1) + &<br> (0.D0, 1.D0) * evc(1:npw, nbnd -level_ccmg2)<br> psic(nlsm(igk(1:npw))) = CONJG(evc(1:npw, nbnd -level_ccmg1) - &<br> (0.D0, 1.D0) * evc(1:npw, nbnd -level_ccmg2))<br> CALL invfft('Wave', psic, dffts)<br> CALL get_rho_gamma_ccmg(rho_r_ccmg(:,current_spin), dffts % nnr, psic, w1_ccmg)<br> END IF<br> ENDIF ! noncolinear or colinear<br> ENDIF ! loc_ccmg or not<br> !<br> IF (loc_ccmg) THEN<br> IF (noncolin) THEN<br> ! the case of noncolinear has not been supported so far, remaining further work.<br> ELSE<br> IF ( io_wave_ccmg == 'write' ) THEN<br> CALL MPI_COMM_RANK(MPI_COMM_WORLD, myid_ccmg, ierr_ccmg)<br> WRITE( file_ccmg,'(I4)') myid_ccmg<br> file_ccmg = TRIM(ADJUSTL(file_ccmg))<br> file_ccmg = 'wave_ccmg/'//'rho'//TRIM(file_ccmg)//'.dat'<br> OPEN(unit = 12306, file = file_ccmg)<br> DO ig = 1, size(rho_r_ccmg,1)<br> WRITE(12306,*) rho_r_ccmg(ig,current_spin)<br> END DO<br> CLOSE(12306)<br> END IF<br> ! if reading wavefunction.<br> IF ( io_wave_ccmg == 'read' ) THEN<br> CALL MPI_COMM_RANK(MPI_COMM_WORLD, myid_ccmg, ierr_ccmg)<br> WRITE( file_ccmg,'(I4)') myid_ccmg<br> file_ccmg = TRIM(ADJUSTL(file_ccmg))<br> file_ccmg = 'wave_ccmg/'//'rho'//TRIM(file_ccmg)//'.dat'<br> INQUIRE(file = file_ccmg, exist = alive_ccmg )<br> IF ( alive_ccmg == .false. ) CALL errore( 'sum_band', 'rho.dat does not exsit!', 1 )<br> OPEN(unit = 12306, file = file_ccmg)<br> DO ig = 1, size(rho_r_ccmg,1)<br> READ(12306,*) rho_r_ccmg(ig,current_spin)<br> END DO<br> CLOSE(12306)<br> rho%of_r(:, current_spin)=rho%of_r(:, current_spin)+rho_r_ccmg(:,current_spin)<br> END IF<br> ENDIF ! noncolinear or colinear<br> ENDIF ! loc_ccmg or not<br> !</span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> Is the place correct?</span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">Jiqiang</span></div><div style="font-family: ΢ÈíÑźÚ, Tahoma;"><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span></div><div></div><blockquote><div> </div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0cm 0cm;"><div style="padding: 8px; font-size: 12px; font-family: tahoma; background-color: rgb(239, 239, 239);"><div><b>From:</b> <a href="mailto:p.giannozzi@gmail.com">Paolo Giannozzi</a></div><div><b>Date:</b> 2015-06-12 04:21</div><div><b>To:</b> <a href="mailto:jqli14@fudan.edu.cn">Jiqiang Li</a></div><div><b>Subject:</b> Re: About charge density</div></div></div><div><div class="FoxDiv20150613162702537112"><div dir="ltr">On Thu, Jun 11, 2015 at 5:49 PM, Jiqiang Li <span dir="ltr"><<a href="mailto:jqli14@fudan.edu.cn" target="_blank">jqli14@fudan.edu.cn</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"> <br><blockquote class="gmail_quote" style="margin-right: 0px; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><blockquote><blockquote> (3) Actually I want to realize these process: First I run a whole ordinary SCF calculation and at the end output the wavefunction on the disk. Then I run another new SCF calculation, but in this new calculation <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> a new charge density, rho_new = rho + <m|n> = \sum_i(occupation) { <i|i>} + <m|n>, is treated as input charge density in SCF loop . The term <m|n> is fixed as a constant array read from disk in every SCF loop. So Where should I add the code to realize rho_new=rho + <m|n> ?</span></blockquote></blockquote></blockquote><div> <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br>In subroutine PW/src/potinit.f90, which either reads from file or generates the starting charge <br>density (not the potential, actually: it is computed at the end by calling routine "v_of_rho").<br>You might also use routine </span>"plugin_scf_potential" to add your preferred term to the charge density.<br><br></div><div>Paolo<br></div></div><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><font color="#888888">Paolo Giannozzi, Dept. Chemistry&Physics&Environment,<br>Univ. Udine, via delle Scienze 208, 33100 Udine, Italy<br>hone <a href="tel:%2B39-0432-558216" value="+390432558216" target="_blank">+39-0432-558216</a>, fax <a href="tel:%2B39-0432-558222" value="+390432558222" target="_blank">+39-0432-558222</a></font></div></div></div></div></div></div></blockquote></div><hr style="width: 210px; height: 1px; display: none;" color="#b5c4df" size="1" align="left">
<div><span></span></div>
</body></html>