Skip to content
Snippets Groups Projects
Commit 7ee38886 authored by Carlo Camilloni's avatar Carlo Camilloni
Browse files

PDB: new methods to get all the atoms in a residue

parent 015d89fc
No related branches found
No related tags found
No related merge requests found
...@@ -243,6 +243,17 @@ AtomNumber PDB::getNamedAtomFromResidueAndChain( const std::string& aname, const ...@@ -243,6 +243,17 @@ AtomNumber PDB::getNamedAtomFromResidueAndChain( const std::string& aname, const
return numbers[0]; // This is to stop compiler errors return numbers[0]; // This is to stop compiler errors
} }
std::vector<AtomNumber> PDB::getAtomsInResidue(const unsigned& resnum,const std::string& chainid)const {
std::vector<AtomNumber> tmp;
for(unsigned i=0;i<size();++i){
if( residue[i]==resnum && ( chainid=="*" || chain[i]==chainid) ) tmp.push_back(numbers[i]);
}
if(tmp.size()==0) {
std::string num; Tools::convert( resnum, num );
plumed_merror("Cannot find residue " + num + " from chain " + chainid );
}
return tmp;
}
std::string PDB::getChainID(const unsigned& resnumber) const { std::string PDB::getChainID(const unsigned& resnumber) const {
for(unsigned i=0;i<size();++i){ for(unsigned i=0;i<size();++i){
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
/// Return the atom named aname from residue number resnum and chain. /// Return the atom named aname from residue number resnum and chain.
/// Chain=="*" matches any chain and makes it equivalent to getNamedAtomFromResidue. /// Chain=="*" matches any chain and makes it equivalent to getNamedAtomFromResidue.
AtomNumber getNamedAtomFromResidueAndChain( const std::string& aname, const unsigned& resnum, const std::string& chain ) const; AtomNumber getNamedAtomFromResidueAndChain( const std::string& aname, const unsigned& resnum, const std::string& chain ) const;
/// Access to the atoms of a residue
std::vector<AtomNumber> getAtomsInResidue(const unsigned& resnum,const std::string& chainid)const;
/// Get the extents of the blocks containing the atoms /// Get the extents of the blocks containing the atoms
const std::vector<unsigned> & getAtomBlockEnds() const ; const std::vector<unsigned> & getAtomBlockEnds() const ;
/// Get the number of blocks of atoms in the pdb /// Get the number of blocks of atoms in the pdb
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment