加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

关于lammps中的variable的碎碎念

(2018-12-19 18:47:43)
分类: lammps学习笔记

Note

1)“immediatevariables

lammps,将用圆括号声明的形如$(formula)的变量,称之为“immediate”变量。

2)“string

lammps变量定义命令的语法:

variable  name  style  argas  

很明显name说的就是变量的“名字”,style后面的一串子就是指“string,指的是一系列的输入参数。

3)“value

The “value” is the numeric quantity resulting from evaluation of the string. Note that the same string can generate different values when it is evaluated at different times during a simulation.

The Commands parse doc page explains how occurrences of a variable name in an input script line are replaced by the variable’s string. The variable name can be referenced as $x if the name “x” is a single character, or as ${LoopVar} if the name “LoopVar” is one or more characters.

Many of the styles store one or more strings. Note that a single string can contain spaces (multiple words), if it is enclosed in quotes in the variable command. When the variable is substituted for in another input script command, its returned string will then be interpreted as multiple arguments in the expanded command.

4)“string”中如果有空格,可以加单引号,双引号,三引号,将该 string看作是一个argument,详细介绍:

If you want text with spaces to be treated as a single argument, it can be enclosed in either single or double or triple quotes. A long single argument enclosed in single or double quotes can span multiple lines if the “&” character is used, as described above. When the lines are concatenated together (and the “&” characters and line breaks removed), the text will become a single line. If you want multiple lines of an argument to retain their line breaks, the text can be enclosed in triple quotes, in which case “&” characters are not needed. For example:

print"Volume = $v”

print'Volume = $v’

if"${steps} > 1000"thenquit

variableastring"red green blue &

      purpleorangecyan"

print"""

Systemvolume = $v

Systemtemperature = $t

""”

In each case, the single, double, or triple quotes are removed when the single argument they enclose is stored internally.

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有