Draft · incomplete inputsLAMMPS · —

Cycle a gold–silver core–shell nanowire (draft)

Tension–compression cycling of Au-core/Ag-shell and Ag-core/Au-shell nanowires with the paper’s MEAM parameters. Draft: some alloy parameters still need checking against the published tables.

Draft. This tutorial is incomplete. The README lists what is missing.

What you will learn

  • How MEAM library and alloy files are structured
  • How to run cyclic loading with fix deform
  • How to compare loops cycle by cycle

Set up

Set up LAMMPS. See the README for the required potential files.

python -m pip install numpy matplotlib

Files for this tutorial:

How it works

  1. Finish the parameter files

    The text extraction of Tables 1–2 left one screening parameter (Cmin for Ag–Au–Au) unreadable. The input stops until it is filled from the published PDF.

  2. Cycle

    Three tension–compression cycles between −10% and +10% strain for both wire types.

How this differs from the paper

The paper cycled ten times between −15% and +15% and found the Ag-core/Au-shell wire most reversible. It also found that the Au-core/Ag-shell wire lost only 0.4% of its strength over ten cycles.

Full source

library.meam (6 lines)
library.meam
# INCOMPLETE transcription from Table 1. Do not use for dynamics.
# TODO: Table extraction merges B with re, and obscures the beta headings.
# Ag: Ec=2.85 re=2.880 A=1.087 Cmin=0.94 Cmax=1.38 B=2.80? beta/t: 4.73 2.2 6.0 2.2 3.40 3.00 1.50 d=0.05
# Au: Ec=2.85 re=2.880 A=1.803 Cmin=1.00 Cmax=1.53 B=2.80? beta/t: 5.77 2.2 6.0 2.2 2.90 1.64 2.00 d=0.05
# TODO: verify element records, reference lattice and the MEAM alpha conversion from B.
AuAg.meam (10 lines)
AuAg.meam
# INCOMPLETE Table 2 transcription. Do not use for dynamics.
# TODO: Cmin(Ag-Au-Au) is blank in extracted source; obtain the original table.
# TODO: establish table's i-j-k convention and map screening triplets to LAMMPS indices.
# Ec=-3.41 eV as printed; LAMMPS Ec convention needs checking.
# re=2.89 angstrom; B=147 GPa; d=0.05; density scale=1
# Cmin(Ag-Au-Ag)=1.38; Cmin(Au-Ag-Au)=1.53; Cmin(Ag-Ag-Au)=1.45
# Cmax(Ag-Au-Ag)=1.46; Cmax(Au-Ag-Au)=2.80
# Cmax(Ag-Ag-Au)=2.80; Cmax(Ag-Au-Au)=2.80
# TODO: verify isolated 2.80 value in extracted table, alloy reference lattice and alpha.
in.auag.lmp (50 lines)
in.auag.lmp
units metal
atom_style atomic
boundary f f p
variable T index 300
variable rate index 0.01
variable seed index 87287
timestep 0.001
variable coretype index 1
variable shelltype index 2
variable out index loops_aucore.txt
lattice fcc 4.08
region box block -22 22 -22 22 -24.48 24.48 units box
create_box 2 box
region wire cylinder z 0 0 17 -24.48 24.48 units box
region core cylinder z 0 0 10 -24.48 24.48 units box
create_atoms ${coretype} region wire
# shell=2 gives Au core and Ag shell. Swap type mapping in pair_coeff for inverse wire.
group core region core
group shell subtract all core
set group shell type ${shelltype}
mass 1 196.96657
mass 2 107.8682
# TODO: complete and validate library.meam and AuAg.meam before removing this stop.
print "STOP: unresolved Au-Ag MEAM parameters; see README.md"
quit 1
pair_style meam
pair_coeff * * library.meam Au Ag AuAg.meam Au Ag
minimize 1e-8 1e-8 500 5000
velocity all create ${T} ${seed} mom yes rot yes dist gaussian
fix bath all nvt temp ${T} ${T} 0.1
run 2000
variable L0 equal $(lz)
variable strain equal (lz-v_L0)/v_L0
variable stress equal -pzz*vol/(907.92028*v_L0)*0.0001
fix output all print 100 "${strain} ${stress}" file ${out} screen no title "# strain stress_GPa"
# First go from zero to +10%; then alternate -10% and +10% for three loops.
fix deform all deform 1 z erate ${rate} remap x units box
run 10000
unfix deform
variable i loop 3
label cycle
fix deform all deform 1 z final $(zlo) $(zlo+0.9*v_L0) remap x units box
run 20000
unfix deform
fix deform all deform 1 z final $(zlo) $(zlo+1.1*v_L0) remap x units box
run 20000
unfix deform
next i
jump SELF cycle
analyze.py (44 lines)
analyze.py
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt

CASES = [('loops_aucore.txt','Au core'),('loops_agcore.txt','Ag core')]
fig, ax = plt.subplots()
found = 0
for filename, label in CASES:
    path = Path(filename)
    if not path.exists():
        print(f"Missing output: {path}. Run the matching LAMMPS command first.")
        continue
    try:
        data = np.loadtxt(path, comments="#", ndmin=2)
        if data.shape[1] < 2 or data.shape[0] == 0:
            print(f"{path}: expected strain and stress_GPa columns; skipping.")
            continue
        data = data[np.isfinite(data[:, :2]).all(axis=1)]
        if not len(data):
            print(f"{path}: no finite data rows; skipping.")
            continue
    except (ValueError, OSError) as exc:
        print(f"Cannot read {path}: {exc}")
        continue
    strain, stress = data[:, 0], data[:, 1]
    # Each complete loop starts at the +10% turning point.
    peaks = np.flatnonzero((strain[1:-1] >= strain[:-2]) & (strain[1:-1] > strain[2:])) + 1
    if len(strain) > 1 and strain[-1] > strain[-2]:
        peaks = np.append(peaks, len(strain) - 1)
    if len(peaks) < 2:
        ax.plot(strain, stress, label=label + " (incomplete)")
        print(f"{label}: fewer than two tensile turning points")
    for i, (a, b) in enumerate(zip(peaks[:-1], peaks[1:]), 1):
        ax.plot(strain[a:b+1], stress[a:b+1], label=f"{label}, cycle {i}")
    found += 1
if found:
    ax.set(xlabel="Engineering strain", ylabel="Engineering stress (GPa)")
    ax.legend()
    fig.tight_layout()
    fig.savefig("stress_strain.png", dpi=200)
    print("Saved stress_strain.png")
else:
    print("No usable data; no figure written.")