40 #ifndef MADNESS_SCFPARAM_H 
   41 #define MADNESS_SCFPARAM_H 
   44 #include <moldft/molecule.h> 
   45 #include <moldft/molecularbasis.h> 
   99     template <
typename Archive>
 
  101         ar & charge & smear & econv & dconv & L & maxrotn & nvalpha & nvbeta & nopen & maxiter & nio & 
spin_restricted;
 
  102         ar & plotlo & plothi & plotdens & plotcoul & localize & localize_pm & restart & maxsub & npt_plot & plot_cell & 
aobasis;
 
  103         ar & nalpha & nbeta & nmo_alpha & nmo_beta & 
lo;
 
  104         ar & core_type & derivatives & conv_only_dens & 
dipole;
 
  106         ar & gopt & gtol & gtest & gval & gprec & gmaxiter & 
algopt;
 
  121         , spin_restricted(true)
 
  135         , conv_only_dens(false)
 
  154         std::ifstream 
f(filename.c_str());
 
  164             else if (s == 
"charge") {
 
  167             else if (s == 
"smear") {
 
  170             else if (s == 
"econv") {
 
  173             else if (s == 
"dconv") {
 
  179             else if (s == 
"maxrotn") {
 
  182             else if (s == 
"nvalpha") {
 
  185             else if (s == 
"nvbeta") {
 
  188             else if (s == 
"nopen") {
 
  191             else if (s == 
"unrestricted") {
 
  192                 spin_restricted = 
false;
 
  194             else if (s == 
"restricted") {
 
  195                 spin_restricted = 
true;
 
  197             else if (s == 
"maxiter") {
 
  200             else if (s == 
"nio") {
 
  203             else if (s == 
"xc") {
 
  205                 f.getline(buf,
sizeof(buf));
 
  208             else if (s == 
"protocol") {
 
  211                 protocol_data = std::vector<double>();
 
  213                 std::stringstream s(buf);
 
  214                 while (s >> d) protocol_data.push_back(d);
 
  216             else if (s == 
"plotmos") {
 
  219             else if (s == 
"plotdens") {
 
  222             else if (s == 
"plotcoul") {
 
  225             else if (s == 
"plotnpt") {
 
  228             else if (s == 
"plotcell") {
 
  232             else if (s == 
"aobasis") {
 
  234                 if (aobasis!=
"sto-3g" && aobasis!=
"6-31g") {
 
  235                     std::cout << 
"moldft: unrecognized aobasis (sto-3g or 6-31g only): " << aobasis << std::endl;
 
  239             else if (s == 
"canon") {
 
  242             else if (s == 
"local") {
 
  245             else if (s == 
"pm") {
 
  248             else if (s == 
"boys") {
 
  251             else if (s == 
"restart") {
 
  254             else if (s == 
"maxsub") {
 
  256                 if (maxsub <= 0) maxsub = 1;
 
  257                 if (maxsub > 20) maxsub = 20;
 
  259             else if (s == 
"core_type") {
 
  262             else if (s == 
"derivatives") {
 
  265             else if (s == 
"dipole") {
 
  268             else if (s == 
"convonlydens") {
 
  269                 conv_only_dens = 
true;
 
  271             else if (s == 
"gopt") {
 
  274             else if (s == 
"gtol") {
 
  277             else if (s == 
"gtest") {
 
  280             else if (s == 
"gval") {
 
  283             else if (s == 
"gprec") {
 
  286             else if (s == 
"gmaxiter") {
 
  289             else if (s == 
"algopt") {
 
  291                 f.getline(buf,
sizeof(buf));
 
  295                 std::cout << 
"moldft: unrecognized input keyword " << s << std::endl;
 
  298             if (nopen != 0) spin_restricted = 
false;
 
  304         int nelec = int(z - charge - n_core*2);
 
  305         if (
fabs(nelec+charge+n_core*2-z) > 1e-6) {
 
  306             error(
"non-integer number of electrons?", nelec+charge+n_core*2-z);
 
  308         nalpha = (nelec + 
nopen)/2;
 
  309         nbeta  = (nelec - 
nopen)/2;
 
  310         if (nalpha < 0) 
error(
"negative number of alpha electrons?", nalpha);
 
  311         if (nbeta < 0) 
error(
"negative number of beta electrons?", nbeta);
 
  312         if ((nalpha+nbeta) != nelec) 
error(
"nalpha+nbeta != nelec", nalpha+nbeta);
 
  314         nmo_beta = nbeta + 
nvbeta;
 
  315         if (nalpha != nbeta) spin_restricted = 
false;
 
  320         int nbf = aobasis.
nbf(molecule);
 
  321         nmo_alpha = 
std::min(nbf,nmo_alpha);
 
  323         if (nalpha>nbf || nbeta>nbf) 
error(
"too few basis functions?", nbf);
 
  324         nvalpha = nmo_alpha - 
nalpha;
 
  325         nvbeta = nmo_beta - 
nbeta;
 
  354 #ifdef MADNESS_HAS_LIBXC 
  370             madness::print(
" Convergence criteria are density delta & BSH residual.");
 
  375         if (plot_cell.size() > 0)
 
  382         if (localize_pm) loctype = 
"pm";
 
bool localize_pm
If true use PM for localization. 
Definition: scfparam.h:73
Tensor< double > tensorT
Definition: DFcode/distpm.cc:13
bool derivatives
If true calculate derivatives. 
Definition: scfparam.h:80
std::string aobasis
AO basis used for initial guess (6-31g or sto-3g) 
Definition: scfparam.h:78
bool gopt
geometry optimizer 
Definition: scfparam.h:91
tensorT plot_cell
lo hi in each dimension for plotting (default is all space) 
Definition: scfparam.h:77
std::vector< double > protocol_data
Calculation protocol. 
Definition: scfparam.h:90
int nalpha
Number of alpha spin electrons. 
Definition: scfparam.h:84
double L
User coordinates box size. 
Definition: scfparam.h:61
int nopen
Number of unpaired electrons = napha-nbeta. 
Definition: scfparam.h:65
std::istream & position_stream(std::istream &f, const std::string &tag)
Definition: position_stream.cc:37
bool plotcoul
If true plot the total coulomb potential at convergence. 
Definition: scfparam.h:71
double dconv
Density convergence. 
Definition: scfparam.h:60
bool restart
If true restart from orbitals on disk. 
Definition: scfparam.h:74
int plotlo
Definition: scfparam.h:69
::std::string string
Definition: gtest-port.h:872
void read_file(const std::string &filename)
Definition: scfparam.h:153
int nbf(const Molecule &molecule) const 
Given a molecule count the number of basis functions. 
Definition: DFcode/molecularbasis.h:555
double gtol
geometry tolerance 
Definition: scfparam.h:92
double total_nuclear_charge() const 
Definition: DFcode/molecule.cc:542
NDIM & f
Definition: mra.h:2179
double smallest_length_scale() const 
Definition: DFcode/molecule.cc:300
Definition: DFcode/molecule.h:82
bool conv_only_dens
If true remove bsh_residual from convergence criteria how ugly name is... 
Definition: scfparam.h:82
void gprint(World &world) const 
Definition: scfparam.h:393
int maxiter
Maximum number of iterations. 
Definition: scfparam.h:66
double maxrotn
Step restriction used in autoshift algorithm. 
Definition: scfparam.h:62
int gmaxiter
optimization maxiter 
Definition: scfparam.h:96
int nio
No. of io servers to use. 
Definition: scfparam.h:67
unsigned int maxsub
Size of iterative subspace ... set to 0 or 1 to disable. 
Definition: scfparam.h:75
Defines and implements most of Tensor. 
double econv
Energy convergence. 
Definition: scfparam.h:59
double charge
Total molecular charge. 
Definition: scfparam.h:57
Tensor< double > tensorT
Definition: scfparam.h:47
double gval
value precision 
Definition: scfparam.h:94
SCFParameters()
Definition: scfparam.h:109
void serialize(Archive &ar)
Definition: scfparam.h:100
bool gtest
geometry tolerance 
Definition: scfparam.h:93
int nvbeta
Number of beta virtuals to compute. 
Definition: scfparam.h:64
const mpreal min(const mpreal &x, const mpreal &y)
Definition: mpreal.h:2675
int nmo_beta
Number of beta spin molecular orbitals. 
Definition: scfparam.h:87
int nvalpha
Number of alpha virtuals to compute. 
Definition: scfparam.h:63
double smear
Smearing parameter. 
Definition: scfparam.h:58
std::string core_type
core potential type ("" or "mcp") 
Definition: scfparam.h:79
int nmo_alpha
Number of alpha spin molecular orbitals. 
Definition: scfparam.h:86
void error(const char *msg, int code)
Definition: oldtest.cc:57
Definition: scfparam.h:49
void set_molecular_info(const Molecule &molecule, const AtomicBasisSet &aobasis, unsigned int n_core)
Definition: scfparam.h:302
bool dipole
If true calculatio dipole moment. 
Definition: scfparam.h:81
double bounding_cube() const 
Returns the half width of the bounding cube. 
Definition: DFcode/molecule.cc:532
std::string xc_data
XC input line. 
Definition: scfparam.h:89
int plothi
Range of MOs to print (for both spins if polarized) 
Definition: scfparam.h:69
std::string algopt
algorithm used for optimization 
Definition: scfparam.h:97
void print(World &world) const 
Definition: scfparam.h:338
int npt_plot
No. of points to use in each dim for plots. 
Definition: scfparam.h:76
bool plotdens
If true print the density at convergence. 
Definition: scfparam.h:70
double lo
Smallest length scale we need to resolve. 
Definition: scfparam.h:88
std::vector< T > vector_factory(const T &v0)
Returns a std::vector initialized from the arguments. 
Definition: vector_factory.h:50
void print(const A &a)
Print a single item to std::cout terminating with new line. 
Definition: print.h:122
#define MADNESS_EXCEPTION(msg, value)
Definition: worldexc.h:88
int nbeta
Number of beta spin electrons. 
Definition: scfparam.h:85
bool spin_restricted
True if spin restricted. 
Definition: scfparam.h:68
const mpreal fabs(const mpreal &v, mp_rnd_t rnd_mode)
Definition: mpreal.h:2187
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces. 
Definition: chem/atomutil.cc:45
Contracted Gaussian basis. 
Definition: DFcode/molecularbasis.h:390
double gprec
gradient precision 
Definition: scfparam.h:95
bool localize
If true solve for localized orbitals. 
Definition: scfparam.h:72