How to use M3GNet instead of CHGNet in Atomate2 PhononMaker?

Hi all,

I am using PhononMaker from Atomate2 to generate phonon workflows. By default, it uses CHGNet as the phonon displacement maker. I wanted to use M3GNet instead, so I overrode it like this:

phonon_flow = PhononMaker(
    displacement=0.02,
    store_force_constants=True,
    bulk_relax_maker=None,
    sym_reduce=False,
    symprec=1e-5,
    prefer_90_degrees=False,
    allow_orthorhombic=False,
    use_symmetrized_structure="conventional",
    phonon_displacement_maker=ForceFieldStaticMaker(force_field_name="M3GNet"),
    kpath_scheme="seekpath",
)

But when I run it, the output still prints:

CHGNet v0.3.0 initialized with 412,525 parameters

So my doubt is: am I really using M3GNet, or is it still running CHGNet in the background?

There’s another field in PhononMaker, static_energy_maker, which uses CHGNet by default. Try:

phonon_flow = PhononMaker(
    displacement=0.02,
    store_force_constants=True,
    bulk_relax_maker=None,
    sym_reduce=False,
    symprec=1e-5,
    prefer_90_degrees=False,
    allow_orthorhombic=False,
    use_symmetrized_structure="conventional",
    phonon_displacement_maker=ForceFieldStaticMaker(force_field_name="M3GNet"),
    kpath_scheme="seekpath",
    static_energy_maker = ForceFieldStaticMaker(force_field_name="M3GNet"),
)

or use the convenience method available in newer versions of atomate2 by first pip install --upgrade atomate2 and then using:

phonon_flow = PhononMaker.from_force_field_name(
    force_field_name = "M3GNet",
    relax_initial_structure = False,
    displacement=0.02,
    store_force_constants=True,
    sym_reduce=False,
    symprec=1e-5,
    prefer_90_degrees=False,
    allow_orthorhombic=False,
    use_symmetrized_structure="conventional",
    kpath_scheme="seekpath",
)

Thanks! This seems to work. But relax_initial_structure = False, doesn’t seem to help. It additionally requires bulk_relax_maker to be set to None.

That’s likely a bug, thanks for catching that!

1 Like

Hey this should be fixed now, can you try pip install atomate2==0.0.22rc1 and rerun your workflow without setting bulk_relax_maker=None?

1 Like

This works now.