|
|
本帖最后由 haodont 于 2026-2-2 14:19 编辑
感谢楼主分享!我有两个问题1.使用该力场该如何引用2.记录一个问题:在运行gmxmmpbsa时候由于该力场中的水分子力场如tip3p.itp中的func.缺失,Parmed转换时候发生了报错‘IndexError: list index out of range’,解决方法1.修改parmed文件‘/envs/gmxMMPBSA/lib/python3.11/site-packages/parmed/gromacs/gromacstop.py’中line600,angle也会报错以此类推2.为每个itp添加func
from .. import load_file
super(GromacsTopologyFile, self).__init__()
self.filename = fname
self.parameterset = None
self.defaults = _Defaults(gen_pairs='yes') # make ParmEd's default yes
if fname is not None:
self.read(fname, defines, parametrize)
# Fill in coordinates and unit cell information if appropriate
if xyz is not None:
if isinstance(xyz, str):
f = load_file(xyz, skip_bonds=True)
if not hasattr(f, 'coordinates') or f.coordinates is None:
raise TypeError(f'File {xyz} does not have coordinates')
self.coordinates = f.coordinates
if box is None and hasattr(f, 'box'):
self.box = f.box
else:
self.coordinates = xyz
if box is not None:
self.box = box
self.unchange()
elif xyz is not None or box is not None:
raise ValueError('Cannot provide coordinates/box and NOT a top')
#line600
def _parse_bonds(self, line, bond_types, atoms):
""" Parses a bond line. Returns a Bond, BondType/None """
words = line.split()
try:
i, j = int(words[0])-1, int(words[1])-1
funct = int(words[2])
except:
print('Error parsing bond line:', words, self.filename)
i, j = int(words[0])-1, int(words[1])-1
funct = 1
|
|