Commit 4663b405 by Francois Gygi

new charge mixing variables


git-svn-id: http://qboxcode.org/svn/qb/trunk@304 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 0627845f
////////////////////////////////////////////////////////////////////////////////
//
// ChargeMixCoeff.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ChargeMixCoeff.h,v 1.1 2004-12-02 22:20:23 fgygi Exp $
#ifndef CHARGEMIXCOEFF_H
#define CHARGEMIXCOEFF_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class ChargeMixCoeff : public Var
{
Sample *s;
public:
char *name ( void ) const { return "charge_mix_coeff"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " charge_mix_coeff takes only one value" << endl;
return 1;
}
double v = atof(argv[1]);
if ( v < 0.0 )
{
if ( ui->onpe0() )
cout << " charge_mix_coeff must be non-negative" << endl;
return 1;
}
s->ctrl.charge_mix_coeff = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.charge_mix_coeff;
return st.str();
}
ChargeMixCoeff(Sample *sample) : s(sample) { s->ctrl.charge_mix_coeff = 0.5; };
};
#endif
////////////////////////////////////////////////////////////////////////////////
//
// ChargeMixRcut.h
//
////////////////////////////////////////////////////////////////////////////////
// $Id: ChargeMixRcut.h,v 1.1 2004-12-02 22:20:23 fgygi Exp $
#ifndef CHARGEMIXRCUT_H
#define CHARGEMIXRCUT_H
#include<iostream>
#include<iomanip>
#include<sstream>
#include<stdlib.h>
#include "Sample.h"
class ChargeMixRcut : public Var
{
Sample *s;
public:
char *name ( void ) const { return "charge_mix_rcut"; };
int set ( int argc, char **argv )
{
if ( argc != 2 )
{
if ( ui->onpe0() )
cout << " charge_mix_rcut takes only one value" << endl;
return 1;
}
double v = atof(argv[1]);
if ( v < 0.0 )
{
if ( ui->onpe0() )
cout << " charge_mix_rcut must be non-negative" << endl;
return 1;
}
s->ctrl.charge_mix_rcut = v;
return 0;
}
string print (void) const
{
ostringstream st;
st.setf(ios::left,ios::adjustfield);
st << setw(10) << name() << " = ";
st.setf(ios::right,ios::adjustfield);
st << setw(10) << s->ctrl.charge_mix_rcut;
return st.str();
}
ChargeMixRcut(Sample *sample) : s(sample) { s->ctrl.charge_mix_rcut = 10.0; };
};
#endif
......@@ -3,7 +3,7 @@
// Control.h:
//
////////////////////////////////////////////////////////////////////////////////
// $Id: Control.h,v 1.8 2004-09-14 22:24:11 fgygi Exp $
// $Id: Control.h,v 1.9 2004-12-02 22:20:23 fgygi Exp $
#ifndef CONTROL_H
#define CONTROL_H
......@@ -46,6 +46,9 @@ struct Control
double dt;
int iprint;
int timeout;
int timeout;
double charge_mix_coeff;
double charge_mix_rcut;
};
#endif
......@@ -3,7 +3,7 @@
// qb.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: qb.C,v 1.41 2004-11-10 22:43:39 fgygi Exp $
// $Id: qb.C,v 1.42 2004-12-02 22:22:19 fgygi Exp $
#include <iostream>
#include <string>
......@@ -45,6 +45,8 @@ using namespace std;
#include "CellDyn.h"
#include "CellLock.h"
#include "CellMass.h"
#include "ChargeMixCoeff.h"
#include "ChargeMixRcut.h"
#include "Debug.h"
#include "Ecut.h"
#include "Ecutprec.h"
......@@ -206,6 +208,8 @@ int main(int argc, char **argv, char **envp)
ui.addVar(new Cell(s));
ui.addVar(new CellDyn(s));
ui.addVar(new CellLock(s));
ui.addVar(new ChargeMixCoeff(s));
ui.addVar(new ChargeMixRcut(s));
ui.addVar(new CellMass(s));
ui.addVar(new Debug(s));
ui.addVar(new Ecut(s));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment