Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Plumed AlphaFold
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Kurečka
Plumed AlphaFold
Commits
16b9eb85
There was an error fetching the commit references. Please try again later.
Commit
16b9eb85
authored
10 years ago
by
Carlo Camilloni
Browse files
Options
Downloads
Patches
Plain Diff
ENSEMBLE: perform replica-averaging on any collective variable
parent
ee7943ff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES/Unreleased.txt
+4
-3
4 additions, 3 deletions
CHANGES/Unreleased.txt
src/function/Ensemble.cpp
+111
-0
111 additions, 0 deletions
src/function/Ensemble.cpp
with
115 additions
and
3 deletions
CHANGES/Unreleased.txt
+
4
−
3
View file @
16b9eb85
...
...
@@ -20,13 +20,14 @@ Changes from version 2.0 which are relevant for users:
- \ref NLINKS.
- \ref DIHCOR.
- \ref NOE.
- \ref RDC.
- \ref RDC.
- \ref CLASSICAL_MDS
- \ref XDISTANCES
- \ref YDISTANCES
- \ref ZDISTANCES
- \ref DUMPMULTICOLVAR
- Crystallation module, including \ref Q4, \ref Q6, \ref LOCAL_Q4, \ref LOCAL_Q6, \ref MOLECULES, \ref SIMPLECUBIC, \ref TETRAHEDRAL and \ref FCCUBIC.
- \ref ENSEMBLE to perform Replica-Averaging on any collective variable.
- New features for existing actions:
- \ref METAD : WALKERS_MPI flag (multiple walkers in a mpi-based multi-replica framework),
ACCELERATION flag (calculate on the fly the Metadynamics acceleration factor),
...
...
@@ -40,8 +41,8 @@ Changes from version 2.0 which are relevant for users:
- \ref GROUP : NDX_FILE and NDX_GROUP options to import atom lists from ndx (gromacs) files.
- In many multicolvars, MIN and MAX options can be used.
- \ref HISTOGRAM : GRID_SPACING (alternative to GRID_BIN to set grid spacing),
FREQUENCY and
FREE-ENERGY flags in addition to standard probability density,
additional option for KERNEL=
NON
E to accumulate standard histograms.
FREE-ENERGY flags in addition to standard probability density,
additional option for KERNEL=
DISCRET
E to accumulate standard histograms.
- \ref sum_hills : added options --spacing (alternative to --bin to set grid spacing)
and --setmintozero to translate the minimum of the output files to zero.
- New features in MD patches (require repatch):
...
...
This diff is collapsed.
Click to expand it.
src/function/Ensemble.cpp
0 → 100644
+
111
−
0
View file @
16b9eb85
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright (c) 2013 The plumed team
(see the PEOPLE file at the root of the distribution for a list of names)
See http://www.plumed-code.org for more information.
This file is part of plumed, version 2.
plumed is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
plumed is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with plumed. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#include
"Function.h"
#include
"ActionRegister.h"
#include
"tools/Communicator.h"
using
namespace
std
;
namespace
PLMD
{
namespace
function
{
//+PLUMEDOC FUNCTION ENSEMBLE
/*
Calculates the replica averaging of a collective variable over multiple replicas.
Each collective variable is averaged separately and stored in a component labelled <em>label</em>.cvlabel.
\par Examples
The following input tells plumed to calculate the distance between atoms 3 and 5
and the average it over the available replicas.
\verbatim
dist: DISTANCE ATOMS=3,5
ens: ENSEMBLE ARG=dist
PRINT ARG=dist,ens.dist
\endverbatim
(See also \ref PRINT and \ref DISTANCE).
*/
//+ENDPLUMEDOC
class
Ensemble
:
public
Function
{
unsigned
ens_dim
;
double
fact
;
public:
Ensemble
(
const
ActionOptions
&
);
void
calculate
();
static
void
registerKeywords
(
Keywords
&
keys
);
};
PLUMED_REGISTER_ACTION
(
Ensemble
,
"ENSEMBLE"
)
void
Ensemble
::
registerKeywords
(
Keywords
&
keys
){
Function
::
registerKeywords
(
keys
);
keys
.
use
(
"ARG"
);
ActionWithValue
::
useCustomisableComponents
(
keys
);
}
Ensemble
::
Ensemble
(
const
ActionOptions
&
ao
)
:
Action
(
ao
),
Function
(
ao
)
{
if
(
comm
.
Get_rank
()
==
0
)
{
if
(
multi_sim_comm
.
Get_size
()
<
2
)
error
(
"You CANNOT run Replica-Averaged simulations without running multiple replicas!
\n
"
);
else
ens_dim
=
multi_sim_comm
.
Get_size
();
}
else
ens_dim
=
0
;
comm
.
Sum
(
&
ens_dim
,
1
);
fact
=
1.
/
((
double
)
ens_dim
);
for
(
unsigned
i
=
0
;
i
<
getNumberOfArguments
();
i
++
)
{
std
::
string
s
=
getPntrToArgument
(
i
)
->
getName
();
addComponentWithDerivatives
(
s
);
getPntrToComponent
(
i
)
->
setNotPeriodic
();
}
log
.
printf
(
" using %u replicas.
\n
"
,
ens_dim
);
checkRead
();
}
void
Ensemble
::
calculate
(){
for
(
unsigned
i
=
0
;
i
<
getNumberOfArguments
();
++
i
){
double
cv
=
0.
;
if
(
comm
.
Get_rank
()
==
0
)
{
// I am the master of my replica
// among replicas
cv
=
getArgument
(
i
);
multi_sim_comm
.
Sum
(
&
cv
,
1
);
cv
*=
fact
;
}
// inside each replica
comm
.
Sum
(
&
cv
,
1
);
Value
*
v
=
getPntrToComponent
(
i
);
v
->
set
(
cv
);
setDerivative
(
v
,
cv
,
fact
);
};
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment