Open ggdhzdx opened 3 years ago
I found the reason for this problem When I load the prmtop file It has the type of AmberParm and when AmberParm.from_strucuture() is performed It will return a copy of itself directly without performing the line in this function: inst = struct.copy(cls, split_dihedrals=True) which split the DihedralTypeList My temporary solution is using parmed.gromacs.GromacsTopologyFile.from_structure() to convert the AmberParm object to GromacsTopologyFile object after I convert DihedralType to DihedralTypeLists I wonder If there are more elegant solutions to this problem?
I load a Amber prmtop file as Parmed Structure Then I convert all DihedralType to DihedralTypeList I can save the the Structure as gromacs top file with correct dihedral function type 9 However, When I save a gro file . It raise a error as follows:
Traceback (most recent call last): File "../paramrf.py", line 1468, in
final_top.save(f2,overwrite=True)
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\structure.py", line 1483, in save
gromacs.GromacsGroFile.write(self, fname, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\gromacs\gromacsgro.py", line 260, in write
split_struct = struct.split()
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\structure.py", line 1374, in split
mol = self[[atom.marked == i+1 for atom in self.atoms]]
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\amber_amberparm.py", line 399, in getitem
other.remake_parm()
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\amber_amberparm.py", line 678, in remake_parm
self._xfer_dihedral_info()
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\amber_amberparm.py", line 1648, in _xfer_dihedral_info
data['DIHEDRAL_FORCE_CONSTANT'] = [type.phi_k for type in self.dihedral_types]
File "C:\Users\admin\Anaconda3\lib\site-packages\parmed\amber_amberparm.py", line 1648, in
data['DIHEDRAL_FORCE_CONSTANT'] = [type.phi_k for type in self.dihedral_types]
AttributeError: 'DihedralTypeList' object has no attribute 'phi_k'
It seems that when it loop over the atoms via: mol = self[[atom.marked == i+1 for atom in self.atoms]] there is a line: other.remake_parm() in getitem function # I think generate gro file shouldn't need parameters... and when it try to remake_parm via: data['DIHEDRAL_FORCE_CONSTANT'] = [type.phi_k for type in self.dihedral_types] it dosn't consider the situation when there is a DihedralTypeList