From 1132441d18841ee9b104d2ab9fadda9ec9c863c0 Mon Sep 17 00:00:00 2001 From: Francois Gygi Date: Fri, 29 Apr 2005 18:12:37 +0000 Subject: [PATCH] modified to be consistent with the net_charge variable git-svn-id: http://qboxcode.org/svn/qb/trunk@388 cba15fb0-1239-40c8-b417-11db7ca47a34 --- src/AtomCmd.h | 17 +++++++---------- src/LoadCmd.C | 13 +------------ src/Nempty.h | 6 +++++- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/AtomCmd.h b/src/AtomCmd.h index 525aa46..80afbbb 100644 --- a/src/AtomCmd.h +++ b/src/AtomCmd.h @@ -3,7 +3,7 @@ // AtomCmd.h: // //////////////////////////////////////////////////////////////////////////////// -// $Id: AtomCmd.h,v 1.5 2004-09-14 22:24:11 fgygi Exp $ +// $Id: AtomCmd.h,v 1.6 2005-04-29 18:12:37 fgygi Exp $ #ifndef ATOMCMD_H #define ATOMCMD_H @@ -66,6 +66,7 @@ class AtomCmd : public Cmd Atom *a = new Atom(name,species,position,velocity); + const int atoms_nel_before = s->atoms.nel(); if ( !(s->atoms.addAtom( a ) ) ) { if ( ui->onpe0() ) @@ -73,22 +74,18 @@ class AtomCmd : public Cmd delete a; return 1; } + const int atoms_nel_after = s->atoms.nel(); + const int delta_nel = atoms_nel_after - atoms_nel_before; + const int wf_nel = s->wf.nel(); -#if DEBUG -cout << " dbg check "<< __FILE__ <<" "<< __LINE__ <<" mype="<< mype << endl; -#endif - - s->wf.set_nel(s->atoms.nel()); + s->wf.set_nel(wf_nel+delta_nel); s->wf.update_occ(0.0); if ( s->wfv != 0 ) { - s->wfv->set_nel(s->atoms.nel()); + s->wfv->set_nel(wf_nel+delta_nel); s->wfv->clear(); } -#if DEBUG -cout << " dbg check "<< __FILE__ <<" "<< __LINE__ <<" mype="<< mype << endl; -#endif return 0; } }; diff --git a/src/LoadCmd.C b/src/LoadCmd.C index 85c0717..39e5d74 100644 --- a/src/LoadCmd.C +++ b/src/LoadCmd.C @@ -3,7 +3,7 @@ // LoadCmd.C // //////////////////////////////////////////////////////////////////////////////// -// $Id: LoadCmd.C,v 1.6 2004-09-14 22:24:11 fgygi Exp $ +// $Id: LoadCmd.C,v 1.7 2005-04-29 18:12:37 fgygi Exp $ #include "LoadCmd.h" #include "SampleReader.h" @@ -52,17 +52,6 @@ int LoadCmd::action(int argc, char **argv) s->ctxt_.barrier(); - // If only was read, set nel for the wavefunction - //cout << " LoadCmd: atoms.nel() = " << s->atoms.nel() << endl; - //cout << " LoadCmd: wf.nel() = " << s->wf.nel() << endl; - if ( s->wf.nel() != s->atoms.nel() ) - { - s->wf.set_nel(s->atoms.nel()); - s->wf.update_occ(0.0); - } - //cout << " LoadCmd: atoms.nel() = " << s->atoms.nel() << endl; - //cout << " LoadCmd: wf.nel() = " << s->wf.nel() << endl; - if ( ui->onpe0() ) cout << " -->" << endl; diff --git a/src/Nempty.h b/src/Nempty.h index ed48aab..a6f1a20 100644 --- a/src/Nempty.h +++ b/src/Nempty.h @@ -3,7 +3,7 @@ // Nempty.h // //////////////////////////////////////////////////////////////////////////////// -// $Id: Nempty.h,v 1.1 2003-01-25 01:23:31 fgygi Exp $ +// $Id: Nempty.h,v 1.2 2005-04-29 18:12:37 fgygi Exp $ #ifndef NEMPTY_H #define NEMPTY_H @@ -41,6 +41,10 @@ class Nempty : public Var } s->wf.set_nempty(v); + if ( s->wfv != 0 ) + { + s->wfv->set_nempty(v); + } return 0; } -- libgit2 0.26.0