zhoulong的个人博客分享 http://blog.sciencenet.cn/u/zhoulong

博文

Al 拉伸lammps脚本

已有 3730 次阅读 2021-8-17 22:05 |个人分类:lammps|系统分类:科研笔记

Al 拉伸lammps输入脚本:






# ------------------------ INITIALIZATION ----------------------------



units metal

dimension 3

boundary p p p

atom_style atomic

variable latparam equal 4.0320





# ----------------------- ATOM DEFINITION----------------------------



lattice fcc ${latparam}

region whole block 0 10 0 10 0 10

create_box 1 whole

lattice fcc ${latparam} orient x 1 0 0 orient y 0 1 0 orient z 0 0 1

create_atoms 1 region whole





# ------------------------ FORCE FIELDS------------------------------



pair_style eam/alloy

pair_coeff * * Al_EA.eam.alloy Al





# ------------------------EQUILIBRATION---------------------------------



variable tstp equal 0.001

timestep ${tstp}

variable tdamp equal "v_tstp * 100"

variable pdamp equal "v_tstp * 1000"



fix 1 all nve

fix 2 all langevin 300.0 300.0 ${pdamp} 904297



thermo 500

run 10000



unfix 1

unfix 2



fix 1 all npt temp 300 300 1 iso 0 0 1 drag 1



thermo 200

thermo_style custom step lx ly lz press pxx pyy pzz pe temp



run 10000

unfix 1



variable tmp equal "lx"

variable L0 equal ${tmp}





# ------------------------DEFORMATION---------------------------------



reset_timestep 0

fix 1 all npt temp 300 300 ${tdamp} y 1 1 ${pdamp} z 1 1 ${pdamp} drag 1

variable srate equal 1.0e10

variable srate1 equal "v_srate / 1.0e12"

fix 2 all deform 1 x erate ${srate1} units box remap x





# ------------------------OUTPUTS---------------------------------



# for units metal, pressure is in [bars] = 100 [kPa] = 1/10000 [GPa]

# for units real, pressure is in [atm] = 101.325 [kPa] = 1.01325/10000 [GPa]



variable strain equal "(lx - v_L0)/v_L0"

variable p1 equal "-pxx/10000"

variable p2 equal "-pyy/10000"

variable p3 equal "-pzz/10000"



fix print all print 10 "${strain} ${p1} ${p2} ${p3}" file stress-strain.txt screen no



dump            2 all atom 200 tensile_test_movie.lammpstrj



thermo 100

thermo_style custom step temp v_strain v_p1 v_p2 v_p3 ke pe press



run 20000

应力应变后处理MATLAB脚本:




%% 2020/12/12

%% This code extracts data from the LAMMPS output file stress-strain.dump and plot the stress-strain curve.



clear all

close all

clc



%% Extracting stress-strain data from the log.lammps file



[fid] = fopen('stress-srain.txt');



headings = fscanf(fid,'%s ',7);



[Stress,count] = fscanf(fid, '%f %f %f %f',[4,inf]);



Stress = Stress'; %



%% Plotting



figure

plot(Stress(:,1), Stress(:,2),'-or','MarkerSize',2)

hold on

plot(Stress(:,1), Stress(:,3),'-ob','MarkerSize',2)

hold on

plot(Stress(:,1), Stress(:,4),'-og','MarkerSize',2)

xlabel('Strain','fontsize',12)

ylabel('Stress (GPa)','fontsize',12)

grid on

set(gca,'LineWidth',1,'Fontsize',12)

axis square

%axis([0 0.3 0 120])

legend({ '\sigma_{xx}', '\sigma_{yy}', '\sigma_{zz}'},'Location','northwest','FontSize',14)

legend boxoff




https://blog.sciencenet.cn/blog-3437453-1300250.html

上一篇:如何使用lammps内部建模命令来创建data文件
下一篇:如何在 Windows 上编写批处理脚本
收藏 IP: 218.95.214.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-24 17:29

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部