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
03c71534
There was an error fetching the commit references. Please try again later.
Commit
03c71534
authored
11 years ago
by
Giovanni Bussi
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation to class SwitchingFunction
parent
ce0a3c98
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tools/SwitchingFunction.h
+47
-9
47 additions, 9 deletions
src/tools/SwitchingFunction.h
with
47 additions
and
9 deletions
src/tools/SwitchingFunction.h
+
47
−
9
View file @
03c71534
...
@@ -30,29 +30,67 @@ class Log;
...
@@ -30,29 +30,67 @@ class Log;
class
Keywords
;
class
Keywords
;
/// \ingroup TOOLBOX
/// \ingroup TOOLBOX
/// Small class to compure switching functions in the form
/// Small class to compure switching functions.
/// In the future we might extend it so as to be set using
/// Switching functions are created using set() and
/// a string:
/// then can be used with function calculate() or calculateSqr().
/// void set(std::string);
/// Since this is typically computed on a distance vector,
/// which can then be parsed for more complex stuff, e.g. exponentials
/// the second all (calculateSqr()) allows to skip the calculation
/// tabulated functions from file, matheval, etc...
/// of a square root in some case, thus potentially increasing
/// performances.
class
SwitchingFunction
{
class
SwitchingFunction
{
/// This is to check that switching function has been initialized
bool
init
;
bool
init
;
/// Type of function
enum
{
spline
,
exponential
,
gaussian
,
smap
}
type
;
enum
{
spline
,
exponential
,
gaussian
,
smap
}
type
;
int
nn
,
mm
,
a
,
b
;
/// Inverse of scaling length.
double
invr0
,
d0
,
dmax
,
c
,
d
;
/// We store the inverse to avoid a division
double
invr0_2
,
dmax_2
;
double
invr0
;
/// Minimum distance (before this, function is one)
double
d0
;
/// Maximum distance (after this, function is zero)
double
dmax
;
/// Exponents for rational function
int
nn
,
mm
;
/// Parameters for smap function
int
a
,
b
;
double
c
,
d
;
/// Square of invr0, useful in calculateSqr()
double
invr0_2
;
/// Square of dmax, useful in calculateSqr()
double
dmax_2
;
/// Parameters for stretching the function to zero at d_max
double
stretch
,
shift
;
double
stretch
,
shift
;
/// Low-level tool to compute rational functions.
/// It is separated since it is called both by calculate() and calculateSqr()
double
do_rational
(
double
rdist
,
double
&
dfunc
,
int
nn
,
int
mm
)
const
;
double
do_rational
(
double
rdist
,
double
&
dfunc
,
int
nn
,
int
mm
)
const
;
public
:
public
:
static
void
registerKeywords
(
Keywords
&
keys
);
static
void
registerKeywords
(
Keywords
&
keys
);
/// Constructor
SwitchingFunction
();
SwitchingFunction
();
/// Set a "rational" switching function.
/// Notice that a d_max is set automatically to a value such that
/// f(d_max)=0.00001.
void
set
(
int
nn
,
int
mm
,
double
r_0
,
double
d_0
);
void
set
(
int
nn
,
int
mm
,
double
r_0
,
double
d_0
);
/// Set an arbitrary switching function.
/// Parse the string in definition and possibly returns errors
/// in the errormsg string
void
set
(
const
std
::
string
&
definition
,
std
::
string
&
errormsg
);
void
set
(
const
std
::
string
&
definition
,
std
::
string
&
errormsg
);
/// Returns a string with a description of the switching function
std
::
string
description
()
const
;
std
::
string
description
()
const
;
/// Compute the switching function.
/// Returns s(x). df will be set to the value of the derivative
/// of the switching function _divided_by_x
double
calculate
(
double
x
,
double
&
df
)
const
;
double
calculate
(
double
x
,
double
&
df
)
const
;
/// Compute the switching function.
/// Returns \f$ s(\sqrt{x})\f$ .
/// df will be set to the \f$ \frac{1}{\sqrt{x}}\frac{ds}{d\sqrt{x}}= 2 \frac{ds}{dx}\f$
/// (same as calculate()).
/// The advantage is that in some case the expensive square root can be avoided
/// (namely for rational functions, if nn and mm are even and d0 is zero)
double
calculateSqr
(
double
distance2
,
double
&
dfunc
)
const
;
double
calculateSqr
(
double
distance2
,
double
&
dfunc
)
const
;
/// Returns d0
double
get_d0
()
const
;
double
get_d0
()
const
;
/// Returns r0
double
get_r0
()
const
;
double
get_r0
()
const
;
};
};
...
...
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