Build Fe-graphene interface using InterfaceBuilder

Hi all,

I would like to build some interface (Iron - Graphene and Iron-Graphite) using pymatgen.analysis.interface InterfaceBuilder.
What information should i put into “match” in the apply_transformations(match) ?

What is ZSL stand for? and is there other method you can suggest to build interface between 2 slabs?
Should I use combine_slabs instead?
Here is an example of what I used
from pymatgen.analysis.interface import InterfaceBuilder fe100_graphene = InterfaceBuilder(fe_100_4,graphene).apply_transformations(???)

Thank you all for your time!

The InterfaceBuilder is a very early prototype and I’m still fixing issues in the algorithm. I would not recommend anyone use it for now if you’re not comfortable with the level of programming employed in pymatgen.

That being said you want to use the generate_interfaces method.

what is the correct way to use generate_interfaces method?
fe100_graphene = InterfaceBuilder(fe_100_4,graphene).apply_transformations
interfaces = fe100_graphene.generate_interfaces() ?

You don’t use apply_transformations. You need to just make an InterfaceBuilder object and then run the generate_interfaces method:

fe100_graphene = InterfaceBuilder(fe_100_4,graphene)
fe100_graphene.generate_interfaces() 
interfaces = fe100_graphene.interfaces

Hi!

@shyamd:
I would also like to know a little bit more about this? Especially on what algorithm is the interface matching is based on, and if there is a possibility to tune e.g. maximal strains and angle mismatches and allowed size of the matched cell?

In an initial test with two slabs of Au111 and C001 (diamond) I have failed to produce a correct interface, but I think the lattice matching is working OK. The main issue seems to be with the vacuum region and maybe the fact that I am not using a monolayer thin film, but two slabs with ~10A thickness each. Is one supposed to use slabs (pymatgen.core.surface.Slab) that contain a vacuum as an input, or rather oriented structures without vacuum?

@Ngan_Huynh:
You might be interested in the MPInterfaces package which works decently well for me for generating interfaces. Note that while this was developed as part of the materials project, I do not thing it is officially supported. After a small exchange with the developers in spring however, they have updated the version that you can install via pip and now interface generation works fine. Note however, that I have tested only that part of the package. I think it is not maintained well anymore and in the long run it would certainly be better to use the code within pymatgen itself I think. You should check out the paper: MPInterfaces: A Materials Project based Python tool for high-throughput computational screening of interfacial systems
The algorithm from Zur and McGill is used and you want to look at:

mpinterfaces.transformations.get_aligned_lattices and mpinterfaces.transformations.get_interface

Here is some code to match two slabs (need to be pymatgen.core.surface.Slab objects) with reasonable parameter defaults provided:

import pprint
from mpinterfaces.transformations import get_aligned_lattices, \
     get_interface

def MatchTheInterface(slab_1, slab_2, inter_params={}):
    
    max_area = inter_params.get('max_area', 500)
    max_missmatch = inter_params.get('max_missmatch', 0.01)
    max_angle_diff = inter_params.get('max_angle_diff', 2.0)
    r1r2_tol = inter_params.get('r1r2_tol', 0.05)
    separation = inter_params.get('separation', 2.5)
    
    bottom_aligned, top_aligned = get_aligned_lattices(
                                        slab_1,
                                        slab_2,
                                        max_area = max_area,
                                        max_mismatch = max_missmatch,
                                        max_angle_diff = max_angle_diff,
                                        r1r2_tol = r1r2_tol)
    if bottom_aligned:
        hetero_interfaces = get_interface(top_aligned,
                                      bottom_aligned,
                                      nlayers_2d = 1,
                                      nlayers_substrate = 1,
                                      separation = separation)
        return_dict = {"interface": hetero_interfaces,
                       "matched_bottom_slab": bottom_aligned,
                       "matched_top_slab": top_aligned}
        return return_dict
    else:
        print('No match of the given slabs could be found with the '
              'given parameters:')
        pprint.pprint(inter_params)
        print('')
        return None
2 Likes

@mwo

It’s the same Zur and McGil algorithm. although we have been exploring a larger number of degrees of freedom: methods to enumerate in-plane shifts and determine optimal surface separation. Unfortunately, this work has been a bit on hold as I’ve had other work priorities for MP. As i mentioned the current interface builder is still early stage, and is likely to have a number of bugs.

Thanks for the quick reply. I am super happy that someone is working on this. I guess for now I will continue using the MPInterfaces stuff, but will switch later to the pymatgen implementation as soon as it will be bugfree. I will watch the changelog and wish you all the best for the implementation!

Hi,
Thank you for your help.
I just have a quick question for the MPInterfaces. When I load the mpinterface packages, I got this error message even though I already install the MPInterfaces.
ImportError: cannot import name 'get_interface' from 'mpinterfaces.transformations' (/Users/nganhuynh/opt/anaconda3/lib/python3.8/site-packages/mpinterfaces/transformations.py)
Do you know what might cause it?

Thank you a lot for your time and your help!
Ngan Huynh

We don’t develop that package. You might check if they have a mailing list or forum.

Hi,

I installed the package from the github and for me it works. I think the versions available via pip is not up to date. Look into the transformations module, mybe the function is just called differently?

Here is the github:

Thank you!
I will give it a try.
One more question. Is there other softwares you can share to help generate interface?
I am trying to generate Fe (111) + Graphite (100) 90-90-90 angle and I could not place the graphite into the Fe surface. Would like some recommendation if you have.
Thank you again for sharing!

Ngan Huynh

Sorry, no other software that I know of.

I am not quite sure what you mean by 90-90-90 angle? Do you want to force an orthorombic cell? I am not sure that would be a great idea in the case of these materials, since both the bcc111 and the graphite 0001 cells are hexagonal.

I would try to get MPInterfaces from github to work and see what kind of a cell you end up with.

Hi @mwo, I think your code exports one structure only. May I ask how to obtain all possible configurations? I tried generate_all_configs function, but it actually translates the second slab along the [001] direction.

Hi @thienbinh92 ,

could you elaborate a bit? Do you mean you want all possible matched cells (i.e. some with smaller area and larger mismatch, and some with larger area but smaller mismatch), or all different lateral configurations (i.e. laterally moving one interface over the other)

For the first option, I think you have to play around with the max_area, and max_mismatch parameters, and/or change best_match in the MPInterfaces input.

For the lateral shifts, this is not trivial to do efficiently, and not included in MPInterfaces. However, I have a paper coming out soon that tackles this question. I am about to send back the page proofs today, so look out for:

“High-throughput generation of potential energy surfaces for solid interfaces” in the journal Computational Material Science in the next couple of days…

You can also check out a poster I presented on this topic last spring at the DPG here, but the paper will have obviously more details.

edit:
I just checked, and it seems that pymatgen’s own interface capabilities have been significantly expanded in v2022.0.9. Check it out!

I far as I understand, the first step is creating two parenting slabs from bulks with the desired {hkl}.
Then, in the second step, check the mismatch between the two slabs and create two new slabs satisfying conditions.
Third, put two slabs together. I assume that we set slab 2 on top of slab 1 along z-direction. What I like to ask is how to put them together. I imagine that we need to fix slab 1 and translate/shift slab 2 along z-direction or xy-face.
Please correct me if my thought is wrong.

OK, so you want to set both the distance between the slabs and the lateral shift between them.
I am just checking out the new capabilities of pymatgen here, so I am not 100% sure, but I think this should be easily doable once you have the interface object. It has both a .gap and an .in_plane_offset properties that can be set to whatever you want.

1 Like

Thank you!
I tried Interface.from_slabs and changed in_plane-offset, but I think it did not work. It generated the same structure. @shyamd, does in_plane-offset work?

from pymatgen.core.interface import Interface
A = Interface.from_slabs(bottom_aligned, top_aligned, 
                         in_plane_offset=(0, 0.1), 
                         gap=1.9, vacuum_over_film=10, 
                         center_slab=True)

Hi again @thienbinh92 ,

for me it works, but I have created the interface using the CoherentInterfaceBuilder, so maybe there is some difference?

In [82]: interf.sites[0]

Out[82]: PeriodicSite: Al (3.3693, 2.9179, 83.6411) [0.3333, 0.6667, 0.9857]

In [83]: interf.in_plane_offset

Out[83]: array([0., 0.])

In [84]: interf.in_plane_offset = (0.5, 0.5)

In [85]: interf.sites[0]

Out[85]: PeriodicSite: Al (4.6328, 0.7295, 83.6411) [0.8333, 0.1667, 0.9857]

In [86]: interf.in_plane_offset

Out[86]: array([0.5, 0.5])
1 Like

Hi again @thienbinh92 ,

the paper I talked about a couple of days ago just came out. Please have a look if you are interested: High-throughput generation of potential energy surfaces for solid interfaces - ScienceDirect