QMCPACK / QMCPACK/qmcpack

SingleParticlePos gets used as synonym for three vector.

Open
#3,674 2 comments 0 reactions 1 assignee Claimed by @PDoakORNL View on GitHub
Dominant language
C++
Stars
403
Forks
154
Avg merge
1d 12h
Merged PRs (30d)
82

Description

**Is your feature request related to a problem? Please describe.**
This leads to type aliases that add cognitive load rather than reduce it.
The smell is actually bigger than this but this is a low level "confusor"

ex:
collected from far too many separate headers.
```c++
using ParticleLayout_t = CrystalLattice;
typedef TinyVector SingleParticlePos_t;
typedef ParticleLayout_t::SingleParticlePos_t SingleParticlePos_t;

template>
class ParticleAttrib : public Vector, public OhmmsObject
{...};

typedef ParticleAttrib ParticlePos_t;

typedef ParticleSet::ParticlePos_t Force_t;
```

**Describe the solution you'd like**
type aliases shouldn't be a chore to unroll and they shouldn't obfuscate or reuse types that incidentally evaluate to the same low level type.
```
template
using ThreeVec = TinyVector;

using Forces = std::vector>;
// or probably better
using Forces = std::vector>;
```

PatricleAttribute should not be used unless necessary, which looks like it should be never. The address calls should be marked deprecated and certainly the units look to be incorrect for forces. It might be useful (although not as the code is currently written) to have a vector of vector values with units but I think that would be better enforced through types at the three vec level at compile time.

I.e. ThreeVector traits for three vector basis isBasisLattice isBasisCartesian.

**Describe alternatives you've considered**

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.