ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/branches/development/src/io/Globals.cpp
(Generate patch)

Comparing trunk/src/io/Globals.cpp (file contents):
Revision 580 by chrisfen, Tue Aug 30 18:23:50 2005 UTC vs.
Revision 598 by chrisfen, Thu Sep 15 00:14:35 2005 UTC

# Line 117 | Line 117
117   #define G_THERM_INT_THETA_SPRING 55
118   #define G_THERM_INT_OMEGA_SPRING 56
119   #define G_SURFACETENSION 57
120 < #define G_PRINTPREESURETENSOR   58
121 < #define G_USE_UNDAMPED_WOLF 59
122 < #define G_USE_DAMPED_WOLF   60
120 > #define G_PRINTPRESSURETENSOR   58
121 > #define G_COULOMBIC_CORRECTION  59
122 > #define G_DAMPING_ALPHA     60
123 > #define G_CUTOFFPOLICY      61
124  
125   Globals::Globals(){
126    initalize();
# Line 195 | Line 196 | void Globals::initalize(){
196    command_table.insert(CommandMapType::value_type("thermIntThetaSpringConst", G_THERM_INT_THETA_SPRING));
197    command_table.insert(CommandMapType::value_type("thermIntOmegaSpringConst", G_THERM_INT_OMEGA_SPRING));
198    command_table.insert(CommandMapType::value_type("surfaceTension", G_SURFACETENSION));
199 <  command_table.insert(CommandMapType::value_type("printPressureTensor", G_PRINTPREESURETENSOR));
200 <  command_table.insert(CommandMapType::value_type("useUndampedWolf", G_USE_UNDAMPED_WOLF));
201 <  command_table.insert(CommandMapType::value_type("useDampedWolf", G_USE_DAMPED_WOLF));
199 >  command_table.insert(CommandMapType::value_type("printPressureTensor", G_PRINTPRESSURETENSOR));
200 >  command_table.insert(CommandMapType::value_type("coulombicCorrection", G_COULOMBIC_CORRECTION));
201 >  command_table.insert(CommandMapType::value_type("dampingAlpha", G_DAMPING_ALPHA));
202 >  command_table.insert(CommandMapType::value_type("cutoffPolicy", G_CUTOFFPOLICY));
203  
204    strcpy( mixingRule,"standard");  //default mixing rules to standard.
205    usePBC = 1; //default  periodic boundry conditions to on
# Line 207 | Line 209 | void Globals::initalize(){
209    orthoBoxTolerance = 1E-6;
210    useSolidThermInt = 0; // default solid-state thermodynamic integration to off
211    useLiquidThermInt = 0; // default liquid thermodynamic integration to off
212 +  dampingAlpha = 1.5; // default damping parameter in Wolf Electrostatics
213  
214    have_force_field =  0;
215    have_n_components = 0;
# Line 261 | Line 264 | void Globals::initalize(){
264    have_omega_spring_constant = 0;
265    have_surface_tension = 0;
266    have_print_pressure_tensor = 0;
267 +  have_coulombic_correction = 0;
268 +  have_damping_alpha = 0;
269 +  have_cutoff_policy = 0;
270   }
271  
272   int Globals::newComponent( event* the_event ){
# Line 1877 | Line 1883 | int Globals::globalAssign( event* the_event ){
1883          }
1884          break;
1885  
1886 <    case G_PRINTPREESURETENSOR:
1887 <          if( the_type == STRING ){
1886 >    case G_PRINTPRESSURETENSOR:
1887 >      if( the_type == STRING ){
1888          
1889          if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) {
1890              have_print_pressure_tensor= 1;
# Line 1899 | Line 1905 | int Globals::globalAssign( event* the_event ){
1905            return 0;
1906            break;
1907  
1908 <    case G_USE_UNDAMPED_WOLF:
1909 <      if( the_type == STRING ){
1910 <        
1911 <        if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useUndampedWolf = 1;
1912 <        else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useUndampedWolf = 0;
1913 <        else{
1914 <          the_event->err_msg =
1915 <          strdup( "Error in parsing meta-data file!\n\tuseUndampedWolf was not \"true\" or \"false\".\n" );
1916 <          return 0;
1917 <        }
1918 <        return 1;
1908 >    case G_COULOMBIC_CORRECTION:
1909 >      switch( the_type ){
1910 >        
1911 >      case STRING:
1912 >        strcpy(coulombicCorrection, the_event->evt.asmt.rhs.sval);
1913 >
1914 >        for(int i = 0; coulombicCorrection[i] != '\0'; i++)
1915 >          {
1916 >            coulombicCorrection[i] = toupper(coulombicCorrection[i]);
1917 >          }
1918 >        have_coulombic_correction = 1;
1919 >        return 1;
1920 >        break;
1921 >        
1922 >      case DOUBLE:
1923 >        the_event->err_msg =
1924 >          strdup( "Error in parsing meta-data file!\n\tcoulombicCorrection should be a string!\n" );
1925 >        return 0;
1926 >        break;
1927 >        
1928 >      case INT:
1929 >        the_event->err_msg =
1930 >          strdup( "Error in parsing meta-data file!\n\tcoulombicCorrection should be a string!\n" );
1931 >        return 0;
1932 >        break;
1933 >        
1934 >      default:
1935 >        the_event->err_msg =
1936 >          strdup( "Error in parsing meta-data file!\n\tcoulombicCorrection unrecognized.\n" );
1937 >        return 0;
1938 >        break;
1939        }
1914      
1915      the_event->err_msg =
1916      strdup( "Error in parsing meta-data file!\n\tuseUndampedWolf was not \"true\" or \"false\".\n" );
1917      return 0;
1940        break;
1941 <      
1942 <    case G_USE_DAMPED_WOLF:
1943 <      if( the_type == STRING ){
1941 >
1942 >    case G_DAMPING_ALPHA:
1943 >      switch( the_type ){
1944 >        
1945 >      case STRING:
1946 >        the_event->err_msg =
1947 >          strdup( "Error in parsing meta-data file!\n\tdampingAlpha is not a double or int.\n" );
1948 >        return 1;
1949 >        break;
1950          
1951 <        if( !strcasecmp( "true", the_event->evt.asmt.rhs.sval )) useDampedWolf = 1;
1952 <        else if( !strcasecmp( "false", the_event->evt.asmt.rhs.sval )) useDampedWolf = 0;
1953 <        else{
1926 <          the_event->err_msg =
1927 <          strdup( "Error in parsing meta-data file!\n\tuseDampedWolf was not \"true\" or \"false\".\n" );
1928 <          return 0;
1929 <        }
1951 >      case DOUBLE:
1952 >        dampingAlpha = the_event->evt.asmt.rhs.dval;
1953 >        have_damping_alpha = 1;
1954          return 1;
1955 +        break;
1956 +        
1957 +      case INT:
1958 +        dampingAlpha = (double)the_event->evt.asmt.rhs.dval;
1959 +        have_damping_alpha = 1;
1960 +        return 1;
1961 +        break;
1962 +        
1963 +      default:
1964 +        the_event->err_msg =
1965 +          strdup( "Error in parsing meta-data file!\n\tdampingAlpha unrecognized.\n" );
1966 +        return 0;
1967 +        break;
1968        }
1969 <      
1970 <      the_event->err_msg =
1971 <      strdup( "Error in parsing meta-data file!\n\tuseDampedWolf was not \"true\" or \"false\".\n" );
1972 <      return 0;
1969 >      break;  
1970 >
1971 >    case G_CUTOFFPOLICY:
1972 >      switch( the_type ){
1973 >        
1974 >      case STRING:
1975 >        strcpy(cutoffPolicy, the_event->evt.asmt.rhs.sval);
1976 >
1977 >        for(int i = 0; cutoffPolicy[i] != '\0'; i++)
1978 >          {
1979 >            cutoffPolicy[i] = toupper(cutoffPolicy[i]);
1980 >          }
1981 >        have_cutoff_policy = 1;
1982 >        return 1;
1983 >        break;
1984 >        
1985 >      case DOUBLE:
1986 >        the_event->err_msg =
1987 >          strdup( "Error in parsing meta-data file!\n\tcutoffPolicy should be a string!\n" );
1988 >        return 0;
1989 >        break;
1990 >        
1991 >      case INT:
1992 >        the_event->err_msg =
1993 >          strdup( "Error in parsing meta-data file!\n\tcutoffPolicy should be a string!\n" );
1994 >        return 0;
1995 >        break;
1996 >        
1997 >      default:
1998 >        the_event->err_msg =
1999 >          strdup( "Error in parsing meta-data file!\n\tcutoffPolicy unrecognized.\n" );
2000 >        return 0;
2001 >        break;
2002 >      }
2003        break;
2004 +
2005        
1938      
2006        // add more token cases here.      
2007      }
2008    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines