CP2K/ASE vibration analysis question

511 views
Skip to first unread message

Chanwoo Noh

unread,
Oct 3, 2016, 10:23:16 PM10/3/16
to cp2k
Dear all,

I have some question about using ASE tools for CP2K.
I want to perform the vibration analysis using ASE interface, because some of the atoms of my system should be constrained.
If some atoms are constrained, then normal CP2K calculation does not create the output file of .mol. (https://groups.google.com/forum/#!searchin/cp2k/vibration$20%7Csort:relevance/cp2k/vS_s3781V4g/_aryuXQrDAAJ)
In this link, S Ling suggested to use the  CP2K/ASE interface in this situation.

When I follow the tutorial (https://wiki.fysik.dtu.dk/ase/ase/vibrations/vibrations.html?highlight=vibration), calculating vibrational normal modes function, Vibrations() works.
However, when I use the Infrared() function, following error message occurs.

  File "test.py", line 75, in <module>
    main()
  File "test.py", line 72, in main
    ir.run()
  File "/home/chanwoo/PROGRAM/ASE/ase/ase/vibrations/vibrations.py", line 129, in run
    self.calculate(filename, fd)
  File "/home/chanwoo/PROGRAM/ASE/ase/ase/vibrations/vibrations.py", line 146, in calculate
    dipole = self.calc.get_dipole_moment(self.atoms)
  File "/home/chanwoo/PROGRAM/ASE/ase/ase/calculators/calculator.py", line 361, in get_dipole_moment
    return self.get_property('dipole', atoms)
  File "/home/chanwoo/PROGRAM/ASE/ase/ase/calculators/calculator.py", line 374, in get_property
    raise NotImplementedError
NotImplementedError

I think that a dipole moment of molecules is needed when IR intensity is calculated, but the CP2K/ASE interface doesn't support the dipole moment calculation.
Is there any method to implement the Infrared function?
I would appreciate for any suggestions and comments.

The python script for calculating normal modes is as follows.

test.py

#!/usr/bin/python
from __future__ import division, print_function
import os

from ase.structure import molecule
from ase.optimize import BFGS
from ase.calculators.cp2k import CP2K
from ase.vibrations import Vibrations
from ase.vibrations import Infrared

inp="""
&FORCE_EVAL
    METHOD Quickstep
    &DFT
        &PRINT
            &MOMENTS
                PERIODIC    FALSE
            &END
        &END

        BASIS_SET_FILE_NAME BASIS_MOLOPT
        POTENTIAL_FILE_NAME GTH_POTENTIALS
        &MGRID
            CUTOFF 400
        &END MGRID
        &XC
            &XC_FUNCTIONAL PBE
            &END XC_FUNCTIONAL
        &END XC
        &POISSON
            PERIODIC NONE
            PSOLVER MT
        &END POISSON
    &END DFT
    &SUBSYS
        &KIND O 
            BASIS_SET DZVP-MOLOPT-SR-GTH
            POTENTIAL GTH-PBE-q6
        &END KIND

        &KIND H
            BASIS_SET DZVP-MOLOPT-SR-GTH
            POTENTIAL GTH-PBE-q1
        &END KIND
    &END SUBSYS
&END FORCE_EVAL
"""

def main():
    calc = CP2K(basis_set=None,
            basis_set_file=None,
            max_scf=None,
            charge=None,
            cutoff=None,
            force_eval_method=None,
            potential_file=None,
            poisson_solver=None,
            pseudo_potential=None,
            stress_tensor=False,
            uks=None,
            xc=None,
            label='test_H2O_GOPT', inp=inp)
    h2o = molecule('H2O', calculator = calc)
    h2o.center(vacuum=2.0)
    BFGS(h2o).run()
    print(h2o.get_potential_energy())
    vib = Vibrations(h2o)
    vib.run()
    vib.summary()
    ir = Infrared(h2o)
    ir.run()
    ir.summary()

main()

test.py

Ole Schütt

unread,
Oct 5, 2016, 7:42:09 AM10/5/16
to cp...@googlegroups.com
Dear Chanwoo,

adding support for get_dipole_moment() to the ASE Calculator is probably
rather straightforward. While I would be happy to do the python part,
I'm not quite sure how things work on the CP2K side. Therefore, I would
suggest you to first try to figuring out why CP2K does not print the
molden output in the first place:


https://github.com/cp2k/cp2k/blob/master/cp2k/src/motion/vibrational_analysis.F#L454

Cheers,
Ole

On 2016-10-04 04:23, Chanwoo Noh wrote:
> Dear all,
>
> I have some question about using ASE tools for CP2K.
> I want to perform the vibration analysis using ASE interface, because
> some of the atoms of my system should be constrained.
> If some atoms are constrained, then normal CP2K calculation does not
> create the output file of .mol.
> (https://groups.google.com/forum/#!searchin/cp2k/vibration$20%7Csort:relevance/cp2k/vS_s3781V4g/_aryuXQrDAAJ
> [1])
> In this link, S Ling suggested to use the  CP2K/ASE interface in this
> situation.
>
> When I follow the tutorial
> (https://wiki.fysik.dtu.dk/ase/ase/vibrations/vibrations.html?highlight=vibration
> [2]), calculating vibrational normal modes function, Vibrations()
> TEST.PY
> --
> You received this message because you are subscribed to the Google
> Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to cp2k+uns...@googlegroups.com.
> To post to this group, send email to cp...@googlegroups.com.
> Visit this group at https://groups.google.com/group/cp2k [3].
> For more options, visit https://groups.google.com/d/optout [4].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/forum/#!searchin/cp2k/vibration$20%7Csort:relevance/cp2k/vS_s3781V4g/_aryuXQrDAAJ
> [2]
> https://wiki.fysik.dtu.dk/ase/ase/vibrations/vibrations.html?highlight=vibration
> [3] https://groups.google.com/group/cp2k
> [4] https://groups.google.com/d/optout

Chanwoo Noh

unread,
Oct 5, 2016, 8:21:48 PM10/5/16
to cp2k
Dear Ole,

I really thank you for your suggestion.
As you mentioned, I will try to figure out the reason that cp2k does not print the molden output.
If I find it, I will post the result on this board.

Chanwoo

Iain Bethune

unread,
Oct 26, 2016, 10:06:17 AM10/26/16
to cp...@googlegroups.com
Dear Chanwoo, all,

Support for molden output from vibrational analysis with fixed atoms has just been added in r17502 - please try it out and let me know if you run into problems. Thanks to Tobi Kraemer for pointing this out in the first place and for some testing!

- Iain

--

Iain Bethune
Project Manager, EPCC

Email: ibet...@epcc.ed.ac.uk
Twitter: @IainBethune @PrimeGrid @CP2Kproject
Web: http://www2.epcc.ed.ac.uk/~ibethune
Tel/Fax: +44 (0)131 650 5201/6555
Mob: +44 (0)7598317015
Addr: 2404 JCMB, The King's Buildings, Peter Guthrie Tait Road, Edinburgh, EH9 3FD
> --
> You received this message because you are subscribed to the Google Groups "cp2k" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+uns...@googlegroups.com.
> To post to this group, send email to cp...@googlegroups.com.
> Visit this group at https://groups.google.com/group/cp2k.
> For more options, visit https://groups.google.com/d/optout.


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

Chanwoo Noh

unread,
Oct 26, 2016, 8:39:36 PM10/26/16
to cp2k
Dear Iain Bethune

I really thanks to you and Tobi Kraemer for the support.
I would try it out, and I will report if there is some problems.

Chanwoo 
Reply all
Reply to author
Forward
0 new messages