本文整理汇总了C++中Units::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ Units::getLength方法的具体用法?C++ Units::getLength怎么用?C++ Units::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Units
的用法示例。
在下文中一共展示了Units::getLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void MDAtomsTyped<T>::setUnits(const Units& units,const Units& MDUnits){
double lscale=units.getLength()/MDUnits.getLength();
double escale=units.getEnergy()/MDUnits.getEnergy();
// scalep and scaleb are used to convert MD to plumed
scalep=1.0/lscale;
scaleb=1.0/lscale;
// scalef and scalev are used to convert plumed to MD
scalef=escale/lscale;
scalev=escale;
}
示例2: if
ContourFindingBase::ContourFindingBase(const ActionOptions&ao):
Action(ao),
ActionWithInputGrid(ao),
mymin(this),
mydata(NULL)
{
if( ingrid->noDerivatives() ) error("cannot find contours if input grid has no derivatives");
parse("CONTOUR",contour);
log.printf(" calculating dividing surface along which function equals %f \n", contour);
if( keywords.exists("FILE") ){
std::string file; parse("FILE",file);
if(file.length()==0 && keywords.style("FILE","compulsory") ) error("name out output file was not specified");
else if( file.length()>0 ){
std::string type=Tools::extension(file);
log<<" file name "<<file<<"\n";
if(type!="xyz") error("can only print xyz file type with contour finding");
fmt_xyz="%f";
std::string precision; parse("PRECISION",precision);
if(precision.length()>0){
int p; Tools::convert(precision,p);
log<<" with precision "<<p<<"\n";
std::string a,b;
Tools::convert(p+5,a);
Tools::convert(p,b);
fmt_xyz="%"+a+"."+b+"f";
}
std::string unitname; parse("UNITS",unitname);
if(unitname!="PLUMED"){
Units myunit; myunit.setLength(unitname);
lenunit=plumed.getAtoms().getUnits().getLength()/myunit.getLength();
}
else lenunit=1.0;
of.link(*this); of.open(file);
// Now create a store data vessel to hold the points
mydata=buildDataStashes( NULL );
}
}
}
示例3: dumpforces
//.........这里部分代码省略.........
pbc_cli_given=true;
vector<string> words=Tools::getWords(pbc_cli_list,",");
if(words.size()==3){
for(int i=0;i<3;i++) sscanf(words[i].c_str(),"%100lf",&(pbc_cli_box[4*i]));
} else if(words.size()==9) {
for(int i=0;i<9;i++) sscanf(words[i].c_str(),"%100lf",&(pbc_cli_box[i]));
} else {
string msg="ERROR: cannot parse command-line box "+pbc_cli_list;
fprintf(stderr,"%s\n",msg.c_str());
return 1;
}
}
}
if( debug_dd && debug_pd ) error("cannot use debug-dd and debug-pd at the same time");
if(debug_pd || debug_dd){
if( !Communicator::initialized() ) error("needs mpi for debug-pd");
}
Plumed p;
int rr=sizeof(real);
p.cmd("setRealPrecision",&rr);
int checknatoms=-1;
int step=0;
if(Communicator::initialized()){
if(multi){
if(intracomm.Get_rank()==0) p.cmd("GREX setMPIIntercomm",&intercomm.Get_comm());
p.cmd("GREX setMPIIntracomm",&intracomm.Get_comm());
p.cmd("GREX init");
}
p.cmd("setMPIComm",&intracomm.Get_comm());
}
p.cmd("setMDLengthUnits",&units.getLength());
p.cmd("setMDEngine","driver");
p.cmd("setTimestep",×tep);
p.cmd("setPlumedDat",plumedFile.c_str());
p.cmd("setLog",out);
if(multi){
string n;
Tools::convert(intercomm.Get_rank(),n);
trajectoryFile+="."+n;
}
FILE* fp=NULL; FILE* fp_forces=NULL;
if(!noatoms){
if (trajectoryFile=="-")
fp=in;
else {
fp=fopen(trajectoryFile.c_str(),"r");
if(!fp){
string msg="ERROR: Error opening XYZ file "+trajectoryFile;
fprintf(stderr,"%s\n",msg.c_str());
return 1;
}
}
if(dumpforces.length()>0){
if(Communicator::initialized() && pc.Get_size()>1){
string n;
Tools::convert(pc.Get_rank(),n);
dumpforces+="."+n;
}
fp_forces=fopen(dumpforces.c_str(),"w");
}