25 #include "Sample/Particle/Crystal.h"
26 #include "Sample/Particle/IFormFactor.h"
27 #include "Sample/Particle/MesoCrystal.h"
28 #include "Sample/Particle/Particle.h"
29 #include "Sample/Particle/ParticleCoreShell.h"
30 #include "Sample/Scattering/Rotations.h"
34 const QString abundance_tooltip =
"Proportion of this type of mesocrystal normalized to the \n"
35 "total number of particles in the layout";
37 const QString position_tooltip =
"Relative position of the mesocrystal's reference point \n"
38 "in the coordinate system of the parent (nm)";
44 , m_materials(materials)
46 m_vectorA.
init(
"First lattice vector",
"Coordinates of the first lattice vector",
48 m_vectorB.
init(
"Second lattice vector",
"Coordinates of the second lattice vector",
50 m_vectorC.
init(
"Third lattice vector",
"Coordinates of the third lattice vector",
62 Serialize::rwSelected<RotationItemCatalog>(s,
m_rotation);
66 Serialize::rwSelected<FormFactorItemCatalog>(s,
m_outerShape);
73 if (!(lattice.unitCellVolume() > 0.0))
74 throw Error(
"MesoCrystalItem::createMesoCrystal(): "
75 "Lattice volume not strictly positive");
76 std::unique_ptr<IParticle> basis =
getBasis();
78 throw Error(
"MesoCrystalItem::createMesoCrystal(): "
79 "No basis particle defined");
80 Crystal crystal(*basis, lattice);
84 throw Error(
"MesoCrystalItem::createMesoCrystal(): "
85 "No outer shape defined");
87 auto result = std::make_unique<MesoCrystal>(crystal, *ff);
88 result->setParticlePosition(
position());
90 result->setRotation(*r);
103 return p->createParticle();
106 return p->createParticleCoreShell();
109 return p->createParticleComposition();
112 return p->createMesoCrystal();
174 QVector<ItemWithParticles*> result;
Defines class ItemWithParticlesCatalog.
Defines class MesoCrystalItem.
Defines class ParticleCompositionItem.
Defines class ParticleCoreShellItem.
Defines class ParticleItem.
Defines class RotationItemCatalog.
VectorProperty m_position
SelectionProperty< RotationItem * > m_rotation
std::unique_ptr< IRotation > createRotation() const
nullptr only if "no rotation". Can contain identity!
DoubleProperty m_abundance
virtual QVector< ItemWithParticles * > containedItemsWithParticles() const =0
Return full hierarchical contained items with particles.
void setRawDataVectorA(const R3 &vector_a)
void setOuterShape(FormFactorItem *p)
std::unique_ptr< IFormFactor > getOuterShape() const
void setRawDataVectorC(const R3 &vector_c)
VectorDescriptor vectorB() const
VectorDescriptor vectorC() const
void setRawDataVectorB(const R3 &vector_b)
void setBasis(ItemWithParticles *basis)
const MaterialItems * m_materials
std::unique_ptr< MesoCrystal > createMesoCrystal() const
SelectionProperty< FormFactorItem * > m_outerShape
std::unique_ptr< IParticle > getBasis() const
VectorDescriptor vectorA() const
SelectionDescriptor< FormFactorItem * > outerShape() const
Lattice3D getLattice() const
MesoCrystalItem(const MaterialItems *materials)
void serialize(Streamer &s) override
SelectionProperty< ItemWithParticles * > m_basisParticle
ItemWithParticles * basisParticle() const
QVector< ItemWithParticles * > containedItemsWithParticles() const override
Return full hierarchical contained items with particles.
Describes a selection (various possibilities and the current one).
void set(T t, bool callInitializer=false)
Directly set the new item.
T get() const
Direct access to the stored pointer.
void init(const QString &label, const QString &tooltip, const QString &persistentTag, ArgsForCreation... argsForCreation)
Initialize by means of a catalog class and optional creation arguments.
Supports serialization to or deserialization from QXmlStream.
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Describes properties of a 3D vector, consisting of three double values.
void init(const QString &label, const QString &tooltip, const variant< QString, Unit > &unit, const QString &persistentTag)
void rwProperty(Streamer &s, DoubleProperty &d)