correctly determine the number of active pair style instances
This commit is contained in:
@ -82,15 +82,18 @@ void ComputeSpin::init()
|
||||
|
||||
// loop 1: obtain # of Pairs, and # of Pair/Spin styles
|
||||
|
||||
if (force->pair_match("spin",0,0)) { // only one Pair/Spin style
|
||||
pair = force->pair_match("spin",0,0);
|
||||
npairs = pair->instance_total;
|
||||
PairHybrid *hybrid = (PairHybrid *)force->pair_match("^hybrid",0);
|
||||
if (force->pair_match("^spin",0,0)) { // only one Pair/Spin style
|
||||
pair = force->pair_match("^spin",0,0);
|
||||
if (hybrid == nullptr) npairs = 1;
|
||||
else npairs = hybrid->nstyles;
|
||||
npairspin = 1;
|
||||
} else if (force->pair_match("spin",0,1)) { // more than one Pair/Spin style
|
||||
pair = force->pair_match("spin",0,1);
|
||||
npairs = pair->instance_total;
|
||||
} else if (force->pair_match("^spin",0,1)) { // more than one Pair/Spin style
|
||||
pair = force->pair_match("^spin",0,1);
|
||||
if (hybrid == nullptr) npairs = 1;
|
||||
else npairs = hybrid->nstyles;
|
||||
for (int i = 0; i<npairs; i++) {
|
||||
if (force->pair_match("spin",0,i)) {
|
||||
if (force->pair_match("^spin",0,i)) {
|
||||
npairspin ++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,15 +172,18 @@ void FixNVESpin::init()
|
||||
|
||||
// loop 1: obtain # of Pairs, and # of Pair/Spin styles
|
||||
|
||||
if (force->pair_match("spin",0,0)) { // only one Pair/Spin style
|
||||
pair = force->pair_match("spin",0,0);
|
||||
npairs = pair->instance_total;
|
||||
PairHybrid *hybrid = (PairHybrid *)force->pair_match("^hybrid",0);
|
||||
if (force->pair_match("^spin",0,0)) { // only one Pair/Spin style
|
||||
pair = force->pair_match("^spin",0,0);
|
||||
if (hybrid == nullptr) npairs = 1;
|
||||
else npairs = hybrid->nstyles;
|
||||
npairspin = 1;
|
||||
} else if (force->pair_match("spin",0,1)) { // more than one Pair/Spin style
|
||||
pair = force->pair_match("spin",0,1);
|
||||
npairs = pair->instance_total;
|
||||
} else if (force->pair_match("^spin",0,1)) { // more than one Pair/Spin style
|
||||
pair = force->pair_match("^spin",0,1);
|
||||
if (hybrid == nullptr) npairs = 1;
|
||||
else npairs = hybrid->nstyles;
|
||||
for (int i = 0; i<npairs; i++) {
|
||||
if (force->pair_match("spin",0,i)) {
|
||||
if (force->pair_match("^spin",0,i)) {
|
||||
npairspin ++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,13 +25,15 @@ PairStyle(hybrid,PairHybrid)
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class PairHybrid : public Pair {
|
||||
friend class ComputeSpin;
|
||||
friend class FixGPU;
|
||||
friend class FixIntel;
|
||||
friend class FixOMP;
|
||||
friend class FixNVESpin;
|
||||
friend class Force;
|
||||
friend class Info;
|
||||
friend class Neighbor;
|
||||
friend class Respa;
|
||||
friend class Info;
|
||||
friend class PairDeprecated;
|
||||
public:
|
||||
PairHybrid(class LAMMPS *);
|
||||
|
||||
Reference in New Issue
Block a user