// Action_Grid::Init() Action::RetType Action_Grid::Init(ArgList& actionArgs, ActionInit& init, int debugIn) { debug_ = debugIn; nframes_ = 0; // Get output filename std::string filename = actionArgs.GetStringKey("out"); // Get grid options grid_ = GridInit( "GRID", actionArgs, init.DSL() ); if (grid_ == 0) return Action::ERR; # ifdef MPI if (ParallelGridInit(init.TrajComm(), grid_)) return Action::ERR; # endif // Get extra options max_ = actionArgs.getKeyDouble("max", 0.80); madura_ = actionArgs.getKeyDouble("madura", 0); smooth_ = actionArgs.getKeyDouble("smoothdensity", 0); invert_ = actionArgs.hasKey("invert"); pdbfile_ = init.DFL().AddCpptrajFile(actionArgs.GetStringKey("pdb"),"Grid PDB",DataFileList::PDB,true); density_ = actionArgs.getKeyDouble("density",0.033456); if (actionArgs.hasKey("normframe")) normalize_ = TO_FRAME; else if (actionArgs.hasKey("normdensity")) normalize_ = TO_DENSITY; else normalize_ = NONE; if (normalize_ != NONE && (smooth_ > 0.0 || madura_ > 0.0)) { mprinterr("Error: Normalize options are not compatible with smoothdensity/madura options.\n"); init.DSL().RemoveSet( grid_ ); return Action::ERR; } // Get mask std::string maskexpr = actionArgs.GetMaskNext(); if (maskexpr.empty()) { mprinterr("Error: GRID: No mask specified.\n"); init.DSL().RemoveSet( grid_ ); return Action::ERR; } mask_.SetMaskString(maskexpr); // Setup output file // For backwards compat., if no 'out' assume next string is filename if (filename.empty() && actionArgs.Nargs() > 1 && !actionArgs.Marked(1)) filename = actionArgs.GetStringNext(); DataFile* outfile = init.DFL().AddDataFile(filename, actionArgs); if (outfile != 0) outfile->AddDataSet((DataSet*)grid_); // Info mprintf(" GRID:\n"); GridInfo( *grid_ ); if (outfile != 0) mprintf("\tGrid will be printed to file %s\n", outfile->DataFilename().full()); mprintf("\tGrid data set: '%s'\n", grid_->legend()); mprintf("\tMask expression: [%s]\n",mask_.MaskString()); if (pdbfile_ != 0) mprintf("\tPseudo-PDB will be printed to %s\n", pdbfile_->Filename().full()); if (normalize_ == TO_FRAME) mprintf("\tGrid will be normalized by number of frames.\n"); else if (normalize_ == TO_DENSITY) mprintf("\tGrid will be normalized to a density of %g molecules/Ang^3.\n", density_); // TODO: print extra options return Action::OK; }
inline int GridInit( int bHandle, const AbstractDistMatrix<scalarType>& A ) { if( A.ColDist() != MC || A.RowDist() != MR ) LogicError ("Only (MC,MR) distributions are currently supported with ScaLAPACK"); const int context = GridInit ( bHandle, A.Grid().Order()==COLUMN_MAJOR, A.ColStride(), A.RowStride() ); DEBUG_ONLY( if( A.ColStride() != GridHeight(context) ) LogicError("Grid height did not match BLACS"); if( A.RowStride() != GridWidth(context) ) LogicError("Grid width did not match BLACS"); if( A.ColRank() != GridRow(context) ) LogicError("Grid row did not match BLACS"); if( A.RowRank() != GridCol(context) ) LogicError("Grid col did not match BLACS"); ) return context;
// Action_GridFreeEnergy::init() Action::RetType Action_GridFreeEnergy::Init(ArgList& actionArgs, ActionInit& init, int debugIn) { // Get output filename DataFile* outfile = init.DFL().AddDataFile(actionArgs.GetStringNext(), actionArgs); if (outfile == 0) { mprinterr("Error: GridFreeEnergy: no output filename specified.\n"); return Action::ERR; } // Get grid options (<nx> <dx> <ny> <dy> <nz> <dz> [box|origin] [negative]) grid_ = GridInit( "GridFreeEnergy", actionArgs, init.DSL() ); if (grid_ == 0) return Action::ERR; # ifdef MPI if (ParallelGridInit(init.TrajComm(), grid_)) return Action::ERR; # endif //grid_.PrintXplor( filename_, "", "REMARKS Change in Free energy from bulk solvent with bin normalisation of " + integerToString(currentLargestVoxelOccupancyCount) ); // Get mask std::string maskexpr = actionArgs.GetMaskNext(); if (maskexpr.empty()) { mprinterr("Error: GridFreeEnergy: No mask specified.\n"); init.DSL().RemoveSet( grid_ ); return Action::ERR; } mask_.SetMaskString(maskexpr); // Get extra args tempInKevin_ = actionArgs.getKeyDouble("temp", 293.0); outfile->AddDataSet( grid_ ); // Info mprintf("Warning: DNAIONTRACKER is experimental code!\n"); mprintf(" GridFreeEnergy\n"); GridInfo( *grid_ ); mprintf("\tGrid will be printed to file %s\n",outfile->DataFilename().full()); mprintf("\tMask expression: [%s]\n",mask_.MaskString()); mprintf("\tTemp is : %f K\n",tempInKevin_); // Allocate grid //if (GridAllocate()) return 1; return Action::OK; }
void Init(char *langs, char *dialects, int anamorph) { Starting = 1; GenOnAssert = 1; LexEntryOff = 0; SaveTime = 1; /* SaveTime = 1: no spell correction hashing or phrase derivation, * saves memory. * SaveTime = 0: uses more time and memory. */ qallocInit(); DbgInit(); DbgSet(DBGALL, DBGBAD); DbgSetStdoutLevel(DBGOK); NoticePrint(stderr); NoticePrint(Log); EnvInit(); StringInit(); RandomInit(); GridInit(); ObjInit(); ObjListInit(); DbInit(); ContextInit(); TsInit(); TsRangeInit(); LexEntryInit(); Lex_WordForm2Init(); MorphInit(anamorph); WordFormInit(); InferenceInit(); ReportInit(); CommentaryInit(); TranslateInit(); LearnInit(); StopAtInit(); TT_HTML_Init(); StdDiscourse = DiscourseCreate(langs, dialects); DiscourseSetLang(StdDiscourse, F_ENGLISH); Starting = 0; }