Molcas Forum

Support and discussions for Molcas and OpenMolcas users and developers

You are not logged in.

Announcement

Welcome to the Molcas forum.

Please note: The forum's URL has changed. The new URL is: https://molcasforum.univie.ac.at. Please update your bookmarks!

You can choose an avatar and change the default style by going to "Profile" → "Personality" or "Display".

#1 2024-04-16 14:18:04

Lorenz
Member
Registered: 2024-04-16
Posts: 4

Processing .molden file

Hi all,
I am trying to use the molden files generated by molcas for further calculations. I am currently using N2 as a trial molecule.

Now there appears to be a bit of an issue with the transformation of the molcas output into the .molden file.

If I compare my n2.log output and my n2.scf.molden output file I see there are slightly different molecular orbital energies. If I export the molden file and read it into pyscf and recalculate the RHF energy through integral summation it is only accurat (compared to the .log energy) up untill the fourth digit after the decimal point. This is usually fine because it (barely) is below chemical accuracy, but I would prefere to get my molecular orbitals from open molcas as exact as possible.

From the n2.log file:
          Orbital            1             2              3             4            5             6             7            8             9            10   
          Energy          -15.8272  -15.8270   -1.0835   -0.9742   -0.4613   -0.3904   -0.3904   -0.0944   -0.0944    0.0132
          Occ. No.          2.0000    2.0000      2.0000     2.0000    2.0000    2.0000     2.0000    0.0000    0.0000    0.0000

From the n2.scf.molden file:

[MO]
Sym=     1a 
Ene=   -15.8270
Spin= Alpha
Occup=    2.00000

Sym=     2a 
Ene=   -15.8270
Spin= Alpha
Occup=    2.00000

Sym=     3a 
Ene=    -1.0835
Spin= Alpha
Occup=    2.00000

etc. (some of the MO energies match and some difer in the fourth digit after the decimal point)

Since the coefficients also get changed in their ordering from the .log file to the .molden file (apparently in the .molden file the basis sets are orderd differently) I assume it might have something to do with this coefficient matrix transformation. But I would be happy if someone knows more about it.



For reference:
------------------ n2.xyz
2

N 0 0 0
N 0 0 2.094

------------------- n2.inp
&GATEWAY
  COORD = n2.xyz
  BASIS = cc-pVDZ
  GROUP = C1

&SEWARD
  CHOLesky

&SCF
  SPIN   = 1
  CHARGE = 0
  CHOLesky

Offline

#2 2024-04-17 08:19:23

Ignacio
Administrator
From: Uppsala
Registered: 2015-11-03
Posts: 1,011

Re: Processing .molden file

It seems the molden files are created not from the raw data in memory (or in the RunFile), but from the data in the ScfOrb file. In turn, the energies in the ScfOrb file are written with just 5 significant figures (-1.5827E+01). On the other hand, the coefficients have 15 significant figures. If you need more precise energies, use the scf.h5 file.

Offline

#3 2024-04-17 08:36:34

Lorenz
Member
Registered: 2024-04-16
Posts: 4

Re: Processing .molden file

Dear Ignacio,

Thank you for your quick reply!

I am not as much out for the MO energies as for the coefficients. I only startet comparing the MO energies of the .molden file with the .log file, when the RHF energy I was calculating from the coefficients (through plain integral summation) was not exactly the same as the one in my .log file (differing on the 5th digit behind the decimal).

I think the difference in the MO energies in the .molden file (e.g. 0.0002 Hartree and therfore not a rounding issue) is symptomatic and shows that the coefficients are also not exported correctly. Do you have a better idea on how to creat a .molden file?

In the mean time I will have a look at the scf.h5 file and see if I could use that instead, but the .molden file would be preferd as it is easier to import to other QC programs.

Offline

#4 2024-04-17 09:34:02

Ignacio
Administrator
From: Uppsala
Registered: 2015-11-03
Posts: 1,011

Re: Processing .molden file

I don't think there's any additional degradation in the coefficients (but I could be wrong). Note that the use of Cholesky-decomposed two-electron integrals changes the total energy.

Offline

#5 2024-04-17 10:13:39

Lorenz
Member
Registered: 2024-04-16
Posts: 4

Re: Processing .molden file

Dear Ignacio, you are absolutely right!

After consulting the .ScfOrb file I see that what I initially thought could not be a rounding issue [difference in the MO energies in the .molden file (e.g. 0.0002 Hartree and therfore not a rounding issue) is symptomatic] is not a rounding issue after all. The energies in the .ScfOrb file are only given in a certain 4 digits after the decimal E+ form leading to the difference between -1.5827 E+1 => -15.8270 and the true energy -15.8272.

The coefficients also appear to be correctly imported from the .ScfOrb file into the .molden file, although they are rounded to the 8th digit after the decimal which is unfortunately not exact enough for me (RHF energy from those coefficients only exact to 4th digit after decimal).

Therfore oh wise one: Is there maybe a keyword in Molcas to omit the rounding and to export the coefficients as exactly as possible into the .molden file? angel

This would solve all my problems big_smile

If there is no such keyword I would be interested in where the coefficients for the primitives in the molden file get imported from, as the coefficients in the .h5 file are less accurate then in the molden file and there is no information about the primitives in the .ScfOrb file. I am tinkering on a script which writes a molden output utilising the MO coefficients from the .h5 file (important to include permutations) and I would like to include the primitive coefficients as exactly as possible as well. But ofcourse it would be easier if there would be a keyword in molcas to increase the number of digits when exporting to the molden file.

E.g.
---------------------- n2.scf.h5
PRIMITIVES               Dataset {72, 2}
    Data:
         9046, 0.0007, 1357, 0.005389, 309.3, 0.027406, 87.73, 0.103207, 28.56, 0.278723, 10.21, 0.44854, 3.838, 0.278238, 0.7466,
         0.01544, 0.2248, -0.002864, 9046, -0.000153, 1357, -0.001208, 309.3, -0.005992, 87.73, -0.024544, 28.56, -0.067459, 10.21,
         -0.158078, 3.838, -0.121831, 0.7466, 0.549003, 0.2248, 0.578815, 9046, 0, 1357, 0, 309.3, 0, 87.73, 0, 28.56, 0, 10.21, 0,
         3.838, 0, 0.7466, 0, 0.2248, 1, 13.55, 0.039919, 2.917, 0.217169, 0.7973, 0.510319, 0.2185, 0.462214, 13.55, 0, 2.917, 0,
         0.7973, 0, 0.2185, 1, 0.817, 1, 9046, 0.0007, 1357, 0.005389, 309.3, 0.027406, 87.73, 0.103207, 28.56, 0.278723, 10.21,
         0.44854, 3.838, 0.278238, 0.7466, 0.01544, 0.2248, -0.002864, 9046, -0.000153, 1357, -0.001208, 309.3, -0.005992, 87.73,
         -0.024544, 28.56, -0.067459, 10.21, -0.158078, 3.838, -0.121831, 0.7466, 0.549003, 0.2248, 0.578815, 9046, 0, 1357, 0,
         309.3, 0, 87.73, 0, 28.56, 0, 10.21, 0, 3.838, 0, 0.7466, 0, 0.2248, 1, 13.55, 0.039919, 2.917, 0.217169, 0.7973, 0.510319,
         0.2185, 0.462214, 13.55, 0, 2.917, 0, 0.7973, 0, 0.2185, 1, 0.817, 1


----------------------- n2.scf.molden (information which gets rounded in the .h5 file in red)
[GTO] (AU)
   1
   s   9
  9.046000000E+03  7.000000346E-04
  1.357000000E+03  5.389000266E-03
  3.093000000E+02  2.740600135E-02
  8.773000000E+01  1.032070051E-01
  2.856000000E+01  2.787230138E-01
  1.021000000E+01  4.485400222E-01
  3.838000000E+00  2.782380137E-01
  7.466000000E-01   1.544000076E-02
  2.248000000E-01  -2.864000141E-03
   s   9
  9.046000000E+03 -1.529999886E-04
  1.357000000E+03 -1.207999910E-03
  3.093000000E+02 -5.991999553E-03
  8.773000000E+01 -2.454399817E-02
  2.856000000E+01 -6.745899497E-02
  1.021000000E+01 -1.580779882E-01
  3.838000000E+00 -1.218309909E-01
  7.466000000E-01  5.490029590E-01
  2.248000000E-01  5.788149568E-0

Last edited by Lorenz (2024-04-17 13:03:21)

Offline

#6 2024-04-17 14:26:10

Ignacio
Administrator
From: Uppsala
Registered: 2015-11-03
Posts: 1,011

Re: Processing .molden file

I don't think there's such an option. But I beileve what you think are rounding issues in the h5 file are just the opposite (finite precision errors) in the molden file. The cc-pVDZ coefficients are defined in the basis set file as:

  0.0007000000 -0.0001530000  0.0000000000
  0.0053890000 -0.0012080000  0.0000000000
  0.0274060000 -0.0059920000  0.0000000000
  0.1032070000 -0.0245440000  0.0000000000
  0.2787230000 -0.0674590000  0.0000000000
  0.4485400000 -0.1580780000  0.0000000000
  0.2782380000 -0.1218310000  0.0000000000
  0.0154400000  0.5490030000  0.0000000000
 -0.0028640000  0.5788150000  1.0000000000

and as far as I can see, those agree (to numerical precision) with the numbers stored in the h5 file.

Offline

#7 2024-04-17 14:38:22

Lorenz
Member
Registered: 2024-04-16
Posts: 4

Re: Processing .molden file

That is very good news! I did not even check the basis set files of molcas yet. Now I should be able to write a script to export all the information from a .h5 file into a .molden file including the MO coefficients with higher precision.

Thank you very much for your help!

Offline

#8 2024-04-19 02:24:20

jxzou
Member
Registered: 2020-09-11
Posts: 7

Re: Processing .molden file

Hi, you can use the `molden2fch` and `bas_fch2py`utilities in the open source package MOKIT (https://gitlab.com/jxzou/mokit). Assuming we have a file named h2o.molden generated by (Open)Molcas, we can run the following commands

molden2fch h2o.molden -molcas
bas_fch2py h2o.fch

This will generate the file h2o.py, which is just PySCF input script. This script includes Cartesian coordinates, basis set data and keywords of reading MOs from h2o.fch. The molden file generated by other quantum chemistry packages (ORCA, Turbomole, CFOUR v2.1) are also supported. But note that these molden formats do not obey the same basis function conventions (this is why `-orca` is required for molden2fch). Hope this will do some help.

Offline

Board footer

Powered by FluxBB 1.5.11

Last refresh: Today 11:44:16