Skip to content

Commit

Permalink
Reformatted PrefsData (now Prefs) enums and associated methods. Remov…
Browse files Browse the repository at this point in the history
…ed QS_* enum (charge source) since it wasn't really doing anything. Changed spotlight component enums (SL_*) to represent generic GL lighting components.
  • Loading branch information
t.youngs committed Mar 27, 2008
1 parent 3d34682 commit 82ac767
Show file tree
Hide file tree
Showing 49 changed files with 676 additions and 709 deletions.
34 changes: 17 additions & 17 deletions src/base/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Cli cliSwitches[] = {
};

// Parse debug options
void MasterData::debugCli(int argc, char *argv[])
void Master::debugCli(int argc, char *argv[])
{
int n, o;
bool isShort, match;
Expand Down Expand Up @@ -154,13 +154,13 @@ void MasterData::debugCli(int argc, char *argv[])
}

// Parse all options
int MasterData::parseCli(int argc, char *argv[])
int Master::parseCli(int argc, char *argv[])
{
int argn, opt, ntried = 0, n, el;
bool isShort, match;
char *arg;
CommandList *cl;
ZmapType zm;
Prefs::ZmapType zm;
Refitem<const char,int> *ri;
Filter *f, *modelfilter = NULL;
// Cycle over program arguments and available CLI options (skip [0] which is the binary run)
Expand Down Expand Up @@ -194,20 +194,20 @@ int MasterData::parseCli(int argc, char *argv[])
break;
// Force bonding calculation of atoms on load
case (Cli::BondSwitch):
prefs.setBondOnLoad(PS_YES);
prefs.setBondOnLoad(Prefs::SwitchOn);
break;
// Set trajectory cache limit
case (Cli::CacheSwitch):
prefs.setCacheLimit(atoi(argv[++argn]));
break;
// Force model centering on load (for non-periodic systems)
case (Cli::CentreSwitch):
prefs.setCentreOnLoad(PS_YES);
prefs.setCentreOnLoad(Prefs::SwitchOn);
break;
// Read script commands from passed string
case (Cli::CommandSwitch):
cl = master.commands.add();
if (cl->cacheLine(argv[++argn])) master.setProgramMode(PM_COMMAND);
if (cl->cacheLine(argv[++argn])) master.setProgramMode(Master::CommandMode);
else
{
master.commands.remove(cl);
Expand All @@ -220,7 +220,7 @@ int MasterData::parseCli(int argc, char *argv[])
break;
// Force folding (MIM'ing) of atoms in periodic systems on load
case (Cli::FoldSwitch):
prefs.setFoldOnLoad(PS_YES);
prefs.setFoldOnLoad(Prefs::SwitchOn);
break;
// Set forced model load format
case (Cli::FormatSwitch):
Expand All @@ -240,7 +240,7 @@ int MasterData::parseCli(int argc, char *argv[])
break;
// Enter interactive mode
case (Cli::InteractiveSwitch):
master.setProgramMode(PM_INTERACTIVE);
master.setProgramMode(Master::InteractiveMode);
break;
// Set type mappings
case (Cli::MapSwitch):
Expand All @@ -257,28 +257,28 @@ int MasterData::parseCli(int argc, char *argv[])
break;
// Prohibit bonding calculation of atoms on load
case (Cli::NoBondSwitch):
prefs.setBondOnLoad(PS_NO);
prefs.setBondOnLoad(Prefs::SwitchOff);
break;
// Prohibit model centering on load (for non-periodic systems)
case (Cli::NoCentreSwitch):
prefs.setCentreOnLoad(PS_NO);
prefs.setCentreOnLoad(Prefs::SwitchOff);
break;
// Prohibit folding (MIM'ing) of atoms in periodic systems on load
case (Cli::NoFoldSwitch):
prefs.setFoldOnLoad(PS_NO);
prefs.setFoldOnLoad(Prefs::SwitchOff);
break;
// Force packing (application of symmetry operators) on load
case (Cli::NoPackSwitch):
prefs.setPackOnLoad(PS_NO);
prefs.setPackOnLoad(Prefs::SwitchOff);
break;
// Prohibit packing (application of symmetry operators) on load
case (Cli::PackSwitch):
prefs.setPackOnLoad(PS_YES);
prefs.setPackOnLoad(Prefs::SwitchOn);
break;
// Cache a script file
case (Cli::ScriptSwitch):
cl = master.scripts.add();
if (cl->load(argv[++argn])) master.setProgramMode(PM_COMMAND);
if (cl->load(argv[++argn])) master.setProgramMode(Master::CommandMode);
else
{
master.scripts.remove(cl);
Expand All @@ -291,8 +291,8 @@ int MasterData::parseCli(int argc, char *argv[])
break;
// Set the type of element (Z) mapping to use in name conversion
case (Cli::ZmapSwitch):
zm = ZM_from_text(argv[++argn]);
if (zm != ZM_NITEMS) prefs.setZmapType(zm);
zm = Prefs::zmapType(argv[++argn]);
if (zm != Prefs::nZmapTypes) prefs.setZmapType(zm);
break;
default:
printf("Unrecognised command-line option '%s'.\n",argv[argn]);
Expand Down Expand Up @@ -321,7 +321,7 @@ int MasterData::parseCli(int argc, char *argv[])
}

// Usage help
void MasterData::printUsage() const
void Master::printUsage() const
{
printf("Usage: aten [options] [<model> ...]\n");
printf("\nProgram Options:\n");
Expand Down
16 changes: 8 additions & 8 deletions src/base/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ int ElementMap::find(const char *query)
switch (prefs.zmapType())
{
// Automatic determination
case (ZM_AUTO):
case (Prefs::AutoZmap):
// First, try pure numeric conversion
result = numberToZ(query);
if (result != -1) break;
Expand All @@ -440,25 +440,25 @@ int ElementMap::find(const char *query)
result = ffToZ(query);
break;
// Name search
case (ZM_NAME):
case (Prefs::NameZmap):
result = nameToZ(query);
break;
// Search loaded forcefields for atom names
case (ZM_FORCEFIELD):
case (Prefs::ForcefieldZmap):
result = ffToZ(query);
// Attempt an alpha conversion if the FF conversion failed
if (result == -1) result = alphaToZ(query);
break;
// Convert based on alpha-part of atom name only
case (ZM_ALPHA):
case (Prefs::AlphaZmap):
result = alphaToZ(query);
break;
// Convert based on first alpha-part of atom name only
case (ZM_FIRSTALPHA):
case (Prefs::FirstAlphaZmap):
result = firstAlphaToZ(query);
break;
// Convert based on numeric part only
case (ZM_NUMERIC):
case (Prefs::NumericZmap):
result = numberToZ(query);
break;
}
Expand All @@ -467,10 +467,10 @@ int ElementMap::find(const char *query)
}

// Search for element named 'query' in the list of known elements, using the specified algorithm
int ElementMap::find(const char *query, ZmapType zmt)
int ElementMap::find(const char *query, Prefs::ZmapType zmt)
{
// Store the old zmapping type, and temporarily set a new one
ZmapType last = prefs.zmapType();
Prefs::ZmapType last = prefs.zmapType();
prefs.setZmapType(zmt);
int result = find(query);
prefs.setZmapType(last);
Expand Down
2 changes: 1 addition & 1 deletion src/base/elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ElementMap
// Return atomic number of element in string
int find(const char*);
// Return atomic number of element in string, specifying algorithm
int find(const char*, ZmapType);
int find(const char*, Prefs::ZmapType);
// Return number of defined elements
int nElements();

Expand Down
2 changes: 1 addition & 1 deletion src/base/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#define FVSX 0.83333333

// Define spacegroup generators in the master
Generator MasterData::generators[] = {
Generator Master::generators[] = {
{ "x,y,z", Mat3<double>( 1,0,0,0,1,0,0,0,1), Vec3<double>(0 ,0 ,0 ) },
{ "-x,-y,-z", Mat3<double>(-1,0,0,0,-1,0,0,0,-1), Vec3<double>(0 ,0 ,0 ) },
{ "-x,y,-z", Mat3<double>(-1,0,0,0,1,0,0,0,-1), Vec3<double>(0 ,0 ,0 ) },
Expand Down
Loading

0 comments on commit 82ac767

Please sign in to comment.