Prevent BPM bonds breaking during setup

This commit is contained in:
jtclemm
2025-04-11 12:53:51 -06:00
parent 7a40e78c7a
commit 2ca9e188c0
3 changed files with 9 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#include "memory.h"
#include "modify.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
@ -483,6 +484,7 @@ void BondBPMRotational::compute(int eflag, int vflag)
int newton_bond = force->newton_bond;
double **bondstore = fix_bond_history->bondstore;
const bool allow_breaks = (update->setupflag == 0) && break_flag;
for (n = 0; n < nbondlist; n++) {
@ -527,7 +529,7 @@ void BondBPMRotational::compute(int eflag, int vflag)
breaking = elastic_forces(i1, i2, type, r_mag, r0_mag, r_mag_inv, rhat, r, r0, force1on2,
torque1on2, torque2on1);
if ((breaking >= 1.0) && break_flag) {
if ((breaking >= 1.0) && allow_breaks) {
bondlist[n][2] = 0;
process_broken(i1, i2);
continue;

View File

@ -26,6 +26,7 @@
#include "memory.h"
#include "modify.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
@ -218,6 +219,7 @@ void BondBPMSpring::compute(int eflag, int vflag)
double invdim = 1.0 / dim;
double **bondstore = fix_bond_history->bondstore;
const bool allow_breaks = (update->setupflag == 0) && break_flag;
for (n = 0; n < nbondlist; n++) {
@ -249,7 +251,7 @@ void BondBPMSpring::compute(int eflag, int vflag)
r = sqrt(rsq);
e = (r - r0) / r0;
if ((fabs(e) > ecrit[type]) && break_flag) {
if ((fabs(e) > ecrit[type]) && allow_breaks) {
bondlist[n][2] = 0;
process_broken(i1, i2);

View File

@ -26,6 +26,7 @@
#include "force.h"
#include "memory.h"
#include "neighbor.h"
#include "update.h"
#include <cmath>
#include <cstring>
@ -185,6 +186,7 @@ void BondBPMSpringPlastic::compute(int eflag, int vflag)
int newton_bond = force->newton_bond;
double **bondstore = fix_bond_history->bondstore;
const bool allow_breaks = (update->setupflag == 0) && break_flag;
for (n = 0; n < nbondlist; n++) {
@ -217,7 +219,7 @@ void BondBPMSpringPlastic::compute(int eflag, int vflag)
r = sqrt(rsq);
e = (r - r0) / r0;
if ((fabs(e) > ecrit[type]) && break_flag) {
if ((fabs(e) > ecrit[type]) && allow_breaks) {
bondlist[n][2] = 0;
process_broken(i1, i2);
continue;