Hello,
I have been trying to modify the verlet files to create a runge_kutta integration class for academic reasons...
I have added the variable bool has_converged as a protected variable, and a public function virtual void set_has_converged as follows
#ifdef INTEGRATE_CLASS
IntegrateStyle(my_rk,my_rk)
#else
#ifndef LMP_MY_RK_H
#define LMP_MY_RK_H
#include "integrate.h"
namespace LAMMPS_NS {
class my_rk : public Integrate {
public:
my_rk(class LAMMPS *, int, char **);
virtual ~my_rk() {}
virtual void init();
virtual void setup();
virtual void setup_minimal(int);
virtual void run(int);
virtual void set_has_converged(bool arg){has_converged = arg};
void cleanup();
protected:
int triclinic; // 0 if domain is orthog, 1 if triclinic
int torqueflag,erforceflag;
int e_flag,rho_flag;
bool has_converged;
void force_clear();
};
}
#endif
#endif
I have then created rk4.h and rk4.cpp to implement the 4th order runge kutta method.
In rk4.cpp i have included my_rk.h and am trying to access the function set_has_converged function in my_rk.h bt
my_rk->set_has_converged(arg);
but I am getting the error
expected unqualified-id before ‘->’
Am i missing something in my_rk.h?
Thank you!
arnom | Thu, 07/20/2017 - 08:20
my_rk is the class name and
my_rk is the class name and not a variable name.
You want to have a:
my_rk *variable_rk = new my_rk(lmp, narg, arg);
(possibly in the constructor of your rk class)
then you can use:
variable_rk->set_has_converged(my_bool);
and do not forget to delete in the rk class destructor:
delete variable_rk;
HTH,
Arno
mschramm | Fri, 07/21/2017 - 21:21
Thank you
Thank you for the help.