dimension 3 boundary s p p units metal atom_style atomic neighbor 2.0 bin neigh_modify every 1 delay 0 check yes pair_style eam region box block 0 119.295 -10 46 -10 46 units box create_box 2 box lattice fcc 3.6150 region Cu block 0 119.295 0 36.15 0 36.15 units box create_atoms 1 region Cu pair_coeff * * Cu_u3.eam region left block INF 0.1 INF INF INF INF units box group left region left region right block 119.1 INF INF INF INF INF units box group right region right group cu subtract all left right timestep 0.002 thermo 100 thermo_style custom step temp pxx pyy pzz thermo_modify flush yes velocity cu create 300 5645354 loop local dist gaussian rot yes #dump mydump1 all atom 10000 atom1.lammpstrj fix fxnvt cu nvt temp 300.0 300.0 0.2 run 100000 fix 1 right move linear 0.01 0.0 0.0 # Store final cell length for strain calculations variable tmp1 equal "lx" variable tmp2 equal "ly" variable tmp3 equal "lz" variable L0 equal ${tmp1} print "Initial Length, L0: ${L0}" variable strain equal "-(v_L0 - lx)/v_L0" variable p1 equal "v_strain" compute myp all stress/atom NULL compute mypx all reduce sum c_myp[1] variable x2 equal 0.0001*c_mypx[1]/(lz*lx*ly) fix def1 all print 1000 "${p1} ${x2}" file compress1.txt screen no run 500000 提示报错ERROR: Variable x2: Mismatched compute in variable formula (../variable.cpp:1592),应该如何修改?
时间: 2024-02-14 20:27:06 浏览: 250
您好!根据错误提示,出现了“Variable x2: Mismatched compute in variable formula”错误,这意味着在计算中存在错误。在您的输入中,变量 x2 的计算公式中使用了 compute mypx,但是没有定义该 compute。
为了解决这个问题,您需要在使用变量 x2 的计算公式之前,先定义 compute mypx。您可以在输入文件中添加以下代码来定义 compute mypx:
```plaintext
compute mypx all reduce sum c_myp[1]
```
将其添加在 `variable x2 equal 0.0001*c_mypx[1]/(lz*lx*ly)` 之前,并重新运行模拟。这样应该就能够解决错误并计算出正确的结果了。
希望能对您有所帮助!如果您还有其他问题,请随时提问。
阅读全文