Ejemplo n.º 1
0
/*******************************************************************
 * 
 * NAME :               accept_new_position()  
 * 
 *
 * DESCRIPTION :        Updates old matrices with the new WF and inverse.
 * 
 */
void Slater::accept_new_position() {

    if (active_particle < N) {
        for (int i = 0; i < N; i++)
            Dp(i, active_particle) = Dp_new(i, active_particle);
        Dp_inv = Dp_inv_new;
    } else {
        for (int i = 0; i < N; i++)
            Dm(i, active_particle - N) = Dm_new(i, active_particle - N);
        Dm_inv = Dm_inv_new;
    }
}
Ejemplo n.º 2
0
// transverse comoving distance and vectorizations
static PyObject*
PyCosmoObject_Dm(struct PyCosmoObject* self, PyObject* args) {
    double zmin, zmax;
    double d;

    if (!PyArg_ParseTuple(args, (char*)"dd", &zmin, &zmax)) {
        return NULL;
    }

    d = Dm(self->cosmo, zmin, zmax);
    return PyFloat_FromDouble(d);

}
Mat3d ReducedStVKCubatureForceModel::computeElasticDmInv(const double *reference_pos) const
{
    //reference_pos is 12x1 vector
	Mat3d Dm(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
	for(int i=0;i<3;++i)
	{
        for(int j=0;j<3;++j)
            Dm[j][i]=reference_pos[3*i+j]-reference_pos[9+j];
    	// Dm[i][1]=reference_pos[3+i]-reference_pos[9+i];
    	// Dm[i][2]=reference_pos[6+i]-reference_pos[9+i];
	}
	Mat3d DmInv=inv(Dm);
	return DmInv;
}
Ejemplo n.º 4
0
/*******************************************************************
 * 
 * NAME :               init(); 
 * 
 *
 * DESCRIPTION :        Initializes the Slater matrix with position 
 *                      values.
 * 
 */
void Slater::init() {

    // Updating the whole matrix.
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            Dp(j, i) = orbital->evaluate(r_new.row(i), nx(j), ny(j));
            Dm(j, i) = orbital->evaluate(r_new.row(i + N), nx(j), ny(j));
        }
    }
    Dp_new = Dp;
    Dm_new = Dm;

    // Calulating the inverse using Armadillo.
    Dp_inv = inv(Dp).t();
    Dm_inv = inv(Dm).t();

    Dp_inv_new = Dp_inv;
    Dm_inv_new = Dm_inv;
}
Mat3d ReducedStVKCubatureForceModel::computeDmInv(const int &ele) const
{//3x3
	int *global_idx=new int[4];
	Vec3d *vert_pos=new Vec3d[4];
	for(int j=0;j<4;++j)
	{
		global_idx[j]=volumetric_mesh_->getVertexIndex(ele,j);
		vert_pos[j]=*volumetric_mesh_->getVertex(global_idx[j]);
	}
	Mat3d Dm(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0);
	for(int i=0;i<3;++i)
	{
		Dm[i][0]=vert_pos[0][i]-vert_pos[3][i];
		Dm[i][1]=vert_pos[1][i]-vert_pos[3][i];
		Dm[i][2]=vert_pos[2][i]-vert_pos[3][i];
	}
	Mat3d DmInv=inv(Dm);
	delete[] global_idx;
	delete[] vert_pos;
	return DmInv;
}
Ejemplo n.º 6
0
static PyObject*
PyCosmoObject_Dm_vec2(struct PyCosmoObject* self, PyObject* args) {
    PyObject* zmaxObj=NULL, *resObj=NULL;;
    double zmin, *zmax, *res;
    npy_intp n, i;

    if (!PyArg_ParseTuple(args, (char*)"dO", &zmin, &zmaxObj)) {
        return NULL;
    }

    n = PyArray_SIZE(zmaxObj);
    zmax = (double* )PyArray_DATA(zmaxObj);

    resObj = PyArray_ZEROS(1, &n, NPY_FLOAT64, 0);
    res = (double* )PyArray_DATA(resObj);

    for (i=0; i<n; i++) {
        res[i] = Dm(self->cosmo, zmin, zmax[i]); 
    }

    return resObj;
}