Skip to content

Commit

Permalink
Made changes to ctests infrastructure and added appropriate changes i…
Browse files Browse the repository at this point in the history
…n src folder
  • Loading branch information
phanimotamarri committed Jun 22, 2018
1 parent fd03c67 commit 24f7074
Show file tree
Hide file tree
Showing 39 changed files with 3,372 additions and 64 deletions.
60 changes: 60 additions & 0 deletions include/PeriodicTable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// ---------------------------------------------------------------------
//
// Copyright (c) 2017 The Regents of the University of Michigan and DFT-FE authors.
//
// This file is part of the DFT-FE code.
//
// The DFT-FE code is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the DFT-FE distribution.
//
// ---------------------------------------------------------------------
//
// @author Phani Motamarri (2018)
//

#ifndef PERIODICTABLE_H
#define PERIODICTABLE_H

#include <map>
#include <vector>
#include <string>

namespace dftfe
{
namespace pseudoUtils
{
struct Element
{
int z;
std::string symbol;
std::string config;
double mass;
Element(int zz, std::string s, std::string c, double m) : z(zz), symbol(s), config(c),mass(m) {}
};

class PeriodicTable
{
private:

std::vector<Element> ptable;
std::map<std::string,int> zmap;

public:

PeriodicTable(void);
int z(std::string symbol) const;
std::string symbol(int zval) const;
std::string configuration(int zval) const;
std::string configuration(std::string symbol) const;
double mass(int zval) const;
double mass(std::string symbol) const;
int size(void) const;

};
}
}
#endif
4 changes: 2 additions & 2 deletions include/dftParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ namespace dftfe {
namespace dftParameters
{

extern unsigned int finiteElementPolynomialOrder,n_refinement_steps,numberEigenValues,xc_id, spinPolarized, nkx,nky,nkz, pseudoProjector;
extern unsigned int finiteElementPolynomialOrder,n_refinement_steps,numberEigenValues,xc_id, spinPolarized, nkx,nky,nkz;
extern unsigned int chebyshevOrder,numPass,numSCFIterations,maxLinearSolverIterations, mixingHistory, npool;

extern double radiusAtomBall, mixingParameter, dkx, dky, dkz;
extern double lowerEndWantedSpectrum,relLinearSolverTolerance,selfConsistentSolverTolerance,TVal, start_magnetization;

extern bool isPseudopotential, periodicX, periodicY, periodicZ, useSymm, timeReversal;
extern bool isPseudopotential, periodicX, periodicY, periodicZ, useSymm, timeReversal,pseudoTestsFlag;
extern std::string meshFileName,coordinatesFile,domainBoundingVectorsFile,kPointDataFile, ionRelaxFlagsFile, orthogType,pseudoPotentialFile;

extern double outerAtomBallRadius, meshSizeOuterDomain;
Expand Down
30 changes: 30 additions & 0 deletions include/pseudoConverter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ---------------------------------------------------------------------
//
// Copyright (c) 2017 The Regents of the University of Michigan and DFT-FE authors.
//
// This file is part of the DFT-FE code.
//
// The DFT-FE code is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the DFT-FE distribution.
//
// ---------------------------------------------------------------------
//
// @author Phani Motamarri (2018)
//

#ifndef converter_h
#define converter_h
#include <string>
#include "string.h"
namespace dftfe
{
namespace pseudoUtils
{
void convert(std::string & file);
}
}
#endif
34 changes: 34 additions & 0 deletions include/upfToxml.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// ---------------------------------------------------------------------
//
// Copyright (c) 2017 The Regents of the University of Michigan and DFT-FE authors.
//
// This file is part of the DFT-FE code.
//
// The DFT-FE code is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the DFT-FE distribution.
//
// ---------------------------------------------------------------------
//
// @author Phani Motamarri (2018)
//

#ifndef upfToxml_h
#define upfToxml_h
#include <string>
#include "string.h"
#include <headers.h>
#include <dftParameters.h>

namespace dftfe
{
namespace pseudoUtils
{
int upfToxml(std::string &inputFile,
std::string &outputFile);
}
}
#endif
94 changes: 94 additions & 0 deletions include/xmlTodftfeParser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// ---------------------------------------------------------------------
//
// Copyright (c) 2017-2018 The Regents of the University of Michigan and DFT-FE authors.
//
// This file is part of the DFT-FE code.
//
// The DFT-FE code is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the DFT-FE distribution.
//
// ---------------------------------------------------------------------
//
// @author Shukan Parekh, Phani Motamarri
//

#include <vector>
#include <string>
#include <string.h>
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <sstream>
#include <fstream>
#include <tuple>
#include <stack>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <fstream>

#ifndef xmlTodftfeParser_h
#define xmlTodftfeParser_h

namespace dftfe{
//
//Declare pseudoUtils function
//
namespace pseudoUtils
{

class xmlTodftfeParser{

private:
xmlDoc *doc;
xmlNode *root;
double mesh_spacing;
std::vector<std::string> local_potential;
std::vector<std::string> density;
std::vector<std::string> mesh;
std::vector<std::tuple<size_t, size_t, std::vector<std::string>>> projectors;
std::vector<std::tuple<size_t, size_t, size_t, double>> d_ij;

std::ofstream loc_pot;
std::ofstream dense;
std::ofstream denom;
std::ofstream l1;
std::ofstream l2;
std::ofstream l3;
std::ofstream ad_file;
std::ofstream pseudo;

public:
/**
* class constructor
*/
xmlTodftfeParser();

/**
* class destructor
*/
~xmlTodftfeParser();

/**
* @brief parse a given xml pseudopotential file
*
* @param filePath location of the xml file
*/
bool parseFile(std::string & filePath);

/**
* @brief output the parsed xml pseudopotential file into dat files required by dftfe code
*
* @param filePath location to write the data
*/
bool outputData(std::string & filePath);

};

}

}
#endif /* parser_h */
3 changes: 2 additions & 1 deletion src/dft/initPseudo-OV.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ void dftClass<FEOrder>::initNonLocalPseudoPotential_OV()

unsigned int atomicNumber = *it;

pcout<<"Reading data from file: "<<pseudoAtomDataFile<<std::endl;
if(dftParameters::verbosity >= 2)
pcout<<"Reading data from file: "<<pseudoAtomDataFile<<std::endl;

//
// open the testFunctionFileName
Expand Down
6 changes: 3 additions & 3 deletions src/dft/initPseudo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void dftClass<FEOrder>::initLocalPseudoPotential()
//else
//sprintf(pseudoFile,"%s/data/electronicStructure/pseudoPotential/z%u/pseudoAtomData/locPot.dat", DFT_PATH,*it);

if (!dftParameters::reproducible_output)
if (dftParameters::verbosity>=2)
pcout<<"Reading Local Pseudo-potential data from: " <<pseudoFile<<std::endl;
dftUtils::readFile(2, pseudoPotentialData[*it], pseudoFile);
unsigned int numRows = pseudoPotentialData[*it].size()-1;
Expand All @@ -59,9 +59,9 @@ void dftClass<FEOrder>::initLocalPseudoPotential()
x.setcontent(numRows,&xData[0]);
alglib::real_1d_array y;
y.setcontent(numRows,&yData[0]);
alglib::ae_int_t bound_type_l = 2;
alglib::ae_int_t bound_type_l = 0;
alglib::ae_int_t bound_type_r = 1;
const double slopeL= 0;//(pseudoPotentialData[*it][1][1]-pseudoPotentialData[*it][0][1])/(pseudoPotentialData[*it][1][0]-pseudoPotentialData[*it][0][0]);
const double slopeL= (pseudoPotentialData[*it][1][1]-pseudoPotentialData[*it][0][1])/(pseudoPotentialData[*it][1][0]-pseudoPotentialData[*it][0][0]);
const double slopeR=-pseudoPotentialData[*it][numRows-1][1]/pseudoPotentialData[*it][numRows-1][0];
spline1dbuildcubic(x, y, numRows, bound_type_l, slopeL, bound_type_r, slopeR, pseudoSpline[*it]);
outerMostPointPseudo[*it]= xData[numRows-1];
Expand Down
6 changes: 3 additions & 3 deletions src/dft/initRho.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void dftClass<FEOrder>::initRho()
char densityFile[256];
if(dftParameters::isPseudopotential)
{
if(dftParameters::pseudoProjector==1)
sprintf(densityFile, "%s/data/electronicStructure/pseudoPotential/z%u/singleAtomData/density.inp", DFT_PATH, *it);
else
//if(dftParameters::pseudoProjector==1)
// sprintf(densityFile, "%s/data/electronicStructure/pseudoPotential/z%u/singleAtomData/density.inp", DFT_PATH, *it);
//else
sprintf(densityFile,"temp/z%u/density.inp",*it);
//sprintf(densityFile, "%s/data/electronicStructure/pseudoPotential/z%u/oncv/singleAtomData/density.inp", DFT_PATH, *it);

Expand Down
Loading

0 comments on commit 24f7074

Please sign in to comment.