针对python版本下的gem模拟gibbs_mc_lj.py的代码结构分析以及其中用的python常用函数记录。
代码结构分析:
常用函数:
python中数组(numpy.array)的基本操作:
1. Numpy.array()
该函数的作用一言蔽之就是用来产生数组。
1.1 函数形式
numpy.array(object,
dtype=None,
copy=True,
order='K',
subok=False,
ndmin=0)
1.2 参数详解
object:必选参数,类型为array_like,可以有四种类型:数组,公开数组接口的任何对象,__array__方法返回数组的对象,或任何(嵌套)序列。np.array()的作用就是按照一定要求将object转换为数组。
dtype:可选参数,用来表示数组元素的类型。如果没有给出,那么类型将被确定为保持序列中的对象所需的最小类型。注: This argument can only be used to ‘upcast’ the array. For downcasting, use the .astype(t) method.