예제 #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
}
예제 #2
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
}