Changeset 477bb2
- Timestamp:
- Jan 2, 2010, 3:49:40 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:
- 6b932c7
- Parents:
- 096214
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/menu.cpp
r096214 r477bb2 900 900 901 901 void oldmenu::createNewMolecule(periodentafel *periode,MoleculeListClass *molecules) { 902 molecule *mol = NULL; 903 mol = new molecule(periode); 904 molecules->insert(mol); 902 molecules->createNewMolecule(periode); 905 903 }; 906 904 907 905 void oldmenu::loadFromXYZ(periodentafel *periode,MoleculeListClass *molecules){ 908 molecule *mol = NULL; 909 Vector center; 910 char filename[MAXSTRINGSIZE]; 911 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 912 mol = new molecule(periode); 913 do { 914 Log() << Verbose(0) << "Enter file name: "; 915 cin >> filename; 916 } while (!mol->AddXYZFile(filename)); 917 mol->SetNameFromFilename(filename); 918 // center at set box dimensions 919 mol->CenterEdge(¢er); 920 mol->cell_size[0] = center.x[0]; 921 mol->cell_size[1] = 0; 922 mol->cell_size[2] = center.x[1]; 923 mol->cell_size[3] = 0; 924 mol->cell_size[4] = 0; 925 mol->cell_size[5] = center.x[2]; 926 molecules->insert(mol); 906 molecules->loadFromXYZ(periode); 927 907 } 928 908 929 909 void oldmenu::changeName(MoleculeListClass *molecules){ 930 char filename[MAXSTRINGSIZE]; 931 molecule *mol = NULL; 932 int nr; 933 do { 934 Log() << Verbose(0) << "Enter index of molecule: "; 935 cin >> nr; 936 mol = molecules->ReturnIndex(nr); 937 } while (mol == NULL); 938 Log() << Verbose(0) << "Enter name: "; 939 cin >> filename; 940 strcpy(mol->name, filename); 910 molecules->changeName(); 941 911 } 942 912 943 913 void oldmenu::setMoleculeFilename(MoleculeListClass *molecules) { 944 char filename[MAXSTRINGSIZE]; 945 int nr; 946 molecule *mol = NULL; 947 do { 948 Log() << Verbose(0) << "Enter index of molecule: "; 949 cin >> nr; 950 mol = molecules->ReturnIndex(nr); 951 } while (mol == NULL); 952 Log() << Verbose(0) << "Enter name: "; 953 cin >> filename; 954 mol->SetNameFromFilename(filename); 914 molecules->setMoleculeFilename(); 955 915 } 956 916 957 917 void oldmenu::parseXYZIntoMolecule(MoleculeListClass *molecules){ 958 char filename[MAXSTRINGSIZE]; 959 int nr; 960 molecule *mol = NULL; 961 mol = NULL; 962 do { 963 Log() << Verbose(0) << "Enter index of molecule: "; 964 cin >> nr; 965 mol = molecules->ReturnIndex(nr); 966 } while (mol == NULL); 967 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 968 do { 969 Log() << Verbose(0) << "Enter file name: "; 970 cin >> filename; 971 } while (!mol->AddXYZFile(filename)); 972 mol->SetNameFromFilename(filename); 918 molecules->parseXYZIntoMolecule(); 973 919 }; 974 920 975 921 void oldmenu::eraseMolecule(MoleculeListClass *molecules){ 976 int nr; 977 molecule *mol = NULL; 978 Log() << Verbose(0) << "Enter index of molecule: "; 979 cin >> nr; 980 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 981 if (nr == (*ListRunner)->IndexNr) { 982 mol = *ListRunner; 983 molecules->ListOfMolecules.erase(ListRunner); 984 delete(mol); 985 break; 986 } 922 molecules->eraseMolecule(); 987 923 }; 988 924 -
src/molecule.hpp
r096214 r477bb2 327 327 int CountAllAtoms() const; 328 328 329 // Methods moved here from the menus 330 // TODO: more refactoring needed on these methods 329 331 void flipChosen(); 332 void createNewMolecule(periodentafel *periode); 333 void loadFromXYZ(periodentafel *periode); 334 void changeName(); 335 void setMoleculeFilename(); 336 void parseXYZIntoMolecule(); 337 void eraseMolecule(); 338 330 339 331 340 // merging of molecules -
src/moleculelist.cpp
r096214 r477bb2 838 838 } 839 839 840 /*********** 841 * Methods Moved here from the menus 842 */ 840 843 841 844 void MoleculeListClass::flipChosen() { … … 847 850 (*ListRunner)->ActiveFlag = !(*ListRunner)->ActiveFlag; 848 851 } 852 853 void MoleculeListClass::createNewMolecule(periodentafel *periode) { 854 molecule *mol = NULL; 855 mol = new molecule(periode); 856 insert(mol); 857 }; 858 859 void MoleculeListClass::loadFromXYZ(periodentafel *periode){ 860 molecule *mol = NULL; 861 Vector center; 862 char filename[MAXSTRINGSIZE]; 863 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 864 mol = new molecule(periode); 865 do { 866 Log() << Verbose(0) << "Enter file name: "; 867 cin >> filename; 868 } while (!mol->AddXYZFile(filename)); 869 mol->SetNameFromFilename(filename); 870 // center at set box dimensions 871 mol->CenterEdge(¢er); 872 mol->cell_size[0] = center.x[0]; 873 mol->cell_size[1] = 0; 874 mol->cell_size[2] = center.x[1]; 875 mol->cell_size[3] = 0; 876 mol->cell_size[4] = 0; 877 mol->cell_size[5] = center.x[2]; 878 insert(mol); 879 } 880 881 void MoleculeListClass::changeName(){ 882 char filename[MAXSTRINGSIZE]; 883 molecule *mol = NULL; 884 int nr; 885 do { 886 Log() << Verbose(0) << "Enter index of molecule: "; 887 cin >> nr; 888 mol = ReturnIndex(nr); 889 } while (mol == NULL); 890 Log() << Verbose(0) << "Enter name: "; 891 cin >> filename; 892 strcpy(mol->name, filename); 893 } 894 895 void MoleculeListClass::setMoleculeFilename() { 896 char filename[MAXSTRINGSIZE]; 897 int nr; 898 molecule *mol = NULL; 899 do { 900 Log() << Verbose(0) << "Enter index of molecule: "; 901 cin >> nr; 902 mol = ReturnIndex(nr); 903 } while (mol == NULL); 904 Log() << Verbose(0) << "Enter name: "; 905 cin >> filename; 906 mol->SetNameFromFilename(filename); 907 } 908 909 void MoleculeListClass::parseXYZIntoMolecule(){ 910 char filename[MAXSTRINGSIZE]; 911 int nr; 912 molecule *mol = NULL; 913 mol = NULL; 914 do { 915 Log() << Verbose(0) << "Enter index of molecule: "; 916 cin >> nr; 917 mol = ReturnIndex(nr); 918 } while (mol == NULL); 919 Log() << Verbose(0) << "Format should be XYZ with: ShorthandOfElement\tX\tY\tZ" << endl; 920 do { 921 Log() << Verbose(0) << "Enter file name: "; 922 cin >> filename; 923 } while (!mol->AddXYZFile(filename)); 924 mol->SetNameFromFilename(filename); 925 }; 926 927 void MoleculeListClass::eraseMolecule(){ 928 int nr; 929 molecule *mol = NULL; 930 Log() << Verbose(0) << "Enter index of molecule: "; 931 cin >> nr; 932 for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) 933 if (nr == (*ListRunner)->IndexNr) { 934 mol = *ListRunner; 935 ListOfMolecules.erase(ListRunner); 936 delete(mol); 937 break; 938 } 939 }; 849 940 850 941
Note:
See TracChangeset
for help on using the changeset viewer.