Skip to content

Commit

Permalink
Merge pull request #115 from ye-luo/set-MF
Browse files Browse the repository at this point in the history
Allows adjust spline grid with -m meshfactor
  • Loading branch information
grahamlopez authored May 3, 2018
2 parents d91091e + 039f796 commit 00c6b6a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 20 deletions.
35 changes: 28 additions & 7 deletions src/Drivers/check_spo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ void print_help()
{
//clang-format off
app_summary() << "usage:" << '\n';
app_summary() << " check_spo [-hvV] [-g \"n0 n1 n2\"] [-n steps]" << '\n';
app_summary() << " [-r rmax] [-s seed]" << '\n';
app_summary() << " check_spo [-hvV] [-g \"n0 n1 n2\"] [-m meshfactor]" << '\n';
app_summary() << " [-n steps] [-r rmax] [-s seed]" << '\n';
app_summary() << "options:" << '\n';
app_summary() << " -g set the 3D tiling. default: 1 1 1" << '\n';
app_summary() << " -h print help and exit" << '\n';
app_summary() << " -m meshfactor default: 1.0" << '\n';
app_summary() << " -n number of MC steps default: 100" << '\n';
app_summary() << " -r set the Rmax. default: 1.7" << '\n';
app_summary() << " -s set the random seed. default: 11" << '\n';
Expand Down Expand Up @@ -86,7 +87,7 @@ int main(int argc, char **argv)
int opt;
while(optind < argc)
{
if ((opt = getopt(argc, argv, "hvVa:c:f:g:n:r:s:")) != -1)
if ((opt = getopt(argc, argv, "hvVa:c:f:g:m:n:r:s:")) != -1)
{
switch (opt)
{
Expand All @@ -98,6 +99,12 @@ int main(int argc, char **argv)
sscanf(optarg, "%d %d %d", &na, &nb, &nc);
break;
case 'h': print_help(); break;
case 'm':
{
const RealType meshfactor = atof(optarg);
nx *= meshfactor; ny *= meshfactor; nz *= meshfactor;
}
break;
case 'n':
nsteps = atoi(optarg);
break;
Expand Down Expand Up @@ -154,10 +161,24 @@ int main(int argc, char **argv)
const int norb = count_electrons(ions, 1) / 2;
tileSize = (tileSize > 0) ? tileSize : norb;
nTiles = norb / tileSize;
app_summary() << "\nNumber of orbitals/splines = " << norb
<< " and Tile size = " << tileSize
<< " and Number of tiles = " << nTiles
<< " and Iterations = " << nsteps << endl;

const unsigned int SPO_coeff_size =
(nx + 3) * (ny + 3) * (nz + 3) * norb * sizeof(RealType);
const double SPO_coeff_size_MB = SPO_coeff_size * 1.0 / 1024 / 1024;

app_summary() << "Number of orbitals/splines = " << norb << endl
<< "Tile size = " << tileSize << endl
<< "Number of tiles = " << nTiles << endl
<< "Rmax = " << Rmax << endl;
app_summary() << "Iterations = " << nsteps << endl;
app_summary() << "OpenMP threads = " << omp_get_max_threads() << endl;
#ifdef HAVE_MPI
app_summary() << "MPI processes = " << comm.size() << endl;
#endif

app_summary() << "\nSPO coefficients size = " << SPO_coeff_size
<< " bytes (" << SPO_coeff_size_MB << " MB)" << endl;

spo_main.set(nx, ny, nz, norb, nTiles);
spo_main.Lattice.set(lattice_b);
spo_ref_main.set(nx, ny, nz, norb, nTiles);
Expand Down
33 changes: 20 additions & 13 deletions src/Drivers/miniqmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@ void print_help()
{
//clang-format off
app_summary() << "usage:" << '\n';
app_summary() << " miniqmc [-hjvV] [-g \"n0 n1 n2\"] [-n steps]" << '\n';
app_summary() << " [-N substeps] [-r rmax] [-s seed]" << '\n';
app_summary() << " miniqmc [-hjvV] [-g \"n0 n1 n2\"] [-m meshfactor]" << '\n';
app_summary() << " [-n steps] [-N substeps] [-r rmax] [-s seed]" << '\n';
app_summary() << "options:" << '\n';
app_summary() << " -g set the 3D tiling. default: 1 1 1" << '\n';
app_summary() << " -h print help and exit" << '\n';
app_summary() << " -j enable three body Jastrow default: off" << '\n';
app_summary() << " -m meshfactor default: 1.0" << '\n';
app_summary() << " -n number of MC steps default: 100" << '\n';
app_summary() << " -N number of MC substeps default: 1" << '\n';
app_summary() << " -r set the Rmax. default: 1.7" << '\n';
Expand Down Expand Up @@ -209,7 +210,7 @@ int main(int argc, char **argv)
int opt;
while(optind < argc)
{
if ((opt = getopt(argc, argv, "hjvVa:c:g:n:N:r:s:")) != -1)
if ((opt = getopt(argc, argv, "hjvVa:c:g:m:n:N:r:s:")) != -1)
{
switch (opt)
{
Expand All @@ -227,6 +228,12 @@ int main(int argc, char **argv)
case 'j':
enableJ3 = true;
break;
case 'm':
{
const RealType meshfactor = atof(optarg);
nx *= meshfactor; ny *= meshfactor; nz *= meshfactor;
}
break;
case 'n':
nsteps = atoi(optarg);
break;
Expand Down Expand Up @@ -295,21 +302,21 @@ int main(int argc, char **argv)

const unsigned int SPO_coeff_size =
(nx + 3) * (ny + 3) * (nz + 3) * norb * sizeof(RealType);
double SPO_coeff_size_MB = SPO_coeff_size * 1.0 / 1024 / 1024;
const double SPO_coeff_size_MB = SPO_coeff_size * 1.0 / 1024 / 1024;

app_summary() << "\nNumber of orbitals/splines = " << norb << endl;
app_summary() << "Tile size = " << tileSize << endl;
app_summary() << "Number of tiles = " << nTiles << endl;
app_summary() << "Number of electrons = " << nels << endl;
app_summary() << "Number of orbitals/splines = " << norb << endl
<< "Tile size = " << tileSize << endl
<< "Number of tiles = " << nTiles << endl
<< "Number of electrons = " << nels << endl
<< "Rmax = " << Rmax << endl;
app_summary() << "Iterations = " << nsteps << endl;
app_summary() << "Rmax " << Rmax << endl;
app_summary() << "OpenMP threads " << omp_get_max_threads() << endl;
app_summary() << "OpenMP threads = " << omp_get_max_threads() << endl;
#ifdef HAVE_MPI
app_summary() << "MPI processes " << comm.size() << endl;
app_summary() << "MPI processes = " << comm.size() << endl;
#endif

app_summary() << "\nSPO coefficients size = " << SPO_coeff_size;
app_summary() << " bytes (" << SPO_coeff_size_MB << " MB)" << endl;
app_summary() << "\nSPO coefficients size = " << SPO_coeff_size
<< " bytes (" << SPO_coeff_size_MB << " MB)" << endl;

spo_main.set(nx, ny, nz, norb, nTiles);
spo_main.Lattice.set(lattice_b);
Expand Down

0 comments on commit 00c6b6a

Please sign in to comment.