Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
9abbb918
Commit
9abbb918
authored
6 years ago
by
Van Herck, Walter
Browse files
Options
Downloads
Patches
Plain Diff
Provide Python translation for InterferenceFunctionHardDisk
parent
39c66205
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Core/Aggregate/InterferenceFunctionHardDisk.h
+2
-0
2 additions, 0 deletions
Core/Aggregate/InterferenceFunctionHardDisk.h
Core/Aggregate/ParticleLayout.cpp
+4
-1
4 additions, 1 deletion
Core/Aggregate/ParticleLayout.cpp
Core/Export/SampleToPython.cpp
+29
-20
29 additions, 20 deletions
Core/Export/SampleToPython.cpp
with
35 additions
and
21 deletions
Core/Aggregate/InterferenceFunctionHardDisk.h
+
2
−
0
View file @
9abbb918
...
@@ -38,6 +38,8 @@ public:
...
@@ -38,6 +38,8 @@ public:
double
getParticleDensity
()
const
override
final
;
double
getParticleDensity
()
const
override
final
;
double
radius
()
const
{
return
m_radius
;
}
double
density
()
const
{
return
m_density
;
}
private
:
private
:
InterferenceFunctionHardDisk
(
const
InterferenceFunctionHardDisk
&
other
);
InterferenceFunctionHardDisk
(
const
InterferenceFunctionHardDisk
&
other
);
double
iff_without_dw
(
const
kvector_t
q
)
const
override
final
;
double
iff_without_dw
(
const
kvector_t
q
)
const
override
final
;
...
...
This diff is collapsed.
Click to expand it.
Core/Aggregate/ParticleLayout.cpp
+
4
−
1
View file @
9abbb918
...
@@ -30,7 +30,10 @@ namespace {
...
@@ -30,7 +30,10 @@ namespace {
bool
particleDensityIsProvidedByInterference
(
const
IInterferenceFunction
&
iff
)
bool
particleDensityIsProvidedByInterference
(
const
IInterferenceFunction
&
iff
)
{
{
if
(
iff
.
getName
()
==
BornAgain
::
InterferenceFunction2DLatticeType
||
if
(
iff
.
getName
()
==
BornAgain
::
InterferenceFunction2DLatticeType
||
iff
.
getName
()
==
BornAgain
::
InterferenceFunction2DParaCrystalType
)
iff
.
getName
()
==
BornAgain
::
InterferenceFunction2DParaCrystalType
||
iff
.
getName
()
==
BornAgain
::
InterferenceFunction2DSuperLattice
||
iff
.
getName
()
==
BornAgain
::
InterferenceFunctionFinite2DLatticeType
||
iff
.
getName
()
==
BornAgain
::
InterferenceFunctionHardDiskType
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Core/Export/SampleToPython.cpp
+
29
−
20
View file @
9abbb918
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
#include
"IFormFactor.h"
#include
"IFormFactor.h"
#include
"INodeUtils.h"
#include
"INodeUtils.h"
#include
"InterferenceFunctions.h"
#include
"InterferenceFunctions.h"
#include
"Layer.h"
#include
"Lattice.h"
#include
"Lattice.h"
#include
"Layer.h"
#include
"LayerInterface.h"
#include
"LayerInterface.h"
#include
"LayerRoughness.h"
#include
"LayerRoughness.h"
#include
"Material.h"
#include
"Material.h"
...
@@ -86,11 +86,12 @@ SampleToPython::~SampleToPython() = default;
...
@@ -86,11 +86,12 @@ SampleToPython::~SampleToPython() = default;
std
::
string
SampleToPython
::
defineGetSample
()
const
std
::
string
SampleToPython
::
defineGetSample
()
const
{
{
return
"def "
+
getSampleFunctionName
()
+
"():
\n
"
+
defineMaterials
()
+
defineLayers
()
+
defineFormFactors
()
return
"def "
+
getSampleFunctionName
()
+
"():
\n
"
+
defineMaterials
()
+
defineLayers
()
+
defineParticles
()
+
defineCoreShellParticles
()
+
defineParticleCompositions
()
+
defineFormFactors
()
+
defineParticles
()
+
defineCoreShellParticles
()
+
defineLattices
()
+
defineCrystals
()
+
defineMesoCrystals
()
+
defineParticleCompositions
()
+
defineLattices
()
+
defineCrystals
()
+
defineParticleDistributions
()
+
defineInterferenceFunctions
()
+
defineParticleLayouts
()
+
defineMesoCrystals
()
+
defineParticleDistributions
()
+
defineInterferenceFunctions
()
+
defineRoughnesses
()
+
addLayoutsToLayers
()
+
defineMultiLayers
()
+
"
\n\n
"
;
+
defineParticleLayouts
()
+
defineRoughnesses
()
+
addLayoutsToLayers
()
+
defineMultiLayers
()
+
"
\n\n
"
;
}
}
const
std
::
map
<
MATERIAL_TYPES
,
std
::
string
>
factory_names
{
const
std
::
map
<
MATERIAL_TYPES
,
std
::
string
>
factory_names
{
...
@@ -370,8 +371,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -370,8 +371,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
if
(
dynamic_cast
<
const
InterferenceFunctionNone
*>
(
interference
))
if
(
dynamic_cast
<
const
InterferenceFunctionNone
*>
(
interference
))
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionNone()
\n
"
;
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionNone()
\n
"
;
else
if
(
auto
p_lattice_1d
else
if
(
auto
p_lattice_1d
=
=
dynamic_cast
<
const
InterferenceFunction1DLattice
*>
(
interference
))
{
dynamic_cast
<
const
InterferenceFunction1DLattice
*>
(
interference
))
{
const
Lattice1DParameters
latticeParameters
=
p_lattice_1d
->
getLatticeParameters
();
const
Lattice1DParameters
latticeParameters
=
p_lattice_1d
->
getLatticeParameters
();
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction1DLattice("
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction1DLattice("
<<
printNm
(
latticeParameters
.
m_length
)
<<
", "
<<
printNm
(
latticeParameters
.
m_length
)
<<
", "
...
@@ -383,8 +384,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -383,8 +384,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
result
<<
indent
()
<<
it
->
second
<<
"_pdf = ba."
<<
pdf
->
getName
()
<<
"("
result
<<
indent
()
<<
it
->
second
<<
"_pdf = ba."
<<
pdf
->
getName
()
<<
"("
<<
argumentList
(
pdf
)
<<
")
\n
"
<<
argumentList
(
pdf
)
<<
")
\n
"
<<
indent
()
<<
it
->
second
<<
".setDecayFunction("
<<
it
->
second
<<
"_pdf)
\n
"
;
<<
indent
()
<<
it
->
second
<<
".setDecayFunction("
<<
it
->
second
<<
"_pdf)
\n
"
;
}
else
if
(
auto
p_para_radial
}
else
if
(
auto
p_para_radial
=
=
dynamic_cast
<
const
InterferenceFunctionRadialParaCrystal
*>
(
interference
))
{
dynamic_cast
<
const
InterferenceFunctionRadialParaCrystal
*>
(
interference
))
{
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionRadialParaCrystal("
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionRadialParaCrystal("
<<
printNm
(
p_para_radial
->
peakDistance
())
<<
", "
<<
printNm
(
p_para_radial
->
peakDistance
())
<<
", "
<<
printNm
(
p_para_radial
->
dampingLength
())
<<
")
\n
"
;
<<
printNm
(
p_para_radial
->
dampingLength
())
<<
")
\n
"
;
...
@@ -404,8 +405,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -404,8 +405,8 @@ std::string SampleToPython::defineInterferenceFunctions() const
<<
argumentList
(
pdf
)
<<
")
\n
"
<<
argumentList
(
pdf
)
<<
")
\n
"
<<
indent
()
<<
it
->
second
<<
".setProbabilityDistribution("
<<
it
->
second
<<
indent
()
<<
it
->
second
<<
".setProbabilityDistribution("
<<
it
->
second
<<
"_pdf)
\n
"
;
<<
"_pdf)
\n
"
;
}
else
if
(
auto
p_lattice_2d
}
else
if
(
auto
p_lattice_2d
=
=
dynamic_cast
<
const
InterferenceFunction2DLattice
*>
(
interference
))
{
dynamic_cast
<
const
InterferenceFunction2DLattice
*>
(
interference
))
{
const
Lattice2D
&
lattice
=
p_lattice_2d
->
lattice
();
const
Lattice2D
&
lattice
=
p_lattice_2d
->
lattice
();
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction2DLattice("
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction2DLattice("
<<
printNm
(
lattice
.
length1
())
<<
", "
<<
printNm
(
lattice
.
length2
())
<<
", "
<<
printNm
(
lattice
.
length1
())
<<
", "
<<
printNm
(
lattice
.
length2
())
<<
", "
...
@@ -420,20 +421,20 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -420,20 +421,20 @@ std::string SampleToPython::defineInterferenceFunctions() const
if
(
p_lattice_2d
->
integrationOverXi
()
==
true
)
if
(
p_lattice_2d
->
integrationOverXi
()
==
true
)
result
<<
indent
()
<<
it
->
second
<<
".setIntegrationOverXi(True)
\n
"
;
result
<<
indent
()
<<
it
->
second
<<
".setIntegrationOverXi(True)
\n
"
;
}
else
if
(
auto
p_lattice_2d
}
else
if
(
auto
p_lattice_2d
=
=
dynamic_cast
<
const
InterferenceFunctionFinite2DLattice
*>
(
interference
))
{
dynamic_cast
<
const
InterferenceFunctionFinite2DLattice
*>
(
interference
))
{
const
Lattice2D
&
lattice
=
p_lattice_2d
->
lattice
();
const
Lattice2D
&
lattice
=
p_lattice_2d
->
lattice
();
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionFinite2DLattice("
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionFinite2DLattice("
<<
printNm
(
lattice
.
length1
())
<<
", "
<<
printNm
(
lattice
.
length2
())
<<
", "
<<
printNm
(
lattice
.
length1
())
<<
", "
<<
printNm
(
lattice
.
length2
())
<<
", "
<<
printDegrees
(
lattice
.
latticeAngle
())
<<
", "
<<
printDegrees
(
lattice
.
latticeAngle
())
<<
", "
<<
printDegrees
(
lattice
.
rotationAngle
())
<<
", "
<<
printDegrees
(
lattice
.
rotationAngle
())
<<
", "
<<
p_lattice_2d
->
numberUnitCells1
()
<<
", "
<<
p_lattice_2d
->
numberUnitCells1
()
<<
", "
<<
p_lattice_2d
->
numberUnitCells2
()
<<
p_lattice_2d
->
numberUnitCells2
()
<<
")
\n
"
;
<<
")
\n
"
;
if
(
p_lattice_2d
->
integrationOverXi
()
==
true
)
if
(
p_lattice_2d
->
integrationOverXi
()
==
true
)
result
<<
indent
()
<<
it
->
second
<<
".setIntegrationOverXi(True)
\n
"
;
result
<<
indent
()
<<
it
->
second
<<
".setIntegrationOverXi(True)
\n
"
;
}
else
if
(
auto
p_para_2d
}
else
if
(
auto
p_para_2d
=
=
dynamic_cast
<
const
InterferenceFunction2DParaCrystal
*>
(
interference
))
{
dynamic_cast
<
const
InterferenceFunction2DParaCrystal
*>
(
interference
))
{
std
::
vector
<
double
>
domainSize
=
p_para_2d
->
domainSizes
();
std
::
vector
<
double
>
domainSize
=
p_para_2d
->
domainSizes
();
const
Lattice2D
&
lattice
=
p_para_2d
->
lattice
();
const
Lattice2D
&
lattice
=
p_para_2d
->
lattice
();
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction2DParaCrystal("
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunction2DParaCrystal("
...
@@ -462,12 +463,17 @@ std::string SampleToPython::defineInterferenceFunctions() const
...
@@ -462,12 +463,17 @@ std::string SampleToPython::defineInterferenceFunctions() const
<<
argumentList
(
pdf
)
<<
")
\n
"
;
<<
argumentList
(
pdf
)
<<
")
\n
"
;
result
<<
indent
()
<<
it
->
second
<<
".setProbabilityDistributions("
<<
it
->
second
result
<<
indent
()
<<
it
->
second
<<
".setProbabilityDistributions("
<<
it
->
second
<<
"_pdf_1, "
<<
it
->
second
<<
"_pdf_2)
\n
"
;
<<
"_pdf_1, "
<<
it
->
second
<<
"_pdf_2)
\n
"
;
}
else
if
(
auto
p_lattice_hd
=
dynamic_cast
<
const
InterferenceFunctionHardDisk
*>
(
interference
))
{
result
<<
indent
()
<<
it
->
second
<<
" = ba.InterferenceFunctionHardDisk("
<<
printNm
(
p_lattice_hd
->
radius
())
<<
", "
<<
printDouble
(
p_lattice_hd
->
density
())
<<
")
\n
"
;
}
else
}
else
throw
Exceptions
::
NotImplementedException
(
throw
Exceptions
::
NotImplementedException
(
"Bug: ExportToPython::defineInterferenceFunctions() called with unexpected "
"Bug: ExportToPython::defineInterferenceFunctions() called with unexpected "
"IInterferenceFunction "
"IInterferenceFunction "
+
interference
->
getName
());
+
interference
->
getName
());
if
(
interference
->
positionVariance
()
>
0.0
)
{
if
(
interference
->
positionVariance
()
>
0.0
)
{
result
<<
indent
()
<<
it
->
second
<<
".setPositionVariance("
result
<<
indent
()
<<
it
->
second
<<
".setPositionVariance("
<<
printNm2
(
interference
->
positionVariance
())
<<
")
\n
"
;
<<
printNm2
(
interference
->
positionVariance
())
<<
")
\n
"
;
}
}
...
@@ -591,7 +597,10 @@ std::string SampleToPython::defineMultiLayers() const
...
@@ -591,7 +597,10 @@ std::string SampleToPython::defineMultiLayers() const
return
result
.
str
();
return
result
.
str
();
}
}
std
::
string
SampleToPython
::
indent
()
const
{
return
" "
;
}
std
::
string
SampleToPython
::
indent
()
const
{
return
" "
;
}
void
SampleToPython
::
setRotationInformation
(
const
IParticle
*
p_particle
,
std
::
string
name
,
void
SampleToPython
::
setRotationInformation
(
const
IParticle
*
p_particle
,
std
::
string
name
,
std
::
ostringstream
&
result
)
const
std
::
ostringstream
&
result
)
const
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment