Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
main
main.cpp
Go to the documentation of this file.
1
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
Copyright (c) 2013 The plumed team
3
(see the PEOPLE file at the root of the distribution for a list of names)
4
5
See http://www.plumed-code.org for more information.
6
7
This file is part of plumed, version 2.0.
8
9
plumed is free software: you can redistribute it and/or modify
10
it under the terms of the GNU Lesser General Public License as published by
11
the Free Software Foundation, either version 3 of the License, or
12
(at your option) any later version.
13
14
plumed is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public License
20
along with plumed. If not, see <http://www.gnu.org/licenses/>.
21
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22
#include "wrapper/Plumed.h"
23
#include <cstring>
24
25
#ifdef __PLUMED_MPI
26
#include <mpi.h>
27
#endif
28
29
using namespace
std
;
30
31
/**
32
This main uses only the interface published in
33
Plumed.h. The object file generated from this .cpp
34
is the only part of the plumed library that should
35
not be linked with external MD codes, so as
36
to avoid linker error.
37
*/
38
int
main
(
int
argc,
char
**argv){
39
#ifdef __PLUMED_MPI
40
bool
nompi=
false
;
41
if
(argc>1 && !strcmp(argv[1],
"--no-mpi"
)) nompi=
true
;
42
if
(!nompi) MPI_Init(&argc,&argv);
43
#endif
44
int
ret=0;
45
46
PLMD::Plumed
* p=
new
PLMD::Plumed
;
47
p->
cmd
(
"CLTool setArgc"
,&argc);
48
p->
cmd
(
"CLTool setArgv"
,argv);
49
#ifdef __PLUMED_MPI
50
if
(!nompi){
51
MPI_Comm comm;
52
MPI_Comm_dup(MPI_COMM_WORLD,&comm);
53
p->
cmd
(
"CLTool setMPIComm"
,&comm);
54
}
55
#endif
56
p->
cmd
(
"CLTool run"
,&ret);
57
delete
p;
58
59
#ifdef __PLUMED_MPI
60
if
(!nompi) MPI_Finalize();
61
#endif
62
return
ret;
63
}
PLMD::Plumed::cmd
void cmd(const char *key, const void *val=NULL)
Send a command to this plumed object.
Definition:
Plumed.h:455
main
int main(int argc, char **argv)
This main uses only the interface published in Plumed.h.
Definition:
main.cpp:38
std
STL namespace.
PLMD::Plumed
C++ wrapper for plumed.
Definition:
Plumed.h:314
Hosted by GitHub
1.8.8