简体   繁体   English

TypeError:-:“ str”和“ int”的不受支持的操作数类型

[英]TypeError:unsupported operand type(s) for -: 'str' and 'int'

I want to convert pmma85compositedata.initeq to a acceptable data file for lammps but I face with this error: 我想将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')

Error: 错误:

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'

Looking at the source code for the lmpsdata.molecules() function, you are missing a parameter: the number of processors in the pool. 查看lmpsdata.molecules()函数的源代码 ,您缺少一个参数:池中的处理器数量。 Try: 尝试:

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

...or replace 8 with however many processors you have at your disposal. ...或将8替换为您拥有的许多处理器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM