diff --git a/App/App.pro b/App/App.pro index c6566795e985afffffd647241f4ffdf0924b3cd2..ac9b205f616728a73194a9df337128221b17305d 100644 --- a/App/App.pro +++ b/App/App.pro @@ -44,6 +44,7 @@ SOURCES += \ src/TestIsGISAXS11.cpp \ src/TestIsGISAXS12.cpp \ src/TestIsGISAXS13.cpp \ + src/TestIsGISAXS14.cpp \ src/TestIsGISAXS15.cpp \ src/TestIsGISAXS2.cpp \ src/TestIsGISAXS3.cpp \ @@ -99,6 +100,7 @@ HEADERS += \ inc/TestIsGISAXS11.h \ inc/TestIsGISAXS12.h \ inc/TestIsGISAXS13.h \ + inc/TestIsGISAXS14.h \ inc/TestIsGISAXS15.h \ inc/TestIsGISAXS2.h \ inc/TestIsGISAXS3.h \ @@ -123,9 +125,6 @@ CONFIG(DEBUG_FPE) { SOURCES += src/fp_exception_glibc_extension.c } - - - # additional locations LOCATIONS = ./inc $${FUNCTIONAL_TESTS}/IsGISAXS01 INCLUDEPATH += $${LOCATIONS} diff --git a/App/inc/StandardSamples.h b/App/inc/StandardSamples.h index 8846b6ffd5c9db2fdb814a1c888686a617e877ee..5f09c94ee366af279a3d40718eb9a152c38f77d3 100644 --- a/App/inc/StandardSamples.h +++ b/App/inc/StandardSamples.h @@ -14,7 +14,7 @@ ISample *MultilayerOffspecTestcase1a(); ISample *MultilayerOffspecTestcase1b(); ISample *MultilayerOffspecTestcase2a(); ISample *MultilayerOffspecTestcase2b(); -ISample *IsGISAXS1_CylinderAndPrism(); +//ISample *IsGISAXS1_CylinderAndPrism(); ISample *IsGISAXS2_CylindersMixture(); ISample *IsGISAXS3_CylinderDWBA(); ISample *IsGISAXS3_CylinderBA(); @@ -28,6 +28,7 @@ ISample *IsGISAXS9_Pyramid(); ISample *IsGISAXS9_RotatedPyramid(); ISample *IsGISAXS10_CylindersParacrystal1D(); ISample *IsGISAXS11_CoreShellParticles(); +ISample *IsGISAXS14_LayeredSpheresOnGradedInterface(); ISample *IsGISAXS15_SSCA(); ISample *MesoCrystal1(); ISample *MesoCrystal2(); diff --git a/App/inc/TestIsGISAXS1.h b/App/inc/TestIsGISAXS1.h index 70d6d7a91038f6cc27a1cd6bfd1cd21598ecc9a2..d02195cb0cfb59002740425744b98794859cbe28 100644 --- a/App/inc/TestIsGISAXS1.h +++ b/App/inc/TestIsGISAXS1.h @@ -23,7 +23,7 @@ class TestIsGISAXS1 : public IFunctionalTest { public: - TestIsGISAXS1() { } + TestIsGISAXS1(); virtual ~TestIsGISAXS1() { } virtual void execute(); diff --git a/App/inc/TestIsGISAXS14.h b/App/inc/TestIsGISAXS14.h new file mode 100644 index 0000000000000000000000000000000000000000..ca61f992e319d495907c8a38bdeed1260c726e66 --- /dev/null +++ b/App/inc/TestIsGISAXS14.h @@ -0,0 +1,32 @@ +#ifndef TESTISGISAXS14_H +#define TESTISGISAXS14_H +// ******************************************************************** +// * The BornAgain project * +// * Simulation of neutron and x-ray scattering at grazing incidence * +// * * +// * LICENSE AND DISCLAIMER * +// * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris * +// * eget quam orci. Quisque porta varius dui, quis posuere nibh * +// * mollis quis. Mauris commodo rhoncus porttitor. * +// ******************************************************************** +//! @file TestIsGISAXS14.h +//! @brief Definition of TestIsGISAXS14 class for IsGISAXS validation +//! @author Scientific Computing Group at FRM II +//! @date Jan 28, 2013 + +#include "IFunctionalTest.h" + +//- ------------------------------------------------------------------- +//! @class TestIsGISAXS14 +//! @brief Comparison with IsGISAXS ex-14: multi layered sphere on graded interface +//- ------------------------------------------------------------------- +class TestIsGISAXS14 : public IFunctionalTest +{ +public: + TestIsGISAXS14(); + virtual ~TestIsGISAXS14() {} + virtual void execute(); + virtual void finalise(); +}; + +#endif // TESTISGISAXS14_H diff --git a/App/src/FunctionalTestFactory.cpp b/App/src/FunctionalTestFactory.cpp index 6529f6dc39fc2d5ba126ad05a6e291aeefe0c25d..a0cecce4c92d74652ca6be6f5b5096fcfb31fc76 100644 --- a/App/src/FunctionalTestFactory.cpp +++ b/App/src/FunctionalTestFactory.cpp @@ -16,6 +16,7 @@ #include "TestIsGISAXS11.h" #include "TestIsGISAXS12.h" #include "TestIsGISAXS13.h" +#include "TestIsGISAXS14.h" #include "TestIsGISAXS15.h" #include "TestConvolution.h" #include "TestDetectorResolution.h" @@ -73,6 +74,8 @@ FunctionalTestFactory::FunctionalTestFactory() : m_benchmark(0) "functional test: isgisaxs ex-12 (constrained fit example)"); registerItem("isgisaxs13", IFactoryCreateFunction<TestIsGISAXS13, IFunctionalTest>, "functional test: isgisaxs ex-13 (simulated annealing fit)"); + registerItem("isgisaxs14", IFactoryCreateFunction<TestIsGISAXS14, IFunctionalTest>, + "functional test: isgisaxs ex-14 (multilayered sphere on graded interface)"); registerItem("isgisaxs15", IFactoryCreateFunction<TestIsGISAXS15, IFunctionalTest>, "functional test: isgisaxs ex-15 (size-spacing correlation approximation)"); registerItem("convolution", IFactoryCreateFunction<TestConvolution, IFunctionalTest>, diff --git a/App/src/SampleFactory.cpp b/App/src/SampleFactory.cpp index 698ba62f8c634d2c2d35987b221d8e537b0747ec..61cd8dd1235f6a8a671b8eb3b7bf2207833cd319 100644 --- a/App/src/SampleFactory.cpp +++ b/App/src/SampleFactory.cpp @@ -26,7 +26,7 @@ SampleFactory::SampleFactory() registerItem("MultilayerOffspecTestcase2b", StandardSamples::MultilayerOffspecTestcase2b); // IsGISAXS1 example: cylinder and prism - registerItem("IsGISAXS1_CylinderAndPrism", StandardSamples::IsGISAXS1_CylinderAndPrism); + //registerItem("IsGISAXS1_CylinderAndPrism", StandardSamples::IsGISAXS1_CylinderAndPrism); // IsGISAXS2 example: mixture of cylindrical particles with two size distribution registerItem("IsGISAXS2_CylindersMixture", StandardSamples::IsGISAXS2_CylindersMixture); @@ -57,6 +57,9 @@ SampleFactory::SampleFactory() // IsGISAXS11 example: core shell parallelepipeds registerItem("IsGISAXS11_CoreShellParticle", StandardSamples::IsGISAXS11_CoreShellParticles); + // IsGISAXS14 example: layered sphere on graded interface + registerItem("IsGISAXS14_LayeredSpheresOnGradedInterface", StandardSamples::IsGISAXS14_LayeredSpheresOnGradedInterface); + // IsGISAXS15 example: Size-Spacing Correlation Approximation registerItem("IsGISAXS15_SSCA", StandardSamples::IsGISAXS15_SSCA); diff --git a/App/src/StandardSamples.cpp b/App/src/StandardSamples.cpp index 4926f430bc6590f2787898020e37c15c33b47dff..22a696d3a5b1da690e2be597b76ac2df7f48d68d 100644 --- a/App/src/StandardSamples.cpp +++ b/App/src/StandardSamples.cpp @@ -350,35 +350,31 @@ ISample *StandardSamples::MultilayerOffspecTestcase2b() // - - - - /* ************************************************************************* */ // IsGISAXS1 functional test: cylinder and prism /* ************************************************************************* */ -ISample *StandardSamples::IsGISAXS1_CylinderAndPrism() -{ - MultiLayer *p_multi_layer = new MultiLayer(); - complex_t n_air(1.0, 0.0); - complex_t n_substrate(1.0-6e-6, 2e-8); - complex_t n_particle(1.0-6e-4, 2e-8); - const IMaterial *p_air_material = MaterialManager::instance().addHomogeneousMaterial("Air", n_air); - const IMaterial *p_substrate_material = MaterialManager::instance().addHomogeneousMaterial("Substrate", n_substrate); - Layer air_layer; - air_layer.setMaterial(p_air_material); - Layer substrate_layer; - substrate_layer.setMaterial(p_substrate_material); - ParticleDecoration particle_decoration; - particle_decoration.addParticle(new Particle(n_particle, new FormFactorCylinder(5*Units::nanometer, 5*Units::nanometer)),0.0, 0.5); - particle_decoration.addParticle(new Particle(n_particle, new FormFactorPrism3(5*Units::nanometer, 5*Units::nanometer)), 0.0, 0.5); - particle_decoration.addInterferenceFunction(new InterferenceFunctionNone()); - LayerDecorator air_layer_decorator(air_layer, particle_decoration); +//ISample *StandardSamples::IsGISAXS1_CylinderAndPrism() +//{ +// MultiLayer *p_multi_layer = new MultiLayer(); +// complex_t n_air(1.0, 0.0); +// complex_t n_substrate(1.0-6e-6, 2e-8); +// complex_t n_particle(1.0-6e-4, 2e-8); +// const IMaterial *p_air_material = MaterialManager::instance().addHomogeneousMaterial("Air", n_air); +// const IMaterial *p_substrate_material = MaterialManager::instance().addHomogeneousMaterial("Substrate", n_substrate); +// Layer air_layer; +// air_layer.setMaterial(p_air_material); +// Layer substrate_layer; +// substrate_layer.setMaterial(p_substrate_material); +// ParticleDecoration particle_decoration; +// particle_decoration.addParticle(new Particle(n_particle, new FormFactorCylinder(5*Units::nanometer, 5*Units::nanometer)),0.0, 0.5); +// particle_decoration.addParticle(new Particle(n_particle, new FormFactorPrism3(5*Units::nanometer, 5*Units::nanometer)), 0.0, 0.5); +// particle_decoration.addInterferenceFunction(new InterferenceFunctionNone()); +// LayerDecorator air_layer_decorator(air_layer, particle_decoration); - p_multi_layer->addLayer(air_layer_decorator); - p_multi_layer->addLayer(substrate_layer); - return p_multi_layer; -} +// p_multi_layer->addLayer(air_layer_decorator); +// p_multi_layer->addLayer(substrate_layer); +// return p_multi_layer; +//} /* ************************************************************************* */ @@ -801,6 +797,33 @@ ISample *StandardSamples::IsGISAXS11_CoreShellParticles() return p_multi_layer; } +/* ************************************************************************* */ +// IsGISAXS14 functional test: layered sphere on graded interface +/* ************************************************************************* */ +ISample *StandardSamples::IsGISAXS14_LayeredSpheresOnGradedInterface() +{ + MultiLayer *p_multi_layer = new MultiLayer(); + complex_t n_air(1.0, 0.0); + complex_t n_substrate(1.0-6e-6, 2e-8); + complex_t n_particle(1.0-6e-5, 2e-8); + const IMaterial *p_air_material = MaterialManager::instance().addHomogeneousMaterial("Air10", n_air); + const IMaterial *p_substrate_material = MaterialManager::instance().addHomogeneousMaterial("Substrate10", n_substrate); + Layer air_layer; + air_layer.setMaterial(p_air_material); + Layer substrate_layer; + substrate_layer.setMaterial(p_substrate_material); + IInterferenceFunction *p_interference_function = new InterferenceFunction1DParaCrystal(15.0*Units::nanometer,5*Units::nanometer, 1e7*Units::nanometer); + ParticleDecoration particle_decoration(new Particle(n_particle, new FormFactorSphere(5*Units::nanometer, 5*Units::nanometer))); + particle_decoration.addInterferenceFunction(p_interference_function); + // particle_decoration.setTotalParticleSurfaceDensity(1.0/(20.0*Units::nanometer*20.0*Units::nanometer)); + LayerDecorator air_layer_decorator(air_layer, particle_decoration); + + p_multi_layer->addLayer(air_layer_decorator); + p_multi_layer->addLayer(substrate_layer); + + return p_multi_layer; +} + /* ************************************************************************* */ // IsGISAXS15 functional test: size-spacing correlation approximation /* ************************************************************************* */ diff --git a/App/src/TestIsGISAXS1.cpp b/App/src/TestIsGISAXS1.cpp index c8ead296a0d37df5cda809ea09314de6f0584277..9edfa9d6c433dce764f2335edb31c519bd2cc6ba 100644 --- a/App/src/TestIsGISAXS1.cpp +++ b/App/src/TestIsGISAXS1.cpp @@ -1,132 +1,37 @@ #include "TestIsGISAXS1.h" +#include "IsGISAXS01.h" #include "IsGISAXSTools.h" -#include "Units.h" -#include "Utils.h" -#include "MultiLayer.h" -#include "GISASExperiment.h" -#include "FormFactors.h" -#include "SampleFactory.h" -#include "DrawHelper.h" -#include "TCanvas.h" -#include "TH2.h" -#include "TStyle.h" #include "OutputDataIOFactory.h" +#include "Utils.h" -#include "IsGISAXS01.h" #include <fstream> - -void TestIsGISAXS1::execute() +TestIsGISAXS1::TestIsGISAXS1() : IFunctionalTest("TestIsGISAXS1") { -// MultiLayer *sample = dynamic_cast<MultiLayer *>(SampleFactory::instance().createItem("IsGISAXS1_CylinderAndPrism")); - -// GISASExperiment experiment(mp_options); -// experiment.setSample(*sample); -// experiment.setDetectorParameters(100,-1.0*Units::degree, 1.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); -// experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); -// experiment.runSimulation(); + setOutputPath(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/" ); +} -// FunctionalTests::IsGISAXS01 test; +void TestIsGISAXS1::execute() +{ FunctionalTests::IsGISAXS01 test; test.run(); - OutputDataIOFactory::writeOutputData(*test.getOutputData(), Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/this_2-types-of-islands-ewald.ima"); + OutputDataIOFactory::writeOutputData(*test.getOutputData(), getOutputPath()+"this_2-types-of-islands-ewald.ima"); } void TestIsGISAXS1::finalise() { - std::string isgi_file(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/isgi_2-types-of-islands-ewald.ima.gz"); - std::string this_file(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/this_2-types-of-islands-ewald.ima"); + std::string isgi_file(getOutputPath()+"isgi_2-types-of-islands-ewald.ima.gz"); + std::string this_file(getOutputPath()+"this_2-types-of-islands-ewald.ima"); OutputData<double> *isgi_data = OutputDataIOFactory::getOutputData(isgi_file); OutputData<double> *our_data = OutputDataIOFactory::getOutputData(this_file); - TCanvas *c1 = DrawHelper::instance().createAndRegisterCanvas("TestIsGISAXS1_c1", "Two particles mean DWBA Formfactor"); - - c1->Divide(2,2); - - IsGISAXSTools::setMinimum(1.); - // our calculations - c1->cd(1); gPad->SetLogz(); - IsGISAXSTools::drawOutputDataInPad(*our_data, "CONT4 Z", "Our mean FF"); - - // isgisaxs data - c1->cd(2); gPad->SetLogz(); - IsGISAXSTools::drawOutputDataInPad(*isgi_data, "CONT4 Z", "IsGisaxs mean FF"); - - // difference - c1->cd(3); - IsGISAXSTools::setMinimum(-0.0001); - IsGISAXSTools::setMaximum(0.0001); - IsGISAXSTools::drawOutputDataRelativeDifference2D(*our_data, *isgi_data, "CONT4 Z", "2D Difference map"); - - // difference - c1->cd(4); - IsGISAXSTools::resetMinimumAndMaximum(); - IsGISAXSTools::setMinimum(1); - IsGISAXSTools::drawOutputDataDifference1D(*our_data, *isgi_data, "", "Difference spectra"); + IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, "TestIsGISAXS1_c1", "Two particles mean DWBA Formfactor"); delete isgi_data; delete our_data; - } - - - - -//void TestIsGISAXS1::execute() -//{ -// MultiLayer *sample = dynamic_cast<MultiLayer *>(SampleFactory::instance().createItem("IsGISAXS1_CylinderAndPrism")); - -// GISASExperiment experiment(mp_options); -// experiment.setSample(*sample); -// experiment.setDetectorParameters(100,-1.0*Units::degree, 1.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); -// experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); -// experiment.runSimulation(); - -// OutputDataIOFactory::writeOutputData(*experiment.getOutputData(), Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/this_2-types-of-islands-ewald.ima"); -//} - - -//void TestIsGISAXS1::finalise() -//{ -// std::string isgi_file(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/isgi_2-types-of-islands-ewald.ima.gz"); -// std::string this_file(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-1/this_2-types-of-islands-ewald.ima"); - -// OutputData<double> *isgi_data = OutputDataIOFactory::getOutputData(isgi_file); -// OutputData<double> *our_data = OutputDataIOFactory::getOutputData(this_file); - -// TCanvas *c1 = DrawHelper::instance().createAndRegisterCanvas("TestIsGISAXS1_c1", "Two particles mean DWBA Formfactor"); - -// c1->Divide(2,2); - -// IsGISAXSTools::setMinimum(1.); -// // our calculations -// c1->cd(1); gPad->SetLogz(); -// IsGISAXSTools::drawOutputDataInPad(*our_data, "CONT4 Z", "Our mean FF"); - -// // isgisaxs data -// c1->cd(2); gPad->SetLogz(); -// IsGISAXSTools::drawOutputDataInPad(*isgi_data, "CONT4 Z", "IsGisaxs mean FF"); - -// // difference -// c1->cd(3); -// IsGISAXSTools::setMinimum(-0.0001); -// IsGISAXSTools::setMaximum(0.0001); -// IsGISAXSTools::drawOutputDataRelativeDifference2D(*our_data, *isgi_data, "CONT4 Z", "2D Difference map"); - -// // difference -// c1->cd(4); -// IsGISAXSTools::resetMinimumAndMaximum(); -// IsGISAXSTools::setMinimum(1); -// IsGISAXSTools::drawOutputDataDifference1D(*our_data, *isgi_data, "", "Difference spectra"); - -// delete isgi_data; -// delete our_data; - -//} - - diff --git a/App/src/TestIsGISAXS14.cpp b/App/src/TestIsGISAXS14.cpp new file mode 100644 index 0000000000000000000000000000000000000000..236ff50225effc31b804abe19ab1cb30b3fd2d42 --- /dev/null +++ b/App/src/TestIsGISAXS14.cpp @@ -0,0 +1,45 @@ +#include "TestIsGISAXS14.h" +#include "IsGISAXSTools.h" +#include "OutputDataIOFactory.h" +#include "Utils.h" + +#include "GISASExperiment.h" +#include "MultiLayer.h" +#include "SampleFactory.h" +#include "Units.h" + +#include <fstream> + + +TestIsGISAXS14::TestIsGISAXS14() : IFunctionalTest("TestIsGISAXS14") +{ + setOutputPath(Utils::FileSystem::GetHomePath()+"./Examples/IsGISAXS_examples/ex-14/" ); +} + + +void TestIsGISAXS14::execute() +{ + MultiLayer *sample = dynamic_cast<MultiLayer *>(SampleFactory::instance().createItem("IsGISAXS14_LayeredSpheresOnGradedInterface")); + + GISASExperiment experiment(mp_options); + experiment.setSample(*sample); + experiment.setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, 100, 0.0*Units::degree, 2.0*Units::degree, true); + experiment.setBeamParameters(1.0*Units::angstrom, -0.2*Units::degree, 0.0*Units::degree); + experiment.runSimulation(); + OutputDataIOFactory::writeOutputData(*experiment.getOutputDataClone(), getOutputPath() + "this_multilayer_sphere.ima"); +} + + +void TestIsGISAXS14::finalise() +{ + std::string isgi_file(getOutputPath()+"isgi_normal_sphere.ima"); + std::string this_file(getOutputPath()+"this_multilayer_sphere.ima"); + + OutputData<double> *isgi_data = OutputDataIOFactory::getOutputData(isgi_file); + OutputData<double> *our_data = OutputDataIOFactory::getOutputData(this_file); + + IsGISAXSTools::drawOutputDataComparisonResults(*our_data, *isgi_data, "TestIsGISAXS14_c1", "Multilayered sphere on graded interface"); + + delete isgi_data; + delete our_data; +} diff --git a/Examples/IsGISAXS_examples/README b/Examples/IsGISAXS_examples/README index 66a1bdb550d5269168b5d1744866282026d1e0be..72f0ca78862e234e29b90778e9dd574aea4c3271 100644 --- a/Examples/IsGISAXS_examples/README +++ b/Examples/IsGISAXS_examples/README @@ -6,10 +6,21 @@ In each subdirectory, one finds: - isgi_*.ima files with simulated intensity produced by IsGISAXS List of examples: -ex-1 2 types of particles (cylinder, prism3) on top of substrate. No interference function. -ex-3 cylinder form factor -ex-9 pyramid form factor -ex-10 cylinders with interference on top of substrate +ex-1 Mixture of cylinders and prisms without interference. +ex-2 Two gaussian size cylinder distribution. +ex-3 Cylinder formfactor in BA and DWBA. +ex-4 1D and 2D paracrystal. +ex-5 1D paracrystal fit example. +ex-6 2D lattice with different disorders. +ex-7 Mixture of different particles defined in morphology file. +ex-8 2DDL paracrystal +ex-9 Rotated pyramids on top of substrate. +ex-10 Cylinders with interference on top of substrate. +ex-11 Core shell nano particles. +ex-12 Constrained fit example: mixture of two cylinder types +ex-13 Simulated annealing fit example. +ex-14 Layered spheres on graded interface. +ex-15 Size spacing correlation approximation Some notes: -Since polarization (x-ray) is not yet included in GISASFW, this feature should be disabled in IsGISAXS by returning 1._wp from function PolFac in Reflectivity_mod.f90 diff --git a/Macros/GitUtils/gisasfw_loc.png b/Macros/GitUtils/gisasfw_loc.png index ccd0353bde2d3e15fc2a757fccc1acea66a12c16..770f30c30cc94220f5820f6b8923273bae44bb68 100644 Binary files a/Macros/GitUtils/gisasfw_loc.png and b/Macros/GitUtils/gisasfw_loc.png differ