Skip to content

Commit

Permalink
Periodic Angle Padding (#242)
Browse files Browse the repository at this point in the history
* fix #241 
* add .copy(deep=True) method for dataframe augmentation to avoid pandas potentially loosing changes
  to a df due to working on a copy after indexing
* update CHANGES
* note: Tests pass as before so no functional code changes but more robust code
  • Loading branch information
cadeduckworth committed Mar 27, 2023
1 parent ecab235 commit b7d0b06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Enhancements

Fixes

* for mdpow.workflows.dihedrals.periodic_angle() implement .copy(deep=True)
to explicitly make a copy DataFrame of the data for angle padding (#242)
* fix rcoulomb in CHARMM energy minimization MDP template file (PR #210)
* fix ensemble.EnsembleAnalysis.check_groups_from_common_ensemble (#212)

Expand Down
6 changes: 3 additions & 3 deletions mdpow/workflows/dihedrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,11 @@ def periodic_angle(df, padding=45):
'''

df1 = df[df.dihedral > 180 - padding]
df1 = df[df.dihedral > 180 - padding].copy(deep=True)
df1.dihedral -= 360
df2 = df[df.dihedral < -180 + padding]
df2 = df[df.dihedral < -180 + padding].copy(deep=True)
df2.dihedral += 360
df_aug = pd.concat([df1, df, df2]).reset_index()
df_aug = pd.concat([df1, df, df2]).reset_index(drop=True)

return df_aug

Expand Down

0 comments on commit b7d0b06

Please sign in to comment.