ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/io/Globals.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/io/Globals.cpp (file contents):
Revision 1490 by gezelter, Fri Sep 24 04:16:43 2004 UTC vs.
Revision 2101 by chrisfen, Thu Mar 10 15:10:24 2005 UTC

# Line 1 | Line 1
1 + /*
2 + * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3 + *
4 + * The University of Notre Dame grants you ("Licensee") a
5 + * non-exclusive, royalty free, license to use, modify and
6 + * redistribute this software in source and binary code form, provided
7 + * that the following conditions are met:
8 + *
9 + * 1. Acknowledgement of the program authors must be made in any
10 + *    publication of scientific results based in part on use of the
11 + *    program.  An acceptable form of acknowledgement is citation of
12 + *    the article in which the program was described (Matthew
13 + *    A. Meineke, Charles F. Vardeman II, Teng Lin, Christopher
14 + *    J. Fennell and J. Daniel Gezelter, "OOPSE: An Object-Oriented
15 + *    Parallel Simulation Engine for Molecular Dynamics,"
16 + *    J. Comput. Chem. 26, pp. 252-271 (2005))
17 + *
18 + * 2. Redistributions of source code must retain the above copyright
19 + *    notice, this list of conditions and the following disclaimer.
20 + *
21 + * 3. Redistributions in binary form must reproduce the above copyright
22 + *    notice, this list of conditions and the following disclaimer in the
23 + *    documentation and/or other materials provided with the
24 + *    distribution.
25 + *
26 + * This software is provided "AS IS," without a warranty of any
27 + * kind. All express or implied conditions, representations and
28 + * warranties, including any implied warranty of merchantability,
29 + * fitness for a particular purpose or non-infringement, are hereby
30 + * excluded.  The University of Notre Dame and its licensors shall not
31 + * be liable for any damages suffered by licensee as a result of
32 + * using, modifying or distributing the software or its
33 + * derivatives. In no event will the University of Notre Dame or its
34 + * licensors be liable for any lost revenue, profit or data, or for
35 + * direct, indirect, special, consequential, incidental or punitive
36 + * damages, however caused and regardless of the theory of liability,
37 + * arising out of the use of or inability to use software, even if the
38 + * University of Notre Dame has been advised of the possibility of
39 + * such damages.
40 + */
41 +
42   #include <stdlib.h>
43   #include <stdio.h>
44   #include <string.h>
45  
46 < #include "Globals.hpp"
47 < #include "simError.h"
46 > #include "io/Globals.hpp"
47 > #include "utils/simError.h"
48   #ifdef IS_MPI
49 < #include "mpiBASS.h"
49 > #include "io/mpiBASS.h"
50   #endif // is_mpi
51  
52   /*
53   * The following section lists all of the defined tokens for the
54 < * gloabal assignment statements. All are prefixed with a G_ to avoid
54 > * global assignment statements. All are prefixed with a G_ to avoid
55   * stepping on any previously defined enumerations.
56   *
57   * NOTE: tokens start at 1, 0 is a resrved token number
# Line 71 | Line 112
112   #define G_THERM_INT_LAMBDA  50
113   #define G_THERM_INT_K       51
114   #define G_FORCEFIELD_VARIANT 52
115 + #define G_FORCEFIELD_FILENAME 53
116 + #define G_THERM_INT_DIST_SPRING  54
117 + #define G_THERM_INT_THETA_SPRING 55
118 + #define G_THERM_INT_OMEGA_SPRING 56
119  
120   Globals::Globals(){
121    initalize();
# Line 155 | Line 200 | void Globals::initalize(){
200    addHash( "thermodynamicIntegrationLambda",       G_THERM_INT_LAMBDA);
201    addHash( "thermodynamicIntegrationK",            G_THERM_INT_K);
202    addHash( "forceFieldVariant",                    G_FORCEFIELD_VARIANT);
203 +  addHash( "forceFieldFileName",                   G_FORCEFIELD_FILENAME);
204 +  addHash( "thermIntDistSpringConst",              G_THERM_INT_DIST_SPRING);
205 +  addHash( "thermIntThetaSpringConst",             G_THERM_INT_THETA_SPRING);
206 +  addHash( "thermIntOmegaSpringConst",             G_THERM_INT_OMEGA_SPRING);
207  
208    strcpy( mixingRule,"standard");  //default mixing rules to standard.
209    usePBC = 1; //default  periodic boundry conditions to on
# Line 212 | Line 261 | void Globals::initalize(){
261    have_thermodynamic_integration_lambda = 0;
262    have_thermodynamic_integration_k = 0;
263    have_forcefield_variant = 0;
264 <
264 >  have_forcefield_filename = 0;
265 >  have_dist_spring_constant =  0;
266 >  have_theta_spring_constant = 0;
267 >  have_omega_spring_constant = 0;
268   }
269  
270   int Globals::newComponent( event* the_event ){
# Line 1389 | Line 1441 | int Globals::globalAssign( event* the_event ){
1441  
1442        case STRING:
1443          the_event->err_msg =
1444 <          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not a double or int.\n" );
1444 >          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not an int.\n" );
1445          return 1;
1446          break;
1447          
1448        case DOUBLE:
1449 <        minimizer_writefrq= the_event->evt.asmt.rhs.dval;
1450 <        have_minimizer_writefrq = 1;
1449 >        the_event->err_msg =
1450 >          strdup( "Error in parsing meta-data file!\n\tminimizer_writefrq is not an  int.\n" );
1451          return 1;
1452          break;
1453          
# Line 1505 | Line 1557 | int Globals::globalAssign( event* the_event ){
1557  
1558        case STRING:
1559          the_event->err_msg =
1560 <          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not a double or int.\n" );
1560 >          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not an int.\n" );
1561          return 1;
1562          break;
1563          
1564        case DOUBLE:
1565 <        minimizer_ls_maxiteration = the_event->evt.asmt.rhs.dval;
1566 <        have_minimizer_ls_maxiteration = 1;
1565 >        the_event->err_msg =
1566 >          strdup( "Error in parsing meta-data file!\n\tminimizer_ls_maxiteration is not an int.\n" );
1567          return 1;
1568          break;
1569          
# Line 1681 | Line 1733 | int Globals::globalAssign( event* the_event ){
1733          return 0;
1734          break;
1735        }
1736 <      break;      
1736 >      break;  
1737 >  
1738      case G_FORCEFIELD_VARIANT:
1739        if( the_type == STRING ){
1740          strcpy( forcefield_variant, the_event->evt.asmt.rhs.sval );
# Line 1694 | Line 1747 | int Globals::globalAssign( event* the_event ){
1747        return 0;
1748        break;      
1749        // add more token cases here.      
1750 +
1751 +    case G_FORCEFIELD_FILENAME:
1752 +      if( the_type == STRING ){
1753 +        strcpy( forcefield_filename, the_event->evt.asmt.rhs.sval );
1754 +        have_forcefield_filename = 1;
1755 +        return 1;
1756 +      }
1757 +      
1758 +      the_event->err_msg =
1759 +        strdup( "Error in parsing meta-data file!\n\tforceFieldFileName was not a string assignment.\n" );
1760 +      return 0;
1761 +      break;      
1762 +
1763 +    case G_THERM_INT_DIST_SPRING:
1764 +      switch( the_type ){
1765 +        
1766 +      case STRING:
1767 +        the_event->err_msg =
1768 +          strdup( "Error in parsing meta-data file!\n\tthermIntDistSpringConst is not a double or int.\n" );
1769 +        return 1;
1770 +        break;
1771 +        
1772 +      case DOUBLE:
1773 +        therm_int_dist_spring = the_event->evt.asmt.rhs.dval;
1774 +        have_dist_spring_constant = 1;
1775 +        return 1;
1776 +        break;
1777 +        
1778 +      case INT:
1779 +        therm_int_dist_spring = (double)the_event->evt.asmt.rhs.dval;
1780 +        have_dist_spring_constant = 1;
1781 +        return 1;
1782 +        break;
1783 +        
1784 +      default:
1785 +        the_event->err_msg =
1786 +          strdup( "Error in parsing meta-data file!\n\tthermIntDistSpringConst unrecognized.\n" );
1787 +        return 0;
1788 +        break;
1789 +      }
1790 +      break;  
1791 +
1792 +    case G_THERM_INT_THETA_SPRING:
1793 +      switch( the_type ){
1794 +        
1795 +      case STRING:
1796 +        the_event->err_msg =
1797 +          strdup( "Error in parsing meta-data file!\n\tthermIntThetaSpringConst is not a double or int.\n" );
1798 +        return 1;
1799 +        break;
1800 +        
1801 +      case DOUBLE:
1802 +        therm_int_theta_spring = the_event->evt.asmt.rhs.dval;
1803 +        have_theta_spring_constant = 1;
1804 +        return 1;
1805 +        break;
1806 +        
1807 +      case INT:
1808 +        therm_int_theta_spring = (double)the_event->evt.asmt.rhs.dval;
1809 +        have_theta_spring_constant = 1;
1810 +        return 1;
1811 +        break;
1812 +        
1813 +      default:
1814 +        the_event->err_msg =
1815 +          strdup( "Error in parsing meta-data file!\n\tthermIntThetaSpringConst unrecognized.\n" );
1816 +        return 0;
1817 +        break;
1818 +      }
1819 +      break;
1820 +
1821 +       case G_THERM_INT_OMEGA_SPRING:
1822 +      switch( the_type ){
1823 +        
1824 +      case STRING:
1825 +        the_event->err_msg =
1826 +          strdup( "Error in parsing meta-data file!\n\tthermIntOmegaSpringConst is not a double or int.\n" );
1827 +        return 1;
1828 +        break;
1829 +        
1830 +      case DOUBLE:
1831 +        therm_int_omega_spring = the_event->evt.asmt.rhs.dval;
1832 +        have_omega_spring_constant = 1;
1833 +        return 1;
1834 +        break;
1835 +        
1836 +      case INT:
1837 +        therm_int_omega_spring = (double)the_event->evt.asmt.rhs.dval;
1838 +        have_omega_spring_constant = 1;
1839 +        return 1;
1840 +        break;
1841 +        
1842 +      default:
1843 +        the_event->err_msg =
1844 +          strdup( "Error in parsing meta-data file!\n\tthermIntOmegaSpringConst unrecognized.\n" );
1845 +        return 0;
1846 +        break;
1847 +      }
1848 +      break;  
1849 +      // add more token cases here.      
1850      }
1851    }
1852    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines