6#ifndef MADNESS_APPS_DFGUESSPARAMS_H_INCLUDED
7#define MADNESS_APPS_DFGUESSPARAMS_H_INCLUDED
41 void read(
World& world,
const std::string& raw_filename,
const double& myc,
bool restart,
bool Krestricted){
48 if(world.
rank()==0)
print(
"\n Reading initial data from restarted DF calculation");
56 unsigned int version = 0;
81 Fcwf reader(world, myc);
82 for(
int j=0; j < 4; j++){
91 std::vector<int> dummy2;
100 if (world.
rank() == 0) {
102 "' functions, but DFdriver expects standard MOs.");
115 input & temp_energies;
121 if(world.
rank()==0 &&
closed_shell && !Krestricted)
print(
"\n ***PLEASE NOTE***\n closed shell: add Krestricted to the input to halve the cost");
124 if (order < 1 or order > 30){
125 if(world.
rank() == 0)
print(
"\n ***PLEASE NOTE***\n Invalid wavelet order read from archive, setting to 8.\n This seems to happen when the default wavelet order is used in moldft.");
139 std::complex<double> myi(0,1);
146 Fcwf spinup(world, myc);
147 Fcwf spindown(world, myc);
163 spinup[0] = complexreader;
165 spinup[2] = (-myi) * Dz(complexreader);
166 spinup[2].
scale(0.5);
167 spinup[3] = (-myi) * (Dx(complexreader) + myi * Dy(complexreader));
168 spinup[3].
scale(0.5);
186 spinup[0] = complexreader;
188 spinup[2] = (-myi) * Dz(complexreader);
189 spinup[2].
scale(0.5);
190 spinup[3] = (-myi) * (Dx(complexreader) + myi * Dy(complexreader));
191 spinup[3].
scale(0.5);
194 spindown[1] = complexreader;
195 spindown[2] = (-myi) * (Dx(complexreader) - myi * Dy(complexreader));
196 spindown[2].
scale(0.5);
197 spindown[3] = (myi) * Dz(complexreader);
198 spindown[3].
scale(0.5);
220 Fcwf fcwfreader(world, myc);
224 fcwfreader[0] = complexreader;
226 fcwfreader[2] = (-myi) * Dz(complexreader);
227 fcwfreader[2].
scale(0.5);
228 fcwfreader[3] = (-myi) * (Dx(complexreader) + myi * Dy(complexreader));
229 fcwfreader[3].
scale(0.5);
236 unsigned int num_betas=0;
240 input & beta_energies;
245 std::vector<int> dummy4;
249 for(
unsigned int i = 0; i < num_betas; i++){
253 fcwfreader[1] = complexreader;
254 fcwfreader[2] = (-myi) * (Dx(complexreader) - myi * Dy(complexreader));
255 fcwfreader[2].
scale(0.5);
256 fcwfreader[3] = (myi) * Dz(complexreader);
257 fcwfreader[3].
scale(0.5);
267 for(
unsigned int i = 0; i < num_betas; i++){
283 Fcwf fcwfreader(world, myc);
287 if(world.
rank()==0)
print(
"swapping orbitals", i,
" and ", j);
318 if(world.
rank() != 0) {
319 std::ostream dev_null(
nullptr);
333 for(
unsigned int i=0; i <
nwchem.atoms.size(); i++){
336 x =
nwchem.atoms[i].position[0];
337 y =
nwchem.atoms[i].position[1];
338 z =
nwchem.atoms[i].position[2];
343 unsigned int numalpha(0), numbeta(0);
345 bool have_beta(
false);
346 for(
unsigned int i = 0; i <
nwchem.beta_occupancies.size(); i++){
347 if(
nwchem.beta_occupancies[i] > 0.0) have_beta =
true;
353 for(
unsigned int i = 0; i <
nwchem.occupancies.size(); i++){
354 if(
nwchem.occupancies[i] == 1.0) numalpha+=1;
356 for(
unsigned int i = 0; i <
nwchem.beta_occupancies.size(); i++){
357 if(
nwchem.beta_occupancies[i] == 1.0) numbeta+=1;
364 for(
unsigned int i = 0; i <
nwchem.occupancies.size(); i++){
365 if(
nwchem.occupancies[i] == 2.0) numalpha += 1;
370 if(world.
rank()==0 &&
closed_shell && !Krestricted)
print(
"\n ***PLEASE NOTE***\n closed shell: add Krestricted to the input to halve the cost");
382 if(world.
rank()==0)
print(
"\nalpha occupancies:\n",
nwchem.occupancies);
383 if(world.
rank()==0)
print(
"\nbeta occupancies:\n",
nwchem.beta_occupancies);
386 if(world.
rank()==0)
print(
"num alpha",numalpha);
387 if(world.
rank()==0)
print(
"num beta",numbeta);
393 for(
unsigned int i=0; i < numalpha; i++){
399 for(
unsigned int i=0; i < numalpha; i++){
405 for(
unsigned int i=0; i < numalpha-1; i++){
416 for(
auto basis : slymer::cast_basis<slymer::GaussianFunction>(
nwchem.basis_set)) {
418 std::vector<coord_3d> centers;
420 r[0] = basis.get().center[0]; r[1] = basis.get().center[1]; r[2] = basis.get().center[2];
421 centers.push_back(r);
425 double norm2 = temp1[ii].norm2();
438 Fcwf spinup(world, myc);
439 Fcwf spindown(world, myc);
443 std::complex<double> myi(0,1);
444 for(
unsigned int i = 0; i < numalpha-1; i++){
446 spinup[0] = complexreader;
448 spinup[2] = (-myi) * Dz(complexreader);
449 spinup[2].
scale(0.5);
450 spinup[3] = (-myi) * (Dx(complexreader) + myi * Dy(complexreader));
451 spinup[3].
scale(0.5);
456 spindown[1] = complexreader;
457 spindown[2] = (-myi) * (Dx(complexreader) - myi * Dy(complexreader));
458 spindown[2].
scale(0.5);
459 spindown[3] = (myi) * Dz(complexreader);
460 spindown[3].
scale(0.5);
466 spinup[0] = complexreader;
468 spinup[2] = (-myi) * Dz(complexreader);
469 spinup[2].
scale(0.5);
470 spinup[3] = (-myi) * (Dx(complexreader) + myi * Dy(complexreader));
471 spinup[3].
scale(0.5);
474 if(!have_beta and not Krestricted){
476 spindown[1] = complexreader;
477 spindown[2] = (-myi) * (Dx(complexreader) - myi * Dy(complexreader));
478 spindown[2].
scale(0.5);
479 spindown[3] = (myi) * Dz(complexreader);
480 spindown[3].
scale(0.5);
Format version for DFdriver restart archives, and its validation.
double myyfunc(const madness::coord_3d &r)
Definition DF.cc:28
double myxfunc(const madness::coord_3d &r)
Definition DF.cc:23
double q(double t)
Definition DKops.h:18
double myyfunc(const madness::coord_3d &r)
Definition DF.cc:28
double myxfunc(const madness::coord_3d &r)
Definition DF.cc:23
Function< std::complex< double >, 3 > function_real2complex(const Function< double, 3 > &r)
Definition DF.cc:99
the header of a restartdata archive, in one place
void scale(std::complex< double > a)
Definition fcwf.cc:161
void normalize()
Definition fcwf.cc:222
Implements derivatives operators with variety of boundary conditions on simulation domain.
Definition derivative.h:329
static void set_k(int value)
Sets the default wavelet order.
Definition funcdefaults.h:177
static void set_cubic_cell(double lo, double hi)
Sets the user cell to be cubic with each dimension having range [lo,hi].
Definition funcdefaults.h:383
FunctionFactory implements the named-parameter idiom for Function.
Definition function_factory.h:86
FunctionFactory & functor(const std::shared_ptr< FunctionFunctorInterface< T, NDIM > > &f)
Definition function_factory.h:141
Abstract base class interface required for functors used as input to Functions.
Definition function_interface.h:68
A multiresolution adaptive numerical function.
Definition mra.h:144
Definition molecule.h:129
void add_atom(double x, double y, double z, double q, int atn)
Definition molecule.cc:401
A tensor is a multidimensional array.
Definition tensor.h:318
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
void broadcast(objT &obj, ProcessID root) const
Same as world.gop.broadcast_serializable(obj, root).
Definition parallel_archive.h:260
Archive & local_archive() const
Returns a reference to the local archive.
Definition parallel_archive.h:248
Definition gaussian.h:376
Class for interfacing with NWChem (tested on version 6.6).
Definition NWChem.h:22
#define MADNESS_CHECK(condition)
Check a condition — even in a release build the condition is always evaluated so it can have side eff...
Definition madness_exception.h:182
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
#define MADNESS_ASSERT(condition)
Assert a condition that should be free of side-effects since in release builds this might be a no-op.
Definition madness_exception.h:134
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
std::string to_string(const Representation r)
Definition Restart.h:64
static const char * filename
Definition legendre.cc:96
std::vector< Function< TENSOR_RESULT_TYPE(T, R), NDIM > > transform(World &world, const std::vector< Function< T, NDIM > > &v, const Tensor< R > &c, bool fence=true)
Transforms a vector of functions according to new[i] = sum[j] old[j]*c[j,i].
Definition vmra.h:758
Function< std::complex< Q >, NDIM > function_real2complex(const Function< Q, NDIM > &r)
Definition complexfun.h:241
double norm2(World &world, const std::vector< Function< T, NDIM > > &v)
Computes the 2-norm of a vector of functions.
Definition vmra.h:961
@ nwchem
read an NWChem movecs file and iterate
std::vector< real_function_3d > vector_real_function_3d
Definition functypedefs.h:94
unsigned int symbol_to_atomic_number(const std::string &symbol)
Definition atomutil.cc:173
std::string clean_archive_filename(std::string name)
Definition DFParameters.h:18
FunctionFactory< double, 3 > real_factory_3d
Definition functypedefs.h:108
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:227
FunctionFactory< double_complex, 3 > complex_factory_3d
Definition functypedefs.h:115
void normalize(World &world, std::vector< Function< T, NDIM > > &v, bool fence=true)
Normalizes a vector of functions — v[i] = v[i].scale(1.0/v[i].norm2())
Definition vmra.h:2092
unsigned int read_df_restart_version(const Archive &ar)
Definition DFRestart.h:42
void require_supported_df_restart(const unsigned int version)
Throws unless version is a DF restart format this build can read.
Definition DFRestart.h:57
Function< T, NDIM > copy(const Function< T, NDIM > &f, const std::shared_ptr< WorldDCPmapInterface< Key< NDIM > > > &pmap, bool fence=true)
Create a new copy of the function with different distribution and optional fence.
Definition mra.h:2233
@ znemo
complex regularized orbitals
@ nemo
nemo's regularized orbitals F = psi/R
constexpr Properties Occupancies
MO occupancies.
Definition ESInterface.h:52
constexpr Properties MOs
The MO vector coefficients.
Definition ESInterface.h:51
constexpr Properties Energies
The MO energies.
Definition ESInterface.h:50
constexpr Properties Basis
The basis set.
Definition ESInterface.h:48
Definition InitParameters.h:22
double Init_total_energy
Total energy of the nonrelativistic ground state.
Definition InitParameters.h:25
bool closed_shell
Definition InitParameters.h:28
int order
Order of polynomial used in input.
Definition InitParameters.h:33
std::string inFile
Name of input archive to read in.
Definition InitParameters.h:24
Molecule molecule
The molecule used in input calculation.
Definition InitParameters.h:34
unsigned int num_occupied
Number of orbitals.
Definition InitParameters.h:29
double L
Box size of input - Dirac Fock calcluation is in same box.
Definition InitParameters.h:32
void read(World &world, const std::string &raw_filename, const double &myc, bool restart, bool Krestricted)
Definition InitParameters.h:41
Tensor< double > occ
Occupancy of input orbitals.
Definition InitParameters.h:31
double conv_thresh
Convergence threshold for MOs.
Definition InitParameters.h:26
void readnw(World &world, const std::string &filename, const double &myc, bool Krestricted)
Definition InitParameters.h:302
Tensor< double > energies
Energies of input orbitals.
Definition InitParameters.h:30
void print_params() const
Definition InitParameters.h:491
std::vector< Fcwf > orbitals
The occupied orbitals.
Definition InitParameters.h:35
InitParameters()
Definition InitParameters.h:38
bool spinrestricted
Indicates if input calc. was spin-restricted.
Definition InitParameters.h:27