diff --git a/src/Makefile b/src/Makefile index 00d95b8..eaee598 100644 --- a/src/Makefile +++ b/src/Makefile @@ -71,6 +71,19 @@ CXXFLAGS += -DTARGET='"$(TARGET)"' ExtForceSet.o ExtForce.o PairExtForce.o AtomicExtForce.o \ GlobalExtForce.o sampling.o $(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS) + testSampleReader: testSampleReader.o AtomSet.o Atom.o Species.o \ + Wavefunction.o SlaterDet.o \ + Basis.o FourierTransform.o Matrix.o Context.o \ + sinft.o spline.o UnitCell.o \ + Base64Transcoder.o Constraint.o ConstraintSet.o DistanceConstraint.o \ + AngleConstraint.o TorsionConstraint.o PositionConstraint.o \ + ExtForceSet.o ExtForce.o PairExtForce.o AtomicExtForce.o \ + GlobalExtForce.o sampling.o \ + SampleReader.o StructuredDocumentHandler.o \ + SampleHandler.o AtomSetHandler.o WavefunctionHandler.o \ + SpeciesReader.o SpeciesHandler.o \ + XMLGFPreprocessor.o Base64Transcoder.o + $(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS) testChargeDensity: testChargeDensity.o ChargeDensity.o \ Wavefunction.o SlaterDet.o \ Basis.o FourierTransform.o Matrix.o UnitCell.o Context.o \ @@ -667,7 +680,8 @@ UserInterface.o: UserInterface.h qbox_xmlns.h VWNFunctional.o: VWNFunctional.h XCFunctional.h VWNFunctional.o: XCFunctional.h Wavefunction.o: Wavefunction.h D3vector.h UnitCell.h SlaterDet.h Context.h -Wavefunction.o: blacs.h Basis.h Matrix.h Timer.h jacobi.h SharedFilePtr.h +Wavefunction.o: blacs.h Basis.h Matrix.h Timer.h FourierTransform.h jacobi.h +Wavefunction.o: SharedFilePtr.h Wavefunction.o: D3vector.h UnitCell.h WavefunctionHandler.o: WavefunctionHandler.h StructureHandler.h UnitCell.h WavefunctionHandler.o: D3vector.h Wavefunction.h SlaterDet.h Context.h @@ -751,6 +765,10 @@ testMatrix.o: Timer.h Context.h blacs.h Matrix.h testSample.o: Context.h blacs.h SlaterDet.h Basis.h D3vector.h UnitCell.h testSample.o: Matrix.h Timer.h Sample.h AtomSet.h Atom.h D3tensor.h blas.h testSample.o: ConstraintSet.h ExtForceSet.h Wavefunction.h Control.h +testSampleReader.o: Context.h blacs.h SlaterDet.h Basis.h D3vector.h +testSampleReader.o: UnitCell.h Matrix.h Timer.h Sample.h AtomSet.h Atom.h +testSampleReader.o: D3tensor.h blas.h ConstraintSet.h ExtForceSet.h +testSampleReader.o: Wavefunction.h Control.h SampleReader.h testSlaterDet.o: Context.h blacs.h SlaterDet.h Basis.h D3vector.h UnitCell.h testSlaterDet.o: Matrix.h Timer.h FourierTransform.h testSpecies.o: Species.h SpeciesReader.h diff --git a/src/testSampleReader.C b/src/testSampleReader.C new file mode 100644 index 0000000..e58b88e --- /dev/null +++ b/src/testSampleReader.C @@ -0,0 +1,75 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2008 The Regents of the University of California +// +// This file is part of Qbox +// +// Qbox is distributed under the terms of the GNU General Public License +// as published by the Free Software Foundation, either version 2 of +// the License, or (at your option) any later version. +// See the file COPYING in the root directory of this distribution +// or . +// +//////////////////////////////////////////////////////////////////////////////// +// +// testSampleReader.C +// +// Test functionality of SampleReader +// use: ./testSampleReader sample.xml +// +//////////////////////////////////////////////////////////////////////////////// +#include +using namespace std; + +#include "Context.h" +#include "SlaterDet.h" +#include "UnitCell.h" +#include "Sample.h" +#include "D3vector.h" +#include "SampleReader.h" + +int main(int argc, char** argv) +{ + MPI_Init(&argc,&argv); + // extra scope to ensure that BlacsContext objects get destructed before + // the MPI_Finalize call + { + Context ctxt(MPI_COMM_WORLD); + + char processor_name[MPI_MAX_PROCESSOR_NAME]; + int namelen; + PMPI_Get_processor_name(processor_name,&namelen); + cout << " Process " << ctxt.mype() << " on " << processor_name << endl; + + Sample* s = new Sample(ctxt); + + SampleReader s_reader(s->ctxt_); + bool serial = false; + const char* filename = argv[1]; + + try + { + s_reader.readSample(*s,filename,serial); + } + catch ( const SampleReaderException& e ) + { + cout << " SampleReaderException caught:" << endl; + cout << e.msg << endl; + } + catch (...) + { + cout << " testSampleReader: cannot load Sample" << endl; + } + + //s->ctxt_.barrier(); + + if ( ctxt.onpe0() ) + { + cout << filename << endl; + cout << s->atoms.size() << " atoms" << endl; + cout << s->wf.nel() << " electrons" << endl; + } + } + MPI_Finalize(); + return 0; +}