update src
This commit is contained in:
parent
ab973decfd
commit
ab541ac981
@ -48,28 +48,10 @@ void magtet::init_site(std::string para)
|
|||||||
double xmin, xmax, ymin, ymax, z;
|
double xmin, xmax, ymin, ymax, z;
|
||||||
int xsize, ysize;
|
int xsize, ysize;
|
||||||
gctl::utility::parse_string_to_value(para, '/', xmin, xmax, ymin, ymax, z, xsize, ysize);
|
gctl::utility::parse_string_to_value(para, '/', xmin, xmax, ymin, ymax, z, xsize, ysize);
|
||||||
|
gctl::gridspace(gctl::point3dc(xmin, 0.0, 0.5*z), gctl::point3dc(xmax, 0.0, 0.5*z),
|
||||||
|
gctl::point3dc(0.0, ymin, 0.5*z), gctl::point3dc(0.0, ymax, 0.5*z), xsize, ysize, site_);
|
||||||
|
|
||||||
if (xsize <= 0 || ysize <= 0)
|
site_num_ = site_.size();
|
||||||
{
|
|
||||||
throw gctl::invalid_argument("Invalid site size. From magtet::init_site(...)");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<double> xs, ys;
|
|
||||||
gctl::linespace(xmin, xmax, xsize, xs);
|
|
||||||
gctl::linespace(ymin, ymax, ysize, ys);
|
|
||||||
|
|
||||||
site_num_ = xsize*ysize;
|
|
||||||
site_.resize(site_num_);
|
|
||||||
for (int i = 0; i < ysize; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < xsize; ++j)
|
|
||||||
{
|
|
||||||
site_[i*xsize + j].set(xs[j], ys[i], z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gctl::destroy_vector(xs);
|
|
||||||
gctl::destroy_vector(ys);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user