Changeset eee966
- Timestamp:
- Aug 28, 2010, 6:08:52 AM (14 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:
- ef3640e
- Parents:
- a42054
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Makefile.am
ra42054 reee966 91 91 MoleculeAction/CopyAction.cpp \ 92 92 MoleculeAction/FillWithMoleculeAction.cpp \ 93 MoleculeAction/FillVoidWithMoleculeAction.cpp \ 93 94 MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \ 94 95 MoleculeAction/RotateAroundSelfByAngleAction.cpp \ … … 104 105 MoleculeAction/CopyAction.hpp \ 105 106 MoleculeAction/FillWithMoleculeAction.hpp \ 107 MoleculeAction/FillVoidWithMoleculeAction.hpp \ 106 108 MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \ 107 109 MoleculeAction/RotateAroundSelfByAngleAction.hpp \ -
src/Actions/MapOfActions.cpp
ra42054 reee966 71 71 #include "Actions/MoleculeAction/CopyAction.hpp" 72 72 #include "Actions/MoleculeAction/FillWithMoleculeAction.hpp" 73 #include "Actions/MoleculeAction/FillVoidWithMoleculeAction.hpp" 73 74 #include "Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp" 74 75 #include "Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp" … … 221 222 DescriptionMap["element-db"] = "setting the path where the element databases can be found"; 222 223 DescriptionMap["fastparsing"] = "setting whether trajectories shall be parsed completely (n) or just first step (y)"; 223 DescriptionMap["fill-molecule"] = "fill empty space of box with a filler molecule"; 224 DescriptionMap["fill-molecule"] = "fill around molecules' surface with a filler molecule"; 225 DescriptionMap["fill-void"] = "fill void space of box with a filler molecule"; 224 226 DescriptionMap["fragment-mol"] = "create for a given molecule into fragments up to given order"; 225 227 DescriptionMap["help"] = "Give this help screen"; … … 361 363 TypeMap["fastparsing"] = &typeid(bool); 362 364 TypeMap["fill-molecule"] = &typeid(std::string); 365 TypeMap["fill-void"] = &typeid(std::string); 363 366 TypeMap["fragment-mol"] = &typeid(std::string); 364 367 TypeMap["input"] = &typeid(std::string); … … 498 501 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "change-molname") ); 499 502 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-molecule") ); 503 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "fill-void") ); 500 504 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "linear-interpolate") ); 501 505 MenuContainsActionMap.insert( pair<std::string, std::string> ("molecule", "rotate-origin") ); … … 571 575 generic.insert("fastparsing"); 572 576 generic.insert("fill-molecule"); 577 generic.insert("fill-void"); 573 578 generic.insert("fragment-mol"); 574 579 generic.insert("help"); … … 954 959 new MoleculeCopyAction(); 955 960 new MoleculeFillWithMoleculeAction(); 961 new MoleculeFillVoidWithMoleculeAction(); 956 962 new MoleculeLinearInterpolationofTrajectoriesAction(); 957 963 new MoleculeRotateAroundSelfByAngleAction(); -
src/boundary.cpp
ra42054 reee966 770 770 771 771 772 /** Fills the empty space of the simulation box with water/772 /** Fills the empty space around other molecules' surface of the simulation box with a filler. 773 773 * \param *out output stream for debugging 774 774 * \param *List list of molecules already present in box … … 925 925 }; 926 926 927 /** Fills the empty space of the simulation box with water/ 928 * \param *out output stream for debugging 929 * \param *TesselStruct contains tesselated surface 930 * \param *filler molecule which the box is to be filled with 931 * \param configuration contains box dimensions 932 * \param distance[NDIM] distance between filling molecules in each direction 933 * \param boundary length of boundary zone between molecule and filling mollecules 934 * \param epsilon distance to surface which is not filled 935 * \param RandAtomDisplacement maximum distance for random displacement per atom 936 * \param RandMolDisplacement maximum distance for random displacement per filler molecule 937 * \param DoRandomRotation true - do random rotiations, false - don't 938 */ 939 void FillVoidWithMolecule(molecule *filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation) 940 { 941 Info FunctionInfo(__func__); 942 molecule *Filling = NULL; 943 Vector CurrentPosition; 944 int N[NDIM]; 945 int n[NDIM]; 946 const Matrix &M = World::getInstance().getDomain().getM(); 947 Matrix Rotations; 948 const Matrix &MInverse = World::getInstance().getDomain().getMinv(); 949 Vector AtomTranslations; 950 Vector FillerTranslations; 951 Vector FillerDistance; 952 Vector Inserter; 953 double FillIt = false; 954 bond *Binder = NULL; 955 double phi[NDIM]; 956 map<molecule *, LinkedCell *> LCList; 957 std::vector<molecule *> List = World::getInstance().getAllMolecules(); 958 MoleculeListClass *MolList = World::getInstance().getMolecules(); 959 960 for (std::vector<molecule *>::iterator ListRunner = List.begin(); ListRunner != List.end(); ListRunner++) 961 if ((*ListRunner)->getAtomCount() > 0) { 962 DoLog(1) && (Log() << Verbose(1) << "Pre-creating linked cell lists for molecule " << *ListRunner << "." << endl); 963 LCList[(*ListRunner)] = new LinkedCell(*(*ListRunner), 10.); // get linked cell list 964 } 965 966 // Center filler at origin 967 filler->CenterEdge(&Inserter); 968 const int FillerCount = filler->getAtomCount(); 969 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl); 970 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) 971 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 972 if ((*BondRunner)->leftatom == *AtomRunner) 973 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl); 974 975 // calculate filler grid in [0,1]^3 976 FillerDistance = MInverse * Vector(distance[0], distance[1], distance[2]); 977 for(int i=0;i<NDIM;i++) 978 N[i] = (int) ceil(1./FillerDistance[i]); 979 DoLog(1) && (Log() << Verbose(1) << "INFO: Grid steps are " << N[0] << ", " << N[1] << ", " << N[2] << "." << endl); 980 981 // initialize seed of random number generator to current time 982 srand ( time(NULL) ); 983 984 // go over [0,1]^3 filler grid 985 for (n[0] = 0; n[0] < N[0]; n[0]++) 986 for (n[1] = 0; n[1] < N[1]; n[1]++) 987 for (n[2] = 0; n[2] < N[2]; n[2]++) { 988 // calculate position of current grid vector in untransformed box 989 CurrentPosition = M * Vector((double)n[0]/(double)N[0], (double)n[1]/(double)N[1], (double)n[2]/(double)N[2]); 990 // create molecule random translation vector ... 991 for (int i=0;i<NDIM;i++) 992 FillerTranslations[i] = RandomMolDisplacement*(rand()/(RAND_MAX/2.) - 1.); 993 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Position is " << CurrentPosition << "+" << FillerTranslations << "." << endl); 994 995 // ... and rotation matrix 996 if (DoRandomRotation) { 997 for (int i=0;i<NDIM;i++) { 998 phi[i] = rand()/(RAND_MAX/(2.*M_PI)); 999 } 1000 1001 Rotations.set(0,0, cos(phi[0]) *cos(phi[2]) + (sin(phi[0])*sin(phi[1])*sin(phi[2]))); 1002 Rotations.set(0,1, sin(phi[0]) *cos(phi[2]) - (cos(phi[0])*sin(phi[1])*sin(phi[2]))); 1003 Rotations.set(0,2, cos(phi[1])*sin(phi[2]) ); 1004 Rotations.set(1,0, -sin(phi[0])*cos(phi[1]) ); 1005 Rotations.set(1,1, cos(phi[0])*cos(phi[1]) ); 1006 Rotations.set(1,2, sin(phi[1]) ); 1007 Rotations.set(2,0, -cos(phi[0]) *sin(phi[2]) + (sin(phi[0])*sin(phi[1])*cos(phi[2]))); 1008 Rotations.set(2,1, -sin(phi[0]) *sin(phi[2]) - (cos(phi[0])*sin(phi[1])*cos(phi[2]))); 1009 Rotations.set(2,2, cos(phi[1])*cos(phi[2]) ); 1010 } 1011 1012 FillIt = true; 1013 // go through all atoms 1014 for(molecule::const_iterator iter = filler->begin(); iter !=filler->end();++iter){ 1015 1016 // Check whether there is anything too close by 1017 LinkedCell::LinkedNodes* liste = NULL; 1018 for (std::map<molecule *, LinkedCell *>::iterator ListRunner = LCList.begin(); ListRunner != LCList.end(); ++ListRunner) { 1019 liste = ListRunner->second->GetPointsInsideSphere(boundary, &CurrentPosition); 1020 FillIt = FillIt && (liste->size() == 0); 1021 delete(liste); 1022 if (!FillIt) 1023 break; 1024 } 1025 } 1026 // insert into Filling 1027 if (FillIt) { 1028 Inserter = CurrentPosition + FillerTranslations; 1029 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is void point." << endl); 1030 Filling = filler->CopyMolecule(); 1031 for(molecule::iterator miter = Filling->begin(); miter != Filling->end(); ++miter) { 1032 if (DoRandomRotation) { 1033 Vector temp = (*miter)->getPosition(); 1034 temp *= Rotations; 1035 (*miter)->setPosition(temp); 1036 } 1037 // create atomic random translation vector ... 1038 for (int i=0;i<NDIM;i++) 1039 AtomTranslations[i] = RandomAtomDisplacement*(rand()/(RAND_MAX/2.) - 1.); 1040 (*miter)->setPosition((*miter)->getPosition() + AtomTranslations); 1041 } 1042 Filling->Translate(&Inserter); 1043 for(molecule::iterator miter = Filling->begin(); miter != Filling->end(); ) { 1044 // check whether each atom is inside box 1045 if (!World::getInstance().getDomain().isInside((*miter)->getPosition())) { 1046 atom *Walker = *miter; 1047 ++miter; 1048 World::getInstance().destroyAtom(Walker); 1049 } else { 1050 ++miter; 1051 } 1052 } 1053 MolList->insert(Filling); 1054 } else { 1055 DoLog(1) && (Log() << Verbose(1) << "INFO: Position at " << Inserter << " is non-void point, within boundary or outside of MaxDistance." << endl); 1056 continue; 1057 } 1058 } 1059 // last one is replaced by the filler, as we need the original atoms contained therein! 1060 filler->Translate(&Inserter); 1061 MolList->erase(Filling); 1062 for (molecule::iterator iter = Filling->begin(); !Filling->empty(); iter = Filling->begin()) { 1063 atom *Walker = *iter; 1064 Filling->erase(iter); 1065 World::getInstance().destroyAtom(Walker); 1066 } 1067 World::getInstance().destroyMolecule(Filling); 1068 1069 for (std::map<molecule *, LinkedCell *>::iterator ListRunner = LCList.begin(); !LCList.empty(); ListRunner = LCList.begin()) { 1070 delete ListRunner->second; 1071 LCList.erase(ListRunner); 1072 } 1073 }; 927 1074 928 1075 /** Tesselates the non convex boundary by rolling a virtual sphere along the surface of the molecule. -
src/boundary.hpp
ra42054 reee966 41 41 double ConvexizeNonconvexEnvelope(class Tesselation *&TesselStruct, const molecule * const mol, const char * const filename); 42 42 molecule * FillBoxWithMolecule(MoleculeListClass *List, molecule *filler, config &configuration, const double MaxDistance, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation); 43 void FindConvexBorder(const molecule* const mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename); 43 void FillVoidWithMolecule(molecule *filler, config &configuration, const double distance[NDIM], const double boundary, const double RandomAtomDisplacement, const double RandomMolDisplacement, const bool DoRandomRotation); 44 void FindConvexBorder(const molecule* const mol, Boundaries *BoundaryPts, Tesselation *&TesselStruct, const LinkedCell *LCList, const char *filename); 44 45 Vector* FindEmbeddingHole(MoleculeListClass *mols, molecule *srcmol); 45 46 bool FindNonConvexBorder(const molecule* const mol, Tesselation *&TesselStruct, const LinkedCell *&LC, const double RADIUS, const char *tempbasename); -
tests/regression/testsuite-filling.at
ra42054 reee966 1 1 AT_BANNER([MoleCuilder - Filling in molecules]) 2 2 # 1. filling box 3 AT_SETUP([Filling - filling empty box])3 AT_SETUP([Filling - filling box around molecule's surface]) 4 4 AT_KEYWORDS([filling]) 5 5 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/1/pre/test.conf .], 0) … … 22 22 AT_CLEANUP 23 23 24 # 3. filling box 25 AT_SETUP([Filling - filling void space in box]) 26 AT_KEYWORDS([filling]) 27 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/3/pre/test.conf .], 0) 28 AT_DATA([water.xyz], [[3 29 # test configuration, created by molecuilder test suite 30 O 0. 0. 0. 31 H 0.758602 0. 0.504284 32 H 0.758602 0. -0.504284 33 ]]) 34 AT_CHECK([../../molecuilder -i test.conf -e ${abs_top_srcdir}/src/ -o xyz --fill-void water.xyz --MaxDistance -1 --distances "3.1, 3.1, 3.1" --lengths "2.1, 0., 0." --DoRotate 0], 0, [stdout], [stderr]) 35 AT_CHECK([file=test.xyz; diff -I '.*reated by molecuilder.*' $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/3/post/$file], 0, [ignore], [ignore]) 36 AT_CLEANUP 37 38 AT_SETUP([Filling - filling void space besides tenside micelle in box]) 39 AT_KEYWORDS([filling]) 40 AT_CHECK([/bin/cp -f ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/3/pre/*.data .], 0) 41 AT_CHECK([../../molecuilder -i tensid.data -e ${abs_top_srcdir}/src/ -B "30,0,30,0,0,30" --fill-void water.data --MaxDistance -1 --distances "3.1, 3.1, 3.1" --lengths "2.1, 0., 0." --DoRotate 0], 0, [stdout], [stderr]) 42 AT_CHECK([file=tensid.data; diff $file ${abs_top_srcdir}/${AUTOTEST_PATH}/Filling/3/post/$file], 0, [ignore], [ignore]) 43 AT_CLEANUP
Note:
See TracChangeset
for help on using the changeset viewer.