Beispiel #1
0
// Find forcefield by name
Forcefield* Aten::findForcefield(QString name) const
{
	Messenger::enter("Aten::findForcefield");
	Forcefield* ff;
	for (ff = forcefields_.first(); ff != NULL; ff = ff->next) if (name == ff->name()) break;
	if (ff == NULL) Messenger::print("Forcefield '%s' is not loaded.", qPrintable(name));
	Messenger::exit("Aten::findForcefield");
	return ff;
}
Beispiel #2
0
// Return first forcefield atom type matching supplied name
ForcefieldAtom* ElementMap::forcefieldAtom(QString name)
{
	ForcefieldAtom* ffa;

	for (Forcefield* ff = aten_->forcefields(); ff != NULL; ff = ff->next)
	{
		ffa = ff->findType(name);
		if (ffa != NULL) return ffa;
	}
	return NULL;
}
Beispiel #3
0
// Convert string from fftype to element number
int ElementMap::ffToZ(const char* s) const
{
	ForcefieldAtom* ffa;
	int result = -1;
	for (Forcefield* ff = duq.forcefields(); ff != NULL; ff = ff->next)
	{
		ffa = ff->findType(s);
		// Found a match, so find out what element it is...
		if (ffa != NULL) result = ffa->neta()->characterElement();
		if (result != -1) break;
	}
	return result;
}
Beispiel #4
0
ATEN_USING_NAMESPACE

// Add Forcefield
Forcefield* Aten::addForcefield(QString name)
{
	Forcefield* newFF = forcefields_.add();
	if (name != NULL) newFF->setName(name);

	// Set this new forcefield to be the current one
	setCurrentForcefield(newFF);

	return current_.ff;
}
Beispiel #5
0
// Convert string from fftype to element number
int ElementMap::ffToZ(QString s)
{
	if (!aten_) return -1;
	ForcefieldAtom* ffa;
	int result = -1;
	for (Forcefield* ff = aten_->forcefields(); ff != NULL; ff = ff->next)
	{
		ffa = ff->findType(s);
		// Found a match, so find out what element it is...
		if (ffa != NULL) result = ffa->neta()->characterElement();
		if (result != -1) break;
	}
	return result;
}
Beispiel #6
0
// Load forcefield
Forcefield* Aten::loadForcefield(QString ffFile)
{
	Messenger::enter("Aten::loadForcefield");

	// Try some different locations to find the supplied forcefield.
	QString filename;
	QFileInfo fileInfo;
	bool result;
	Forcefield* newff = forcefields_.add();

	// First try - actual / absolute path
	fileInfo.setFile(ffFile);
	Messenger::print(Messenger::Verbose, "Looking for forcefield in absolute path (%s)...", qPrintable(ffFile));
	if (fileInfo.exists()) result = newff->load(ffFile);
	else
	{
		// Second try - aten.dataDir/ff
		filename = dataDirectoryFile("ff/"+ffFile);
		fileInfo.setFile(filename);
		Messenger::print(Messenger::Verbose, "Looking for forcefield in installed location (%s)...", qPrintable(filename));
		if (fileInfo.exists()) result = newff->load(filename);
		else
		{
			// Last try - user home datadir/ff
			filename = atenDirectoryFile("ff/"+ffFile);
			fileInfo.setFile(filename);
			Messenger::print(Messenger::Verbose, "Looking for forcefield in user's data directory (%s)...", qPrintable(filename));
			if (fileInfo.exists()) result = newff->load(filename);
			else
			{
				Messenger::print("Can't find forcefield file '%s' in any location.", qPrintable(ffFile));
				result = false;
			}
		}
	}
	if (result) setCurrentForcefield(newff);
	else
	{
		Messenger::print("Couldn't load forcefield file '%s'.", qPrintable(ffFile));
		forcefields_.remove(newff);
		newff = NULL;
	}
	Messenger::exit("Aten::loadForcefield");
	return newff;
}
Beispiel #7
0
// Close window (accepted)
void AtenPrefs::on_PrefsOkButton_clicked(bool checked)
{
	// Recalculate forcefield energy terms if the glboal energy unit was changed
	if (prefsBackup_.energyUnit() != prefs.energyUnit()) for (Forcefield* ff = parent_.aten().forcefields(); ff != NULL; ff = ff->next) ff->convertParameters();

	updateAfterViewPrefs();

	accept();
}
Beispiel #8
0
void TestRefiner_FromStage2( int argc, char** argv)
{
	ASSERT( argc == 6, ArgumentException, "Give me traname, startres, length, branchCount\n" );

	std::string traFile( argv[1] );
	int startRes = atoi( argv[2] );
	int nRes = atoi( argv[3] );
	double dielec = atof( argv[4] );
	int execID = atoi( argv[5] );
	int endRes = startRes + nRes - 1;	
	std::string stem = traPathToStem( traFile, dielec ) + "_out";

	// set a standard random number seed for this test.
	Maths::FastRandom::getInstance()->reinitialise(100);

	std::string libPath = "./";

	// Load the replay InTra
	if( !IO::fileExists( traFile ) )
	{
		throw IOException("Cant find tra!");
	}

	// Load our anglsest
	Library::AngleSet as;
	as.loadFromFile(libPath + "big.loop.angleset");
	as.info();

	// Load our forcefield parameters
	FFParamSet ffps;
	ffps.readLib(libPath + "amber03aa.ff");

	Library::RotamerLibrary rotLib( ffps );
	//rotLib.readLib( libPath + "lib/rotlib/shetty.rotamer" );
	// Use the HIGH resolution lib for refinement
	rotLib.convertLib(libPath + "scl-B30-occ1.0-rmsd0.5-prop20.0", Library::RotLibConvert_Shetty() );
	//rotLib.convertLib(libPath + "scl-B30-occ1.0-rmsd0.2-prop20.0", Library::RotLibConvert_Shetty() );
	//rotLib.convertLib(libPath + "scl-B30-occ1.0-rmsd1.0-prop20.0", Library::RotLibConvert_Shetty() );
	//rotLib.writeLib( libPath + "shetty.rotamer" );

	// Load our tra
	System sys(ffps);
	IO::InTra_BTF traInput( traFile );
	traInput.loadIntoSystem( sys, -1 );

	// Make a full workspace from the imported system
	WorkSpace wspace( sys );
	wspace.info();
	RotBond replacement; // Must stay in scope for the lifetime of this wspace...
	wspace.setRotatableBondList( &replacement ); // Override the internal dummy rotbond array
	IO::OutTra_BTF& tra = wspace.addStdTra(stem); // tra
	IO::BTF_Block_Comment* cmnt = new IO::BTF_Block_Comment();
	tra.addOwnedBlock(cmnt);

	// Write what we have interpreted from the import file	
	PDB_Writer(stem + ".imported.pdb").write(wspace); // pdb

	// Forcefield config
	bool useBrokenBonded = true; // Flag the use of the bonded forcefield that allows bond breaks.
	Forcefield ffs = createffts(wspace,useBrokenBonded,false);
	Forcefield ff = createff(wspace,useBrokenBonded,dielec,false);

	SegmentDef def(wspace,startRes,endRes,SegBreakCentre);
	def.info();

	// Loop stitcher
	Protocol::ArcusReplay loopBuild(ffs,ff,as,rotLib,traInput);
	loopBuild.UpdateNList = 5;
	loopBuild.OutputLevel = Verbosity::Eleven; // I love that flag :-D
	loopBuild.enableComments( cmnt );
	loopBuild.buildAddExplicit( def ); // turn off auto-detection of what to build and explicitly define it

	// Override to split protocol ...
	ArcusRefine_CGMin minimisingRefiner;
	minimisingRefiner.OutputLevel = Verbosity::Normal;
	minimisingRefiner.enableRotamerPack( rotLib );
	minimisingRefiner.UpdateNList = 10;
	loopBuild.setRefiner( minimisingRefiner );

	Printf("All setup complete... Rolling the primary loop. Hold onto your hat!\n");

	int result = loopBuild.run();

	ff.calcEnergies();
	cmnt->setFormat("**Final Best** Structure According to FF! Ene: %8.3f, BB-cRMS: %8.3f, Heavy-cRMS: %8.3f\n")
		(wspace.ene.epot / (Physics::PhysicsConst::kcal2J / Physics::PhysicsConst::Na))
		(def.cCRMS_BB())
		(def.cCRMS_Heavy());
	cmnt->toScreen();
	wspace.outtra.append();

	Printf("Complete! :-D\n");

	return;
}