[ase-users] Constraints using Espresso

Christoph Wolf wolf.christoph at qns.science
Thu Feb 20 05:19:02 CET 2020


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-0001.html>


More information about the ase-users mailing list