diff --git a/src/colvar/Dipole.cpp b/src/colvar/Dipole.cpp index 1d7dab8cb7..5a050bb7cd 100644 --- a/src/colvar/Dipole.cpp +++ b/src/colvar/Dipole.cpp @@ -85,6 +85,9 @@ class Dipole : public Colvar { std::vector value, masses, charges; std::vector > derivs; std::vector virial; + Value* valuex=nullptr; + Value* valuey=nullptr; + Value* valuez=nullptr; public: explicit Dipole(const ActionOptions&); static void parseAtomList( const int& num, std::vector& t, ActionAtomistic* aa ); @@ -121,7 +124,12 @@ Dipole::Dipole(const ActionOptions&ao): { parseAtomList(-1,ga_lista,this); charges.resize(ga_lista.size()); components=(getModeAndSetupValues(this)==1); - if( components ) { value.resize(3); derivs.resize(3); virial.resize(3); } + if( components ) { + value.resize(3); derivs.resize(3); virial.resize(3); + valuex=getPntrToComponent("x"); + valuey=getPntrToComponent("y"); + valuez=getPntrToComponent("z"); + } for(unsigned i=0; i