Commit e782467a authored by Francois Gygi's avatar Francois Gygi
Browse files

rel1_63_7

git-svn-id: http://qboxcode.org/svn/qb/branches/rel1_63@1924 cba15fb0-1239-40c8-b417-11db7ca47a34
parents 0c77dcad 66b16485
......@@ -21,16 +21,18 @@
#include <string>
#include <list>
#include <fstream>
#include <unistd.h> // sync()
#include <sstream>
#include <unistd.h> // fsync()
#include <stdio.h> // fopen(), fclose(), fprintf()
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h> // stat()
#include <mpi.h>
using namespace std;
////////////////////////////////////////////////////////////////////////////////
void wait_for_no_file(const string& lockfilename)
{
cerr << " waiting for no " << lockfilename << endl;
//cerr << " waiting for no " << lockfilename << endl;
struct stat statbuf;
int status;
do
......@@ -293,23 +295,21 @@ void UserInterface::processCmdsServer ( string inputfilename,
string lockfilename = inputfilename + ".lock";
// in server mode, redirect output to stream qbout
streambuf *qbout_buf;
streambuf *cout_buf;
ofstream qbout;
ifstream qbin;
ofstream tstfile;
ostringstream os;
while ( !done )
{
if ( onpe0_ )
{
// create file to signal that Qbox is waiting for a command on qbin
tstfile.open(lockfilename.c_str());
tstfile << "1" << endl;
tstfile.close();
sync();
// wait for tstfile to be removed by the driver
FILE *lockfile = fopen(lockfilename.c_str(),"w");
fprintf(lockfile,"1");
fclose(lockfile);
fsync(fileno(lockfile));
usleep(100000);
wait_for_no_file(lockfilename.c_str());
......@@ -317,13 +317,14 @@ void UserInterface::processCmdsServer ( string inputfilename,
qbin.sync();
qbin.clear();
// clear os
os.str("");
// save copy of cout streambuf
cout_buf = cout.rdbuf();
qbout.open(outputfilename.c_str(),ios_base::trunc);
qbout_buf = qbout.rdbuf();
// redirect cout
cout.rdbuf(qbout_buf);
cerr << " processCmdsServer: cout streambuf redirected" << endl;
// redirect cout to os
cout.rdbuf(os.rdbuf());
// cerr << " processCmdsServer: cout streambuf redirected" << endl;
cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
cout << "<fpmd:simulation xmlns:fpmd=\"" << qbox_xmlns() << "\">" << endl;
......@@ -480,13 +481,19 @@ void UserInterface::processCmdsServer ( string inputfilename,
cout << " End of command stream " << endl;
cout << "</fpmd:simulation>" << endl;
cout.flush();
qbout.close();
// write ostringstream contents to output file
FILE *qboutfile = fopen(outputfilename.c_str(),"w");
fprintf(qboutfile,"%s",os.str().c_str());
fclose(qboutfile);
fsync(fileno(qboutfile));
// restore cout streambuf
cout.rdbuf(cout_buf);
cerr << " processCmdsServer: cout streambuf reassigned" << endl;
// cerr << " processCmdsServer: cout streambuf reassigned" << endl;
}
// wait before retrying
sync();
usleep(200000);
} // while !done
......@@ -495,6 +502,5 @@ void UserInterface::processCmdsServer ( string inputfilename,
{
// remove lock file
remove(lockfilename.c_str());
sync();
}
}
--------------------------------------------------------------------------------
rel1_63_7
--------------------------------------------------------------------------------
r1920: Modified UserInterface.C to use C library, fsync()
to ensure synchronization.
r1912-1919: improvements in util/qbdriver files, twin.C
Added test programs in util/qbdriver
Added runtwin.sh script for interactive test of client-server mode
--------------------------------------------------------------------------------
rel1_63_6
--------------------------------------------------------------------------------
r1907: add sync in UserInterface.C
--------------------------------------------------------------------------------
rel1_63_5
--------------------------------------------------------------------------------
r1886: fix coeff of divergence correction for nspin=2 and multiple k-points
......
......@@ -19,5 +19,5 @@
#include "release.h"
std::string release(void)
{
return std::string("1.63.6");
return std::string("1.63.7");
}
<?xml version="1.0" encoding="UTF-8"?>
<fpmd:species xmlns:fpmd="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.quantum-simulation.org/ns/fpmd/fpmd-1.0
species.xsd">
<description>
PSGen-1.6.0 pseudopotential: HSCV C xc=PBE
Generated by PSGen-1.6.0 on 2009-02-15T02:25:04Z
psgen arguments:
-element C -xc PBE -smooth_v -bound l=0:rc=0.8 -bound l=1:rc=0.8
</description>
<symbol>C</symbol>
<atomic_number>6</atomic_number>
<mass>12.0107</mass>
<norm_conserving_pseudopotential>
<valence_charge>4</valence_charge>
<lmax>1</lmax>
<llocal>1</llocal>
<nquad>0</nquad>
<rquad>0</rquad>
<mesh_spacing>0.01</mesh_spacing>
<projector l="0" size="2797">
<radial_potential>
1.116621
1.115158
1.110767
1.103452
1.093216
1.080066
1.064007
1.045048
1.023200
0.998475
0.970885
0.940445
0.907172
0.871083
0.832198
0.790538
0.746126
0.698986
0.649143
0.596624
0.541459
0.483678
0.423313
0.360397
0.294965
0.227054
0.156702
0.083948
0.008835
-0.068596
-0.148299
-0.230230
-0.314340
-0.400580
-0.488900
-0.579248
-0.671569
-0.765810
-0.861912
-0.959817
-1.059466
-1.160753
-1.263388
-1.367028
-1.471322
-1.575918
-1.680467
-1.784628
-1.888077
-1.990505
-2.091624
-2.191172
-2.288913
-2.384636
-2.478159
-2.569323
-2.657996
-2.744066
-2.827442
-2.908050
-2.985829
-3.060735
-3.132731
-3.201792
-3.267899
-3.331042
-3.391217
-3.448424
-3.502672
-3.553974
-3.602347
-3.647817
-3.690413
-3.730171
-3.767134
-3.801350
-3.832876
-3.861772
-3.888107
-3.911958
-3.933405
-3.952531
-3.969384
-3.984003
-3.996423
-4.006676
-4.014795
-4.020812
-4.024759
-4.026672
-4.026590
-4.024555
-4.020611
-4.014809
-4.007202
-3.997847
-3.986805
-3.974140
-3.959921
-3.944218
-3.927105
-3.908656
-3.888948
-3.868061
-3.846074
-3.823066
-3.799119
-3.774313
-3.748727
-3.722439
-3.695528
-3.668070
-3.640139
-3.611807
-3.583145
-3.554219
-3.525095
-3.495834
-3.466496
-3.437135
-3.407805
-3.378554
-3.349429
-3.320471
-3.291719
-3.263209
-3.234973
-3.207040
-3.179435
-3.152180
-3.125296
-3.098797
-3.072698
-3.047010
-3.021740
-2.996896
-2.972479
-2.948494
-2.924938
-2.901811
-2.879108
-2.856826
-2.834957
-2.813496
-2.792434
-2.771763
-2.751472
-2.731554
-2.711996
-2.692789
-2.673923
-2.655386
-2.637168
-2.619259
-2.601648
-2.584325
-2.567281
-2.550505
-2.533989
-2.517724
-2.501701
-2.485911
-2.470349
-2.455005
-2.439873
-2.424947
-2.410220
-2.395687
-2.381341
-2.367179
-2.353194
-2.339382
-2.325739
-2.312261
-2.298944
-2.285784
-2.272777
-2.259922
-2.247213
-2.234649
-2.222227
-2.209944
-2.197797
-2.185783
-2.173902
-2.162149
-2.150523
-2.139022
-2.127644
-2.116386
-2.105247
-2.094225
-2.083318
-2.072524
-2.061841
-2.051268
-2.040802
-2.030443
-2.020189
-2.010038
-1.999988
-1.990038
-1.980187
-1.970432
-1.960774
-1.951209
-1.941738
-1.932358
-1.923068
-1.913867
-1.904753
-1.895726
-1.886785
-1.877927
-1.869152
-1.860458
-1.851845
-1.843311
-1.834856
-1.826478
-1.818176
-1.809949
-1.801796
-1.793717
-1.785709
-1.777773
-1.769907
-1.762110
-1.754382
-1.746721
-1.739126
-1.731598
-1.724134
-1.716735
-1.709398
-1.702124
-1.694912
-1.687761
-1.680670
-1.673638
-1.666664
-1.659749
-1.652890
-1.646088
-1.639342
-1.632651
-1.626014
-1.619431
-1.612902
-1.606424
-1.599999
-1.593624
-1.587300
-1.581027
-1.574802
-1.568626
-1.562499
-1.556419
-1.550387
-1.544401
-1.538461
-1.532567
-1.526717
-1.520912
-1.515151
-1.509434
-1.503759
-1.498127
-1.492537
-1.486989
-1.481482
-1.476015
-1.470588
-1.465202
-1.459854
-1.454546
-1.449276
-1.444044
-1.438849
-1.433692
-1.428572
-1.423488
-1.418440
-1.413428
-1.408451
-1.403509
-1.398602
-1.393729
-1.388890
-1.384084
-1.379311
-1.374571
-1.369864
-1.365188
-1.360545
-1.355933
-1.351352
-1.346802
-1.342283
-1.337793
-1.333334
-1.328904
-1.324504
-1.320133
-1.315790
-1.311476
-1.307190
-1.302932
-1.298702
-1.294499
-1.290323
-1.286175
-1.282052
-1.277956
-1.273886
-1.269842
-1.265824
-1.261831
-1.257862
-1.253919
-1.250001
-1.246107
-1.242237
-1.238391
-1.234569
-1.230770
-1.226995
-1.223242
-1.219513
-1.215806
-1.212122
-1.208460
-1.204820
-1.201202
-1.197606
-1.194031
-1.190477
-1.186944
-1.183433
-1.179942
-1.176471
-1.173021
-1.169591
-1.166181
-1.162791
-1.159421
-1.156070
-1.152738
-1.149426
-1.146132
-1.142858
-1.139602
-1.136364
-1.133145
-1.129944
-1.126761
-1.123596
-1.120449
-1.117319
-1.114207
-1.111112
-1.108034
-1.104973
-1.101929
-1.098902
-1.095891
-1.092897
-1.089919
-1.086957
-1.084011
-1.081082
-1.078168
-1.075269
-1.072387
-1.069519
-1.066667
-1.063830
-1.061008
-1.058202
-1.055409
-1.052632
-1.049869
-1.047121
-1.044387
-1.041667
-1.038961
-1.036270
-1.033592
-1.030928
-1.028278
-1.025641
-1.023018
-1.020409
-1.017812
-1.015229
-1.012659
-1.010102
-1.007557
-1.005026
-1.002507
-1.000001
-0.997507
-0.995025
-0.992556
-0.990100
-0.987655
-0.985222
-0.982802
-0.980393
-0.977996
-0.975610
-0.973237
-0.970874
-0.968524
-0.966184
-0.963856
-0.961539
-0.959233
-0.956938
-0.954655
-0.952382
-0.950119
-0.947868
-0.945627
-0.943397
-0.941177
-0.938968
-0.936769
-0.934580
-0.932402
-0.930233
-0.928075
-0.925927
-0.923788
-0.921660
-0.919541
-0.917432
-0.915333
-0.913243
-0.911163
-0.909092
-0.907030
-0.904978
-0.902935
-0.900902
-0.898877
-0.896862
-0.894856
-0.892858
-0.890870
-0.888890
-0.886919
-0.884957
-0.883003
-0.881058
-0.879122
-0.877194
-0.875275
-0.873364
-0.871461
-0.869566
-0.867680
-0.865802
-0.863932
-0.862070
-0.860216
-0.858370
-0.856532
-0.854702
-0.852880
-0.851065
-0.849258
-0.847459
-0.845667
-0.843883
-0.842107
-0.840338
-0.838576
-0.836822
-0.835075
-0.833335
-0.831602
-0.829877
-0.828159
-0.826448
-0.824744
-0.823047
-0.821357
-0.819674
-0.817997
-0.816328
-0.814666
-0.813010
-0.811361
-0.809718
-0.808082
-0.806453
-0.804831
-0.803214
-0.801605
-0.800002
-0.798405
-0.796814
-0.795230
-0.793652
-0.792081
-0.790516