IMP
2.1.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
simple.cpp
1
/** \example core/simple.cpp
2
3
Simple example of using the IMP C++ library.
4
5
This should be equivalent to the first part of the Python example simple.py.
6
*/
7
8
#include <fstream>
9
10
#include <IMP/kernel.h>
11
#include <IMP/algebra.h>
12
#include <IMP/core.h>
13
14
int
main()
15
{
16
IMP_NEW
(
IMP::kernel::Model
, m, ());
17
18
// Create two "untyped" kernel::Particles
19
IMP_NEW
(
IMP::kernel::Particle
, p1, (m));
20
IMP_NEW
(
IMP::kernel::Particle
, p2, (m));
21
22
// "Decorate" the kernel::Particles with x,y,z attributes (point-like particles)
23
IMP::core::XYZ
d1 =
IMP::core::XYZ::setup_particle
(p1);
24
IMP::core::XYZ
d2 =
IMP::core::XYZ::setup_particle
(p2);
25
26
// Use some XYZ-specific functionality (set coordinates)
27
d1.
set_coordinates
(
IMP::algebra::Vector3D
(10.0, 10.0, 10.0));
28
d2.
set_coordinates
(
IMP::algebra::Vector3D
(-10.0, -10.0, -10.0));
29
std::cout << d1 <<
" "
<< d2 << std::endl;
30
31
return
0;
32
}
IMP::core::XYZ::setup_particle
static XYZ setup_particle(kernel::Model *m, ParticleIndex pi)
Definition:
XYZ.h:53
IMP_NEW
#define IMP_NEW(Typename, varname, args)
Declare a ref counted pointer to a new object.
Definition:
base/object_macros.h:100
IMP::algebra::VectorD< 3 >
IMP::core::XYZ::set_coordinates
void set_coordinates(const algebra::Vector3D &v)
set all coordinates from a vector
Definition:
XYZ.h:64
IMP::core::XYZ
A decorator for a particle with x,y,z coordinates.
Definition:
XYZ.h:32
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/declare_Particle.h:34
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/declare_Model.h:72