[ase-users] Constraints using Espresso

Maxime Van den Bossche maxime.cp.vandenbossche at gmail.com
Thu Feb 20 13:37:09 CET 2020


Hi Christoph,

Indeed, the source of your issue does not lie in the Espresso calculator
but in the process of adding the two Atoms objects together. It looks like
the resulting object only gets the constraints of the left hand side object
('LL' in your case) and not of the other ('RL'), see also:
https://wiki.fysik.dtu.dk/ase/ase/atoms.html#ase.Atoms.extend

There has been a merge request some years ago to improve this (
https://gitlab.com/ase/ase/-/merge_requests/404), but I suppose it got
closed because it was difficult to implement this addition in a
sufficiently general way.

So it seems you will need to redefine the constraints on the "structure"
object after adding "LL+RL" together.

Best,
Maxime



> Message: 3
> Date: Thu, 20 Feb 2020 13:19:02 +0900
> From: Christoph Wolf <wolf.christoph at qns.science>
> To: ase-users <ase-users at listserv.fysik.dtu.dk>
> Subject: Re: [ase-users] Constraints using Espresso
> Message-ID:
>         <
> CAMC_G_5fonh1zUYkxe8RmNCw-J3VLrdCG_j1XY6WpK54V2c7xQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Dear all,
>
> thank you for your replies. After playing around a bit it seems to me that
> the issue arises when I copy atoms over, i.e. when I create everything
> "from scratch" the constraints usually apply.
>
> #!/usr/bin/env python3.6
> import ase
> import ase.db
> from ase.io import *
> import numpy as np
> from ase.constraints import FixAtoms
>
> alat=20
>
> LL = ase.Atoms('Ag', pbc=(0, 0, 0))
>
> LL.center(vacuum=1, axis=0)
> LL.center(vacuum=7.5, axis=(1, 2))
> LL*= (3, 1, 1)
> LL.translate([0,0,0])
> c = FixAtoms(indices=[atom.index for atom in LL if atom.symbol == 'Ag'])
> print("found %s instances to freeze" %(np.array2string(c.index)))
> LL.set_constraint(c)
>
>
> RL=LL.copy()
> RL.rotate(180,'y', center = (alat/2.0,   7.5,   7.5))
> c = FixAtoms(indices=[atom.index for atom in RL if atom.symbol == 'Ag'])
> print("found %s instances to freeze" %(np.array2string(c.index)))
> RL.set_constraint(c)
>
> structure=LL+RL
> structure.set_cell([alat,12,12])
> write("test.in", structure, format='espresso-in')
>
> the resulting constraints only apply to LL but not RL
>
> ATOMIC_POSITIONS angstrom
> Ag 1.0000000000 7.5000000000 7.5000000000  0 0 0
> Ag 3.0000000000 7.5000000000 7.5000000000  0 0 0
> Ag 5.0000000000 7.5000000000 7.5000000000  0 0 0
> Ag 19.0000000000 7.5000000000 7.5000000000
> Ag 17.0000000000 7.5000000000 7.5000000000
> Ag 15.0000000000 7.5000000000 7.5000000000
>
> Thank you for your help and with best wishes,
> Chris
>
>
> --
> Postdoctoral Researcher
> Center for Quantum Nanoscience, Institute for Basic Science
> Ewha Womans University, Seoul, South Korea
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200220/1eb14fa5/attachment.html
> >
>
> ------------------------------
>
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
> End of ase-users Digest, Vol 140, Issue 12
> ******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20200220/c687de5d/attachment.html>


More information about the ase-users mailing list