From fd980e8fe0d14eedbff3ac9b232a54e072e6774b Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Fri, 11 Mar 2022 11:12:59 -0700 Subject: [PATCH] support for writing data files to fix pitorsion --- src/AMOEBA/fix_pitorsion.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/AMOEBA/fix_pitorsion.cpp b/src/AMOEBA/fix_pitorsion.cpp index b474c34202..7679458a7f 100644 --- a/src/AMOEBA/fix_pitorsion.cpp +++ b/src/AMOEBA/fix_pitorsion.cpp @@ -812,8 +812,12 @@ void FixPiTorsion::write_data_section_size(int mth, int &nx, int &ny) // PiTorsion Coeffs section // nx = # of PiTorsion types // ny = 2 columns = PiTorsion type + value + // only proc 0 returns a non-zero nx } else if (mth == 1) { + if (me == 0) nx = npitorsion_types; + else nx = 0; + ny = 2; } } @@ -853,8 +857,17 @@ void FixPiTorsion::write_data_section_pack(int mth, double **buf) // PiTorsion Coeffs section // 1st column = pitorsion type // 2nd column = value + // only proc 0 returns any data } else if (mth == 1) { + if (me) return; + + int n = 0; + for (i = 1; i <= npitorsion_types; i++) { + buf[n][0] = ubuf(i).d; + buf[n][1] = kpit[i]; + n += 2; + } } } @@ -893,6 +906,8 @@ void FixPiTorsion::write_data_section(int mth, FILE *fp, // PiTorsion Coeffs section } else if (mth == 1) { + for (int i = 0; i < n; i++) + fprintf(fp,"%d %g\n",(int) ubuf(buf[i][0]).i,buf[i][1]); } }