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
core
ExchangePatterns.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 "
ExchangePatterns.h
"
23
#include "tools/Random.h"
24
25
using namespace
std
;
26
27
namespace
PLMD
{
28
29
ExchangePatterns::ExchangePatterns():
30
PatternFlag(NONE),
31
NumberOfReplicas(1),
32
random(*new
Random
)
33
{}
34
35
ExchangePatterns::~ExchangePatterns
()
36
{
37
delete
&
random
;
38
}
39
40
void
ExchangePatterns::setNofR
(
const
int
nrepl){
41
NumberOfReplicas
=nrepl;
42
}
43
44
void
ExchangePatterns::setFlag
(
const
int
flag){
45
PatternFlag
=flag;
46
}
47
48
void
ExchangePatterns::getFlag
(
int
&flag){
49
flag=
PatternFlag
;
50
}
51
52
void
ExchangePatterns::setSeed
(
const
int
seed)
53
{
54
random
.
setSeed
(seed);
55
}
56
57
void
ExchangePatterns::getList
(
int
*ind)
58
{
59
switch
(
PatternFlag
)
60
{
61
case
RANDOM
:
62
for
(
int
i=0;i<
NumberOfReplicas
;i++) {
63
int
stat=1;
64
while
(stat) {
65
stat=0;
66
ind[i] = (int) (
random
.
U01
()*
NumberOfReplicas
);
67
for
(
int
j=0;j<i;j++)
if
(ind[i]==ind[j]) stat=1;
68
}
69
}
70
break
;
71
case
NEIGHBOR
:
72
for
(
int
i=0;i<
NumberOfReplicas
;i++) ind[i]=i;
73
break
;
74
}
75
}
76
77
}
PLMD::ExchangePatterns::NumberOfReplicas
int NumberOfReplicas
Definition:
ExchangePatterns.h:30
PLMD::ExchangePatterns::NEIGHBOR
Definition:
ExchangePatterns.h:35
std
STL namespace.
PLMD::Random::U01
double U01()
Definition:
Random.cpp:74
PLMD::Random
Definition:
Random.h:31
PLMD::ExchangePatterns::setFlag
void setFlag(const int)
Definition:
ExchangePatterns.cpp:44
PLMD::Random::setSeed
void setSeed(int idum)
Definition:
Random.cpp:51
PLMD::ExchangePatterns::setNofR
void setNofR(const int)
Definition:
ExchangePatterns.cpp:40
ExchangePatterns.h
PLMD::ExchangePatterns::RANDOM
Definition:
ExchangePatterns.h:35
PLMD::ExchangePatterns::setSeed
void setSeed(const int)
Definition:
ExchangePatterns.cpp:52
PLMD::ExchangePatterns::random
Random & random
Definition:
ExchangePatterns.h:31
PLMD
Definition:
Analysis.cpp:30
PLMD::ExchangePatterns::getList
void getList(int *ind)
Definition:
ExchangePatterns.cpp:57
PLMD::ExchangePatterns::getFlag
void getFlag(int &)
Definition:
ExchangePatterns.cpp:48
PLMD::ExchangePatterns::PatternFlag
int PatternFlag
Definition:
ExchangePatterns.h:29
PLMD::ExchangePatterns::~ExchangePatterns
~ExchangePatterns()
Definition:
ExchangePatterns.cpp:35
Hosted by GitHub
1.8.8