Example #1
0
// checkDREAMMV3MeshASCII checks the layout for mesh related data within the
// DREAMM v3 viz format
func checkDREAMMV3MeshASCII(testDir, dataDir string, allIters, posIters,
	regionIters, stateIters jsonParser.IntList, meshEmpty bool, objects,
	objectRegions []string) error {

	m, err := misc.CreateMolMeshIters(allIters, posIters, regionIters, stateIters)
	if err != nil {
		return err
	}

	if len(objectRegions) == 0 {
		objectRegions = objects
	}

	dataPath := filepath.Join(file.GetOutputDir(testDir), dataDir)
	lastPos := -1
	lastRegion := -1
	lastState := -1

	for _, i := range m.All {
		iterPath := filepath.Join(dataPath, "frame_data", "iteration_%d")
		hadFrame := false

		// positions
		for _, obj := range objects {
			posFile := filepath.Join(iterPath, obj+".positions.dat")
			if err := misc.CheckDREAMMV3IterItems(m.Pos, m.Combined, i, lastPos,
				meshEmpty, posFile); err != nil {
				return err
			}
			conFile := filepath.Join(iterPath, obj+".connections.dat")
			if err := misc.CheckDREAMMV3IterItems(m.Pos, m.Combined, i, lastPos,
				meshEmpty, conFile); err != nil {
				return err
			}
		}
		if m.Pos.Contains(i) {
			lastPos = i
			misc.UnsetTrackers(i, &lastPos, &lastRegion, &lastState)
			hadFrame = true
		}

		// regions
		for _, obj := range objectRegions {
			regionFile := filepath.Join(iterPath, obj+".region_indices.dat")
			if err := misc.CheckDREAMMV3IterItems(m.Others, m.States, i, lastRegion,
				meshEmpty, regionFile); err != nil {
				return err
			}
		}
		if m.Others.Contains(i) {
			lastRegion = i
			misc.UnsetTrackers(i, &lastPos, &lastRegion, &lastState)
			hadFrame = true
		}

		// states
		for _, obj := range objects {
			statesFile := filepath.Join(iterPath, obj+".states.bin")
			emptySet := set.NewIntSet()
			if err := misc.CheckDREAMMV3IterItems(m.States, emptySet, i, lastState,
				meshEmpty, statesFile); err != nil {
				return err
			}
		}
		if m.States.Contains(i) {
			lastState = i
			misc.UnsetTrackers(i, &lastPos, &lastRegion, &lastState)
			hadFrame = true
		}

		template := filepath.Join(iterPath, "meshes.dx")
		if err := misc.CheckDREAMMV3DXItems(i, lastPos, lastRegion, lastState,
			hadFrame, template); err != nil {
			return err
		}
	}
	return nil
}
Example #2
0
// checkDREAMMV3MolsBin checks the layout for molecule viz data as part of the
// binary DREAMM v3 format
func checkDREAMMV3MolsBin(testDir string, c *jsonParser.TestCase) error {

	s, err := misc.CreateMolMeshIters(c.AllIters, c.SurfPosIters, c.SurfOrientIters,
		c.SurfStateIters)
	if err != nil {
		return err
	}

	v, err := misc.CreateMolMeshIters(c.AllIters, c.VolPosIters, c.VolOrientIters,
		c.VolStateIters)
	if err != nil {
		return err
	}
	molIters := s.AllCombined.Clone().Union(v.AllCombined)

	dataPath := filepath.Join(file.GetOutputDir(testDir), c.VizPath)
	lastSurfPos := -1
	lastSurfOrient := -1
	lastSurfState := -1
	lastVolPos := -1
	lastVolOrient := -1
	lastVolState := -1

	for _, i := range s.All {
		iterPath := filepath.Join(dataPath, "frame_data", "iteration_%d")
		hadFrame := false

		// surface positions
		surfPosFile := filepath.Join(iterPath, "surface_molecules_positions.bin")
		if err := misc.CheckDREAMMV3IterItems(s.Pos, molIters, i, lastSurfPos,
			c.SurfEmpty, surfPosFile); err != nil {
			return err
		}
		if s.Pos.Contains(i) {
			lastSurfPos = i
			hadFrame = true
		}

		// surface orientations
		surfOrientFile := filepath.Join(iterPath, "surface_molecules_orientations.bin")
		if err := misc.CheckDREAMMV3IterItems(s.Others, molIters, i, lastSurfOrient,
			c.SurfEmpty, surfOrientFile); err != nil {
			return err
		}
		if s.Others.Contains(i) {
			lastSurfOrient = i
			hadFrame = true
		}

		// surface states
		surfStateFile := filepath.Join(iterPath, "surface_molecules_states.bin")
		if err := misc.CheckDREAMMV3IterItems(s.States, molIters, i, lastSurfState,
			c.SurfEmpty, surfStateFile); err != nil {
			return err
		}
		if s.States.Contains(i) {
			lastSurfState = i
			hadFrame = true
		}

		surfTemplate := filepath.Join(iterPath, "surface_molecules.dx")
		if err := misc.CheckDREAMMV3DXItems(i, lastSurfPos, lastSurfOrient, lastSurfState,
			hadFrame, surfTemplate); err != nil {
			return err
		}

		// volume positions
		hadFrame = false
		volPosFile := filepath.Join(iterPath, "volume_molecules_positions.bin")
		if err := misc.CheckDREAMMV3IterItems(v.Pos, molIters, i, lastVolPos,
			c.VolEmpty, volPosFile); err != nil {
			return err
		}
		if v.Pos.Contains(i) {
			lastVolPos = i
			hadFrame = true
		}

		// volume orientations
		volOrientFile := filepath.Join(iterPath, "volume_molecules_orientations.bin")
		if err := misc.CheckDREAMMV3IterItems(v.Others, molIters, i, lastVolOrient,
			c.VolEmpty, volOrientFile); err != nil {
			return err
		}
		if v.Others.Contains(i) {
			lastVolOrient = i
			hadFrame = true
		}

		// volume states
		volStateFile := filepath.Join(iterPath, "volume_molecules_states.bin")
		if err := misc.CheckDREAMMV3IterItems(v.States, molIters, i, lastVolState,
			c.SurfEmpty, volStateFile); err != nil {
			return err
		}
		if v.States.Contains(i) {
			lastVolState = i
			hadFrame = true
		}

		volTemplate := filepath.Join(iterPath, "volume_molecules.dx")
		if err := misc.CheckDREAMMV3DXItems(i, lastVolPos, lastVolOrient, lastVolState,
			hadFrame, volTemplate); err != nil {
			return err
		}

	}
	return nil
}
Example #3
0
// checkDREAMMV3MolsASCII checks the layout for molecule viz data as part of the
// ASCII DREAMM v3 format
func checkDREAMMV3MolsASCII(testDir string, c *jsonParser.TestCase) error {

	m, err := misc.CreateMolMeshIters(c.AllIters, c.PosIters, c.OrientIters, c.StateIters)
	if err != nil {
		return err
	}

	dataPath := filepath.Join(file.GetOutputDir(testDir), c.VizPath)
	lastPos := -1
	lastOrient := -1
	lastState := -1

	for _, i := range m.All {
		iterPath := filepath.Join(dataPath, "frame_data", "iteration_%d")
		hadFrame := false

		// positions
		for _, obj := range c.MolNames {
			posFile := filepath.Join(iterPath, obj+".positions.dat")
			if err := misc.CheckDREAMMV3IterItems(m.Pos, m.Combined, i, lastPos,
				true, posFile); err != nil {
				return err
			}
		}
		if m.Pos.Contains(i) {
			lastPos = i
			misc.UnsetTrackers(i, &lastPos, &lastOrient, &lastState)
			hadFrame = true
		}

		// orientations
		for _, obj := range c.MolNames {
			orientFile := filepath.Join(iterPath, obj+".orientations.dat")
			if err := misc.CheckDREAMMV3IterItems(m.Others, m.Combined, i, lastOrient,
				true, orientFile); err != nil {
				return err
			}
		}
		if m.Others.Contains(i) {
			lastOrient = i
			misc.UnsetTrackers(i, &lastPos, &lastOrient, &lastState)
			hadFrame = true
		}

		// states
		for _, obj := range c.MolNames {
			stateFile := filepath.Join(iterPath, obj+".states.dat")
			if err := misc.CheckDREAMMV3IterItems(m.States, m.Combined, i, lastState,
				true, stateFile); err != nil {
				return err
			}
		}
		if m.States.Contains(i) {
			lastState = i
			misc.UnsetTrackers(i, &lastPos, &lastOrient, &lastState)
			hadFrame = true
		}

		volTemplate := filepath.Join(iterPath, "volume_molecules.dx")
		if err := misc.CheckDREAMMV3DXItems(i, lastPos, lastOrient, lastState,
			hadFrame, volTemplate); err != nil {
			return err
		}

		surfTemplate := filepath.Join(iterPath, "surface_molecules.dx")
		if err := misc.CheckDREAMMV3DXItems(i, lastPos, lastOrient, lastState,
			hadFrame, surfTemplate); err != nil {
			return err
		}
	}

	return nil
}