Пример #1
0
Big<amplitude_t> TwoBodyJastrowFactor::compute_jastrow (const PositionArguments &r) const
{
    BOOST_ASSERT(r.get_N_sites() == m_correlation_matrix.cols());

    real_t corr = 0;

    for (unsigned int species1 = 0; species1 < r.get_N_species(); ++species1) {
        for (unsigned int index1 = 0; index1 < r.get_N_filled(species1); ++index1) {
            const Particle particle1(index1, species1);
            unsigned int index2_start = index1 + 1;
            for (unsigned int species2 = species1; species2 < r.get_N_species(); ++species2) {
                for (unsigned int index2 = index2_start; index2 < r.get_N_filled(species2); ++index2) {
                    const Particle particle2(index2, species2);
                    corr += m_correlation_matrix(r[particle1], r[particle2]);
                }
                index2_start = 0;
            }
            // same-particle term, necessary for getting the on-site term correct
            corr += .5 * m_correlation_matrix(r[particle1], r[particle1]);
        }
    }

    // returns exp(-corr)
    return Big<amplitude_t>(1, -corr);
}
Пример #2
0
Big<AmplitudeType> NoDoubleOccupancyProjector<AmplitudeType>::compute_jastrow (const PositionArguments &r) const
{
    // FIXME: we should make this requirement more explicit to callers
    assert(r.get_N_species() == 2);

    for (unsigned int i = 0; i < r.get_N_filled(0); ++i) {
        if (r.is_occupied(r[Particle(i, 0)], 1))
            return Big<AmplitudeType>(0);
    }
    return Big<AmplitudeType>(1);
}
Пример #3
0
// this is a private utility method, called from both reinitialize_phibetas()
// and verify_phibetas()
void SwappedSystem::swap_positions (PositionArguments &r1, PositionArguments &r2) const
{
    assert(r1.get_N_species() == r2.get_N_species());
    assert(r1.get_N_species() == copy1_subsystem_indices.size());
    assert(r1.get_N_species() == copy2_subsystem_indices.size());

#ifndef NDEBUG
    assert(r1.get_N_species() == r2.get_N_species());
    for (unsigned int i = 0; i < r1.get_N_species(); ++i)
        assert(r1.get_N_filled(i) == r2.get_N_filled(i));
#endif

    bool some_particles_have_been_swapped = false;

    std::vector<std::vector<unsigned int> > v1, v2;

    for (unsigned int species = 0; species < r1.get_N_species(); ++species) {
        assert(copy1_subsystem_indices[species].size() == copy2_subsystem_indices[species].size());

        v1.push_back(r1.r_vector(species));
        v2.push_back(r2.r_vector(species));

        const unsigned int particles_to_swap = copy1_subsystem_indices[species].size();

        if (particles_to_swap == 0)
            continue;

        some_particles_have_been_swapped = true;

        for (unsigned int i = 0; i < particles_to_swap; ++i) {
            unsigned int i1 = copy1_subsystem_indices[species][i], i2 = copy2_subsystem_indices[species][i];
            // perform the swap
            unsigned int tmp_pos = v1[species][i1];
            v1[species][i1] = v2[species][i2];
            v2[species][i2] = tmp_pos;
        }

    }

    if (some_particles_have_been_swapped) {
        r1.reset(v1);
        r2.reset(v2);
    }
}