Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pgbarletta committed Sep 5, 2023
1 parent faf4f42 commit 5bbca5f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
35 changes: 22 additions & 13 deletions package/MDAnalysis/topology/tpr/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,13 @@ def do_mtop(data, fver, tpr_resid_from_one=False):
(new_resnames,
new_moltypes,
new_molnums,
perres_segids,
perres_chainIDs
perres_segids
)
) = squash_by(resids,
resnames,
moltypes,
molnums,
segids,
chainIDs)
segids)
residueids = Resids(new_resids)
residuenames = Resnames(new_resnames)
residue_moltypes = Moltypes(new_moltypes)
Expand All @@ -394,15 +392,26 @@ def do_mtop(data, fver, tpr_resid_from_one=False):
segids = Segids(perseg_segids)
chainIDs = ChainIDs(chainIDs)


top = Topology(len(atomids), len(new_resids), len(perseg_segids),
attrs=[atomids, atomnames, atomtypes,
charges, masses,
residueids, residuenames,
residue_moltypes, residue_molnums,
segids, chainIDs],
atom_resindex=residx,
residue_segindex=segidx)
top = Topology(
len(atomids),
len(new_resids),
len(perseg_segids),
attrs=[
atomids,
atomnames,
atomtypes,
charges,
masses,
residueids,
residuenames,
residue_moltypes,
residue_molnums,
segids,
chainIDs,
],
atom_resindex=residx,
residue_segindex=segidx,
)
top.add_TopologyAttr(Bonds([bond for bond in bonds if bond]))
top.add_TopologyAttr(Angles([angle for angle in angles if angle]))
top.add_TopologyAttr(Dihedrals([dihedral for dihedral in dihedrals
Expand Down
19 changes: 15 additions & 4 deletions testsuite/MDAnalysisTests/topology/test_tprparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,21 @@

class TPRAttrs(ParserBase):
parser = MDAnalysis.topology.TPRParser.TPRParser
expected_attrs = ['ids', 'names', 'elements',
'resids', 'resnames', 'chainIDs',
'moltypes', 'molnums', 'charges',
'bonds', 'angles', 'dihedrals', 'impropers']
expected_attrs = [
"ids",
"names",
"elements",
"resids",
"resnames",
"chainIDs",
"moltypes",
"molnums",
"charges",
"bonds",
"angles",
"dihedrals",
"impropers",
]

def test_moltypes(self, top):
moltypes = top.moltypes.values
Expand Down

0 comments on commit 5bbca5f

Please sign in to comment.