IMP
2.2.1
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
IMP_NEW
(
IMP::kernel::Model
, m, ());
16
17
// Create two "untyped" kernel::Particles
18
IMP_NEW
(
IMP::kernel::Particle
, p1, (m));
19
IMP_NEW
(
IMP::kernel::Particle
, p2, (m));
20
21
// "Decorate" the kernel::Particles with x,y,z attributes (point-like
22
// 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
}
kernel.h
A container which has pairs which ensure a set is connected.
core.h
A container which has pairs which ensure a set is connected.
algebra.h
A container which has pairs which ensure a set is connected.
IMP::core::XYZ::setup_particle
static XYZ setup_particle(kernel::Model *m, ParticleIndex pi)
Definition:
XYZ.h:51
IMP_NEW
#define IMP_NEW(Typename, varname, args)
Declare a ref counted pointer to a new object.
Definition:
base/object_macros.h:72
IMP::core::XYZ::set_coordinates
void set_coordinates(const algebra::Vector3D &v)
set all coordinates from a vector
Definition:
XYZ.h:62
IMP::core::XYZ
A decorator for a particle with x,y,z coordinates.
Definition:
XYZ.h:30
IMP::kernel::Particle
Class to handle individual model particles.
Definition:
kernel/Particle.h:34
IMP::algebra::Vector3D
VectorD< 3 > Vector3D
Definition:
VectorD.h:395
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:72