Browse Source

cube tweaks

- swapped visuals colors
- add orbitals flag to header
- TODO add format data to volumes as in structures
Alexander Rose 5 years ago
parent
commit
4b1d1a045d

+ 4 - 0
src/mol-io/reader/_spec/common.spec.ts

@@ -8,10 +8,14 @@ import { parseFloat as fastParseFloat, parseInt as fastParseInt, getNumberType,
 
 describe('common', () => {
     it('number-parser fastParseFloat', () => {
+        // ignore suffix numbers in parentheses
         expect(fastParseFloat('11.0829(23)', 0, 11)).toBe(11.0829);
+        // scientific with no space between consecutive values
+        expect(fastParseFloat('-5.1E-01-6.1E-01', 0, 11)).toBe(-0.51);
     });
 
     it('number-parser fastParseInt', () => {
+        // ignore suffix numbers in parentheses
         expect(fastParseInt('11(23)', 0, 11)).toBe(11);
     });
 

+ 2 - 2
src/mol-io/reader/cube/parser.ts

@@ -25,6 +25,7 @@ export interface CubeFile {
 
 export namespace CubeFile {
     export interface Header {
+        orbitals: boolean,
         comment1: string,
         comment2: string,
         atomCount: number,
@@ -80,8 +81,7 @@ function readHeader(tokenizer: Tokenizer) {
         for (let i = 0, _i = +counts[0]; i < _i; i++) dataSetIds.push(+counts[i + 1]);
     }
 
-    const header: CubeFile.Header = { comment1, comment2, atomCount, origin, dim: Vec3.create(NVX, NVY, NVZ), basisX, basisY, basisZ, dataSetIds };
-
+    const header: CubeFile.Header = { orbitals: rawAtomCount < 0, comment1, comment2, atomCount, origin, dim: Vec3.create(NVX, NVY, NVZ), basisX, basisY, basisZ, dataSetIds };
     return { header, atoms };
 }
 

+ 2 - 2
src/mol-plugin-state/formats/volume.ts

@@ -109,13 +109,13 @@ export const CubeProvider = DataFormatProvider({
             type: 'isosurface',
             typeParams: { isoValue: VolumeIsoValue.relative(1), alpha: 0.4 },
             color: 'uniform',
-            colorParams: { value: ColorNames.red }
+            colorParams: { value: ColorNames.blue }
         }));
         const volumeNeg = surfaces.to(data.volume).apply(StateTransforms.Representation.VolumeRepresentation3D, createVolumeRepresentationParams(plugin, volumeData, {
             type: 'isosurface',
             typeParams: { isoValue: VolumeIsoValue.relative(-1), alpha: 0.4 },
             color: 'uniform',
-            colorParams: { value: ColorNames.blue }
+            colorParams: { value: ColorNames.red }
         }));
 
         const structure = await plugin.builders.structure.representation.applyPreset(data.structure, 'auto');