-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed wfn_constraint -> alpha_constraint and made appropriate changes
- Loading branch information
David Williams-Young
committed
Sep 13, 2023
1 parent
3bbd61b
commit e224338
Showing
5 changed files
with
144 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#pragma once | ||
|
||
#include <macis/wfn/raw_bitset.hpp> | ||
namespace macis { | ||
|
||
template <typename WfnTraits> | ||
class alpha_constraint { | ||
|
||
public: | ||
using wfn_traits = WfnTraits; | ||
using wfn_type = typename WfnTraits::wfn_type; | ||
using spin_wfn_type = spin_wfn_t<wfn_type>; | ||
using spin_wfn_traits = wavefunction_traits<spin_wfn_type>; | ||
using constraint_type = spin_wfn_type; | ||
|
||
private: | ||
constraint_type C_; | ||
constraint_type B_; | ||
uint32_t C_min_; | ||
uint32_t count_; | ||
|
||
public: | ||
|
||
alpha_constraint(constraint_type C, constraint_type B, uint32_t C_min) : | ||
C_(C), B_(B), C_min_(C_min), count_(spin_wfn_traits::count(C)) {} | ||
|
||
alpha_constraint(const alpha_constraint&) = default; | ||
alpha_constraint& operator=(const alpha_constraint&) = default; | ||
|
||
alpha_constraint(alpha_constraint&& other) noexcept = default; | ||
alpha_constraint& operator=(alpha_constraint&&) noexcept = default; | ||
|
||
|
||
inline auto C() const { return C_; } | ||
inline auto B() const { return B_; } | ||
inline auto C_min() const { return C_min_; } | ||
inline auto count() const { return count_; } | ||
|
||
|
||
inline spin_wfn_type c_mask_union(spin_wfn_type state) const { | ||
return state & C_; | ||
} | ||
inline spin_wfn_type b_mask_union(spin_wfn_type state) const { | ||
return state & B_; | ||
} | ||
|
||
inline spin_wfn_type symmetric_difference(spin_wfn_type state) const { | ||
return state ^ C_; | ||
} | ||
inline spin_wfn_type symmetric_difference(wfn_type state) const { | ||
return symmetric_difference(wfn_traits::alpha_string(state)); | ||
} | ||
|
||
template <typename WfnType> | ||
inline auto overlap(WfnType state) const { | ||
return spin_wfn_traits::count(c_mask_union(state)); | ||
} | ||
|
||
template <typename WfnType> | ||
inline bool satisfies_constraint(WfnType state) const { | ||
return overlap(state) == count_ and | ||
spin_wfn_traits::count(symmetric_difference(state) >> C_min_) == 0; | ||
} | ||
|
||
|
||
|
||
}; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.