Skip to content
Snippets Groups Projects
Commit 1172a0b4 authored by Giovanni Bussi's avatar Giovanni Bussi
Browse files

Fix #246

There was a bug in driver with --debug-pd when, unluckily, the
last domain had by chance zero atoms

(cherry picked from commit d669afb2)
parent b853f50e
No related branches found
No related tags found
No related merge requests found
...@@ -838,10 +838,14 @@ int Driver<real>::main(FILE* in,FILE*out,Communicator& pc) { ...@@ -838,10 +838,14 @@ int Driver<real>::main(FILE* in,FILE*out,Communicator& pc) {
p.cmd("setMasses",&dd_masses[0]); p.cmd("setMasses",&dd_masses[0]);
p.cmd("setCharges",&dd_charges[0]); p.cmd("setCharges",&dd_charges[0]);
} else { } else {
p.cmd("setForces",&forces[3*pd_start]); // this is required to avoid troubles when the last domain
p.cmd("setPositions",&coordinates[3*pd_start]); // contains zero atoms
p.cmd("setMasses",&masses[pd_start]); // Basically, for empty domains we pass null pointers
p.cmd("setCharges",&charges[pd_start]); #define fix_pd(xx) (pd_nlocal!=0?&xx:NULL)
p.cmd("setForces",fix_pd(forces[3*pd_start]));
p.cmd("setPositions",fix_pd(coordinates[3*pd_start]));
p.cmd("setMasses",fix_pd(masses[pd_start]));
p.cmd("setCharges",fix_pd(charges[pd_start]));
} }
p.cmd("setBox",&cell[0]); p.cmd("setBox",&cell[0]);
p.cmd("setVirial",&virial[0]); p.cmd("setVirial",&virial[0]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment