Importing data set problem for calculating HF energies

11 views
Skip to first unread message

Dibyandu Sardar

unread,
Aug 17, 2021, 11:12:45 AM8/17/21
to molpro-user
Dear Molpro User,

I am new in Molpro. I want to calculate energy for HF calculation of CaF-CaF for some random set of data points in jacobi coordinates. We have generated 100 random set data points for r13, r24, R, theta1, theta2, phi. Finally, we want to calculate HF energy for these 100 sets of  r13, r24, R, theta1, theta2, phi.
But, we don't know how to import these data to my molpro code of CaF-CaF. Here, I am sending my data set and molpro code for CaF-CaF system.
If you kindly help or suggest about our present problem, we will be thankful to you.

We will be waiting for your reply.

Regards
Dibyendu Sardar
University of Colorado, Boulder, USA


CaF-CaF-ecp.inp
caf-caf-lhs100.csv

Peterson, Kirk

unread,
Aug 17, 2021, 11:24:32 AM8/17/21
to Dibyandu Sardar, molpro-user

Dear Dibyendu,

 

the easiest (to me) is just to transpose your .csv data and paste the values as arrays into your molpro input, e.g.,

 

r13 = [4.184 3.512 ....]

r24 = [3.928 4.856 ...]

 

etc.

 

then do a single do loop indexed by the number of array elements in, e.g., r13.  Make sure in your geometry block you specify array elements, e.g., r13(i), assuming "i" is your do loop index.

 

regards, -Kirk

--
You received this message because you are subscribed to the Google Groups "molpro-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to molpro-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/molpro-user/e17cae32-c173-4ca4-8201-4bd4c643c98bn%40googlegroups.com.

Dibyandu Sardar

unread,
Aug 17, 2021, 12:05:05 PM8/17/21
to Peterson, Kirk, molpro-user
Respecter Kirk,
Ok I got your point and it will true for small set of data. But, If I try for a 1000 set of data then I have to take 1000 points for r13(say). And I have to manually write 1000 data for each parameter r13, r24, R, theta1, theta2, phi in six times. Probably, it will create a bigger molpro input file. Would there be any problem with that? Or otherwise how we will able to solve this problem?

Regards
Dibyendu

Jacky LIEVIN

unread,
Aug 18, 2021, 4:46:23 AM8/18/21
to molpro-user, Dibyandu Sardar
Dear Dibyendu,

In order to implement Kirk’s solution, you can use a short fortran program like this:
        program import
        dimension r12(100),r24(100),R(100),theta1(100)
     $            ,theta2(100),phi(100)

        do i=1,10
        read*,k,r12(i),r24(i),R(i),theta1(i),theta2(i),phi(i)
        enddo

        print 10,(r12(i),i=1,10)
        print 11,(r24(i),i=1,10)
        print 12,(R(i),i=1,10)
        print 13,(theta1(i),i=1,10)
        print 14,(theta2(i),i=1,10)
        print 15,(phi(i),i=1,10)
 10     format("r13=[",10f8.3,"]")
 11     format("r24=[",10f8.3,"]")
 12     format("R=[",10f8.3,"]")
 13     format("theta1=[",10f8.3,"]")
 14     format("theta2=[",10f8.3,"]")
 15     format("phi=[",10f8.3,"]")

        end

It reads the ten first input line of your data set and provides the corresponding input for Molpro, to be inserted just after the basis set input.

r13=[   4.184   3.512   2.136   4.760   2.904   4.408   4.344   1.976   3.832   2.552]
r24=[   3.928   4.856   4.120   3.224   4.920   3.576   2.424   3.448   3.384   1.880]
R=[  15.155  19.405   4.615  14.815  10.225  15.835  11.415  11.925  17.025   4.445]
theta1=[ 137.700   0.900 121.500 110.700 134.100 103.500 130.500 175.500  47.700 153.900]
theta2=[  69.300  80.100  33.300  62.100 152.100  49.500  90.900  36.900 144.900  42.300]
phi=[  81.450  33.750  23.850  49.950  22.050  44.550  61.650  13.050  75.150  15.750]

The next lines of the input defining the loop should be:

do i=1,10
geom={
Ca
X    1  cmca*r13(i)
X    2  R(i)      1   theta1(i)
F    2  cmf*r13(i)   3   180-theta1(i)  1  180.
Ca   3  cmca*r24(i)  2   180-theta2(i)  1  phi(i)
F    3  cmf*r24(i)   2   theta2(i)      4  phi(i)
}

{hf;wf,38,1,0}c
e_hf(i)=energy(1)
enddo

table,r13,r24,R,theta1,theta2,phi,e_hf

Note that the geometry input is inserted within the loop with indexed geometry variables.

Please also note that a molpro input line is limited to 256 character. You can split each entry in several lines, with a \ at the end of each line, but the concatenated lines cannot exceed 1024 characters.
So, if you want to run the calculation with a large number of points in a single job, it will be necessary to adapt the fortran program for splitting the arrays in several blocks. For instance for blocks of 20, the input should be:
r13( 1:20) = [ … … . . .]
r13(21:40)= [ … … . . .]  and so on

best wishes,

Jacky




Peterson, Kirk

unread,
Aug 18, 2021, 10:20:41 AM8/18/21
to Dibyandu Sardar, molpr...@googlegroups.com

Dear Dibyendu,

 

Dr Lievin's post is certainly the most elegant way to accomplish what you need to do.  In regard to why your input only calculates the first point is because you've incorrectly specified the beginning of your do loop.  The loop can only run over the length of one array (which is ok since your arrays are all the same length).  Hence just use:

 

do i=1,#r13

 

you could also avoid pasting the output from Jacky's program into your input by instead using an "include" statement before your do loop begins in order to insert an external file containing your array definitions.

 

regards,

 

-Kirk

 

From: Dibyandu Sardar <chem.dibya...@gmail.com>
Date: Tuesday, August 17, 2021 at 9:21 PM
To: "Peterson, Kirk" <kipe...@wsu.edu>
Subject: Re: [molpro-user] Importing data set problem for calculating HF energies

 

Respected Kirk

I have run the molpro code for two set of data. I have made a single do loop that you have mentioned. But, I found that molpro calculates energy only for the first set of data. However, molpro does not calculate energy for 2nd set of data and shows energy zero. I could not understand the error. Why does molpro not calculate data for the second set of parameters r13, r24, R, theta1, theta2, phi? Probably, there may be an error in the loop or anything else !

Here, I am sharing my input file, output file and data file. If you see the data file will find that the energy become zero for second set of data in all cases.

 

Please see and help us to overcome the problems.

 

Dibyendu

 



--

Dibyendu

Peterson, Kirk

unread,
Aug 19, 2021, 1:59:42 AM8/19/21
to Dibyandu Sardar, guitar...@gmail.com, 'Peterson, Kirk' via molpro-user

Hi,

 

I think you need to spend some time with the molpro manual.  The code that Dr. Lievin shared was an external Fortran code, not a snippet of molpro input.  For instance there is no dimension statement in a molpro input.  Plus look up how the include statement works in the manual. I think you have all the pieces and advice you need at this point, you just have to read up a bit and implement accordingly.

 

regards,  -Kirk

 

From: Dibyandu Sardar <chem.dibya...@gmail.com>
Date: Wednesday, August 18, 2021 at 8:18 AM
To: "Peterson, Kirk" <kipe...@wsu.edu>, "guitar...@gmail.com" <guitar...@gmail.com>
Subject: Re: [molpro-user] Importing data set problem for calculating HF energies

 

Respected Kirk

Respected Lievin

 

I have tried to make a final code incorporating the Lievin programme with the original molpro code and I have also mentioned the "include" statement as mentioned by Kirk before defining the do loop of read statement from an external file.

I am afraid whether this code will run or not. Besides, in this code we have not mentioned the external file name for reading.

Therefore, it is my kind request to both of you, if you kindly go through my attached code and mention the errors if present, I will be thankful to you.

 

regards



--

Dibyendu

Jacky Liévin

unread,
Aug 19, 2021, 4:23:35 AM8/19/21
to molpro-user

Dear Dibyandu,

As Dr Peterson said, you must first compile and execute the fortran code (you certainly have a compiler installed on your system, ifort, pgf ...) to generate the file to be included by means of the "include" command in the molpro input. 
Note that the program doesn't read  the first line of your data file. You can of course adapt the dimensions to your needs and recompile.

Best,

Jacky
Reply all
Reply to author
Forward
0 new messages