SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
bond.h
Go to the documentation of this file.
1#ifndef BOND_H
2#define BOND_H
3
4#include <cstdint>
5#include <map>
6
7#include <constants.h>
8#include <neighbours.h>
9
19std::map<uint64_t, std::set<uint64_t>> determineBonds
20(
21 std::vector<uint64_t> forAtoms,
22 std::vector<Atom> & atoms,
23 float cutOff
24)
25{
26 if (cutOff <= 0.0f || forAtoms.size() == 0) { return {}; }
27
28 std::map<uint64_t, std::set<uint64_t>> bonds;
29
30 Neighbours n(atoms, 2.0f*cutOff);
31
32 for (uint64_t i : forAtoms)
33 {
34 auto nn = n.neighbours(atoms, atoms[forAtoms[i]].position, cutOff);
35 for (uint64_t j = 1; j < nn.size(); j++)
36 {
37 auto s = bonds[nn[j].first];
38 if (s.find(i) == s.cend())
39 {
40 bonds[i].insert(nn[j].first);
41 }
42 }
43 }
44 return bonds;
45}
46
47#endif /* BOND_H */
std::map< uint64_t, std::set< uint64_t > > determineBonds(std::vector< uint64_t > forAtoms, std::vector< Atom > &atoms, float cutOff)
Obtain bonds based on a fixed distance cutOff using Neighbours.
Definition bond.h:20
Calculate neighbour lists.
Definition neighbours.h:18
std::vector< std::pair< uint64_t, float > > neighbours(const std::vector< Atom > &atoms, glm::vec3 position, float cutoff, bool noDirect=false, bool nearestImage=true) const
Get the neighbours to a position within a cutoff using the spatial domains.
Definition neighbours.h:109