Page 1 of 2
					
				Jastrow optimisation, the default in 2.12
				Posted: Sun Sep 15, 2013 9:04 am
				by Philip_Hoggan
				Am applying CASINO to a 750 electron chunk of Cu(111)): a diatomic is adsorbed and the bond stretched. Correlation varies from init geom to stretched geom.
I optimised a Jastrow that is clearly not adequate, but the default option is much better for a small test system (CO). Now, I tried it as is for the whole chunk and there are over 4000 variable parameters. I'd like to take advantage of the approach and rationally select the parameters to optimise. How safe is it to truncate the polynomials sooner? Are there some parameters to exclude, at least initially from the vmc_opt step? Can I try keeping the same Jastrow data for copper and initialising the process from that ?
Another pb could be the copper pseudo, but its given reasonable results for copper surfaces in smaller systems.
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Mon Sep 16, 2013 1:50 pm
				by Mike Towler
				Hi Philip,
First of all, can you attach your Jastrow file for us to look at..?
Thanks,
Mike
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Mon Sep 16, 2013 8:00 pm
				by Philip_Hoggan
				Have emailed the original Jastrow Mike and would appreciate your advice.
Best,
Philip
MDT Edit: I've attached the file Philip sent me to this post.
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Tue Sep 17, 2013 4:51 pm
				by Mike Towler
				Hi Philip,
Your question seems to be based on a false premise; there are something like 45 optimizable parameters - not 4000 - in the correlation.data file that you sent to me. You are grouping the atoms into sets - and so the parameters for the atom-centred terms will be the same for all atoms in a given set. Having 45 parameters is not unreasonable. Are you thinking that different Cu atoms in the surface should actually belong to different sets, depending on their position relative to the adsorbate? If so, I wouldn't bother.
If you're having problems with the optimization, make sure (1) you're using enough configs and (2) you've got the atom labels in the different sets correct (I note that if you're absorbing a single diatomic onto a surface the labels for the adsorbate atoms don't look right to me.. but you've given me no information about the geometry. Is it a hetero- or homonuclear diatomic? How is it oriented?)
You don't tell me how you're trying to do the optimization either, but there are various other recent threads (and various sections of the manual) which give advice about optimization strategies. Note in particular that if you are just optimising a Jastrow factor and you have fixed the cutoff lengths, you can use opt_method=varmin_linjas - the optimised variance minimisation algorithm for the linear parameters in the Jastrow factor which is much faster than the other optimisation methods (I'm sure you know this..). 
If you really want to reduce the number of parameters, you might consider not using f terms - at least initially. These are expensive to evaluate (possibly even by far the rate-limiting step in large systems like this). Also you could just fix the cutoff lengths at their defaults.
Keeping the same Cu Jastrow terms you obtained for the bare copper slab would probably be a useful starting point, yes.
Mike
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Wed Sep 18, 2013 7:52 am
				by Philip_Hoggan
				Dear Mike,
Firstly, regarding the geometry, I copy co-ordinates below which I think show the atoms are numbered properly in the Jastrow of the above correlation.data file. The diatomic is H2. The Cell is an 'unfolded' 2 2 1 k-point grid, and I was warned to be careful about numbering in such a case by Dario Alfe, so hopefully there are no mistakes (it is written in cyclic order of co-ordinates, 16 Cu 2H atoms repeated four times)
Now to the remark about 4000 parameters. If you scrap the correlation.data then CASINO 2.12.1 provides a default Jastrow in parameter.casl. I tried using this in a small molecule (CO) and the vmc results were much more negative (than with the correlation.data I had optimised there). I decided to try that for my copper + H2 and THERE got a parameter.casl with 4400 variables.
So, if you check my suspect numbering for the correlation.data I think I'll just stick with that and try to get it optimised better. If the numbering has gone wrong, then I urgently need to learn how to rectify it in this and similar cases.
Atom Atno  Type  Position (fractional)            Position (Cartesian au)
 ------------------------------------------------------------------------------
    1  29   1     0.0000     0.0000     0.0000     0.0000     0.0000     0.0000
    2  29   1     0.5000     0.2887     0.0000     4.8238     0.0000     0.0000
    3  29   1    -0.2500     0.3557     0.0000    -2.4119     4.1776     0.0000
    4  29   1     0.2500     0.6443     0.0000     2.4119     4.1776     0.0000
    5  29   1     0.2500     0.3110    -0.1073     2.4119     1.3925    -3.8985
    6  29   1     0.7500     0.5997    -0.1073     7.2357     1.3925    -3.8985
    7  29   1     0.0000     0.6667    -0.1073     0.0000     5.5701    -3.8985
    8  29   1     0.5000     0.9553    -0.1073     4.8238     5.5701    -3.8985
    9  29   1     0.0000     0.3333    -0.2155     0.0000     2.7850    -7.8291
   10  29   1     0.5000     0.6220    -0.2155     4.8238     2.7850    -7.8291
   11  29   1    -0.2500     0.6890    -0.2155    -2.4119     6.9626    -7.8291
   12  29   1     0.2500     0.9777    -0.2155     2.4119     6.9626    -7.8291
   13  29   1     0.0000     0.0000    -0.3239     0.0000     0.0000   -11.7673
   14  29   1     0.5000     0.2887    -0.3239     4.8238     0.0000   -11.7673
   15  29   1    -0.2500     0.3557    -0.3239    -2.4119     4.1776   -11.7673
   16  29   1     0.2500     0.6443    -0.3239     2.4119     4.1776   -11.7673
   17   1   2     0.2500     0.2610     0.0605     2.4119     0.9751     2.1996
   18   1   2     0.2500     0.0276     0.0605     2.4119    -0.9751     2.1996
   19  29   1    -0.5000     0.7113     0.0000    -4.8238     8.3551     0.0000
   20  29   1    -0.0000     1.0000     0.0000    -0.0000     8.3551     0.0000
   21  29   1    -0.7500     1.0670     0.0000    -7.2357    12.5327     0.0000
   22  29   1    -0.2500     1.3557     0.0000    -2.4119    12.5327     0.0000
   23  29   1    -0.2500     1.0223    -0.1073    -2.4119     9.7476    -3.8985
   24  29   1     0.2500     1.3110    -0.1073     2.4119     9.7476    -3.8985
   25  29   1    -0.5000     1.3780    -0.1073    -4.8238    13.9252    -3.8985
   26  29   1    -0.0000     1.6667    -0.1073    -0.0000    13.9252    -3.8985
   27  29   1    -0.5000     1.0447    -0.2155    -4.8238    11.1402    -7.8291
   28  29   1    -0.0000     1.3333    -0.2155    -0.0000    11.1402    -7.8291
   29  29   1    -0.7500     1.4003    -0.2155    -7.2357    15.3177    -7.8291
   30  29   1    -0.2500     1.6890    -0.2155    -2.4119    15.3177    -7.8291
   31  29   1    -0.5000     0.7113    -0.3239    -4.8238     8.3551   -11.7673
   32  29   1    -0.0000     1.0000    -0.3239    -0.0000     8.3551   -11.7673
   33  29   1    -0.7500     1.0670    -0.3239    -7.2357    12.5327   -11.7673
   34  29   1    -0.2500     1.3557    -0.3239    -2.4119    12.5327   -11.7673
   35   1   2    -0.2500     0.9724     0.0605    -2.4119     9.3302     2.1996
   36   1   2    -0.2500     0.7390     0.0605    -2.4119     7.3800     2.1996
   37  29   1     1.0000     0.5774     0.0000     9.6475     0.0000     0.0000
   38  29   1     1.5000     0.8660     0.0000    14.4714     0.0000     0.0000
   39  29   1     0.7500     0.9330     0.0000     7.2356     4.1776     0.0000
   40  29   1     1.2500     1.2217     0.0000    12.0594     4.1776     0.0000
   41  29   1     1.2500     0.8884    -0.1073    12.0594     1.3925    -3.8985
   42  29   1     1.7500     1.1770    -0.1073    16.8833     1.3925    -3.8985
   43  29   1     1.0000     1.2440    -0.1073     9.6475     5.5701    -3.8985
   44  29   1     1.5000     1.5327    -0.1073    14.4714     5.5701    -3.8985
   45  29   1     1.0000     0.9107    -0.2155     9.6475     2.7850    -7.8291
   46  29   1     1.5000     1.1994    -0.2155    14.4714     2.7850    -7.8291
   47  29   1     0.7500     1.2663    -0.2155     7.2356     6.9626    -7.8291
   48  29   1     1.2500     1.5550    -0.2155    12.0594     6.9626    -7.8291
   49  29   1     1.0000     0.5774    -0.3239     9.6475     0.0000   -11.7673
   50  29   1     1.5000     0.8660    -0.3239    14.4714     0.0000   -11.7673
   51  29   1     0.7500     0.9330    -0.3239     7.2356     4.1776   -11.7673
   52  29   1     1.2500     1.2217    -0.3239    12.0594     4.1776   -11.7673
   53   1   2     1.2500     0.8384     0.0605    12.0594     0.9751     2.1996
   54   1   2     1.2500     0.6050     0.0605    12.0594    -0.9751     2.1996
   55  29   1     0.5000     1.2887     0.0000     4.8237     8.3551     0.0000
   56  29   1     1.0000     1.5773     0.0000     9.6475     8.3551     0.0000
   57  29   1     0.2500     1.6443     0.0000     2.4118    12.5327     0.0000
   58  29   1     0.7500     1.9330     0.0000     7.2356    12.5327     0.0000
   59  29   1     0.7500     1.5997    -0.1073     7.2356     9.7476    -3.8985
   60  29   1     1.2500     1.8884    -0.1073    12.0594     9.7476    -3.8985
   61  29   1     0.5000     1.9553    -0.1073     4.8237    13.9252    -3.8985
   62  29   1     1.0000     2.2440    -0.1073     9.6475    13.9252    -3.8985
   63  29   1     0.5000     1.6220    -0.2155     4.8237    11.1402    -7.8291
   64  29   1     1.0000     1.9107    -0.2155     9.6475    11.1402    -7.8291
   65  29   1     0.2500     1.9777    -0.2155     2.4118    15.3177    -7.8291
   66  29   1     0.7500     2.2663    -0.2155     7.2356    15.3177    -7.8291
   67  29   1     0.5000     1.2887    -0.3239     4.8237     8.3551   -11.7673
   68  29   1     1.0000     1.5773    -0.3239     9.6475     8.3551   -11.7673
   69  29   1     0.2500     1.6443    -0.3239     2.4118    12.5327   -11.7673
   70  29   1     0.7500     1.9330    -0.3239     7.2356    12.5327   -11.7673
   71   1   2     0.7500     1.5497     0.0605     7.2356     9.3302     2.1996
   72   1   2     0.7500     1.3163     0.0605     7.2356     7.3800     2.1996
 Crystal does not appear to have inversion symmetry
PS I'll also email the out that is not in a format you can upload.
Best,
Philip
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Wed Sep 18, 2013 8:22 am
				by Philip_Hoggan
				BY the way:
1-H2 is parallel to the surface.
2-the varmin_linjas seems to only take real wavefunctions and mine is complex.
Best,
Philip
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Wed Sep 18, 2013 4:36 pm
				by Mike Towler
				Hi Philip,
OK - the atoms are indeed numbered and grouped into sets correctly; you have four horizontal H2 molecules per cell in an asymmetric slab configuration. Fine.
OK - the 'default Jastrow' thing:
First of all, all the documentation and examples and summer schools refer to the 'standard Jastrow' used in CASINO for many years which is stored in the 
correlation.data file - this is currently considered the default for general use. 
The 
parameters.casl file refers to the new and quasi-undocumented 'general Jastrow factor'. Pablo has been developing this for years and shows no inclination for making it the default for general use (as far as I understand it because it's slower to evaluate in VMC/DMC and doesn't have full functionality). Making it the default should include documenting it in the manual and examples and so on, so it's probably a bit naughty of him to have it appear as a default if you specify 
use_jastrow = T in input and  don't supply a Jastrow of your own - I'll have him punished later.  

  Though of course if you're happy with it and understand what it is then go ahead (I put some disconnected documentation in 
doc/gjastrow_guide.pdf a while back).
Creating a 'default Jastrow file' in a large system like this using an automatic procedure can be problematic;  the process of grouping the parameters of atom-centred functions into sets presumably produces large numbers of different sets and vast numbers of parameters because the H atoms are at different distances from all the Cu atoms and there is bugger all symmetry. It's far more efficient to design your own default with the atom-centred parameters grouped into sensible sets. 
You are correct that varmin_linjas doesn't work for complex wave functions yet. It's definitely on the TODO list.. as this is his baby perhaps Neil could comment on the likelihood of this being done in the near future?
Mike
PS: you can attach anything to a forum post providing you gzip it first. The phpbb3 forum software seems to be allergic to text files for security reasons, and there doesn't appear to be an option for turning this off.
 
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Wed Sep 18, 2013 4:56 pm
				by Neil Drummond
				Dear Philip / Mike,
Varmin-linjas for complex wave functions is on my to-do list, although it's not likely to get done for a while.
Note that optimisation for complex wave functions is rarely needed. When twist averaging, the same Jastrow factor is normally used at all twists.  Hence one can perform the optimisation at a simulation-cell Bloch vector that permits a real wave function, and then use that Jastrow factor at all twists.
Best wishes,
Neil.
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Wed Sep 18, 2013 8:11 pm
				by Philip_Hoggan
				Dear Mike and Neil,
Many thanks for the helpful information.
Now (maybe particularly to Neil) I've been using varmin_linjas today on the real wave-function obtained by defining a single k-point at the gamma point. 
I'd hoped you could then use the results in the correlation.data file for the 2 2 1 grid. Is this likely to be the case or do I need to do exactly what Neil describes?
Needless to say, there's a big finite size effect problem with these copper surfaces and I estimate that the 2 2 1 grid has 1/25 the error due to this of the single k-point. Basically, I need to do as big a grid as will fit. The 2 2 1 here gets you a complex wave-function (no inversion).
Best,
Philip
			 
			
					
				Re: Jastrow optimisation, the default in 2.12
				Posted: Fri Sep 20, 2013 2:02 pm
				by Neil Drummond
				Dear Philip,
I suggest using a 2x2x1 grid with inversion symmetry, which will allow a real wave function, for the optimisation of the Jastrow factor.  You can then use that Jastrow factor for all offsets to your 2x2x1 grid of k vectors.
Best wishes,
Neil.