Changeset 644ba1 for molecuilder/src/builder.cpp
- Timestamp:
- Aug 18, 2008, 8:57:58 AM (17 years ago)
- Children:
- 04c868
- Parents:
- e6971b
- File:
-
- 1 edited
-
molecuilder/src/builder.cpp (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/builder.cpp
re6971b r644ba1 703 703 output.open(filename, ios::trunc); 704 704 } 705 if (mol->OutputXYZ(&output)) 706 cout << Verbose(0) << "Saving of XYZ file successful." << endl; 707 else 708 cout << Verbose(0) << "Saving of XYZ file failed." << endl; 705 if (mol->MDSteps <= 1) { 706 if (mol->OutputXYZ(&output)) 707 cout << Verbose(0) << "Saving of XYZ file successful." << endl; 708 else 709 cout << Verbose(0) << "Saving of XYZ file failed." << endl; 710 } else { 711 if (mol->OutputTrajectoriesXYZ(&output)) 712 cout << Verbose(0) << "Saving of XYZ file successful." << endl; 713 else 714 cout << Verbose(0) << "Saving of XYZ file failed." << endl; 715 } 709 716 output.close(); 710 717 output.clear(); … … 733 740 string line; 734 741 atom *first; 735 int ExitFlag = 0; 742 bool SaveFlag = false; 743 int ExitFlag = 1; 736 744 int j; 737 745 double volume = 0.; … … 758 766 cout << "\t-b x1 x2 x3\tCenter atoms in domain with given edge lengths of (x1,x2,x3)." << endl; 759 767 cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl; 768 cout << "\t-D <bond distance>\tDepth-First-Search Analysis of the molecule, giving cycles and tree/back edges." << endl; 760 769 cout << "\t-O\tCenter atoms in origin." << endl; 761 770 cout << "\t-d x1 x2 x3\tDuplicate cell along each axis by given factor." << endl; 762 771 cout << "\t-e <file>\tSets the databases path to be parsed (default: ./)." << endl; 763 cout << "\t-f/F <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config ." << endl;772 cout << "\t-f/F <dist> <order>\tFragments the molecule in BOSSANOVA manner (with/out rings compressed) and stores config files in same dir as config (return code 0 - fragmented, 2 - no fragmentation necessary)." << endl; 764 773 cout << "\t-h/-H/-?\tGive this help screen." << endl; 765 774 cout << "\t-m <0/1>\tCalculate (0)/ Align in(1) PAS with greatest EV along z axis." << endl; … … 767 776 cout << "\t-o\tGet volume of the convex envelope (and store to tecplot file)." << endl; 768 777 cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl; 769 cout << "\t-P <file> <delta_t>\tParse given forces file and append as an MD step with width delta_tto config file via Verlet." << endl;778 cout << "\t-P <file>\tParse given forces file and append as an MD step to config file via Verlet." << endl; 770 779 cout << "\t-r\t\tConvert file from an old pcp syntax." << endl; 771 780 cout << "\t-t x1 x2 x3\tTranslate all atoms by this vector (x1,x2,x3)." << endl; … … 860 869 switch(argv[argptr-1][1]) { 861 870 case 'p': 862 ExitFlag = 1;871 SaveFlag = true; 863 872 cout << Verbose(1) << "Parsing xyz file for new atoms." << endl; 864 873 if (!mol->AddXYZFile(argv[argptr])) … … 875 884 if (config_present == present) { 876 885 switch(argv[argptr-1][1]) { 886 case 'D': 887 { 888 cout << Verbose(1) << "Depth-First-Search Analysis." << endl; 889 MoleculeLeafClass *Subgraphs = NULL; // list of subgraphs from DFS analysis 890 int *MinimumRingSize = NULL; 891 mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]), configuration.GetIsAngstroem()); 892 mol->CreateListOfBondsPerAtom((ofstream *)&cout); 893 Subgraphs = mol->DepthFirstSearchAnalysis((ofstream *)&cout, MinimumRingSize); 894 delete[](MinimumRingSize); 895 if (Subgraphs != NULL) { 896 while (Subgraphs->next != NULL) { 897 Subgraphs = Subgraphs->next; 898 delete(Subgraphs->previous); 899 } 900 delete(Subgraphs); 901 } 902 } 903 argptr+=1; 904 break; 877 905 case 'P': 878 ExitFlag = 1;906 SaveFlag = true; 879 907 cout << Verbose(1) << "Parsing forces file and Verlet integrating." << endl; 880 if (!mol->VerletForceIntegration(argv[argptr], atof(argv[argptr+1])))908 if (!mol->VerletForceIntegration(argv[argptr], configuration.Deltat, configuration.GetIsAngstroem())) 881 909 cout << Verbose(2) << "File not found." << endl; 882 910 else 883 911 cout << Verbose(2) << "File found and parsed." << endl; 884 argptr+= 2;912 argptr+=1; 885 913 break; 886 914 case 't': 887 ExitFlag = 1;915 SaveFlag = true; 888 916 cout << Verbose(1) << "Translating all ions to new origin." << endl; 889 917 for (int i=NDIM;i--;) … … 893 921 break; 894 922 case 'a': 895 ExitFlag = 1;923 SaveFlag = true; 896 924 cout << Verbose(1) << "Adding new atom with element " << argv[argptr] << " at (" << argv[argptr+1] << "," << argv[argptr+2] << "," << argv[argptr+3] << "), "; 897 925 first = new atom; … … 908 936 break; 909 937 case 's': 910 ExitFlag = 1;938 SaveFlag = true; 911 939 j = -1; 912 940 cout << Verbose(1) << "Scaling all ion positions by factor." << endl; … … 929 957 break; 930 958 case 'b': 931 ExitFlag = 1;959 SaveFlag = true; 932 960 j = -1; 933 961 cout << Verbose(1) << "Centering atoms in config file within given simulation box." << endl; … … 944 972 break; 945 973 case 'c': 946 ExitFlag = 1;974 SaveFlag = true; 947 975 j = -1; 948 976 cout << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl; … … 961 989 break; 962 990 case 'O': 963 ExitFlag = 1;991 SaveFlag = true; 964 992 cout << Verbose(1) << "Centering atoms in origin." << endl; 965 993 mol->CenterOrigin((ofstream *)&cout, &x); … … 967 995 break; 968 996 case 'r': 969 ExitFlag = 1;997 SaveFlag = true; 970 998 cout << Verbose(1) << "Converting config file from supposed old to new syntax." << endl; 971 999 break; 972 1000 case 'F': 973 1001 case 'f': 974 if (ExitFlag ==0) ExitFlag = 2; // only set if not already by other command line switch975 1002 cout << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl; 976 1003 if (argc >= argptr+2) { … … 980 1007 cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl; 981 1008 if (mol->first->next != mol->last) { 982 mol->FragmentMolecule((ofstream *)&cout, atoi(argv[argptr]), &configuration);1009 ExitFlag = mol->FragmentMolecule((ofstream *)&cout, atoi(argv[argptr]), &configuration); 983 1010 } 984 1011 end = clock(); … … 990 1017 break; 991 1018 case 'm': 992 ExitFlag = 1;993 1019 j = atoi(argv[argptr++]); 994 1020 if ((j<0) || (j>1)) { … … 996 1022 j = 0; 997 1023 } 998 if (j) 1024 if (j) { 1025 SaveFlag = true; 999 1026 cout << Verbose(0) << "Converting to prinicipal axis system." << endl; 1000 else1027 } else 1001 1028 cout << Verbose(0) << "Evaluating prinicipal axis." << endl; 1002 1029 mol->PrincipalAxisSystem((ofstream *)&cout, (bool)j); 1003 1030 break; 1004 1031 case 'o': 1005 ExitFlag = 1;1032 SaveFlag = true; 1006 1033 cout << Verbose(0) << "Evaluating volume of the convex envelope."; 1007 1034 VolumeOfConvexEnvelope((ofstream *)&cout, &configuration, NULL, mol); … … 1013 1040 { 1014 1041 double density; 1015 ExitFlag = 1;1042 SaveFlag = true; 1016 1043 cout << Verbose(0) << "Evaluating necessary cell volume for a cluster suspended in water."; 1017 1044 density = atof(argv[argptr++]); … … 1030 1057 break; 1031 1058 case 'd': 1059 SaveFlag = true; 1032 1060 for (int axis = 1; axis <= NDIM; axis++) { 1033 1061 int faktor = atoi(argv[argptr++]); … … 1089 1117 } else argptr++; 1090 1118 } while (argptr < argc); 1091 if ( ExitFlag == 1) // 1 means save and exit1119 if (SaveFlag) 1092 1120 SaveConfig(ConfigFileName, &configuration, periode, mol); 1093 if ( ExitFlag >= 1) { // 2 means just exit1121 if ((ExitFlag >= 1)) { 1094 1122 delete(mol); 1095 1123 delete(periode); 1096 return ( 1);1124 return (ExitFlag); 1097 1125 } 1098 1126 } else { // no arguments, hence scan the elements db
Note:
See TracChangeset
for help on using the changeset viewer.
