Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
plumed2-fann
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
plumed2-fann
Commits
f3ce5e81
There was an error fetching the commit references. Please try again later.
Commit
f3ce5e81
authored
12 years ago
by
Giovanni Bussi
Browse files
Options
Downloads
Patches
Plain Diff
Added possibility to retrieve more info from MOLINFO
parent
e09429fa
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/core/SetupMolInfo.cpp
+13
-0
13 additions, 0 deletions
src/core/SetupMolInfo.cpp
src/core/SetupMolInfo.h
+3
-0
3 additions, 0 deletions
src/core/SetupMolInfo.h
src/tools/PDB.cpp
+24
-0
24 additions, 0 deletions
src/tools/PDB.cpp
src/tools/PDB.h
+9
-0
9 additions, 0 deletions
src/tools/PDB.h
with
49 additions
and
0 deletions
src/core/SetupMolInfo.cpp
+
13
−
0
View file @
f3ce5e81
...
@@ -151,4 +151,17 @@ void SetupMolInfo::getBackbone( std::vector<std::string>& restrings, const std::
...
@@ -151,4 +151,17 @@ void SetupMolInfo::getBackbone( std::vector<std::string>& restrings, const std::
}
}
}
}
std
::
string
SetupMolInfo
::
getAtomName
(
AtomNumber
a
)
const
{
return
pdb
.
getAtomName
(
a
);
}
unsigned
SetupMolInfo
::
getResidueNumber
(
AtomNumber
a
)
const
{
return
pdb
.
getResidueNumber
(
a
);
}
std
::
string
SetupMolInfo
::
getResidueName
(
AtomNumber
a
)
const
{
return
pdb
.
getResidueName
(
a
);
}
}
}
This diff is collapsed.
Click to expand it.
src/core/SetupMolInfo.h
+
3
−
0
View file @
f3ce5e81
...
@@ -41,6 +41,9 @@ public:
...
@@ -41,6 +41,9 @@ public:
static
void
registerKeywords
(
Keywords
&
keys
);
static
void
registerKeywords
(
Keywords
&
keys
);
SetupMolInfo
(
const
ActionOptions
&
ao
);
SetupMolInfo
(
const
ActionOptions
&
ao
);
void
getBackbone
(
std
::
vector
<
std
::
string
>&
resstrings
,
const
std
::
vector
<
std
::
string
>&
atnames
,
std
::
vector
<
std
::
vector
<
AtomNumber
>
>&
backbone
);
void
getBackbone
(
std
::
vector
<
std
::
string
>&
resstrings
,
const
std
::
vector
<
std
::
string
>&
atnames
,
std
::
vector
<
std
::
vector
<
AtomNumber
>
>&
backbone
);
std
::
string
getAtomName
(
AtomNumber
a
)
const
;
unsigned
getResidueNumber
(
AtomNumber
a
)
const
;
std
::
string
getResidueName
(
AtomNumber
a
)
const
;
};
};
}
}
...
...
This diff is collapsed.
Click to expand it.
src/tools/PDB.cpp
+
24
−
0
View file @
f3ce5e81
...
@@ -48,6 +48,27 @@ const std::vector<AtomNumber> & PDB::getAtomNumbers()const{
...
@@ -48,6 +48,27 @@ const std::vector<AtomNumber> & PDB::getAtomNumbers()const{
return
numbers
;
return
numbers
;
}
}
std
::
string
PDB
::
getAtomName
(
AtomNumber
a
)
const
{
std
::
map
<
AtomNumber
,
unsigned
>::
const_iterator
p
;
p
=
number2index
.
find
(
a
);
if
(
p
==
number2index
.
end
())
return
""
;
else
return
atomsymb
[
p
->
second
];
}
unsigned
PDB
::
getResidueNumber
(
AtomNumber
a
)
const
{
std
::
map
<
AtomNumber
,
unsigned
>::
const_iterator
p
;
p
=
number2index
.
find
(
a
);
if
(
p
==
number2index
.
end
())
return
0
;
else
return
residue
[
p
->
second
];
}
std
::
string
PDB
::
getResidueName
(
AtomNumber
a
)
const
{
std
::
map
<
AtomNumber
,
unsigned
>::
const_iterator
p
;
p
=
number2index
.
find
(
a
);
if
(
p
==
number2index
.
end
())
return
""
;
else
return
residuenames
[
p
->
second
];
}
unsigned
PDB
::
size
()
const
{
unsigned
PDB
::
size
()
const
{
return
positions
.
size
();
return
positions
.
size
();
}
}
...
@@ -65,6 +86,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
...
@@ -65,6 +86,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
string
record
=
line
.
substr
(
0
,
6
);
string
record
=
line
.
substr
(
0
,
6
);
string
serial
=
line
.
substr
(
6
,
5
);
string
serial
=
line
.
substr
(
6
,
5
);
string
atomname
=
line
.
substr
(
12
,
4
);
string
atomname
=
line
.
substr
(
12
,
4
);
string
residuename
=
line
.
substr
(
17
,
3
);
string
chainID
=
line
.
substr
(
21
,
1
);
string
chainID
=
line
.
substr
(
21
,
1
);
string
resnum
=
line
.
substr
(
22
,
4
);
string
resnum
=
line
.
substr
(
22
,
4
);
string
x
=
line
.
substr
(
30
,
8
);
string
x
=
line
.
substr
(
30
,
8
);
...
@@ -94,6 +116,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
...
@@ -94,6 +116,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
// scale into nm
// scale into nm
p
*=
scale
;
p
*=
scale
;
numbers
.
push_back
(
a
);
numbers
.
push_back
(
a
);
number2index
[
a
]
=
positions
.
size
();
std
::
size_t
startpos
=
atomname
.
find_first_not_of
(
"
\t
"
);
std
::
size_t
startpos
=
atomname
.
find_first_not_of
(
"
\t
"
);
std
::
size_t
endpos
=
atomname
.
find_last_not_of
(
"
\t
"
);
std
::
size_t
endpos
=
atomname
.
find_last_not_of
(
"
\t
"
);
atomsymb
.
push_back
(
atomname
.
substr
(
startpos
,
endpos
-
startpos
+
1
)
);
atomsymb
.
push_back
(
atomname
.
substr
(
startpos
,
endpos
-
startpos
+
1
)
);
...
@@ -102,6 +125,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
...
@@ -102,6 +125,7 @@ bool PDB::readFromFilepointer(FILE *fp,bool naturalUnits,double scale){
occupancy
.
push_back
(
o
);
occupancy
.
push_back
(
o
);
beta
.
push_back
(
b
);
beta
.
push_back
(
b
);
positions
.
push_back
(
p
);
positions
.
push_back
(
p
);
residuenames
.
push_back
(
residuename
);
}
}
}
}
return
file_is_alive
;
return
file_is_alive
;
...
...
This diff is collapsed.
Click to expand it.
src/tools/PDB.h
+
9
−
0
View file @
f3ce5e81
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include
<vector>
#include
<vector>
#include
<string>
#include
<string>
#include
"Log.h"
#include
"Log.h"
#include
<map>
namespace
PLMD
{
namespace
PLMD
{
...
@@ -42,6 +43,8 @@ class PDB{
...
@@ -42,6 +43,8 @@ class PDB{
std
::
vector
<
double
>
beta
;
std
::
vector
<
double
>
beta
;
std
::
vector
<
std
::
string
>
remark
;
std
::
vector
<
std
::
string
>
remark
;
std
::
vector
<
AtomNumber
>
numbers
;
std
::
vector
<
AtomNumber
>
numbers
;
std
::
map
<
AtomNumber
,
unsigned
>
number2index
;
std
::
vector
<
std
::
string
>
residuenames
;
public:
public:
/// Read the pdb from a file, scaling positions by a factor scale
/// Read the pdb from a file, scaling positions by a factor scale
bool
read
(
const
std
::
string
&
file
,
bool
naturalUnits
,
double
scale
);
bool
read
(
const
std
::
string
&
file
,
bool
naturalUnits
,
double
scale
);
...
@@ -73,6 +76,12 @@ public:
...
@@ -73,6 +76,12 @@ public:
void
renameAtoms
(
const
std
::
string
&
old_name
,
const
std
::
string
&
new_name
);
void
renameAtoms
(
const
std
::
string
&
old_name
,
const
std
::
string
&
new_name
);
///use the log to dump information
///use the log to dump information
friend
Log
&
operator
<<
(
Log
&
ostr
,
const
PDB
&
pdb
);
friend
Log
&
operator
<<
(
Log
&
ostr
,
const
PDB
&
pdb
);
/// return the name of a specific atom
std
::
string
getAtomName
(
AtomNumber
a
)
const
;
/// return the residue number for a specific atom
unsigned
getResidueNumber
(
AtomNumber
a
)
const
;
/// return the residue name for a specific atom
std
::
string
getResidueName
(
AtomNumber
a
)
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