- Timestamp:
- Nov 7, 2011, 4:12:25 PM (13 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:
- bfbb62
- Parents:
- b82ede
- git-author:
- Gregor Bollerhey <bollerhe@…> (10/20/11 13:16:38)
- git-committer:
- Frederik Heber <heber@…> (11/07/11 16:12:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
utils/boxmaker.py
rb82ede rc0c85f 139 139 140 140 141 def GetSourc MolareMass(opt):141 def GetSourceMolareMass(opt): 142 142 with open(opt.potentialsfiledir+opt.basename+'.potentials') as f: 143 143 potfile = f.read() … … 147 147 for key in elementmasses: 148 148 elementmasses[key] = float(elementmasses[key]) 149 150 # Convert from any format to xyz151 os.system('molecuilder -o xyz --parse-tremolo-potentials %s -i temp_source.xyz -l %s' % (opt.potentialsfiledir+opt.basename+'.potentials', opt.source))152 149 153 150 mass_sum = 0.0 … … 160 157 elem = f.readline().split(None, 1)[0].strip() 161 158 mass_sum += elementmasses[elem] 162 163 os.system('rm temp_source*') 159 164 160 return mass_sum*avogadro 165 161 166 162 167 def UpdateSettings (opt):163 def UpdateSettingsAndSource(opt): 168 164 # Map boolean values 165 boolmap = {'on': True, 'off': False} 166 169 167 for name in ['cubicdomain', 'cubiccell', 'autorotate', 'autodim', 'postprocess', 'automass']: 170 168 value = eval('opt.' + name) 171 169 172 if value == 'on': 173 value = True 174 elif value == 'off': 175 value = False 170 if value in boolmap: 171 value = boolmap[value] 176 172 else: 177 173 print 'Not a boolean value:', value … … 216 212 opt.number = int(opt.number) 217 213 214 UpdateSource(opt) 215 218 216 # Automatic source mass 219 217 if opt.automass: 220 opt.molarmass = GetSourc MolareMass(opt)218 opt.molarmass = GetSourceMolareMass(opt) 221 219 print '======== MOLAR MASS:', opt.molarmass 222 220 … … 295 293 s_ext = '' 296 294 297 # Convert from any format to xyz298 os.system('molecuilder -o xyz --parse-tremolo-potentials %s -i temp_source.xyz -l %s' % (opt.potentialsfiledir+opt.basename+'.potentials', opt.source))299 300 295 # Calculate bounding box from xyz-file 301 296 with open('temp_source.xyz') as f: … … 316 311 bb[i] = abs(bbmax[i] - bbmin[i]) 317 312 318 os.system('rm temp_source.*')319 313 return bb 314 315 316 def UpdateSource(opt): 317 potfilepath = opt.potentialsfiledir + opt.basename + '.potentials' 318 319 cmd = 'molecuilder -o xyz tremolo --parse-tremolo-potentials %s -i temp_source.xyz -l %s' % (potfilepath, opt.source) 320 321 if opt.autorotate: 322 cmd += ' --select-all-atoms --rotate-to-principal-axis-system "0, 1, 0"' 323 324 os.system(cmd) 325 326 opt.source = 'temp_source.data' 327 320 328 321 329 # Global options with sensible default parameters … … 323 331 324 332 ReadSettings(opt) 325 UpdateSettings (opt)333 UpdateSettingsAndSource(opt) 326 334 327 335 if type(opt.number) == type([]): … … 333 341 else: 334 342 nbox = FindBestCuboid(opt) 335 336 # Autorotate337 if opt.autorotate:338 os.system('molecuilder --parse-tremolo-potentials %s -i rotated_temp_source.data -l %s --rotate-to-principal-axis-system "1, 0, 0"' % (opt.potentialsfiledir+opt.basename+'.potentials', opt.source))339 opt.source = 'rotated_temp_source.data'340 343 341 344 VolumePerMolecule = opt.molarmass / (avogadro * opt.density) … … 390 393 f.write(ofile) 391 394 392 if opt.autorotate: 393 os.system('rm ' + opt.source) 395 os.system('rm temp_source.data temp_source.xyz')
Note:
See TracChangeset
for help on using the changeset viewer.