Changeset 820a42
- Timestamp:
- Jan 5, 2010, 10:11:52 AM (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:
- 3e026a
- Parents:
- 235bed
- Location:
- src
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Makefile.am
r235bed r820a42 5 5 ANALYSISHEADER = analysis_bonds.hpp analysis_correlation.hpp 6 6 7 ACTIONSSOURCE = Actions/Action.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp 8 ACTIONSHEADER = Actions/Action.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp 7 ACTIONSSOURCE = Actions/Action.cpp Actions/MethodAction.cpp Actions/ActionSequence.cpp Actions/MakroAction.cpp Actions/ErrorAction.cpp 8 ACTIONSHEADER = Actions/Action.hpp Actions/MethodAction.hpp Actions/ActionSequence.hpp Actions/MakroAction.hpp Actions/ErrorAction.hpp 9 9 10 10 VIEWSOURCE = Views/View.cpp Views/StringView.cpp Views/MethodStringView.cpp Views/StreamStringView.cpp -
src/menu.cpp
r235bed r820a42 740 740 }; 741 741 742 void oldmenu::duplicateCell(MoleculeListClass *molecules, config *configuration) { 743 molecule *mol = NULL; 744 int axis,faktor,count,j; 745 atom *first = NULL; 746 element **Elements; 747 Vector x,y; 748 Vector **vectors; 749 750 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 751 if ((*ListRunner)->ActiveFlag) { 752 mol = *ListRunner; 753 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 754 Log() << Verbose(0) << "State the axis [(+-)123]: "; 755 cin >> axis; 756 Log() << Verbose(0) << "State the factor: "; 757 cin >> faktor; 758 759 mol->CountAtoms(); // recount atoms 760 if (mol->AtomCount != 0) { // if there is more than none 761 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 762 Elements = new element *[count]; 763 vectors = new Vector *[count]; 764 j = 0; 765 first = mol->start; 766 while (first->next != mol->end) { // make a list of all atoms with coordinates and element 767 first = first->next; 768 Elements[j] = first->type; 769 vectors[j] = &first->x; 770 j++; 771 } 772 if (count != j) 773 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 774 x.Zero(); 775 y.Zero(); 776 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 777 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 778 x.AddVector(&y); // per factor one cell width further 779 for (int k=count;k--;) { // go through every atom of the original cell 780 first = new atom(); // create a new body 781 first->x.CopyVector(vectors[k]); // use coordinate of original atom 782 first->x.AddVector(&x); // translate the coordinates 783 first->type = Elements[k]; // insert original element 784 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 785 } 786 } 787 if (mol->first->next != mol->last) // if connect matrix is present already, redo it 788 mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 789 // free memory 790 delete[](Elements); 791 delete[](vectors); 792 // correct cell size 793 if (axis < 0) { // if sign was negative, we have to translate everything 794 x.Zero(); 795 x.AddVector(&y); 796 x.Scale(-(faktor-1)); 797 mol->Translate(&x); 798 } 799 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 800 } 801 } 802 } 803 742 804 /** Submenu for manipulating molecules. 743 805 * \param *periode periodentafel … … 777 839 778 840 case 'd': // duplicate the periodic cell along a given axis, given times 779 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 780 if ((*ListRunner)->ActiveFlag) { 781 mol = *ListRunner; 782 Log() << Verbose(0) << "Current molecule is: " << mol->IndexNr << "\t" << mol->name << endl; 783 Log() << Verbose(0) << "State the axis [(+-)123]: "; 784 cin >> axis; 785 Log() << Verbose(0) << "State the factor: "; 786 cin >> faktor; 787 788 mol->CountAtoms(); // recount atoms 789 if (mol->AtomCount != 0) { // if there is more than none 790 count = mol->AtomCount; // is changed becausing of adding, thus has to be stored away beforehand 791 Elements = new element *[count]; 792 vectors = new Vector *[count]; 793 j = 0; 794 first = mol->start; 795 while (first->next != mol->end) { // make a list of all atoms with coordinates and element 796 first = first->next; 797 Elements[j] = first->type; 798 vectors[j] = &first->x; 799 j++; 800 } 801 if (count != j) 802 eLog() << Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl; 803 x.Zero(); 804 y.Zero(); 805 y.x[abs(axis)-1] = mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude 806 for (int i=1;i<faktor;i++) { // then add this list with respective translation factor times 807 x.AddVector(&y); // per factor one cell width further 808 for (int k=count;k--;) { // go through every atom of the original cell 809 first = new atom(); // create a new body 810 first->x.CopyVector(vectors[k]); // use coordinate of original atom 811 first->x.AddVector(&x); // translate the coordinates 812 first->type = Elements[k]; // insert original element 813 mol->AddAtom(first); // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...) 814 } 815 } 816 if (mol->first->next != mol->last) // if connect matrix is present already, redo it 817 mol->CreateAdjacencyList(mol->BondDistance, configuration->GetIsAngstroem(), &BondGraph::CovalentMinMaxDistance, NULL); 818 // free memory 819 delete[](Elements); 820 delete[](vectors); 821 // correct cell size 822 if (axis < 0) { // if sign was negative, we have to translate everything 823 x.Zero(); 824 x.AddVector(&y); 825 x.Scale(-(faktor-1)); 826 mol->Translate(&x); 827 } 828 mol->cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor; 829 } 830 } 841 duplicateCell(molecules, configuration); 831 842 break; 832 843 … … 899 910 900 911 912 void oldmenu::SimpleAddMolecules(MoleculeListClass *molecules) { 913 int src, dest; 914 molecule *srcmol = NULL, *destmol = NULL; 915 { 916 do { 917 Log() << Verbose(0) << "Enter index of destination molecule: "; 918 cin >> dest; 919 destmol = molecules->ReturnIndex(dest); 920 } while ((destmol == NULL) && (dest != -1)); 921 do { 922 Log() << Verbose(0) << "Enter index of source molecule to add from: "; 923 cin >> src; 924 srcmol = molecules->ReturnIndex(src); 925 } while ((srcmol == NULL) && (src != -1)); 926 if ((src != -1) && (dest != -1)) 927 molecules->SimpleAdd(srcmol, destmol); 928 } 929 } 930 931 void oldmenu::embeddMolecules(MoleculeListClass *molecules) { 932 int src, dest; 933 molecule *srcmol = NULL, *destmol = NULL; 934 do { 935 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): "; 936 cin >> src; 937 srcmol = molecules->ReturnIndex(src); 938 } while ((srcmol == NULL) && (src != -1)); 939 do { 940 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): "; 941 cin >> dest; 942 destmol = molecules->ReturnIndex(dest); 943 } while ((destmol == NULL) && (dest != -1)); 944 if ((src != -1) && (dest != -1)) 945 molecules->EmbedMerge(destmol, srcmol); 946 } 947 948 void oldmenu::multiMergeMolecules(MoleculeListClass *molecules) { 949 int nr; 950 molecule *mol = NULL; 951 do { 952 Log() << Verbose(0) << "Enter index of molecule to merge into: "; 953 cin >> nr; 954 mol = molecules->ReturnIndex(nr); 955 } while ((mol == NULL) && (nr != -1)); 956 if (nr != -1) { 957 int N = molecules->ListOfMolecules.size()-1; 958 int *src = new int(N); 959 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 960 if ((*ListRunner)->IndexNr != nr) 961 src[N++] = (*ListRunner)->IndexNr; 962 molecules->SimpleMultiMerge(mol, src, N); 963 delete[](src); 964 } 965 } 966 967 void oldmenu::simpleMergeMolecules(MoleculeListClass *molecules) { 968 int src, dest; 969 molecule *srcmol = NULL, *destmol = NULL; 970 { 971 do { 972 Log() << Verbose(0) << "Enter index of destination molecule: "; 973 cin >> dest; 974 destmol = molecules->ReturnIndex(dest); 975 } while ((destmol == NULL) && (dest != -1)); 976 do { 977 Log() << Verbose(0) << "Enter index of source molecule to merge into: "; 978 cin >> src; 979 srcmol = molecules->ReturnIndex(src); 980 } while ((srcmol == NULL) && (src != -1)); 981 if ((src != -1) && (dest != -1)) 982 molecules->SimpleMerge(srcmol, destmol); 983 } 984 } 985 901 986 /** Submenu for merging molecules. 902 987 * \param *periode periodentafel … … 924 1009 925 1010 case 'a': 926 { 927 int src, dest; 928 molecule *srcmol = NULL, *destmol = NULL; 929 { 930 do { 931 Log() << Verbose(0) << "Enter index of destination molecule: "; 932 cin >> dest; 933 destmol = molecules->ReturnIndex(dest); 934 } while ((destmol == NULL) && (dest != -1)); 935 do { 936 Log() << Verbose(0) << "Enter index of source molecule to add from: "; 937 cin >> src; 938 srcmol = molecules->ReturnIndex(src); 939 } while ((srcmol == NULL) && (src != -1)); 940 if ((src != -1) && (dest != -1)) 941 molecules->SimpleAdd(srcmol, destmol); 942 } 943 } 1011 SimpleAddMolecules(molecules); 944 1012 break; 945 1013 946 1014 case 'e': 947 { 948 int src, dest; 949 molecule *srcmol = NULL, *destmol = NULL; 950 do { 951 Log() << Verbose(0) << "Enter index of matrix molecule (the variable one): "; 952 cin >> src; 953 srcmol = molecules->ReturnIndex(src); 954 } while ((srcmol == NULL) && (src != -1)); 955 do { 956 Log() << Verbose(0) << "Enter index of molecule to merge into (the fixed one): "; 957 cin >> dest; 958 destmol = molecules->ReturnIndex(dest); 959 } while ((destmol == NULL) && (dest != -1)); 960 if ((src != -1) && (dest != -1)) 961 molecules->EmbedMerge(destmol, srcmol); 962 } 1015 embeddMolecules(molecules); 963 1016 break; 964 1017 965 1018 case 'm': 966 { 967 int nr; 968 molecule *mol = NULL; 969 do { 970 Log() << Verbose(0) << "Enter index of molecule to merge into: "; 971 cin >> nr; 972 mol = molecules->ReturnIndex(nr); 973 } while ((mol == NULL) && (nr != -1)); 974 if (nr != -1) { 975 int N = molecules->ListOfMolecules.size()-1; 976 int *src = new int(N); 977 for(MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 978 if ((*ListRunner)->IndexNr != nr) 979 src[N++] = (*ListRunner)->IndexNr; 980 molecules->SimpleMultiMerge(mol, src, N); 981 delete[](src); 982 } 983 } 1019 multiMergeMolecules(molecules); 984 1020 break; 985 1021 … … 989 1025 990 1026 case 't': 991 { 992 int src, dest; 993 molecule *srcmol = NULL, *destmol = NULL; 994 { 995 do { 996 Log() << Verbose(0) << "Enter index of destination molecule: "; 997 cin >> dest; 998 destmol = molecules->ReturnIndex(dest); 999 } while ((destmol == NULL) && (dest != -1)); 1000 do { 1001 Log() << Verbose(0) << "Enter index of source molecule to merge into: "; 1002 cin >> src; 1003 srcmol = molecules->ReturnIndex(src); 1004 } while ((srcmol == NULL) && (src != -1)); 1005 if ((src != -1) && (dest != -1)) 1006 molecules->SimpleMerge(srcmol, destmol); 1007 } 1008 } 1027 simpleMergeMolecules(molecules); 1009 1028 break; 1010 1029 } -
src/menu.hpp
r235bed r820a42 25 25 void perform(MoleculeListClass *, config *, periodentafel *, char *); 26 26 27 // methods taken from ManipulateMoleculse submenu 28 void duplicateCell(MoleculeListClass *molecules, config *configuration); 29 30 // methods taken from MergeMolecules submenu 31 void SimpleAddMolecules(MoleculeListClass *molecules); 32 void embeddMolecules(MoleculeListClass *molecules); 33 void multiMergeMolecules(MoleculeListClass *molecules); 34 void simpleMergeMolecules(MoleculeListClass *molecules); 35 27 36 protected: 28 37 void AddAtoms(periodentafel *, molecule *);
Note:
See TracChangeset
for help on using the changeset viewer.