ADF Fragment Analysis Recipe#

Use the PLAMS ADF fragment recipe to run two fragment calculations plus a full-system calculation and extract energy decomposition terms.

Downloads: Notebook | Script ?

Requires: AMS2027 or later

Related documentation
../_images/adf_frag_3_0_7e6c46bb.png

Initialization#

from scm.base import ChemicalSystem
from scm.inputs import ADF, AMS
from scm.plams import view, plot_image_grid
from scm.plams.recipes.adffragment import ADFFragmentJob

Define the molecules#

For convenience we define here two molecules, normally you would read them from xyz files

mol1 = ChemicalSystem(
    """
System
    Atoms
        C      -0.75086900       1.37782400      -2.43303700
        C      -0.05392100       2.51281000      -2.41769100
        H      -1.78964800       1.33942600      -2.09651100
        H      -0.30849400       0.43896500      -2.76734700
        H      -0.49177100       3.45043100      -2.06789100
        H       0.98633900       2.54913500      -2.74329400
    End
End
"""
)


mol2 = ChemicalSystem(
    """
System
    Atoms
        C       0.14667300      -0.21503500       0.40053800
        C       1.45297400      -0.07836900       0.12424400
        C       2.23119700       1.15868100       0.12912100
        C       1.78331500       2.39701500       0.38779700
        H      -0.48348000       0.63110600       0.67664100
        H      -0.33261900      -1.19332100       0.35411600
        H       2.01546300      -0.97840100      -0.14506700
        H       3.29046200       1.03872500      -0.12139700
        H       2.45728900       3.25301000       0.35150400
        H       0.74193400       2.60120700       0.64028800
    End
End
"""
)

# Molecules could also be read from xyz files
# mol1 = ChemicalSystem.from_file("ethene.xyz")
# mol2 = ChemicalSystem.from_file("butadiene.xyz")

plot_image_grid(
    {"1": view(mol1, guess_bonds=True), "2": view(mol2, guess_bonds=True)}, show_labels=False
);
image generated from notebook

Setup and run the job#

common = AMS(  # common settings for all 3 jobs
    Task="SinglePoint",
    Engine=ADF(Basis={"Type": "DZP"}, XC={"GGA": "PBE"}, Symmetry="NOSYM"),
)

full = AMS(Engine=ADF())  # additional settings for the full system calculation
full.Engine.ETSNOCV.Enabled = True
full.Engine.Print = ["etslowdin"]

job = ADFFragmentJob(fragment1=mol1, fragment2=mol2, settings=common, full_settings=full)
results = job.run()
[05.11|15:19:00] JOB plamsjob STARTED
[05.11|15:19:00] JOB plamsjob RUNNING
[05.11|15:19:00] JOB plamsjob/frag1 STARTED
[05.11|15:19:00] JOB plamsjob/frag1 RUNNING
[05.11|15:19:03] JOB plamsjob/frag1 FINISHED
[05.11|15:19:03] JOB plamsjob/frag1 SUCCESSFUL
[05.11|15:19:03] JOB plamsjob/frag2 STARTED
[05.11|15:19:03] JOB plamsjob/frag2 RUNNING
[05.11|15:19:06] JOB plamsjob/frag2 FINISHED
[05.11|15:19:06] JOB plamsjob/frag2 SUCCESSFUL
[05.11|15:19:06] JOB plamsjob/full STARTED
[05.11|15:19:06] JOB plamsjob/full RUNNING
[05.11|15:19:11] JOB plamsjob/full FINISHED
[05.11|15:19:11] JOB plamsjob/full SUCCESSFUL
[05.11|15:19:11] JOB plamsjob FINISHED
[05.11|15:19:11] JOB plamsjob SUCCESSFUL

Energy Decomposition Results#

Energy terms contributing to the bond energy (with respect to the fragments):

import pandas as pd

bond_energy = results.get_energy(unit="eV")
decom = results.get_energy_decomposition(unit="eV")

df = pd.DataFrame(
    [
        {"Term": t, "Energy [eV]": e}
        for t, e in list(decom.items()) + [("Total Bond Energy", bond_energy)]
    ]
)
df

Term

Energy [eV]

0

Electrostatic Energy

-0.160280

1

Kinetic Energy

-0.295645

2

Elstat Interaction

0.748751

3

XC Energy

-0.356182

4

E_int

-0.063357

5

E_Pauli

0.187116

6

E_elstat

-0.160280

7

E_orb

-0.090192

8

E_1

-31.722875

9

E_2

-56.338062

10

Total Bond Energy

-0.063357

See also#

Python Script#

#!/usr/bin/env python
# coding: utf-8

# ## Initialization

from scm.base import ChemicalSystem
from scm.inputs import ADF, AMS
from scm.plams import view, plot_image_grid
from scm.plams.recipes.adffragment import ADFFragmentJob


# ## Define the molecules
# For convenience we define here two molecules, normally you would read them from xyz files

mol1 = ChemicalSystem(
    """
System
    Atoms
        C      -0.75086900       1.37782400      -2.43303700
        C      -0.05392100       2.51281000      -2.41769100
        H      -1.78964800       1.33942600      -2.09651100
        H      -0.30849400       0.43896500      -2.76734700
        H      -0.49177100       3.45043100      -2.06789100
        H       0.98633900       2.54913500      -2.74329400
    End
End
"""
)


mol2 = ChemicalSystem(
    """
System
    Atoms
        C       0.14667300      -0.21503500       0.40053800
        C       1.45297400      -0.07836900       0.12424400
        C       2.23119700       1.15868100       0.12912100
        C       1.78331500       2.39701500       0.38779700
        H      -0.48348000       0.63110600       0.67664100
        H      -0.33261900      -1.19332100       0.35411600
        H       2.01546300      -0.97840100      -0.14506700
        H       3.29046200       1.03872500      -0.12139700
        H       2.45728900       3.25301000       0.35150400
        H       0.74193400       2.60120700       0.64028800
    End
End
"""
)

# Molecules could also be read from xyz files
# mol1 = ChemicalSystem.from_file("ethene.xyz")
# mol2 = ChemicalSystem.from_file("butadiene.xyz")

plot_image_grid(
    {"1": view(mol1, guess_bonds=True), "2": view(mol2, guess_bonds=True)}, show_labels=False
, save_path="picture1.png");


# ## Setup and run the job

common = AMS(  # common settings for all 3 jobs
    Task="SinglePoint",
    Engine=ADF(Basis={"Type": "DZP"}, XC={"GGA": "PBE"}, Symmetry="NOSYM"),
)

full = AMS(Engine=ADF())  # additional settings for the full system calculation
full.Engine.ETSNOCV.Enabled = True
full.Engine.Print = ["etslowdin"]

job = ADFFragmentJob(fragment1=mol1, fragment2=mol2, settings=common, full_settings=full)
results = job.run()


# ## Energy Decomposition Results

# Energy terms contributing to the bond energy (with respect to the fragments):

import pandas as pd

bond_energy = results.get_energy(unit="eV")
decom = results.get_energy_decomposition(unit="eV")

df = pd.DataFrame(
    [
        {"Term": t, "Energy [eV]": e}
        for t, e in list(decom.items()) + [("Total Bond Energy", bond_energy)]
    ]
)
print(df)