Commit 47a857e2 by Francois Gygi

trailing blanks


git-svn-id: http://qboxcode.org/svn/qb/trunk@669 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 31690a44
......@@ -15,7 +15,7 @@
// AtomSet.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: AtomSet.C,v 1.25 2008-11-14 04:01:26 fgygi Exp $
// $Id: AtomSet.C,v 1.26 2008-11-14 04:06:41 fgygi Exp $
#include "AtomSet.h"
#include "Species.h"
......@@ -36,7 +36,7 @@ AtomSet::~AtomSet(void)
}
delete species_list[is];
}
}
}
////////////////////////////////////////////////////////////////////////////////
bool AtomSet::addSpecies(Species* sp, string name)
{
......
......@@ -11,7 +11,7 @@
# or <http://www.gnu.org/licenses/>.
#
#-------------------------------------------------------------------------------
# $Id: Makefile,v 1.58 2008-09-15 15:00:31 fgygi Exp $
# $Id: Makefile,v 1.59 2008-11-14 04:08:05 fgygi Exp $
#------------------------------------------------------------------------------
#
include $(TARGET).mk
......@@ -73,6 +73,17 @@ CXXFLAGS += -DTARGET='"$(TARGET)"'
Base64Transcoder.o ConstraintSet.o DistanceConstraint.o \
AngleConstraint.o TorsionConstraint.o XMLGFPreprocessor.o
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
truncateMLWF: truncateMLWF.o \
MLWFTransform.o BasisMapping.o jade.o \
Context.o AtomSet.o Atom.o Basis.o SlaterDet.o \
Constraint.o ConstraintSet.o Wavefunction.o UnitCell.o Matrix.o \
SampleReader.o StructuredDocumentHandler.o FourierTransform.o \
Species.o SpeciesReader.o sinft.o spline.o SpeciesHandler.o \
SampleHandler.o WavefunctionHandler.o AtomSetHandler.o \
Base64Transcoder.o ConstraintSet.o DistanceConstraint.o \
AngleConstraint.o TorsionConstraint.o XMLGFPreprocessor.o \
SampleWriter.o qbox_xmlns.o isodate.o
$(LD) $(DFLAGS) -o $@ $^ $(LDFLAGS)
bisection: bisection.o jade.o \
Context.o AtomSet.o Atom.o Basis.o SlaterDet.o \
Constraint.o ConstraintSet.o Wavefunction.o UnitCell.o Matrix.o \
......@@ -227,10 +238,19 @@ bisection1.o: Context.h Sample.h AtomSet.h Atom.h D3vector.h UnitCell.h
bisection1.o: ConstraintSet.h Wavefunction.h SharedFilePtr.h Control.h
bisection1.o: SampleReader.h Basis.h FourierTransform.h Timer.h SlaterDet.h
bisection1.o: Matrix.h
bisection-2008-10-23.o: Context.h Sample.h AtomSet.h Atom.h D3vector.h
bisection-2008-10-23.o: UnitCell.h ConstraintSet.h Wavefunction.h
bisection-2008-10-23.o: SharedFilePtr.h Control.h SampleReader.h
bisection-2008-10-23.o: SampleWriter.h Basis.h FourierTransform.h Timer.h
bisection-2008-10-23.o: SlaterDet.h Matrix.h isodate.h jade.h
bisection.o: Context.h Sample.h AtomSet.h Atom.h D3vector.h UnitCell.h
bisection.o: ConstraintSet.h Wavefunction.h SharedFilePtr.h Control.h
bisection.o: SampleReader.h SampleWriter.h Basis.h FourierTransform.h Timer.h
bisection.o: SlaterDet.h Matrix.h isodate.h jade.h
bisection_save.o: Context.h Sample.h AtomSet.h Atom.h D3vector.h UnitCell.h
bisection_save.o: ConstraintSet.h Wavefunction.h SharedFilePtr.h Control.h
bisection_save.o: SampleReader.h SampleWriter.h Basis.h FourierTransform.h
bisection_save.o: Timer.h SlaterDet.h Matrix.h isodate.h jade.h
BLYPFunctional.o: BLYPFunctional.h XCFunctional.h
BLYPFunctional.o: XCFunctional.h
BOSampleStepper.o: BOSampleStepper.h SampleStepper.h Timer.h
......@@ -603,6 +623,11 @@ TorsionCmd.o: Control.h
TorsionConstraint.o: TorsionConstraint.h Constraint.h D3vector.h AtomSet.h
TorsionConstraint.o: Context.h Atom.h UnitCell.h Species.h
TorsionConstraint.o: Constraint.h D3vector.h
truncateMLWF.o: Context.h Sample.h AtomSet.h Atom.h D3vector.h UnitCell.h
truncateMLWF.o: ConstraintSet.h Wavefunction.h SharedFilePtr.h Control.h
truncateMLWF.o: SampleReader.h SampleWriter.h Basis.h FourierTransform.h
truncateMLWF.o: Timer.h SlaterDet.h Matrix.h isodate.h jade.h MLWFTransform.h
truncateMLWF.o: BasisMapping.h ComputeMLWFCmd.h UserInterface.h
UnitCell.o: UnitCell.h D3vector.h
UnitCell.o: D3vector.h
UserInterface.o: UserInterface.h
......
TODO: change all char* name() functions to const char* name ()
(causes warning at compile time on tribe).
--------------------------------------------------------------------------------
Fix memory leaks:
(check with valgrind on melodie:
mpirun -np 1 /usr/bin/valgrind --leak-check=full --show-reachable=yes \
../../src/qb t.i 2>&1 | tee valgrind.r
see: http://valgrind.org/docs/manual/mc-manual.html
Note: All definitions of commands and variables cause memory leaks in qb.C
(causes new/delete mismatch in valgrind)
--------------------------------------------------------------------------------
rel1_45_2
qb.C, UserInterface.C: implemented -server option
AtomSet.C: implemented destructor (fix leaks)
qb.C: added delete s at end (fix leaks)
ConstraintSet: implemented destructor (fix leaks)
Constraint.h and derived classes: implemented virtual destructors.
StrainCmd.h: fix error in usage message.
XMLGFPreprocessor.C: new macro PARALLEL_FS. Limit the number of simultaneous
fread calls if PARALLEL_FS is not defined.
--------------------------------------------------------------------------------
rel1_45_1: fixed SDCellStepper.C: make local copy of sigma to avoid
PGI compiler error on franklin: "must be lvalue or...".
......
......@@ -15,10 +15,10 @@
// release.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: release.C,v 1.66 2008-09-26 21:05:18 fgygi Exp $
// $Id: release.C,v 1.67 2008-11-14 04:08:05 fgygi Exp $
#include "release.h"
std::string release(void)
{
return std::string("1.45.1");
return std::string("1.45.2");
}
......@@ -15,7 +15,7 @@
// testAndersonMixer.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: testAndersonMixer.C,v 1.5 2008-09-08 15:56:20 fgygi Exp $
// $Id: testAndersonMixer.C,v 1.6 2008-11-14 04:08:05 fgygi Exp $
#include <iostream>
......@@ -31,51 +31,61 @@ int main(int argc, char** argv)
MPI_Init(&argc,&argv);
#endif
{
const int ndim = 20;
const int niter = 10;
Context ctxt;
char processor_name[MPI_MAX_PROCESSOR_NAME];
int namelen;
PMPI_Get_processor_name(processor_name,&namelen);
cout << " Process " << ctxt.mype() << " on " << processor_name << endl;
// cout << " Process " << ctxt.mype() << " on " << processor_name << endl;
const double alpha = 1.0;
vector<double> x,f,xlast,fbar;
double theta;
x.resize(3);
xlast.resize(3);
f.resize(3);
fbar.resize(3);
x.resize(ndim);
xlast.resize(ndim);
f.resize(ndim);
fbar.resize(ndim);
AndersonMixer mixer(x.size(),&ctxt);
x[0] = 1.0 + 0.2 * ctxt.mype();
x[1] = 2.0 + 0.2 * ctxt.mype();
x[2] = 3.0 + 0.2 * ctxt.mype();
for ( int i = 0; i < ndim; i++ )
x[i] = (i+5);
xlast = x;
for ( int iter = 0; iter < 20; iter++ )
for ( int iter = 0; iter < niter; iter++ )
{
//f[0] = - 2.0 * x[0] - 3.0 * x[0]*x[0]*x[0];
//f[1] = - 1.0 * x[1] - 1.5 * x[1]*x[1]*x[1];
//f[2] = - 4.0 * x[2];
f[0] = - 2.0 * x[0];
f[1] = - 1.0 * x[1];
f[2] = - 4.0 * x[2];
// compute gradient
#if 1
// quadratic form
for ( int i = 0; i < ndim; i++ )
//f[i] = -(i+1) * (x[i]-1.0) - 0.1 * x[i]*x[i]*x[i];
f[i] = -(i+1) * (x[i]-i);
#else
// Rosenbrock function
assert(ndim%2==0);
// f = sum_i^(n-1) (1-x_i)^2 + 100*(x_i+1 - x_i^2)^2
f[0] = 0.0;
for ( int i = 0; i < ndim-1; i++ )
{
f[i+1] = 200 * ( x[i+1] - x[i]*x[i] );
f[i] += -2.0 * ( 1.0 - x[i] ) + 200 * x[i] * ( x[i+1] - x[i]*x[i] );
}
#endif
double resnorm = 0.0;
for ( int i = 0; i < x.size(); i++ )
{
resnorm += f[i]*f[i];
// f[i] *= 0.1;
}
#if USE_MPI
ctxt.dsum(1,1,&resnorm,1);
#endif
cout << ctxt.mype() << ": x: " << x[0] << " " << x[1] << " " << x[2]
<< " resnorm: " << resnorm << endl;
mixer.update(&f[0],&theta,&fbar[0]);
cout << ctxt.mype() << ": theta: " << theta << endl;
cout << " theta: " << theta << " resnorm: " << resnorm << endl;
for ( int i = 0; i < x.size(); i++ )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment