Fix atoms in StructureData

Hello everyone,

I’m creating several surface structures to be calculated with AiiDA-VASP. First, I create all structures with ASE and use the FixAtoms class to fix the bottom layers of my slab. Then I transform these ASE Atoms structures into a list of StructureData as input for my WorkChain. However, when I look at the generated POSCAR in the remote computer I noticed that it did not fix the atoms. What is the proper way to do this?

Thanks in advance!
Thiago

Hi Thiago!

Currently the StructureData doesn’t store such calculation settings, so the ASE constraints aren’t transferred initializing them from the ASE Atoms.

I’ve never run any calculations with aiida-vasp, but it seems there is an input for setting selective dynamics on the VaspCalculation:

This is subsequently passed to the PoscarParser class:

I played around with the PoscarParser a bit, and you can indeed pass selective dynamics to the parser via the options argument as a list of lists. See the following minimal example:

from ase import Atoms
from ase.constraints import FixAtoms

from aiida import orm, load_profile
from aiida_vasp.parsers.content_parsers.poscar import PoscarParser

load_profile()

d = 2.9
L = 10.0

atoms = Atoms(
    symbols=['Au', 'Cu'],
    positions=[[0, L / 2, L / 2], [d, L / 2, L / 2]],
    cell=[2 * d, L, L],
    pbc=[1, 0, 0]
)

poscar_parser = PoscarParser(
    data=orm.StructureData(ase=atoms),
    options={'positions_dof': [[True, True, True], [False, False, False]]}
)
poscar_parser.write('POSCAR')

Now the POSCAR will indeed contain:

Selective dynamics
Direct
  0.000000000000   0.500000000000   0.500000000000 T T T
  0.500000000000   0.500000000000   0.500000000000 F F F

So I’m assuming you can fix atom positions by specifying the dynamics input as follows:

builder = VaspCalculation.get_builder()

builder.dynamics = orm.Dict(
    {'positions_dof': [[True, True, True], [False, False, False]]}
)

Along with the other inputs of course. :slight_smile:

Hope it works!

2 Likes

Hi Marnik!

I see! I managed to use your example as guide for my own system and it worked perfectly.

Thanks a lot for the fast and detailed response, I really appreciate it!
Kind regards,
Thiago

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.