Inputs not yet validated. Runtimes are estimates. The README describes what to check in the outputs.
What you will learn
- How to build a random FCC alloy with LAMMPS
- How to run strain-rate tension with fix deform
- How to convert the virial to engineering stress
Set up
Set up LAMMPS. Download the potential files below and keep them next to the input.
python -m pip install numpy matplotlibFiles for this tutorial:
in.inconel.lmp— Nanowire tension inputanalyze.py— Stress–strain plotREADME.md— Potential download and notes
How it works
Get the potential
Download the Bonny et al. FeNiCr EAM file from the NIST Interatomic Potentials Repository. The README gives the link.
Build the alloy wire
FCC lattice (a = 3.52 Å), cylinder of radius 14 Å, types assigned randomly to Ni 60%, Cr 21% and Fe 19%, as in the paper.
Equilibrate and stretch
Minimize, thermalize under NVT, then stretch along z with fix deform at 10¹⁰ s⁻¹ while printing strain and stress.
Analyze
analyze.py plots both temperatures and reports each peak stress.
Run it
lmp -in in.inconel.lmp -var T 100 -var out tension_100.txt
lmp -in in.inconel.lmp -var T 800 -var out tension_800.txt
python analyze.pyHow this differs from the paper
The paper also studied nanopillars, thin plates, voids and cooling rates from 0.5×10¹⁰ to 10¹⁴ K/s. It reported nanowire strength falling from 10.02 GPa at 100 K to 5.54 GPa at 800 K. This input covers the nanowire temperature test only.
Full source
in.inconel.lmp (37 lines)
units metal
atom_style atomic
boundary f f p
variable T index 100
variable rate index 0.01
variable seed index 87287
timestep 0.001
variable out index tension_100.txt
lattice fcc 3.52
region box block -19 19 -19 19 -28.16 28.16 units box
create_box 3 box
region wire cylinder z 0 0 14 -28.16 28.16 units box
create_atoms 1 region wire
mass 1 58.6934
mass 2 51.9961
mass 3 55.845
set type 1 type/fraction 2 0.21 ${seed}
variable seed2 equal v_seed+17
set type 1 type/fraction 3 0.2405063291 ${seed2}
pair_style eam/alloy
pair_coeff * * FeNiCr.eam.alloy Ni Cr Fe
neighbor 2 bin
min_style cg
minimize 1e-8 1e-8 500 5000
velocity all create ${T} ${seed} mom yes rot yes dist gaussian
fix thermostat all nvt temp ${T} ${T} 0.1
thermo 500
run 2000
# Freeze initial length and normalize global virial by the initial material volume.
variable L0 equal $(lz)
variable A0 equal 615.75216
variable strain equal (lz-v_L0)/v_L0
variable stress equal -pzz*vol/(v_A0*v_L0)*0.0001
fix deform all deform 1 z erate ${rate} units box remap x
fix output all print 100 "${strain} ${stress}" file ${out} screen no title "# strain stress_GPa"
run 15000
analyze.py (36 lines)
from pathlib import Path
import numpy as np
import matplotlib.pyplot as plt
CASES = [('tension_100.txt','100 K'),('tension_800.txt','800 K')]
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]
ax.plot(strain, stress, label=label); print(f"{label}: peak stress = {stress.max():.4g} GPa")
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.")