diff -u pyoz-0.2.3/_features.txt pyoz-0.3/_features.txt --- pyoz-0.2.3/_features.txt 2009-07-29 10:00:10.000000000 +0200 +++ pyoz-0.3/_features.txt 2009-08-12 14:09:09.000000000 +0200 @@ -1,14 +1,13 @@ list of features of pyOZ ======================== -released: 29. July 2009 -version: 0.2.3 - +released: 12. August 2009 +version: 0.3 * general features o bulk calculations for simple atomic/ionic systems (no atomic details in molecules and molecular ions) on McMillan-Mayer level o simple iteration scheme (direct Picard iteration) - o (not available at the moment) improved iteration scheme (Newton-Raphson/conjugate gradients) for HNC closure + o improved iteration scheme (Newton-Raphson/conjugate gradients) o graphics output using Matplotlib * supported closure relations o Hypernetted Chain (HNC) @@ -30,4 +29,3 @@ o partial structure factors S(k) o pair potentials U(r) o total interaction potential - U(r) + indirect correlation function - diff -u pyoz-0.2.3/_notes.txt pyoz-0.3/_notes.txt --- pyoz-0.2.3/_notes.txt 2009-07-29 10:00:21.000000000 +0200 +++ pyoz-0.3/_notes.txt 2009-08-12 14:40:09.000000000 +0200 @@ -1,9 +1,8 @@ release notes for pyOZ ====================== -released: 29. July 2009 -version: 0.2.3 -... +released: 12. August 2009 +version: 0.3 check the website http://pyoz.vrbka.net @@ -13,24 +12,34 @@ - theory -changes from the previous release (0.2.2) +changes from the previous release (0.2.3) - improved readability of the main code - bugfixes - output of partial structure factors S(k) + - newton-raphson/conjugate gradients algorithm reenabled + +!!! IMPORTANT !!! + the convergence of the NR/CG algorithm is heavily dependent on + the quality of the involved operators and their adjoints + + particularly in the very beginning, when the linear approximation + to the problem is not very good, the algorithm frequently fails + to converge and switches to the classical picard scheme +!!! IMPORTANT !!! revisions/descriptions of individual source files - changed files denoted with star (*) -pyoz.py ........................................... 0.1.7* +pyoz.py ........................................... 0.1.8* main program pyoz_closure.py ................................... 0.1.1 definition of closures -pyoz_const.py ..................................... 0.1.6* +pyoz_const.py ..................................... 0.1.6 definition of constants pyoz_dft.py ....................................... 0.1.4 definition of fourier transforms -pyoz_input.py ..................................... 0.1.8* +pyoz_input.py ..................................... 0.1.9* handling of input pyoz_misc.py ...................................... 0.1.3 miscellanous routines @@ -40,6 +49,6 @@ definition and handling of pair potentials pyoz_property.py .................................. 0.1.5 evaluation of thermodynamic properties -pyoz_solver.py .................................... 0.1.2* +pyoz_solver.py .................................... 0.1.2 optimized solvers for special cases diff -u pyoz-0.2.3/pyoz_const.py pyoz-0.3/pyoz_const.py --- pyoz-0.2.3/pyoz_const.py 2009-07-29 10:03:35.000000000 +0200 +++ pyoz-0.3/pyoz_const.py 2009-08-12 14:12:38.000000000 +0200 @@ -15,7 +15,7 @@ from math import sqrt, pi from scipy import inf -pyoz_version = "0.2.3" +pyoz_version = "0.3" class const: """ diff -u pyoz-0.2.3/pyoz_input.py pyoz-0.3/pyoz_input.py --- pyoz-0.2.3/pyoz_input.py 2009-08-04 16:51:51.000000000 +0200 +++ pyoz-0.3/pyoz_input.py 2009-08-12 14:46:37.000000000 +0200 @@ -8,7 +8,7 @@ """ Module with functions for input file parsing -revision of this file: 0.1.8 +revision of this file: 0.1.9 """ # import external modules @@ -354,8 +354,8 @@ raise badValue((i, "only positive dsqn values are allowed")) elif (match(r'use_nr$', keyword)): do_nr = True - print("NR/CG method has been disabled in this version due to severe problems!") - sys.exit(1) + #print("NR/CG method has been disabled in this version due to severe problems!") + #sys.exit(1) elif (match(r'nr_mix_param$', keyword)): nr_mix_param = float((l.split())[1]) if ((nr_mix_param < 0) or (nr_mix_param > 1)): @@ -438,6 +438,7 @@ ctrl['nr_noconv_incr'] = nr_noconv_incr if (ctrl['do_nr']): print("\n\tNewton-Raphson iteration method will be used") + print("\tsupport of Newton-Raphson is highly experimental!") print("\tNR max iterations\t\t%lu" % ctrl['nr_max_iter']) print("\tNR initial mix parameter\t%e" % ctrl['nr_mix_param']) print("\tNR relative convergence factor\t%e" % ctrl['nr_convergence_factor']) @@ -596,12 +597,6 @@ sys.exit(1) # end if (closure_name in supported_closures) - # newton-raphson can be used only with the HNC closure! - if (ctrl['do_nr'] and syst['closure_name'] != 'hnc'): - #print("\tillegal combination of Newton-Raphson and closure (only HNC supported!)") - print("\tsupport of Newton-Raphson with PY closure is highly experimental!") - #sys.exit(1) - # names of the constituents # if not given, use A, B, ... syst['name'] = name_value diff -u pyoz-0.2.3/pyoz.py pyoz-0.3/pyoz.py --- pyoz-0.2.3/pyoz.py 2009-07-28 15:24:12.000000000 +0200 +++ pyoz-0.3/pyoz.py 2009-08-12 13:56:16.000000000 +0200 @@ -9,7 +9,7 @@ """ Program for numerical solution of the Ornstein-Zernike equation version of the program is defined in pyoz_const.py -revision of this file: 0.1.7 +revision of this file: 0.1.8 check the file _features.txt and website http://pyoz.vrbka.net for further information @@ -492,7 +492,14 @@ # the operator works with the matrix CF, set according to the used closure for i in range(syst['ncomponents']): for j in range(syst['ncomponents']): - Rq[i,j] = dft.dfbt(Rcur[i,j])[0] + # even though R is r-space function, we are using the inverse FT here + # the definition of the adjoint requires its usage here! + # the problem is also the normalization sqrt(rho_i rho_j) that would be applied + # incorrectly in case normal FT would be used here + # note that the sinus transform is the same in r- and k-spaces => the difference really + # lies in the normalization + #Rq[i,j] = dft.dfbt(Rcur[i,j])[0] + Rq[i,j] = dft.idfbt(Rcur[i,j]) # matricial product for dr in range(ctrl['npoints']): @@ -500,8 +507,15 @@ for i in range(syst['ncomponents']): for j in range(syst['ncomponents']): + # even though SRS is k-space function, we are using the forward FT here + # the definition of the adjoint requires its usage here! + # the problem is also the normalization sqrt(rho_i rho_j) that would be applied + # incorrectly in case iFT would be used here + # note that the sinus transform is the same in r- and k-spaces => the difference really + # lies in the normalization # remember that FT returns 2 functions in this case - SRSq[i,j] = dft.idfbt(SRS[i,j]) + #SRSq[i,j] = dft.idfbt(SRS[i,j]) + SRSq[i,j] = dft.dfbt(SRS[i,j])[0] # not a matricial product! AtR = Rcur - SRSq*CF Only in pyoz-0.3: tests