Changeset 1020f0
- Timestamp:
- Dec 29, 2009, 12:56:55 PM (15 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 7c6f73
- Parents:
- 8f113e
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/menu.cpp
r8f113e r1020f0 898 898 899 899 900 void oldmenu::createNewMolecule(periodentafel *periode,MoleculeListClass *molecules) { 901 molecule *mol = NULL; 902 mol = new molecule(periode); 903 molecules->insert(mol); 904 }; 905 906 void oldmenu::loadFromXYZ(periodentafel *periode,MoleculeListClass *molecules){ 907 molecule *mol = NULL; 908 Vector center; 909 char filename[MAXSTRINGSIZE]; 910 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 911 mol = new molecule(periode); 912 do { 913 Log() << Verbose(0) << "Enter file name: "; 914 cin >> filename; 915 } while (!mol->AddXYZFile(filename)); 916 mol->SetNameFromFilename(filename); 917 // center at set box dimensions 918 mol->CenterEdge(¢er); 919 mol->cell_size[0] = center.x[0]; 920 mol->cell_size[1] = 0; 921 mol->cell_size[2] = center.x[1]; 922 mol->cell_size[3] = 0; 923 mol->cell_size[4] = 0; 924 mol->cell_size[5] = center.x[2]; 925 molecules->insert(mol); 926 } 927 928 void oldmenu::changeName(MoleculeListClass *molecules){ 929 char filename[MAXSTRINGSIZE]; 930 molecule *mol = NULL; 931 int nr; 932 do { 933 Log() << Verbose(0) << "Enter index of molecule: "; 934 cin >> nr; 935 mol = molecules->ReturnIndex(nr); 936 } while (mol == NULL); 937 Log() << Verbose(0) << "Enter name: "; 938 cin >> filename; 939 strcpy(mol->name, filename); 940 } 941 942 void oldmenu::setMoleculeFilename(MoleculeListClass *molecules) { 943 char filename[MAXSTRINGSIZE]; 944 int nr; 945 molecule *mol = NULL; 946 do { 947 Log() << Verbose(0) << "Enter index of molecule: "; 948 cin >> nr; 949 mol = molecules->ReturnIndex(nr); 950 } while (mol == NULL); 951 Log() << Verbose(0) << "Enter name: "; 952 cin >> filename; 953 mol->SetNameFromFilename(filename); 954 } 955 956 void oldmenu::parseXYZIntoMolecule(MoleculeListClass *molecules){ 957 char filename[MAXSTRINGSIZE]; 958 int nr; 959 molecule *mol = NULL; 960 mol = NULL; 961 do { 962 Log() << Verbose(0) << "Enter index of molecule: "; 963 cin >> nr; 964 mol = molecules->ReturnIndex(nr); 965 } while (mol == NULL); 966 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 967 do { 968 Log() << Verbose(0) << "Enter file name: "; 969 cin >> filename; 970 } while (!mol->AddXYZFile(filename)); 971 mol->SetNameFromFilename(filename); 972 }; 973 974 void oldmenu::eraseMolecule(MoleculeListClass *molecules){ 975 int nr; 976 molecule *mol = NULL; 977 Log() << Verbose(0) << "Enter index of molecule: "; 978 cin >> nr; 979 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 980 if (nr == (*ListRunner)->IndexNr) { 981 mol = *ListRunner; 982 molecules->ListOfMolecules.erase(ListRunner); 983 delete(mol); 984 break; 985 } 986 }; 987 988 900 989 /** Submenu for creating new molecules. 901 990 * \param *periode periodentafel … … 905 994 { 906 995 char choice; // menu choice char 907 Vector center;908 int nr, count;909 molecule *mol = NULL;910 996 911 997 Log() << Verbose(0) << "==========EDIT MOLECULES=====================" << endl; … … 926 1012 break; 927 1013 case 'c': 928 mol = new molecule(periode); 929 molecules->insert(mol); 1014 createNewMolecule(periode,molecules); 930 1015 break; 931 1016 932 1017 case 'l': // load from XYZ file 933 { 934 char filename[MAXSTRINGSIZE]; 935 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 936 mol = new molecule(periode); 937 do { 938 Log() << Verbose(0) << "Enter file name: "; 939 cin >> filename; 940 } while (!mol->AddXYZFile(filename)); 941 mol->SetNameFromFilename(filename); 942 // center at set box dimensions 943 mol->CenterEdge(¢er); 944 mol->cell_size[0] = center.x[0]; 945 mol->cell_size[1] = 0; 946 mol->cell_size[2] = center.x[1]; 947 mol->cell_size[3] = 0; 948 mol->cell_size[4] = 0; 949 mol->cell_size[5] = center.x[2]; 950 molecules->insert(mol); 951 } 1018 loadFromXYZ(periode,molecules); 952 1019 break; 953 1020 954 1021 case 'n': 955 { 956 char filename[MAXSTRINGSIZE]; 957 do { 958 Log() << Verbose(0) << "Enter index of molecule: "; 959 cin >> nr; 960 mol = molecules->ReturnIndex(nr); 961 } while (mol == NULL); 962 Log() << Verbose(0) << "Enter name: "; 963 cin >> filename; 964 strcpy(mol->name, filename); 965 } 1022 changeName(molecules); 966 1023 break; 967 1024 968 1025 case 'N': 969 { 970 char filename[MAXSTRINGSIZE]; 971 do { 972 Log() << Verbose(0) << "Enter index of molecule: "; 973 cin >> nr; 974 mol = molecules->ReturnIndex(nr); 975 } while (mol == NULL); 976 Log() << Verbose(0) << "Enter name: "; 977 cin >> filename; 978 mol->SetNameFromFilename(filename); 979 } 1026 setMoleculeFilename(molecules); 980 1027 break; 981 1028 982 1029 case 'p': // parse XYZ file 983 { 984 char filename[MAXSTRINGSIZE]; 985 mol = NULL; 986 do { 987 Log() << Verbose(0) << "Enter index of molecule: "; 988 cin >> nr; 989 mol = molecules->ReturnIndex(nr); 990 } while (mol == NULL); 991 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 992 do { 993 Log() << Verbose(0) << "Enter file name: "; 994 cin >> filename; 995 } while (!mol->AddXYZFile(filename)); 996 mol->SetNameFromFilename(filename); 997 } 1030 parseXYZIntoMolecule(molecules); 998 1031 break; 999 1032 1000 1033 case 'r': 1001 Log() << Verbose(0) << "Enter index of molecule: "; 1002 cin >> nr; 1003 count = 1; 1004 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1005 if (nr == (*ListRunner)->IndexNr) { 1006 mol = *ListRunner; 1007 molecules->ListOfMolecules.erase(ListRunner); 1008 delete(mol); 1009 break; 1010 } 1034 eraseMolecule(molecules); 1011 1035 break; 1012 1036 } -
src/menu.hpp
r8f113e r1020f0 26 26 void SaveConfig(char *, config *, periodentafel *, MoleculeListClass *); 27 27 28 // Methods extracted from EditMolecules. Probably to be moved to moleculeListClass 29 void createNewMolecule(periodentafel *periode,MoleculeListClass *molecules); 30 void loadFromXYZ(periodentafel *periode,MoleculeListClass *molecules); 31 void changeName(MoleculeListClass *molecules); 32 void setMoleculeFilename(MoleculeListClass *molecules); 33 void parseXYZIntoMolecule(MoleculeListClass *molecules); 34 void eraseMolecule(MoleculeListClass *molecules); 35 28 36 protected: 29 37 void AddAtoms(periodentafel *, molecule *);
Note:
See TracChangeset
for help on using the changeset viewer.