diff --git a/Examples/changeFmaFormat.cpp b/Examples/changeFmaFormat.cpp index 60248e0ce2e59609c7fff62ef5fe4d8d041fc6ef..e6d58119d3416cbe42b0dababd9eec4664e216aa 100644 --- a/Examples/changeFmaFormat.cpp +++ b/Examples/changeFmaFormat.cpp @@ -30,7 +30,7 @@ //! <b> General arguments:</b> //! \param -help (-h) to see the parameters available in this driver //! \param -fin name: file name to convert (with extension .fma (ascii) or bfma (binary) -//! \param -fdlpoly name file coming from a DLpoly simulation +//! \param -fdlpoly name file coming from a DLpoly simulation //! //! \param -fout name: generic name for files (without extension) and save data //! with following format in name.fma or name.bfma if -bin is set" @@ -46,11 +46,13 @@ int main(int argc, char ** argv){ + FHelpDescribeAndExit(argc, argv, "Driver to change the format of the input file. " "fdlpoly is not supported for now.", FParameterDefinitions::InputFile, FParameterDefinitions::OutputFile, - FParameterDefinitions::OutputVisuFile, FParameterDefinitions::OutputBinFormat); + FParameterDefinitions::OutputVisuFile,FParameterDefinitions::FormatVisuFile, + FParameterDefinitions::OutputBinFormat); FSize NbPoints; FReal * particles = nullptr ; diff --git a/Src/Utils/FCompareResults.hpp b/Src/Utils/FCompareResults.hpp index da1c07db4f726e3adaaa045b796bfff137bd241f..a103ebfcf5c69cfeb747796b1fd517297bd4c5c0 100644 --- a/Src/Utils/FCompareResults.hpp +++ b/Src/Utils/FCompareResults.hpp @@ -34,10 +34,11 @@ int compareTwoArrays(const std::string &tag, const int &nbParticles, const clas if(array1[idxPart].getPosition() != array2[idxPart].getPosition() ){ std::cerr <<"Wrong positions " <<std::endl << " P1: " <<array1[idxPart].getPosition()<<std::endl - << " P2: " <<array2[idxPart].getPosition()<<std::endl; + << " P2: " <<array2[idxPart].getPosition()<<std::endl + << " error " <<array1[idxPart].getPosition()-array2[idxPart].getPosition()<<std::endl; } potentialDiff.add(array1[idxPart].getPotential(),array2[idxPart].getPotential()); - fx.add(array1[idxPart].getForces()[0],array1[idxPart].getForces()[0]); + fx.add(array1[idxPart].getForces()[0],array2[idxPart].getForces()[0]); fy.add(array1[idxPart].getForces()[1],array2[idxPart].getForces()[1]); fz.add(array1[idxPart].getForces()[2],array2[idxPart].getForces()[2]); energy1 += array1[idxPart].getPhysicalValue() *array1[idxPart].getPotential() ; diff --git a/Utils/noDist/compare2Files.cpp b/Utils/noDist/compare2Files.cpp index 0c1ca493e128a8d4d42461b642cec94d9445165e..80d2c79308884547d162ce49c2de13c430c6abd0 100644 --- a/Utils/noDist/compare2Files.cpp +++ b/Utils/noDist/compare2Files.cpp @@ -41,10 +41,10 @@ int main(int argc, char ** argv){ - const FParameterNames LocalParameterEwald{ - {"-ewaldfile2"}, - "-ewaldfile2 name2 if name2 contains the result done by the ewald method for 1/r kernel" - }; +// const FParameterNames LocalParameterEwald{ +// {"-ewaldfile2"}, +// "-ewaldfile2 name2 if name2 contains the result done by the ewald method for 1/r kernel" +// }; FHelpDescribeAndExit(argc, argv, "Driver to change the format of the input file.", FParameterDefinitions::InputFileOne, FParameterDefinitions::InputFileTwow, diff --git a/Utils/noDist/removeMoment.cpp b/Utils/noDist/removeMoment.cpp index e1f046a78fcc646cf14f2abdb38a49920370ca77..6cc3f48470fea1aa199f5df09db5d64c06486fd9 100755 --- a/Utils/noDist/removeMoment.cpp +++ b/Utils/noDist/removeMoment.cpp @@ -50,7 +50,8 @@ void genDistusage() { << " -fout fileout.{bfma, fma) output file name "<< std::endl << " -Ewald2FMM to add the Electric Moment in the potential and the force " << std::endl << " -energy Value of the energy (Ewald)" << std::endl - << " -FMM2Ewald to remove the Electric Moment in the potential and the force " << std::endl ; + << " -FMM2Ewald to remove the Electric Moment in the potential and the force " << std::endl + << " Scaling parameters: -noscale, -dlpoly, -stamp" <<std::endl; std::cout << " -verbose : print index x y z fx fy fy Q and V" << std::endl; exit(-1); } @@ -60,14 +61,9 @@ int main(int argc, char ** argv){ bool useDLPOLY=false,useFMA=false,useSTAMP=false; // FReal scaleEnergy, scaleForce ; - const FReal r4pie0 = FReal(138935.4835); const double q0 = 1.6021892e-19; const double e0 = 8.854187e-12; const double ang = 1.0e-10; - const double Unsur4pie0 =8.98755179e+9; // 1.0/(4*FMath::FPi*e0); //8.98755179e+9 ; - double D0 = 1.0; - - std::cout << "Unsur4pie0: " << Unsur4pie0 << " 8.98755179e+9 Diff " << Unsur4pie0-8.98755179e+9 <<std::endl; if( argc == 1 ){ genDistusage() ; @@ -88,17 +84,27 @@ int main(int argc, char ** argv){ scaleForce = 1.0 ; // bool scale = true ; if(FParameters::existParameter(argc, argv, "-dlpoly")){ + const FReal r4pie0 = FReal(138935.4835); // scale = false ; scaleEnergy = r4pie0 / 418.4 ; // kcal mol^{-1} scaleForce = -r4pie0 ; // 10 J mol^{-1} A^{-1} - D0 = 1.0; useDLPOLY = true ; } else if(FParameters::existParameter(argc, argv, "-stamp")){ + // used in Stamp + const double Unsur4pie0 =8.98755179e+9; // 1.0/(4*FMath::FPi*e0); //8.98755179e+9 ; scaleEnergy = q0*q0*Unsur4pie0 /ang; - scaleForce = -scaleEnergy/ang; - D0 = q0/ang/ang; - useSTAMP = true; + scaleForce = -scaleEnergy/ang; + useSTAMP = true; + } + else if(FParameters::existParameter(argc, argv, "-noscale")){ + scaleEnergy = 1.0; + scaleForce = -1.0; + } + + else { + std::cout << "Parameter -dlpoly, -stamp, -noscale is not set" <<std::endl; + std::exit(-1); } std::cout <<"Scaling factor " <<std::endl << " Energy factor " << scaleEnergy<<std::endl @@ -184,14 +190,7 @@ int main(int argc, char ** argv){ } boxsize[0] = boxsize[1]= boxsize[2] = loaderFMA->getBoxWidth(); - // scaleEnergy /= boxsize[0] ; - // scaleForce = -scaleEnergy/boxsize[0] ; - // boxsize[0] = boxsize[1]= boxsize[2] = 1.0 ; - - numberofParticles = loaderFMA->getNumberOfParticles() ; - std::cout << " numberofParticles "<< std::endl; - particlesIn = new FmaRWParticle<8,8>[numberofParticles]; memset(particlesIn, 0, sizeof( FmaRWParticle<8,8>) * numberofParticles) ; loaderFMA->fillParticle(particlesIn,numberofParticles); @@ -200,6 +199,7 @@ int main(int argc, char ** argv){ counter.tic(); FPoint electricMoment(0.0,0.0,0.0) ; + FPoint xmin,xmax ; // const --> then shared // @@ -247,7 +247,7 @@ int main(int argc, char ** argv){ std::cout << " -Ewald2FMM or -FMM2Ewald should be set"<<std::endl; exit(EXIT_FAILURE); } - std::cout << "coeffCorrection: "<<coeffCorrection<<" " <<coeffCorrection*D0<< std::endl; + std::cout << "coeffCorrection: "<<coeffCorrection<< std::endl; std::cout << "preScaleEnergy: "<<preScaleEnergy<<std::endl; std::cout << "postScaleEnergy: "<<postScaleEnergy<<std::endl; std::cout << "preScaleForce: "<<preScaleForce<<std::endl; @@ -259,7 +259,7 @@ int main(int argc, char ** argv){ + particlesIn[idx].getPosition().getZ()*electricMoment.getZ() ; // Potential rescaling ( Not checked) double P = particlesIn[idx].getPotential(); - particlesIn[idx].setPotential( P + tmp*coeffCorrection); + // particlesIn[idx].setPotential( P + tmp*coeffCorrection); // // Force rescaling double * forces ;