Commit 1e94dd3b authored by BRAMAS Berenger's avatar BRAMAS Berenger

Add periodic test in ewal

parent 9e878f8d
......@@ -53,7 +53,7 @@ public:
file.getline(buffer, bufferSize);
int imcon ;
int tempi(0);
//int tempi(0);
FReal tempf(0);
file >> levcfg >> imcon >> this->nbParticles;
// Periodic case
......
......@@ -96,7 +96,7 @@ int main(int argc, char ** argv){
FTic counter;
//
const FReal coeff_MD= 138935.4835 / 418.4 ;
const FReal coeff_MD= FReal( 138935.4835 / 418.4 );
//
const char* const filename = FParameters::getStr(argc,argv,"-f", "../Data/test20k.fma");
......
......@@ -85,7 +85,7 @@ int main(int argc, char ** argv){
///////////////////////What we do/////////////////////////////
std::cout << ">> This executable has to be used to test Spherical algorithm.\n";
std::cout << ">> options are -h H -sh SH -P p -per PER -f FILE -noper -verbose -gen\n";
std::cout << ">> options are -h H -sh SH -P p -per PER -f FILE -noper -verbose -gen -direct\n";
std::cout << ">> Recommanded files : ../Data/EwalTest_Periodic.run ../Data/EwalTest_NoPeriodic.run\n";
//////////////////////////////////////////////////////////////
......@@ -160,6 +160,34 @@ int main(int argc, char ** argv){
std::cout << "Done " << "(@Algorithm = " << counter.elapsed() << "s)." << std::endl;
// -----------------------------------------------------
// Do direct
if(FParameters::existParameter(argc, argv, "-direct")){
KernelClass kernels( DevP, NbLevels, loader.getBoxWidth(), loader.getCenterOfBox());
for(int idxTarget = 0 ; idxTarget < loader.getNumberOfParticles() ; ++idxTarget){
ParticleClass part = particles[idxTarget];
part.setForces(0,0,0);
part.setPotential(0);
// compute with all other except itself
for(int idxOther = 0; idxOther < loader.getNumberOfParticles() ; ++idxOther){
if( idxOther != idxTarget ){
kernels.directInteraction(&part, particles[idxOther]);
}
}
// print result
std::cout << " " << part.getIndex()+1 << " \t "<< part.getType() << " \t " <<
std::setprecision(5)<< part.getPosition().getX() << " \t" <<
part.getPosition().getY() << " \t" <<
part.getPosition().getZ() << " Forces: \t"<<
std::setprecision(8) << part.getForces().getX()*coeff_MD1 << " \t " <<
part.getForces().getY()*coeff_MD1 << " \t " <<
part.getForces().getZ()*coeff_MD1 << std::endl;
}
}
// -----------------------------------------------------
{
FReal potential = 0;
......
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