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

Tom Daff tdd20 at cam.ac.uk
Mon Jan 15 14:24:42 CET 2018


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
> 


More information about the ase-users mailing list