0

我想将 pmma85compositedata.initeq 转换为 lammps 可接受的数据文件,但我遇到了这个错误:

import lmpsdata, copy
data=lmpsdata.Lmpsdata('pmma85compositedata.initeq','full')
polymer=lmpsdata.molecules(data,1,19,'atom') #'atom
nanoparticle=lmpsdata.molecules(data,20,20,'atom')
surface=lmpsdata.particlesurface(nanoparticle[0], 1.94, 8,'full')

错误:

polymer=lmpsdata.molecules(data,1,19,'atom') #'atom
File "/home/marham/...../lmpsdata.py", line 1193, in molecules
p=Pool(processors)
File "/usr/lib/python2.7/multiprocessing/__init__.py", line 232, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild)
File "/usr/lib/python2.7/multiprocessing/pool.py", line 159, in __init__
self._repopulate_pool()
File "/usr/lib/python2.7/multiprocessing/pool.py", line 214, in        _repopulate_pool
for i in range(self._processes - len(self._pool)):
TypeError: unsupported operand type(s) for -: 'str' and 'int'
4

1 回答 1

1

查看函数的源代码lmpsdata.molecules()您缺少一个参数:池中的处理器数量。尝试:

polymer = lmpsdata.molecules(data, 1, 19, 8, 'atom')
nanoparticle = lmpsdata.molecules(data, 20, 20, 8, 'atom')

...或替换8为您可以使用的任意数量的处理器。

于 2015-08-31T17:50:36.790 回答