[ase-users] Feature request: copy() method for a vasp calculator object

Ask Hjorth Larsen asklarsen at gmail.com
Mon Jan 15 17:01:30 CET 2018


Hi,

A copy() method would be assumed to copy the exact state of the calculator,
which is not desirable. If we want a shortcut it could be calc.new().

I usually also use a dictionary to instantiate multiple calculators, if not
a small function.

Best regards
Ask


El 15 ene. 2018 2:25 p. m., "Tom Daff via ase-users" <
ase-users at listserv.fysik.dtu.dk> escribió:

Hi Protik,

I'm assuming that even copy.deepcopy() is useless for this?

To get around having to list all the parameters several times, you can
put them in a dict and unpack that as the arguments:


    vasp_params = {
        'prec': 'Accurate',
        'pp': 'pbe',
        ...
    }

    calc = Vasp(**vasp_params)


Tom


On 13/01/18 01:54, Protik Das via ase-users wrote:
> Hi all,
>
> Sometimes I use a vasp calculator object more than once using a loop. It
> is suggested to create a new calculator object each time. Like this,
> often with a long list of input parameters:
>
> from ase.calculators.vasp import Vasp
>
> kpt = 8
>
> for structure in structure_list:
>
>      calc = Vasp(prec = 'Accurate',
>             pp = 'pbe',
>             istart=0,
>             ismear=0,
>             sigma=0.05,
>             lcharg=False,
>             lwave=False,
>             lreal = False,
>             lorbit=11,
>             ispin=2,
>             encut = 400,
>             algo='Normal',
>             nelm=200,
>             ediff=1e-6,
>             ibrion=-1,
>             nsw=0,
>             nelmin=4,
>             ediffg=-0.01,
>             kpts = [kpt,kpt,kpt],
>             gamma=True)
>
>     structure.set_calculator(calc)
>
>     # do something
>
> It would be a nice if a calculator object could be copied using copy()
> method. Then it would be simpler to use a calculator object more than
> once. Like:
>
> from ase.calculators.vasp import Vasp
>
> kpt=8
>
> calc = Vasp(prec = 'Accurate',
>             pp = 'pbe',
>             istart=0,
>             ismear=0,
>             sigma=0.05,
>             lcharg=False,
>             lwave=False,
>             lreal = False,
>             lorbit=11,
>             ispin=2,
>             encut = 400,
>             algo='Normal',
>             nelm=200,
>             ediff=1e-6,
>             ibrion=-1,
>             nsw=0,
>             nelmin=4,
>             ediffg=-0.01,
>             kpts = [kpt,kpt,kpt],
>             gamma=True)
>
>
> for structure in structure_list:
>
>     calc_this = calc.copy()
>
>     structure.set_calculator(calc_this)
>
>     # do something
>
>
> Feedback regarding the request is appreciated.
>
> Thanks.
>
> --
> Protik Das,
> ECE Graduate Student,
> LATTE (http://latte.ece.ucr.edu <http://latte.ee.ucr.edu/>),
> University of California, Riverside.
>
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
_______________________________________________
ase-users mailing list
ase-users at listserv.fysik.dtu.dk
https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20180115/6d9baca1/attachment.html>


More information about the ase-users mailing list