QMCPACK / QMCPACK/qmcpack

SPOSet API cannot allow modification of underlying SplineInst

Open
#3,980 3 comments 0 reactions 0 assignees View on GitHub
discussion enhancement
Dominant language
C++
Stars
403
Forks
154
Avg merge
1d 12h
Merged PRs (30d)
82

Description

**Describe the bug**
BSplineSet.makeClone() -> SplineR2R Copy Constructor copies SplineInst shared ptr
Then later we call an SPOSet method that modifies SplineInst such as applyRotation. This actually modifies the state of all SPOSets in a clone group.

So if I have the reasonable looking:
```
for (auto& twf : walkers.getTwfs()) {
twf.getSPOSet("electrons").applyRotation(some_rotation)
}
```
If all those twfs were made by cloning the golden wavefunction
Then all the SPOSets get rotated by number of clones * some_rotation.

You would need to know explicitly which SPOSets are backed by which SplineInst and call just one for each SplineInst. This is a terrible break of encapsulation.

This is a significant design issue. I think it stems from either
1. applyRotation is in the wrong interface. There needs to be an interface at the "SPOBasis" level and there needs to be 1 handle to that per group of clones.
2. spline coefficients should be pulled up into the SplineX2X level

This really depends on how the optimization algorithm doing the rotation is intended to work.

**To Reproduce**
Need a reproducer.

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.