Skip to content

Commit b7d0b06

Browse files
Periodic Angle Padding (#242)
* 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
1 parent ecab235 commit b7d0b06

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Enhancements
3030

3131
Fixes
3232

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

mdpow/workflows/dihedrals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ def periodic_angle(df, padding=45):
418418
419419
'''
420420

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

427427
return df_aug
428428

0 commit comments

Comments
 (0)